Timeline: Fix bug causing occasional duplicate 'create' entries in snapshots.

This commit is contained in:
Jonathan Moore Liles 2013-03-13 18:00:03 -07:00
parent 8b9ef85c80
commit a99f707bda
13 changed files with 27 additions and 34 deletions

View File

@ -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 ( )

View File

@ -328,9 +328,11 @@ 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();
return 1;

View File

@ -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 )

View File

@ -32,7 +32,6 @@ protected:
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e );
void log_children ( void ) const;
Cursor_Point ( );

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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 )
{

View File

@ -45,7 +45,6 @@ protected:
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e );
void log_children ( void ) const;
Tempo_Point ( );

View File

@ -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();
}

View File

@ -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 )
{

View File

@ -58,7 +58,6 @@ protected:
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e );
void log_children ( void ) const;
Time_Point ( );

View File

@ -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();
}