From 2695f9eed52ff99295bb360e7a034f76da0f6cd9 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 17 May 2008 16:37:41 -0500 Subject: [PATCH] Add some framework for freewheeling mode. --- Timeline/Engine.C | 26 ++++++++++++++++++++++++++ Timeline/Engine.H | 5 +++++ Timeline/TLE.fl | 4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Timeline/Engine.C b/Timeline/Engine.C index 1bfad73..45172b9 100644 --- a/Timeline/Engine.C +++ b/Timeline/Engine.C @@ -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)? */ diff --git a/Timeline/Engine.H b/Timeline/Engine.H index 71e7e3c..7bfddb8 100644 --- a/Timeline/Engine.H +++ b/Timeline/Engine.H @@ -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 ); } }; diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 6ffba8f..46af4c4 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -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 {} {