@@ -602,20 +602,19 @@ Audio_Region::draw ( void ) | |||||
if ( start != ostart || end != oend ) | if ( start != ostart || end != oend ) | ||||
{ | { | ||||
if ( _clip->peaks()->peakfile_ready() ) | |||||
{ | |||||
if ( _clip->read_peaks( timeline->fpp(), | |||||
_clip->peaks()->peakfile_ready(); | |||||
if ( _clip->read_peaks( timeline->fpp(), | |||||
start, | start, | ||||
end, | end, | ||||
&peaks, &pbuf, &channels ) ) | &peaks, &pbuf, &channels ) ) | ||||
{ | |||||
Waveform::scale( pbuf, peaks * channels, _scale ); | |||||
{ | |||||
Waveform::scale( pbuf, peaks * channels, _scale ); | |||||
ostart = start; | |||||
oend = end; | |||||
} | |||||
ostart = start; | |||||
oend = end; | |||||
} | } | ||||
if ( _clip->peaks()->needs_more_peaks() && ! transport->rolling ) | if ( _clip->peaks()->needs_more_peaks() && ! transport->rolling ) | ||||
{ | { | ||||
/* maybe create a thread to make the peaks */ | /* maybe create a thread to make the peaks */ | ||||
@@ -429,7 +429,7 @@ Peaks::peakfile_ready ( void ) const | |||||
_rescan_needed = false; | _rescan_needed = false; | ||||
} | } | ||||
return current() && ! _first_block_pending; | |||||
return _first_block_pending || current(); | |||||
} | } | ||||
/** start building peaks and/or peak mipmap in another thread. It is | /** start building peaks and/or peak mipmap in another thread. It is | ||||
@@ -640,6 +640,7 @@ Peaks::prepare_for_writing ( void ) | |||||
char *pn = peakname( _clip->filename() ); | char *pn = peakname( _clip->filename() ); | ||||
_first_block_pending = true; | |||||
_peak_writer = new Peaks::Streamer( pn, _clip->channels(), cache_minimum ); | _peak_writer = new Peaks::Streamer( pn, _clip->channels(), cache_minimum ); | ||||
free( pn ); | free( pn ); | ||||
@@ -652,6 +653,8 @@ Peaks::finish_writing ( void ) | |||||
delete _peak_writer; | delete _peak_writer; | ||||
_peak_writer = NULL; | _peak_writer = NULL; | ||||
_first_block_pending = false; | |||||
} | } | ||||
void | void | ||||