diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-15 19:55:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-15 19:55:14 +0000 |
commit | 1c3f709bf75d86462b4441470d5108cdc049301b (patch) | |
tree | 9246d3b43955d61a35b780fcd19b8df7f7bec1ed /libs/ardour/audioengine.cc | |
parent | 01c253b61b3130d13f9e30f17683e0f8a93b4696 (diff) |
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
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r-- | libs/ardour/audioengine.cc | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index f6557fbc4f..5ac4e2140e 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -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); @@ -220,6 +208,11 @@ AudioEngine::start () 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); jack_set_port_registration_callback (_priv_jack, _registration_callback, this); @@ -396,6 +389,12 @@ AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* a } 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) { AudioEngine* ae = static_cast<AudioEngine*> (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) { |