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