mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-06 00:14:20 +01:00
Use custom class to index tiles by fftSize, zoomLevel and sample number
This commit is contained in:
@@ -97,7 +97,7 @@ void Spectrogram::paintEvent(QPaintEvent *event)
|
||||
|
||||
float* Spectrogram::getTile(off_t tile)
|
||||
{
|
||||
float *obj = fftCache.object(qMakePair(fftSize, tile));
|
||||
float *obj = fftCache.object(TileCacheKey(fftSize, zoomLevel, tile));
|
||||
if (obj != 0)
|
||||
return obj;
|
||||
|
||||
@@ -109,7 +109,7 @@ float* Spectrogram::getTile(off_t tile)
|
||||
sample += getStride();
|
||||
ptr += fftSize;
|
||||
}
|
||||
fftCache.insert(qMakePair(fftSize, tile), dest);
|
||||
fftCache.insert(TileCacheKey(fftSize, zoomLevel, tile), dest);
|
||||
return dest;
|
||||
}
|
||||
|
||||
@@ -222,3 +222,7 @@ QString Spectrogram::sampleToTime(off_t sample)
|
||||
int Spectrogram::linesPerTile() {
|
||||
return tileSize / fftSize;
|
||||
}
|
||||
|
||||
uint qHash(const TileCacheKey &key, uint seed) {
|
||||
return key.fftSize ^ key.zoomLevel ^ key.sample ^ seed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user