Mercurial > hg > svcore
diff data/model/WaveFileModel.cpp @ 266:2268963dabd1
* FFT: fix invalid write of normalisation factor in compact mode of disc cache
* FFT: fix range problem for normalisation factor in compact mode (it was
stored as an unsigned scaled from an assumed float range of 0->1, which
is not very plausible and not accurate enough even if true -- use a float
instead)
* Spectrogram: fix vertical zoom behaviour for log frequency spectrograms:
make the thing in the middle of the display remain in the middle after zoom
* Overview widget: don't update the detailed waveform if still decoding the
audio file (too expensive to do all those redraws)
author | Chris Cannam |
---|---|
date | Fri, 08 Jun 2007 15:19:50 +0000 |
parents | e08f486e8d8c |
children | fa612dc181af |
line wrap: on
line diff
--- a/data/model/WaveFileModel.cpp Wed Jun 06 16:24:55 2007 +0000 +++ b/data/model/WaveFileModel.cpp Fri Jun 08 15:19:50 2007 +0000 @@ -96,14 +96,22 @@ { bool ready = (isOK() && (m_fillThread == 0)); double c = double(m_lastFillExtent) / double(getEndFrame() - getStartFrame()); + static int prevCompletion = 0; if (completion) { *completion = int(c * 100.0 + 0.01); if (m_reader) { int decodeCompletion = m_reader->getDecodeCompletion(); -// std::cerr << "decodeCompletion " << decodeCompletion << ", completion " << *completion << std::endl; -// if (decodeCompletion < *completion) *completion = decodeCompletion; - if (decodeCompletion < 100) *completion = decodeCompletion; + if (decodeCompletion < 90) *completion = decodeCompletion; + else *completion = std::min(*completion, decodeCompletion); } + if (*completion != 0 && + *completion != 100 && + prevCompletion != 0 && + prevCompletion > *completion) { + // just to avoid completion going backwards + *completion = prevCompletion; + } + prevCompletion = *completion; } #ifdef DEBUG_WAVE_FILE_MODEL std::cerr << "WaveFileModel::isReady(): ready = " << ready << ", completion = " << (completion ? *completion : -1) << std::endl;