Timeline: Just redraw the whole waveform when recording...
This commit is contained in:
parent
a480a93ba4
commit
44a0279e4c
|
@ -441,7 +441,7 @@ Audio_Region::draw_box( void )
|
||||||
|
|
||||||
color = fl_color_average( color, sequence()->color(), 0.75f );
|
color = fl_color_average( color, sequence()->color(), 0.75f );
|
||||||
|
|
||||||
if ( this == ((Audio_Sequence*)sequence())->capture_region() )
|
if ( recording() )
|
||||||
{
|
{
|
||||||
color = FL_RED;
|
color = FL_RED;
|
||||||
}
|
}
|
||||||
|
@ -478,6 +478,12 @@ Audio_Region::peaks_ready_callback ( void *v )
|
||||||
Fl::awake();
|
Fl::awake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Audio_Region::recording ( void ) const
|
||||||
|
{
|
||||||
|
return this == sequence()->track()->capture_region();
|
||||||
|
}
|
||||||
|
|
||||||
/** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */
|
/** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */
|
||||||
void
|
void
|
||||||
Audio_Region::draw ( void )
|
Audio_Region::draw ( void )
|
||||||
|
@ -505,15 +511,10 @@ Audio_Region::draw ( void )
|
||||||
|
|
||||||
Fl_Color c = selected() ? fl_invert_color( _color ) : _color;
|
Fl_Color c = selected() ? fl_invert_color( _color ) : _color;
|
||||||
|
|
||||||
if ( sequence()->damage() & FL_DAMAGE_USER1 && this == sequence()->track()->capture_region() )
|
if ( sequence()->damage() & FL_DAMAGE_USER1 &&
|
||||||
|
recording() )
|
||||||
{
|
{
|
||||||
/* just draw the section with the updated peaks... */
|
/* TODO: limit drawing. */
|
||||||
|
|
||||||
nframes_t absolute_frame = _r->start + sequence()->track()->capture()->last_frame_drawn;
|
|
||||||
int nx = sequence()->x() + timeline->ts_to_x( absolute_frame - scroll_ts() );
|
|
||||||
|
|
||||||
W -= nx - X;
|
|
||||||
X = nx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate waveform offset due to scrolling */
|
/* calculate waveform offset due to scrolling */
|
||||||
|
@ -555,7 +556,7 @@ Audio_Region::draw ( void )
|
||||||
|
|
||||||
Fl_Color c = Fl::get_color( _color );
|
Fl_Color c = Fl::get_color( _color );
|
||||||
|
|
||||||
if ( this == ((Audio_Sequence*)sequence())->capture_region() )
|
if ( recording() )
|
||||||
{
|
{
|
||||||
// loop_peaks_needed = timeline->ts_to_x( _range.length );
|
// loop_peaks_needed = timeline->ts_to_x( _range.length );
|
||||||
c = FL_BLACK;
|
c = FL_BLACK;
|
||||||
|
@ -640,9 +641,6 @@ Audio_Region::draw ( void )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WARNING( "Pbuf == %p, peaks = %lu", pbuf, (unsigned long)peaks );
|
WARNING( "Pbuf == %p, peaks = %lu", pbuf, (unsigned long)peaks );
|
||||||
|
|
||||||
if ( sequence()->damage() & FL_DAMAGE_USER1 && this == sequence()->track()->capture_region() )
|
|
||||||
sequence()->track()->capture()->last_frame_drawn = start + peaks;
|
|
||||||
|
|
||||||
if ( peaks < loop_peaks_needed )
|
if ( peaks < loop_peaks_needed )
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,6 +162,7 @@ public:
|
||||||
|
|
||||||
void normalize ( void );
|
void normalize ( void );
|
||||||
void split ( nframes_t where );
|
void split ( nframes_t where );
|
||||||
|
bool recording ( void ) const;
|
||||||
|
|
||||||
/* Engine */
|
/* Engine */
|
||||||
nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const;
|
nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const;
|
||||||
|
|
|
@ -70,13 +70,11 @@ public:
|
||||||
|
|
||||||
struct Capture
|
struct Capture
|
||||||
{
|
{
|
||||||
nframes_t last_frame_drawn;
|
|
||||||
Audio_File *audio_file;
|
Audio_File *audio_file;
|
||||||
Audio_Region *region;
|
Audio_Region *region;
|
||||||
|
|
||||||
Capture ( )
|
Capture ( )
|
||||||
{
|
{
|
||||||
last_frame_drawn = 0;
|
|
||||||
region = 0;
|
region = 0;
|
||||||
audio_file = 0;
|
audio_file = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue