diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index 14888e2..7cef71d 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -167,18 +167,15 @@ Audio_Region::Audio_Region ( Audio_File *c ) log_create(); } -/* used when DND importing */ +/* used when DND importing and when recording. must not invoke log_create() */ Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o ) { init(); _clip = c; - _sequence = t; _r->offset = 0; _r->start = o; _r->length = _clip->length(); - sequence()->add( this ); - int sum = 0; const char *s = rindex( _clip->name(), '/' ); if ( ! s ) @@ -192,7 +189,7 @@ Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o ) _box_color = (Fl_Color)sum; - log_create(); + t->add( this ); } Audio_Region::~Audio_Region ( ) diff --git a/timeline/src/Audio_Sequence.C b/timeline/src/Audio_Sequence.C index 64ec3e3..0cff62a 100644 --- a/timeline/src/Audio_Sequence.C +++ b/timeline/src/Audio_Sequence.C @@ -328,8 +328,10 @@ Audio_Sequence::handle ( int m ) free( file ); -// Audio_Region *r = + Audio_Region *r = new Audio_Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) ); + + r->log_create(); redraw(); diff --git a/timeline/src/Cursor_Point.C b/timeline/src/Cursor_Point.C index 771f896..e953b16 100644 --- a/timeline/src/Cursor_Point.C +++ b/timeline/src/Cursor_Point.C @@ -109,12 +109,6 @@ Cursor_Point::set ( Log_Entry &e ) -void -Cursor_Point::log_children ( void ) const -{ - log_create(); -} - int Cursor_Point::handle ( int m ) diff --git a/timeline/src/Cursor_Point.H b/timeline/src/Cursor_Point.H index 7f2c342..0cd05b6 100644 --- a/timeline/src/Cursor_Point.H +++ b/timeline/src/Cursor_Point.H @@ -32,7 +32,6 @@ protected: virtual void get ( Log_Entry &e ) const; void set ( Log_Entry &e ); - void log_children ( void ) const; Cursor_Point ( ); diff --git a/timeline/src/Engine/Audio_Region.C b/timeline/src/Engine/Audio_Region.C index 1d12d42..161651f 100644 --- a/timeline/src/Engine/Audio_Region.C +++ b/timeline/src/Engine/Audio_Region.C @@ -226,7 +226,7 @@ Audio_Region::prepare ( void ) DMESSAGE( "Preparing capture region" ); - log_start(); +// log_start(); } /** write /nframes/ from /buf/ to source. /buf/ is interleaved and @@ -267,7 +267,8 @@ Audio_Region::finalize ( nframes_t frame ) _clip->close(); _clip->open(); - log_end(); + log_create(); +// log_end(); return true; } diff --git a/timeline/src/Engine/Track.C b/timeline/src/Engine/Track.C index 6a62639..ee52be9 100644 --- a/timeline/src/Engine/Track.C +++ b/timeline/src/Engine/Track.C @@ -273,7 +273,7 @@ Track::record ( Capture *c, nframes_t frame ) /* open it again for reading in the GUI thread */ // Audio_File *af = Audio_File::from_file( c->audio_file->name() ); /* must acquire the FLTK lock because adding a widget might interfere with drawing */ - Fl::lock(); +// Fl::lock(); /* must acquire a write lock because the Audio_Region constructor * will add the region to the specified sequence, which might affect playback */ @@ -283,7 +283,7 @@ Track::record ( Capture *c, nframes_t frame ) timeline->unlock(); - Fl::unlock(); +// Fl::unlock(); c->region->prepare(); } diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index aa642b4..9eb2946 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -188,7 +188,13 @@ Sequence::add ( Sequence_Widget *r ) { // Logger _log( this ); - if ( r->sequence() && r->sequence() != this ) + if ( r->sequence() == this ) + { + WARNING( "Programming error: attempt to add sequence widget to the same sequence twice" ); + return; + } + + if ( r->sequence() ) { /* This method can be called from the Capture thread as well as the GUI thread, so we must lock FLTK before redraw */ r->redraw(); diff --git a/timeline/src/Tempo_Point.C b/timeline/src/Tempo_Point.C index bb17769..5848ffc 100644 --- a/timeline/src/Tempo_Point.C +++ b/timeline/src/Tempo_Point.C @@ -83,12 +83,6 @@ Tempo_Point::set ( Log_Entry &e ) _make_label(); } -void -Tempo_Point::log_children ( void ) const -{ - log_create(); -} - int Tempo_Point::handle ( int m ) { diff --git a/timeline/src/Tempo_Point.H b/timeline/src/Tempo_Point.H index f935c1a..8dd88d0 100644 --- a/timeline/src/Tempo_Point.H +++ b/timeline/src/Tempo_Point.H @@ -45,7 +45,6 @@ protected: virtual void get ( Log_Entry &e ) const; void set ( Log_Entry &e ); - void log_children ( void ) const; Tempo_Point ( ); diff --git a/timeline/src/Tempo_Sequence.C b/timeline/src/Tempo_Sequence.C index a81fa08..c07f91b 100644 --- a/timeline/src/Tempo_Sequence.C +++ b/timeline/src/Tempo_Sequence.C @@ -62,7 +62,11 @@ Tempo_Sequence::handle ( int m ) if ( Tempo_Point::edit( &t ) ) { - add( new Tempo_Point( timeline->x_to_offset( Fl::event_x() ), t ) ); + timeline->wrlock(); + + new Tempo_Point( timeline->x_to_offset( Fl::event_x() ), t ); + + timeline->unlock(); timeline->redraw(); } diff --git a/timeline/src/Time_Point.C b/timeline/src/Time_Point.C index 6883528..002c38c 100644 --- a/timeline/src/Time_Point.C +++ b/timeline/src/Time_Point.C @@ -93,12 +93,6 @@ Time_Point::set ( Log_Entry &e ) _make_label(); } -void -Time_Point::log_children ( void ) const -{ - log_create(); -} - int Time_Point::handle ( int m ) { diff --git a/timeline/src/Time_Point.H b/timeline/src/Time_Point.H index 412024c..79665aa 100644 --- a/timeline/src/Time_Point.H +++ b/timeline/src/Time_Point.H @@ -58,7 +58,6 @@ protected: virtual void get ( Log_Entry &e ) const; void set ( Log_Entry &e ); - void log_children ( void ) const; Time_Point ( ); diff --git a/timeline/src/Time_Sequence.C b/timeline/src/Time_Sequence.C index 39461a0..972bfd9 100644 --- a/timeline/src/Time_Sequence.C +++ b/timeline/src/Time_Sequence.C @@ -65,7 +65,11 @@ Time_Sequence::handle ( int m ) if ( Time_Point::edit( &t ) ) { - add( new Time_Point( timeline->x_to_offset( Fl::event_x() ), t.beats_per_bar, t.beat_type ) ); + timeline->wrlock(); + + new Time_Point( timeline->x_to_offset( Fl::event_x() ), t.beats_per_bar, t.beat_type ); + + timeline->unlock(); timeline->redraw(); }