diff --git a/build/win32/vc8/JUCE.vcproj b/build/win32/vc8/JUCE.vcproj index 3675a6ba8e..6e099d65a2 100644 --- a/build/win32/vc8/JUCE.vcproj +++ b/build/win32/vc8/JUCE.vcproj @@ -1009,90 +1009,6 @@ RelativePath="..\..\..\src\juce_appframework\audio\devices\juce_MidiOutput.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sampleRate = 0; numSamplesCached = 0; + cacheNeedsRefilling = true; } void AudioThumbnail::loadFrom (InputStream& input) @@ -221,6 +217,7 @@ void AudioThumbnail::loadFrom (InputStream& input) } numSamplesCached = 0; + cacheNeedsRefilling = true; } void AudioThumbnail::saveTo (OutputStream& output) const @@ -264,7 +261,7 @@ bool AudioThumbnail::readNextBlockFromAudioFile (AudioFormatReader& reader) d->numFinishedSamples += numToDo; } - numSamplesCached = 0; // zap the cache + cacheNeedsRefilling = true; return (d->numFinishedSamples < d->totalSamples); } @@ -362,13 +359,15 @@ void AudioThumbnail::refillCache (const int numSamples, || d->sampleRate <= 0) { numSamplesCached = 0; + cacheNeedsRefilling = true; return; } if (numSamples == numSamplesCached && numChannelsCached == d->numChannels && startTime == cachedStart - && timePerPixel == cachedTimePerPixel) + && timePerPixel == cachedTimePerPixel + && ! cacheNeedsRefilling) { return; } @@ -384,6 +383,8 @@ void AudioThumbnail::refillCache (const int numSamples, const ScopedLock sl (readerLock); + cacheNeedsRefilling = false; + if (needExtraDetail && reader == 0) reader = createReader(); @@ -427,7 +428,7 @@ void AudioThumbnail::refillCache (const int numSamples, } else { - for (int channelNum = 0; channelNum < 2; ++channelNum) + for (int channelNum = 0; channelNum < numChannelsCached; ++channelNum) { char* const data = getChannelData (channelNum); char* cacheData = ((char*) cachedLevels.getData()) + channelNum * 2;