From 77ac8a2c8eacd2800ec87a08b97d91dbe9184d65 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 19 Apr 2008 00:26:43 -0500 Subject: [PATCH] Create track ports with the proper names. --- Timeline/Track.C | 64 +++++++++++++++++++++++++++++++----------------- Timeline/Track.H | 3 +++ Timeline/dsp.C | 1 - 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Timeline/Track.C b/Timeline/Track.C index 599a0fe..a2074eb 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -60,7 +60,7 @@ Track::cb_button ( Fl_Widget *w ) printf( "FIXME: inform mixer here\n" ); if ( w == record_button ) { - /* FIXME: wrong place for this! */ + /* FIXME: wrong place for this! */ if ( record_button->value() ) record_ds->start( transport.frame ); else @@ -108,26 +108,6 @@ Track::Track ( int X, int Y, int W, int H, const char *L ) : labeltype( FL_NO_LABEL ); - { - char pname[40]; - static int no = 0, ni = 0; - - snprintf( pname, sizeof( pname ), "out-%d", no++ ); - - output.push_back( Port( strdup( pname ), Port::Output ) ); - - snprintf( pname, sizeof( pname ), "in-%d", ni++ ); - - input.push_back( Port( strdup( pname ), Port::Input ) ); - - snprintf( pname, sizeof( pname ), "in-%d", ni++ ); - - input.push_back( Port( strdup( pname ), Port::Input ) ); - - } - - playback_ds = new Playback_DS( this, engine->frame_rate(), engine->nframes(), 1 ); - record_ds = new Record_DS( this, engine->frame_rate(), engine->nframes(), 2 ); Fl_Group::size( w(), height() ); @@ -227,6 +207,13 @@ Track::Track ( int X, int Y, int W, int H, const char *L ) : if ( L ) name( L ); + /* FIXME: should be configurable, but where? */ + create_outputs( 2 ); + create_inputs( 2 ); + + playback_ds = new Playback_DS( this, engine->frame_rate(), engine->nframes(), output.size() ); + record_ds = new Record_DS( this, engine->frame_rate(), engine->nframes(), input.size() ); + log_create(); } @@ -318,6 +305,39 @@ Track::add_control( Sequence *t ) /* Engine */ /**********/ +bool +Track::create_outputs ( int n ) +{ + char pname[256]; + + for ( int i = 0; i < n; ++i ) + { + snprintf( pname, sizeof( pname ), "%s/out-%d", name(), i + 1 ); + output.push_back( Port( strdup( pname ), Port::Output ) ); + } + + /* FIXME: bogus */ + return true; +} + +bool +Track::create_inputs ( int n ) +{ + char pname[256]; + + for ( int i = 0; i < n; ++i ) + { + snprintf( pname, sizeof( pname ), "%s/in-%d", name(), i + 1 ); + input.push_back( Port( strdup( pname ), Port::Input ) ); + } + + /* FIXME: bogus */ + return true; +} + + + + /* THREAD: RT */ nframes_t Track::process ( nframes_t nframes ) @@ -342,7 +362,7 @@ Track::seek ( nframes_t frame ) /* FIXME: what about theading issues with this region/audiofile being - accessible from the UI thread? Need locking? */ + accessible from the UI thread? Need locking? */ #include "Region.H" diff --git a/Timeline/Track.H b/Timeline/Track.H index 550b66c..7c079a4 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -69,6 +69,9 @@ private: Region *_capture; /* capture region */ + bool create_outputs ( int n ); + bool create_inputs ( int n ); + public: Fl_Input * name_field; diff --git a/Timeline/dsp.C b/Timeline/dsp.C index 6f4129e..b7f3df9 100644 --- a/Timeline/dsp.C +++ b/Timeline/dsp.C @@ -79,7 +79,6 @@ buffer_interleave_one_channel_and_mix ( sample_t *dst, sample_t *src, int channe void buffer_deinterleave_one_channel ( sample_t *dst, sample_t *src, int channel, int channels, nframes_t nframes ) { - nframes *= channels; src += channel; while ( nframes-- )