From 899740c2f123a5de6a89181da924d3fd2f89f755 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 1 May 2013 22:04:16 -0700 Subject: [PATCH] Timeline: Add freewheel button. --- timeline/src/Engine/Engine.C | 17 ++++++++++++----- timeline/src/Transport.C | 25 +++++++++++++++++++++++++ timeline/src/Transport.H | 1 + 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/timeline/src/Engine/Engine.C b/timeline/src/Engine/Engine.C index fd02171..3257bcf 100644 --- a/timeline/src/Engine/Engine.C +++ b/timeline/src/Engine/Engine.C @@ -158,18 +158,25 @@ Engine::process ( nframes_t nframes ) if ( freewheeling() ) { /* freewheeling mode/export. We're actually running - non-RT. Assume that everything is quiescent, locking is - unecessary and do I/O synchronously */ + non-RT. Assume that everything is quiescent. do I/O + synchronously */ + if ( timeline ) + { + timeline->rdlock(); + timeline->process( nframes ); - /* because we're going faster than realtime. */ - timeline->wait_for_buffers(); + timeline->unlock(); + + /* because we're going faster than realtime. */ + timeline->wait_for_buffers(); + } } else { if ( !timeline) - /* handle chicken/egg problem */ + /* handle chicken/egg problem */ return 0; if ( timeline->tryrdlock() ) diff --git a/timeline/src/Transport.C b/timeline/src/Transport.C index da04dbb..66990c0 100644 --- a/timeline/src/Transport.C +++ b/timeline/src/Transport.C @@ -65,6 +65,10 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L ) _new_take_button->type(1); _new_take_button->labelsize(10); } // Fl_Button* _new_take_button + { _freewheel_button = new Fl_Button(225, 5, 60, 21, "Freewheel"); + _freewheel_button->type(1); + _freewheel_button->labelsize(10); + } // Fl_Button* _new_take_button end(); Fl_Button *o; @@ -112,6 +116,14 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L ) o->color2( fl_color_average( FL_GRAY, FL_YELLOW, 0.50 ) ); o->tooltip( "Toggle automatic creation of new takes for armed tracks" ); + o = _freewheel_button; + o->type( FL_TOGGLE_BUTTON ); + o->shortcut( 'T' ); + o->callback( cb_button, this ); + o->when( FL_WHEN_CHANGED ); + o->color2( fl_color_average( FL_GRAY, FL_BLUE, 0.50 ) ); + o->tooltip( "When active, the next playback will be done in freewheeling mode" ); + flowdown( true ); } @@ -272,7 +284,12 @@ Transport::start ( void ) } if ( engine ) + { + if ( _freewheel_button->value() ) + engine->freewheeling( true ); + engine->transport_start(); + } } void @@ -290,7 +307,15 @@ Transport::stop ( void ) } if ( engine ) + { engine->transport_stop(); + + if ( _freewheel_button->value() ) + { + engine->freewheeling( false ); + _freewheel_button->value( false ); + } + } } void diff --git a/timeline/src/Transport.H b/timeline/src/Transport.H index f098ab1..e728f34 100644 --- a/timeline/src/Transport.H +++ b/timeline/src/Transport.H @@ -50,6 +50,7 @@ private: Fl_Button *_punch_button; Fl_Button *_loop_button; Fl_Button *_new_take_button; + Fl_Button *_freewheel_button; void update_record_state ( void );