Add some framework for freewheeling mode.

This commit is contained in:
Jonathan Moore Liles 2008-05-17 16:37:41 -05:00
parent 9261c3fea6
commit 2695f9eed5
3 changed files with 33 additions and 2 deletions

View File

@ -30,6 +30,7 @@
Engine::Engine ( )
{
_freewheeling = false;
_client = NULL;
_buffers_dropped = 0;
_xruns = 0;
@ -63,6 +64,12 @@ Engine::timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_po
((Engine*)arg)->timebase( state, nframes, pos, new_pos );
}
void
Engine::freewheel ( int starting, void *arg )
{
((Engine*)arg)->freewheel( starting );
}
void
@ -82,6 +89,16 @@ Engine::xrun ( void )
return 0;
}
/* THREAD: RT */
void
Engine::freewheel ( bool starting )
{
_freewheeling = starting;
if ( _freewheeling )
FATAL( "Freewheeling mode is unimplemented" );
}
/* THREAD: RT */
/** This is the jack slow-sync callback. */
int
@ -185,6 +202,14 @@ Engine::process ( nframes_t nframes )
}
/** enter or leave freehweeling mode */
void
Engine::freewheeling ( bool yes )
{
if ( jack_set_freewheel( _client, yes ) )
WARNING( "Unkown error while setting freewheeling mode" );
}
int
Engine::init ( void )
{
@ -195,6 +220,7 @@ Engine::init ( void )
set_callback( process );
set_callback( xrun );
set_callback( freewheel );
/* FIXME: should we wait to register this until after the project
has been loaded (and we have disk threads running)? */

View File

@ -43,6 +43,7 @@ class Engine : public Mutex
int _buffers_dropped; /* buffers dropped because of locking */
nframes_t _sample_rate;
volatile int _xruns;
volatile bool _freewheeling;
static int process ( nframes_t nframes, void *arg );
int process ( nframes_t nframes );
@ -52,6 +53,8 @@ class Engine : public Mutex
int xrun ( void );
static void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg );
void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos );
static void freewheel ( int yes, void *arg );
void freewheel ( bool yes );
Engine ( const Engine &rhs );
Engine & operator = ( const Engine &rhs );
@ -76,6 +79,8 @@ public:
nframes_t sample_rate ( void ) const { return _sample_rate; }
int xruns ( void ) const { return _xruns; };
int dropped ( void ) const { return _buffers_dropped; }
bool freehweeling ( void ) const { return _freewheeling; }
void freewheeling ( bool yes );
float cpu_load ( void ) const { return jack_cpu_load( _client ); }
};

View File

@ -185,7 +185,7 @@ else if ( ! Project::open( name ) )
fl_alert( "Could not open \\"%s\\" as a Non-DAW project!", name );
// we are in a somewhar ambiguous state now with no project open.
}} selected
}}
xywh {10 10 40 25}
}
MenuItem {} {
@ -203,7 +203,7 @@ Loggable::compact();}
xywh {0 0 74 25} deactivate
} {
MenuItem {} {
label Project
label Project selected
xywh {0 0 40 25}
}
MenuItem {} {