diff --git a/Mixer/Engine/Engine.C b/Mixer/Engine/Engine.C index 3fda400..3bc754e 100644 --- a/Mixer/Engine/Engine.C +++ b/Mixer/Engine/Engine.C @@ -74,24 +74,6 @@ Engine::buffer_size ( nframes_t ) return 0; } -int Engine::sync ( jack_transport_state_t, jack_position_t * ) -{ - return 0; -} - -void -Engine::timebase ( jack_transport_state_t, jack_nframes_t, jack_position_t *, int ) -{ - - -} - -void -Engine::timebase ( jack_transport_state_t, jack_nframes_t, jack_position_t * ) -{ - -} - /* THREAD: RT */ int Engine::process ( nframes_t nframes ) diff --git a/Mixer/Engine/Engine.H b/Mixer/Engine/Engine.H index 0862718..ac6dddf 100644 --- a/Mixer/Engine/Engine.H +++ b/Mixer/Engine/Engine.H @@ -39,10 +39,7 @@ class Engine : public JACK::Client, public Mutex void shutdown ( void ); int process ( nframes_t nframes ); - int sync ( jack_transport_state_t state, jack_position_t *pos ); int xrun ( void ); - void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos ); - void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos ); void freewheel ( bool yes ); int buffer_size ( nframes_t nframes ); void thread_init ( void ); diff --git a/Timeline/main.C b/Timeline/main.C index b05a259..0fdf310 100644 --- a/Timeline/main.C +++ b/Timeline/main.C @@ -136,7 +136,7 @@ main ( int argc, char **argv ) const char *jack_name; - if ( ! ( jack_name = engine->init( APP_NAME ) ) ) + if ( ! ( jack_name = engine->init( APP_NAME, JACK::Client::SLOW_SYNC | JACK::Client::TIMEBASE_MASTER ) ) ) FATAL( "Could not connect to JACK!" ); timeline->sample_rate( engine->sample_rate() ); diff --git a/nonlib/JACK/Client.C b/nonlib/JACK/Client.C index 9cffe31..7abfc5d 100644 --- a/nonlib/JACK/Client.C +++ b/nonlib/JACK/Client.C @@ -113,7 +113,7 @@ namespace JACK /** Connect to JACK using client name /client_name/. Return a static * pointer to actual name as reported by JACK */ const char * - Client::init ( const char *client_name ) + Client::init ( const char *client_name, unsigned int opts ) { if (( _client = jack_client_open ( client_name, (jack_options_t)0, NULL )) == 0 ) return NULL; @@ -128,9 +128,11 @@ namespace JACK /* FIXME: should we wait to register this until after the project has been loaded (and we have disk threads running)? */ - set_callback( sync ); + if ( opts & SLOW_SYNC ) + set_callback( sync ); - jack_set_timebase_callback( _client, 0, &Client::timebase, this ); + if ( opts & TIMEBASE_MASTER ) + jack_set_timebase_callback( _client, 0, &Client::timebase, this ); jack_on_shutdown( _client, &Client::shutdown, this ); diff --git a/nonlib/JACK/Client.H b/nonlib/JACK/Client.H index e9bf51f..fc4f28a 100644 --- a/nonlib/JACK/Client.H +++ b/nonlib/JACK/Client.H @@ -31,7 +31,6 @@ namespace JACK class Port; class Client { - std::list _active_ports; jack_client_t *_client; @@ -46,11 +45,11 @@ namespace JACK static int process ( nframes_t nframes, void *arg ); virtual int process ( nframes_t nframes ) = 0; static int sync ( jack_transport_state_t state, jack_position_t *pos, void *arg ); - virtual int sync ( jack_transport_state_t state, jack_position_t *pos ) = 0; + virtual int sync ( jack_transport_state_t, jack_position_t * ) { return 1; } static int xrun ( void *arg ); virtual int xrun ( void ) = 0; static void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg ); - virtual void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos ) = 0; + virtual void timebase ( jack_transport_state_t, jack_nframes_t, jack_position_t *, int ) { } static void freewheel ( int yes, void *arg ); virtual void freewheel ( bool yes ) = 0; static int buffer_size ( nframes_t nframes, void *arg ); @@ -75,6 +74,10 @@ namespace JACK public: + enum options { DEFAULT = 0, + SLOW_SYNC = 1 << 0, + TIMEBASE_MASTER = 1 << 1 }; + jack_client_t * jack_client ( void ) { return _client; } void port_added ( JACK::Port * p ); @@ -83,7 +86,7 @@ namespace JACK Client ( ); virtual ~Client ( ); - const char * init ( const char *client_name ); + const char * init ( const char *client_name, unsigned int opts = 0 ); const char * name ( const char * ); nframes_t nframes ( void ) const { return jack_get_buffer_size( _client ); }