Add appropriate locking. Make control sequences removable.
This commit is contained in:
parent
03465d82b0
commit
b20156053e
|
@ -37,11 +37,11 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 )
|
||||||
|
|
||||||
_track = track;
|
_track = track;
|
||||||
|
|
||||||
|
_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );
|
||||||
|
|
||||||
if ( track )
|
if ( track )
|
||||||
track->add( this );
|
track->add( this );
|
||||||
|
|
||||||
_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );
|
|
||||||
|
|
||||||
log_create();
|
log_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ Control_Sequence::~Control_Sequence ( )
|
||||||
{
|
{
|
||||||
log_destroy();
|
log_destroy();
|
||||||
|
|
||||||
|
_output->shutdown();
|
||||||
|
|
||||||
delete _output;
|
delete _output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +308,7 @@ Control_Sequence::handle ( int m )
|
||||||
}
|
}
|
||||||
else if ( r == &menu[ 1 ] )
|
else if ( r == &menu[ 1 ] )
|
||||||
{
|
{
|
||||||
/* TODO: remove */
|
Fl::delete_widget( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include "Track.H"
|
#include "Track.H"
|
||||||
#include "Transport.H"
|
#include "Transport.H"
|
||||||
|
|
||||||
|
#include "Engine/Engine.H" // for lock()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Timeline::draw_with_measure_lines = true;
|
bool Timeline::draw_with_measure_lines = true;
|
||||||
|
@ -1165,9 +1167,12 @@ Timeline::add_track ( Track *track )
|
||||||
{
|
{
|
||||||
DMESSAGE( "added new track to the timeline" );
|
DMESSAGE( "added new track to the timeline" );
|
||||||
|
|
||||||
/* FIXME: do locking */
|
engine->lock();
|
||||||
|
|
||||||
tracks->add( track );
|
tracks->add( track );
|
||||||
|
|
||||||
|
engine->unlock();
|
||||||
|
|
||||||
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
|
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
@ -1178,11 +1183,13 @@ Timeline::remove_track ( Track *track )
|
||||||
{
|
{
|
||||||
DMESSAGE( "removed track from the timeline" );
|
DMESSAGE( "removed track from the timeline" );
|
||||||
|
|
||||||
/* FIXME: do locking */
|
engine->lock();
|
||||||
|
|
||||||
/* FIXME: what to do about track contents? */
|
/* FIXME: what to do about track contents? */
|
||||||
tracks->remove( track );
|
tracks->remove( track );
|
||||||
|
|
||||||
|
engine->unlock();
|
||||||
|
|
||||||
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
|
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
// #include <FL/fl_draw.H>
|
// #include <FL/fl_draw.H>
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
|
|
||||||
|
#include "Engine/Engine.H" // for lock()
|
||||||
|
|
||||||
#include "Control_Sequence.H"
|
#include "Control_Sequence.H"
|
||||||
#include "Annotation_Sequence.H"
|
#include "Annotation_Sequence.H"
|
||||||
|
|
||||||
|
@ -362,9 +364,15 @@ Track::remove ( Audio_Sequence *t )
|
||||||
void
|
void
|
||||||
Track::remove ( Control_Sequence *t )
|
Track::remove ( Control_Sequence *t )
|
||||||
{
|
{
|
||||||
|
engine->lock();
|
||||||
|
|
||||||
control->remove( t );
|
control->remove( t );
|
||||||
|
|
||||||
|
engine->unlock();
|
||||||
|
|
||||||
resize();
|
resize();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -388,10 +396,14 @@ Track::add ( Control_Sequence *t )
|
||||||
{
|
{
|
||||||
DMESSAGE( "adding control sequence" );
|
DMESSAGE( "adding control sequence" );
|
||||||
|
|
||||||
|
engine->lock();
|
||||||
|
|
||||||
t->track( this );
|
t->track( this );
|
||||||
|
|
||||||
control->add( t );
|
control->add( t );
|
||||||
|
|
||||||
|
engine->unlock();
|
||||||
|
|
||||||
resize();
|
resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ public:
|
||||||
|
|
||||||
int size ( void ) const { return _size; }
|
int size ( void ) const { return _size; }
|
||||||
|
|
||||||
int ncontrols ( void ) { return controls->children(); }
|
int ncontrols ( void ) { return control->children(); }
|
||||||
|
|
||||||
void resize ( void );
|
void resize ( void );
|
||||||
void size ( int v );
|
void size ( int v );
|
||||||
|
|
Loading…
Reference in New Issue