@@ -35,6 +35,7 @@ SpectrogramPlot::SpectrogramPlot(std::shared_ptr<SampleSource<std::complex<float
3535{
3636 setFFTSize (fftSize);
3737 zoomLevel = 1 ;
38+ nfftSkip = 1 ;
3839 powerMax = 0 .0f ;
3940 powerMin = -50 .0f ;
4041 sampleRate = 0 ;
@@ -222,7 +223,7 @@ void SpectrogramPlot::paintMid(QPainter &painter, QRect &rect, range_t<size_t> s
222223
223224QPixmap* SpectrogramPlot::getPixmapTile (size_t tile)
224225{
225- QPixmap *obj = pixmapCache.object (TileCacheKey (fftSize, zoomLevel, tile));
226+ QPixmap *obj = pixmapCache.object (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile));
226227 if (obj != 0 )
227228 return obj;
228229
@@ -241,13 +242,13 @@ QPixmap* SpectrogramPlot::getPixmapTile(size_t tile)
241242 }
242243 }
243244 obj->convertFromImage (image);
244- pixmapCache.insert (TileCacheKey (fftSize, zoomLevel, tile), obj);
245+ pixmapCache.insert (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile), obj);
245246 return obj;
246247}
247248
248249float * SpectrogramPlot::getFFTTile (size_t tile)
249250{
250- std::array<float , tileSize>* obj = fftCache.object (TileCacheKey (fftSize, zoomLevel, tile));
251+ std::array<float , tileSize>* obj = fftCache.object (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile));
251252 if (obj != nullptr )
252253 return obj->data ();
253254
@@ -259,7 +260,7 @@ float* SpectrogramPlot::getFFTTile(size_t tile)
259260 sample += getStride ();
260261 ptr += fftSize;
261262 }
262- fftCache.insert (TileCacheKey (fftSize, zoomLevel, tile), destStorage);
263+ fftCache.insert (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile), destStorage);
263264 return destStorage->data ();
264265}
265266
@@ -296,7 +297,7 @@ void SpectrogramPlot::getLine(float *dest, size_t sample)
296297
297298int SpectrogramPlot::getStride ()
298299{
299- return fftSize / zoomLevel;
300+ return fftSize * nfftSkip / zoomLevel;
300301}
301302
302303float SpectrogramPlot::getTunerPhaseInc ()
@@ -377,6 +378,11 @@ void SpectrogramPlot::setZoomLevel(int zoom)
377378 zoomLevel = zoom;
378379}
379380
381+ void SpectrogramPlot::setSkip (int skip)
382+ {
383+ nfftSkip = skip;
384+ }
385+
380386void SpectrogramPlot::setSampleRate (double rate)
381387{
382388 sampleRate = rate;
0 commit comments