From 6b97c912ebe510d25c3974c2472d96ec3961e1b2 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 25 Apr 2008 02:35:55 -0500 Subject: [PATCH] Fig logging for captures. --- Timeline/Loggable.C | 9 +++++++++ Timeline/Region.C | 17 +++++++++++++++++ Timeline/Region.H | 2 ++ Timeline/Timeline.C | 4 ++++ Timeline/Track.C | 3 +-- 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Timeline/Loggable.C b/Timeline/Loggable.C index af791a1..20149aa 100644 --- a/Timeline/Loggable.C +++ b/Timeline/Loggable.C @@ -538,6 +538,15 @@ void Loggable::log_create ( void ) const { // indent(); + +/* if ( Loggable::_level ) */ +/* { */ +/* /\* defer until the block ends--this is really only required for capturing... *\/ */ + + + +/* } */ + log( "%s 0x%X create ", class_name(), _id ); char **sa; diff --git a/Timeline/Region.C b/Timeline/Region.C index 8531a93..2bc835e 100644 --- a/Timeline/Region.C +++ b/Timeline/Region.C @@ -232,6 +232,10 @@ Region::handle ( int m ) static bool copied = false; static nframes_t os; + + if ( ! active_r() ) + return 0; + // int X = Fl::event_x() - _track->x(); int X = Fl::event_x(); int Y = Fl::event_y(); @@ -543,6 +547,7 @@ Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, in fl_pop_matrix(); } + void Region::draw_box( void ) { @@ -553,6 +558,7 @@ Region::draw_box( void ) Fl_Color selection_color = _selection_color; Fl_Color color = _box_color; + if ( this == ((Audio_Sequence*)track())->capture() ) { color = FL_RED; @@ -954,11 +960,22 @@ Region::write ( sample_t *buf, nframes_t nframes ) return l; } + +/** prepare for capturing */ +void +Region::prepare ( void ) +{ + log_start(); +} + + /** finalize region capture. Assumes that this *is* a captured region and that no other regions refer to the same source */ bool Region::finalize ( void ) { + log_end(); + _clip->close(); _clip->open(); diff --git a/Timeline/Region.H b/Timeline/Region.H index e100ca4..132c05e 100644 --- a/Timeline/Region.H +++ b/Timeline/Region.H @@ -198,9 +198,11 @@ public: void normalize ( void ); + /* Engine */ nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; nframes_t write ( sample_t *buf, nframes_t nframes ); + void prepare ( void ); bool finalize ( void ); }; diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 3923435..4427265 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -933,6 +933,8 @@ Timeline::remove_track ( Track *track ) bool Timeline::record ( void ) { + Loggable::block_start(); + for ( int i = tracks->children(); i-- ; ) { Track *t = (Track*)tracks->child( i ); @@ -958,6 +960,8 @@ Timeline::stop ( void ) t->record_ds->stop( transport->frame ); } + Loggable::block_end(); + activate(); } diff --git a/Timeline/Track.C b/Timeline/Track.C index daf8f7d..68a70c4 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -635,8 +635,7 @@ Track::record ( nframes_t frame ) _capture = new Region( af, track(), frame ); - /* FIXME: wrong place for this */ - _capture->_r->end = 0; + _capture->prepare(); } /* THREAD: IO */