diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index 051f241..7110b0a 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -602,20 +602,19 @@ Audio_Region::draw ( void ) 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, end, &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 ) { /* maybe create a thread to make the peaks */ diff --git a/timeline/src/Engine/Peaks.C b/timeline/src/Engine/Peaks.C index 2c59f04..0fa4dd9 100644 --- a/timeline/src/Engine/Peaks.C +++ b/timeline/src/Engine/Peaks.C @@ -429,7 +429,7 @@ Peaks::peakfile_ready ( void ) const _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 @@ -640,6 +640,7 @@ Peaks::prepare_for_writing ( void ) char *pn = peakname( _clip->filename() ); + _first_block_pending = true; _peak_writer = new Peaks::Streamer( pn, _clip->channels(), cache_minimum ); free( pn ); @@ -652,6 +653,8 @@ Peaks::finish_writing ( void ) delete _peak_writer; _peak_writer = NULL; + + _first_block_pending = false; } void