From d87b35c4e091911e06a00bd9a798eabc066edf9d Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 25 Apr 2008 00:15:08 -0500 Subject: [PATCH] Make mute and solo buttons work. --- Timeline/Playback_DS.C | 8 +++----- Timeline/Track.C | 24 +++++++++++++++++++----- Timeline/Track.H | 4 +++- Timeline/dsp.C | 8 ++++++++ Timeline/dsp.h | 1 + 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Timeline/Playback_DS.C b/Timeline/Playback_DS.C index 878c373..d99b1b5 100644 --- a/Timeline/Playback_DS.C +++ b/Timeline/Playback_DS.C @@ -213,11 +213,9 @@ Playback_DS::process ( nframes_t nframes ) /* FIXME: we need to resync somehow */ } -/* /\* testing. *\/ */ -/* FILE *fp = fopen( "testing.au", "a" ); */ -/* fwrite( buf, block_size, 1, fp ); */ -/* fclose( fp ); */ - + /* TODO: figure out a way to stop IO while muted without losing sync */ + if ( _th->mute() || ( Track::soloing() && ! _th->solo() ) ) + buffer_fill_with_silence( (sample_t*)buf, nframes ); } block_processed(); diff --git a/Timeline/Track.C b/Timeline/Track.C index 67da975..35ea7fb 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -30,6 +30,8 @@ #include "../FL/Fl_Sometimes_Input.H" #include +int Track::_soloing = 0; + void Track::cb_input_field ( Fl_Widget *w, void *v ) { @@ -57,14 +59,26 @@ void Track::cb_button ( Fl_Widget *w ) { - printf( "FIXME: inform mixer here\n" ); if ( w == record_button ) { - /* FIXME: wrong place for this! */ - if ( record_button->value() ) - record_ds->start( transport->frame ); + +/* /\* FIXME: wrong place for this! *\/ */ +/* if ( record_button->value() ) */ +/* record_ds->start( transport->frame ); */ +/* else */ +/* record_ds->stop( transport->frame ); */ + + } + if ( w == mute_button ) + { + + } + if ( w == solo_button ) + { + if ( solo_button->value() ) + ++_soloing; else - record_ds->stop( transport->frame ); + --_soloing; } else if ( w == take_menu ) diff --git a/Timeline/Track.H b/Timeline/Track.H index 1b84db1..8058e71 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -54,9 +54,11 @@ public: Track ( const char *L, int channels=1 ); ~Track ( ); + static bool soloing ( void ) { return _soloing; } + private: -// Sequence * _track; + static int _soloing; char *_name; diff --git a/Timeline/dsp.C b/Timeline/dsp.C index b7f3df9..5145111 100644 --- a/Timeline/dsp.C +++ b/Timeline/dsp.C @@ -20,6 +20,7 @@ /* General DSP related functions. */ #include "dsp.h" +#include "string.h" // for memset. /* TODO: these functions are all targets for optimization (SSE?) */ @@ -87,3 +88,10 @@ buffer_deinterleave_one_channel ( sample_t *dst, sample_t *src, int channel, int src += channels; } } + + +void +buffer_fill_with_silence ( sample_t *buf, nframes_t nframes ) +{ + memset( buf, 0, nframes * sizeof( sample_t ) ); +} diff --git a/Timeline/dsp.h b/Timeline/dsp.h index 65cf34f..716fd2a 100644 --- a/Timeline/dsp.h +++ b/Timeline/dsp.h @@ -28,3 +28,4 @@ void buffer_mix_with_gain ( sample_t *dst, sample_t *src, nframes_t nframes, flo void buffer_interleave_one_channel ( sample_t *dst, sample_t *src, int channel, int channels, nframes_t nframes ); void buffer_interleave_one_channel_and_mix ( sample_t *dst, sample_t *src, int channel, int channels, nframes_t nframes ); void buffer_deinterleave_one_channel ( sample_t *dst, sample_t *src, int channel, int channels, nframes_t nframes ); +void buffer_fill_with_silence ( sample_t *buf, nframes_t nframes );