mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 16:50:26 +02:00
fix WaveTrackCache, again...
... There was still some duplicated loading of block files during normal forward play, though not more than two loads per file.
This commit is contained in:
parent
40651241d9
commit
31832b21a3
@ -2661,9 +2661,7 @@ constSamplePtr WaveTrackCache::Get(sampleFormat format,
|
||||
// Request starts in the second buffer and extends past it.
|
||||
// Discard the first buffer.
|
||||
// (But don't deallocate the buffer space.)
|
||||
float *save = mBuffers[0].data;
|
||||
mBuffers[0] = mBuffers[1];
|
||||
mBuffers[1].data = save;
|
||||
mBuffers[0] .swap ( mBuffers[1] );
|
||||
fillSecond = true;
|
||||
mNValidBuffers = 1;
|
||||
}
|
||||
@ -2678,9 +2676,7 @@ constSamplePtr WaveTrackCache::Get(sampleFormat format,
|
||||
// refill the first.
|
||||
// (This case might be useful when marching backwards through
|
||||
// the track, as with scrubbing.)
|
||||
float *save = mBuffers[1].data;
|
||||
mBuffers[1] = mBuffers[0];
|
||||
mBuffers[0].data = save;
|
||||
mBuffers[0] .swap ( mBuffers[1] );
|
||||
fillFirst = true;
|
||||
fillSecond = false;
|
||||
// Cache is not in a consistent state yet
|
||||
|
@ -646,6 +646,13 @@ private:
|
||||
Buffer() : data(0), start(0), len(0) {}
|
||||
void Free() { delete[] data; data = 0; start = 0; len = 0; }
|
||||
sampleCount end() const { return start + len; }
|
||||
|
||||
void swap ( Buffer &other )
|
||||
{
|
||||
std::swap( data, other.data );
|
||||
std::swap( start, other.start );
|
||||
std::swap( len, other.len );
|
||||
}
|
||||
};
|
||||
|
||||
const WaveTrack *mPTrack;
|
||||
|
Loading…
x
Reference in New Issue
Block a user