Output silence when stopped.

This commit is contained in:
Jonathan Moore Liles 2008-04-29 21:46:07 -05:00
parent 7c516615d8
commit 7793863d46
4 changed files with 28 additions and 5 deletions

View File

@ -127,10 +127,6 @@ Engine::process ( nframes_t nframes )
{ {
transport->poll(); transport->poll();
if ( ! transport->rolling )
/* FIXME: fill all ports with silence */
return 0;
if ( ! trylock() ) if ( ! trylock() )
{ {
/* the data structures we need to access here (tracks and /* the data structures we need to access here (tracks and
@ -141,6 +137,11 @@ Engine::process ( nframes_t nframes )
return 0; return 0;
} }
/* if ( ! transport->rolling ) */
/* timeline->silence( nframes ); */
/* return 0; */
/* handle chicken/egg problem */ /* handle chicken/egg problem */
if ( timeline ) if ( timeline )
/* this will initiate the process() call graph for the various /* this will initiate the process() call graph for the various

View File

@ -122,3 +122,9 @@ Port::buffer ( nframes_t nframes )
{ {
return jack_port_get_buffer( _port, nframes ); return jack_port_get_buffer( _port, nframes );
} }
void
Port::silence ( nframes_t nframes )
{
memset( buffer( nframes ), 0, nframes * sizeof( sample_t ) );
}

View File

@ -62,5 +62,5 @@ public:
void write ( sample_t *buf, nframes_t nframes ); void write ( sample_t *buf, nframes_t nframes );
void read ( sample_t *buf, nframes_t nframes ); void read ( sample_t *buf, nframes_t nframes );
void *buffer ( nframes_t nframes ); void *buffer ( nframes_t nframes );
void silence ( nframes_t nframes );
}; };

View File

@ -645,6 +645,22 @@ Track::configure_inputs ( int n )
nframes_t nframes_t
Track::process ( nframes_t nframes ) 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--; ) for ( int i = control->children(); i--; )
((Control_Sequence*)control->child( i ))->process( nframes ); ((Control_Sequence*)control->child( i ))->process( nframes );