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();
|
// 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
|
/** write /nframes/ from /buf/ to source. /buf/ is interleaved and
|
||||||
must match the channel layout of the write source! */
|
must match the channel layout of the write source! */
|
||||||
nframes_t
|
nframes_t
|
||||||
|
@ -242,9 +263,12 @@ Audio_Region::write ( nframes_t nframes )
|
||||||
|
|
||||||
if ( W )
|
if ( W )
|
||||||
{
|
{
|
||||||
Fl::lock();
|
SequenceRedrawRequest *o = new SequenceRedrawRequest();
|
||||||
sequence()->damage(FL_DAMAGE_USER1, x(), y(), w(), h());
|
o->sequence = sequence();
|
||||||
Fl::unlock();
|
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;
|
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 */
|
/** draws a single measure line */
|
||||||
void
|
void
|
||||||
Timeline::draw_measure_cb ( nframes_t frame, const BBT &bbt, void *v )
|
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 ) {}
|
Rectangle ( int X, int Y, int W, int H ) : x( X ), y( Y ), w( W ), h( H ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_WIDGET_FOR_TIMELINE
|
#ifdef USE_WIDGET_FOR_TIMELINE
|
||||||
class Timeline : public Fl_Group, public RWLock
|
class Timeline : public Fl_Group, public RWLock
|
||||||
#else
|
#else
|
||||||
|
@ -214,6 +213,7 @@ public:
|
||||||
int ts_to_x( nframes_t ts ) const { return ts >> _fpp; }
|
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_ts ( int x ) const { return x << _fpp; }
|
||||||
nframes_t x_to_offset ( int x ) const;
|
nframes_t x_to_offset ( int x ) const;
|
||||||
|
int offset_to_x ( nframes_t frame ) const;
|
||||||
|
|
||||||
float beats_per_minute ( nframes_t when ) const;
|
float beats_per_minute ( nframes_t when ) const;
|
||||||
int beats_per_bar ( nframes_t when ) const;
|
int beats_per_bar ( nframes_t when ) const;
|
||||||
|
|
Loading…
Reference in New Issue