JACK doesn't like it if you set a slow-sync callback and don't act like a slow-sync client...

pull/3/head
Jonathan Moore Liles 2010-01-19 01:45:44 -06:00
parent 34200e2c52
commit b559a0ed7b
5 changed files with 13 additions and 29 deletions

View File

@ -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 )

View File

@ -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 );

View File

@ -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() );

View File

@ -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 );

View File

@ -31,7 +31,6 @@ namespace JACK
class Port;
class Client
{
std::list <JACK::Port*> _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 ); }