Timeline: Fix potential deadlock when stopping recording.
This commit is contained in:
parent
14b8507fcb
commit
9230ab3d04
|
@ -229,6 +229,27 @@ Audio_Region::prepare ( void )
|
|||
// log_start();
|
||||
}
|
||||
|
||||
|
||||
class SequenceRedrawRequest {
|
||||
public:
|
||||
nframes_t start;
|
||||
nframes_t length;
|
||||
Sequence *sequence;
|
||||
};
|
||||
|
||||
static
|
||||
void
|
||||
sequence_redraw_request_handle ( void *v )
|
||||
{
|
||||
THREAD_ASSERT(UI);
|
||||
|
||||
SequenceRedrawRequest *o = (SequenceRedrawRequest*)v;
|
||||
|
||||
o->sequence->damage( FL_DAMAGE_USER1, timeline->offset_to_x( o->start ), o->sequence->y(), timeline->ts_to_x( o->length ), o->sequence->h() );
|
||||
|
||||
delete o;
|
||||
};
|
||||
|
||||
/** write /nframes/ from /buf/ to source. /buf/ is interleaved and
|
||||
must match the channel layout of the write source! */
|
||||
nframes_t
|
||||
|
@ -242,9 +263,12 @@ Audio_Region::write ( nframes_t nframes )
|
|||
|
||||
if ( W )
|
||||
{
|
||||
Fl::lock();
|
||||
sequence()->damage(FL_DAMAGE_USER1, x(), y(), w(), h());
|
||||
Fl::unlock();
|
||||
SequenceRedrawRequest *o = new SequenceRedrawRequest();
|
||||
o->sequence = sequence();
|
||||
o->start = _range.start + ( _range.length - timeline->x_to_ts( 20 ) );
|
||||
o->length = timeline->x_to_ts( 20 );
|
||||
|
||||
Fl::awake(sequence_redraw_request_handle, o);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -940,6 +940,12 @@ Timeline::x_to_offset ( int x ) const
|
|||
return x_to_ts( max( 0, x - Track::width() ) ) + xoffset;
|
||||
}
|
||||
|
||||
int
|
||||
Timeline::offset_to_x ( nframes_t frame ) const
|
||||
{
|
||||
return ts_to_x( frame - xoffset ) + Track::width();
|
||||
}
|
||||
|
||||
/** draws a single measure line */
|
||||
void
|
||||
Timeline::draw_measure_cb ( nframes_t frame, const BBT &bbt, void *v )
|
||||
|
|
|
@ -85,7 +85,6 @@ struct Rectangle
|
|||
Rectangle ( int X, int Y, int W, int H ) : x( X ), y( Y ), w( W ), h( H ) {}
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_WIDGET_FOR_TIMELINE
|
||||
class Timeline : public Fl_Group, public RWLock
|
||||
#else
|
||||
|
@ -214,6 +213,7 @@ public:
|
|||
int ts_to_x( nframes_t ts ) const { return ts >> _fpp; }
|
||||
nframes_t x_to_ts ( int x ) const { return x << _fpp; }
|
||||
nframes_t x_to_offset ( int x ) const;
|
||||
int offset_to_x ( nframes_t frame ) const;
|
||||
|
||||
float beats_per_minute ( nframes_t when ) const;
|
||||
int beats_per_bar ( nframes_t when ) const;
|
||||
|
|
Loading…
Reference in New Issue