part two of new JACK latency API support - should fix broken compilation
git-svn-id: svn://localhost/ardour2/branches/3.0@8864 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -318,6 +318,11 @@ _ the regular process() call to session->process() is not made.
|
||||
int jack_bufsize_callback (pframes_t);
|
||||
int jack_sample_rate_callback (pframes_t);
|
||||
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
static void _latency_callback (jack_latency_callback_mode_t, void*);
|
||||
void jack_latency_callback (jack_latency_callback_mode_t);
|
||||
#endif
|
||||
|
||||
int connect_to_jack (std::string client_name, std::string session_uuid);
|
||||
|
||||
static void halted (void *);
|
||||
|
||||
@@ -99,8 +99,10 @@ public:
|
||||
void request_monitor_input (bool);
|
||||
void set_latency (framecnt_t);
|
||||
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
void get_connected_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const;
|
||||
void set_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const;
|
||||
#endif
|
||||
|
||||
virtual void reset ();
|
||||
|
||||
|
||||
@@ -1361,6 +1361,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
void reset_jack_connection (jack_client_t* jack);
|
||||
void process_rtop (SessionEvent*);
|
||||
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
void update_latency (bool playback);
|
||||
#endif
|
||||
|
||||
XMLNode& state(bool);
|
||||
|
||||
/* click track */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include <glibmm/timer.h>
|
||||
#include <jack/weakjack.h>
|
||||
#include <jack/jack.h>
|
||||
#include <jack/thread.h>
|
||||
|
||||
@@ -153,19 +154,6 @@ _thread_init_callback (void * /*arg*/)
|
||||
MIDI::Port::set_process_thread (pthread_self());
|
||||
}
|
||||
|
||||
typedef void (*_JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
|
||||
|
||||
static void (*on_info_shutdown)(jack_client_t*, _JackInfoShutdownCallback, void *);
|
||||
extern void jack_on_info_shutdown (jack_client_t*, _JackInfoShutdownCallback, void *) __attribute__((weak));
|
||||
|
||||
static void check_jack_symbols () __attribute__((constructor));
|
||||
|
||||
void check_jack_symbols ()
|
||||
{
|
||||
/* use weak linking to see if we really have various late-model JACK function */
|
||||
on_info_shutdown = jack_on_info_shutdown;
|
||||
}
|
||||
|
||||
static void
|
||||
ardour_jack_error (const char* msg)
|
||||
{
|
||||
@@ -204,7 +192,7 @@ AudioEngine::start ()
|
||||
_processed_frames = 0;
|
||||
last_monitor_check = 0;
|
||||
|
||||
if (on_info_shutdown) {
|
||||
if (jack_on_info_shutdown) {
|
||||
jack_on_info_shutdown (_priv_jack, halted_info, this);
|
||||
} else {
|
||||
jack_on_shutdown (_priv_jack, halted, this);
|
||||
@@ -219,6 +207,11 @@ AudioEngine::start ()
|
||||
#ifdef HAVE_JACK_SESSION
|
||||
if( jack_set_session_callback )
|
||||
jack_set_session_callback (_priv_jack, _session_callback, this);
|
||||
#endif
|
||||
#if HAVE_JACK_NEW_LATENCY
|
||||
if (jack_set_latency_callback) {
|
||||
jack_set_latency_callback (_priv_jack, _latency_callback, this);
|
||||
}
|
||||
#endif
|
||||
jack_set_sync_callback (_priv_jack, _jack_sync_callback, this);
|
||||
jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
|
||||
@@ -395,6 +388,12 @@ AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* a
|
||||
ae->PortRegisteredOrUnregistered (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::_latency_callback (jack_latency_callback_mode_t mode, void* arg)
|
||||
{
|
||||
return static_cast<AudioEngine *> (arg)->jack_latency_callback (mode);
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::_connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int conn, void* arg)
|
||||
{
|
||||
@@ -619,6 +618,17 @@ AudioEngine::jack_sample_rate_callback (pframes_t nframes)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::jack_latency_callback (jack_latency_callback_mode_t mode)
|
||||
{
|
||||
cerr << "JACK LATENCY CALLBACK\n";
|
||||
if (_session) {
|
||||
_session->update_latency (mode == JackPlaybackLatency);
|
||||
} else {
|
||||
cerr << "NO SESSION\n";
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
AudioEngine::_bufsize_callback (pframes_t nframes, void *arg)
|
||||
{
|
||||
|
||||
@@ -221,8 +221,8 @@ Port::reset ()
|
||||
void
|
||||
Port::recompute_total_latency () const
|
||||
{
|
||||
#if !HAVE_JACK_NEW_LATENCY
|
||||
#ifdef HAVE_JACK_RECOMPUTE_LATENCY
|
||||
#ifndef HAVE_JACK_NEW_LATENCY
|
||||
#ifdef HAVE_JACK_RECOMPUTE_LATENCY
|
||||
jack_client_t* jack = _engine->jack();
|
||||
|
||||
if (!jack) {
|
||||
@@ -237,7 +237,7 @@ Port::recompute_total_latency () const
|
||||
void
|
||||
Port::set_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const
|
||||
{
|
||||
#if HAVE_JACK_NEW_LATENCY
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
if (!jack_port_set_latency_range) {
|
||||
return;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ Port::set_latency_range (jack_latency_range_t& range, jack_latency_callback_mode
|
||||
void
|
||||
Port::get_connected_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const
|
||||
{
|
||||
#if HAVE_JACK_NEW_LATENCY
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
if (!jack_port_get_latency_range) {
|
||||
return;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ Port::get_connected_latency_range (jack_latency_range_t& range, jack_latency_cal
|
||||
framecnt_t
|
||||
Port::total_latency () const
|
||||
{
|
||||
#if !HAVE_JACK_NEW_LATENCY
|
||||
#ifndef HAVE_JACK_NEW_LATENCY
|
||||
jack_client_t* jack = _engine->jack();
|
||||
|
||||
if (!jack) {
|
||||
@@ -369,7 +369,7 @@ Port::request_monitor_input (bool yn)
|
||||
void
|
||||
Port::set_latency (framecnt_t n)
|
||||
{
|
||||
#if !HAVE_JACK_NEW_LATENCY
|
||||
#ifndef HAVE_JACK_NEW_LATENCY
|
||||
jack_port_set_latency (_jack_port, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3643,6 +3643,7 @@ Route::set_latency_ranges (jack_latency_callback_mode_t mode) const
|
||||
void
|
||||
Route::update_port_latencies (const PortSet& ports, jack_latency_callback_mode_t mode, framecnt_t our_latency) const
|
||||
{
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
/* iterate over all connected ports and get the latency range
|
||||
they represent
|
||||
*/
|
||||
@@ -3661,4 +3662,5 @@ Route::update_port_latencies (const PortSet& ports, jack_latency_callback_mode_t
|
||||
|
||||
p->set_latency_range (range, mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4234,3 +4234,10 @@ Session::unknown_processors () const
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef HAVE_JACK_NEW_LATENCY
|
||||
void
|
||||
Session::update_latency (bool playback)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Latency, "JACK latency callback\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1525,7 +1525,7 @@ Session::update_latency_compensation (bool with_stop, bool abort)
|
||||
framecnt_t track_latency = (*i)->update_total_latency ();
|
||||
|
||||
if (old_latency != track_latency) {
|
||||
#if !HAVE_JACK_NEW_LATENCY
|
||||
#ifndef HAVE_JACK_NEW_LATENCY
|
||||
(*i)->input()->update_port_total_latencies ();
|
||||
(*i)->output()->update_port_total_latencies ();
|
||||
#endif
|
||||
|
||||
@@ -274,8 +274,9 @@ def configure(conf):
|
||||
linkflags = ['-ljack'],
|
||||
msg = 'Checking for new JACK latency API',
|
||||
define_name = 'HAVE_JACK_NEW_LATENCY',
|
||||
uselib_store = "JACK_NEW_LATENCY",
|
||||
okmsg = 'present')
|
||||
|
||||
|
||||
if flac_supported():
|
||||
conf.define ('HAVE_FLAC', 1)
|
||||
if ogg_supported():
|
||||
|
||||
Reference in New Issue
Block a user