From 7793863d4600686beff76d65e4162fa7d34fed32 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 29 Apr 2008 21:46:07 -0500 Subject: [PATCH] Output silence when stopped. --- Timeline/Engine.C | 9 +++++---- Timeline/Port.C | 6 ++++++ Timeline/Port.H | 2 +- Timeline/Track.C | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Timeline/Engine.C b/Timeline/Engine.C index 365ad6a..6c48a72 100644 --- a/Timeline/Engine.C +++ b/Timeline/Engine.C @@ -127,10 +127,6 @@ Engine::process ( nframes_t nframes ) { transport->poll(); - if ( ! transport->rolling ) - /* FIXME: fill all ports with silence */ - return 0; - if ( ! trylock() ) { /* the data structures we need to access here (tracks and @@ -141,6 +137,11 @@ Engine::process ( nframes_t nframes ) return 0; } +/* if ( ! transport->rolling ) */ +/* timeline->silence( nframes ); */ +/* return 0; */ + + /* handle chicken/egg problem */ if ( timeline ) /* this will initiate the process() call graph for the various diff --git a/Timeline/Port.C b/Timeline/Port.C index 93b9b9a..f73397b 100644 --- a/Timeline/Port.C +++ b/Timeline/Port.C @@ -122,3 +122,9 @@ Port::buffer ( nframes_t nframes ) { return jack_port_get_buffer( _port, nframes ); } + +void +Port::silence ( nframes_t nframes ) +{ + memset( buffer( nframes ), 0, nframes * sizeof( sample_t ) ); +} diff --git a/Timeline/Port.H b/Timeline/Port.H index 31519a9..d988f60 100644 --- a/Timeline/Port.H +++ b/Timeline/Port.H @@ -62,5 +62,5 @@ public: void write ( sample_t *buf, nframes_t nframes ); void read ( sample_t *buf, nframes_t nframes ); void *buffer ( nframes_t nframes ); - + void silence ( nframes_t nframes ); }; diff --git a/Timeline/Track.C b/Timeline/Track.C index 4c0e70b..95bc66e 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -645,6 +645,22 @@ Track::configure_inputs ( int n ) nframes_t Track::process ( nframes_t nframes ) { + + if ( ! transport->rolling ) + { + for ( int i = output.size(); i--; ) + output[ i ].silence( nframes ); + + for ( int i = input.size(); i--; ) + input[ i ].silence( nframes ); + + /* FIXME: is this really the right thing to do for control ports? */ + for ( int i = control_out.size(); i--; ) + control_out[ i ]->silence( nframes ); + + return 0; + } + for ( int i = control->children(); i--; ) ((Control_Sequence*)control->child( i ))->process( nframes );