@@ -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 ;
@@ -242,7 +243,7 @@ void SpectrogramPlot::paintMid(QPainter &painter, QRect &rect, range_t<size_t> s
242243
243244QPixmap* SpectrogramPlot::getPixmapTile (size_t tile)
244245{
245- QPixmap *obj = pixmapCache.object (TileCacheKey (fftSize, zoomLevel, tile));
246+ QPixmap *obj = pixmapCache.object (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile));
246247 if (obj != 0 )
247248 return obj;
248249
@@ -261,13 +262,13 @@ QPixmap* SpectrogramPlot::getPixmapTile(size_t tile)
261262 }
262263 }
263264 obj->convertFromImage (image);
264- pixmapCache.insert (TileCacheKey (fftSize, zoomLevel, tile), obj);
265+ pixmapCache.insert (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile), obj);
265266 return obj;
266267}
267268
268269float * SpectrogramPlot::getFFTTile (size_t tile)
269270{
270- std::array<float , tileSize>* obj = fftCache.object (TileCacheKey (fftSize, zoomLevel, tile));
271+ std::array<float , tileSize>* obj = fftCache.object (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile));
271272 if (obj != nullptr )
272273 return obj->data ();
273274
@@ -279,7 +280,7 @@ float* SpectrogramPlot::getFFTTile(size_t tile)
279280 sample += getStride ();
280281 ptr += fftSize;
281282 }
282- fftCache.insert (TileCacheKey (fftSize, zoomLevel, tile), destStorage);
283+ fftCache.insert (TileCacheKey (fftSize, zoomLevel, nfftSkip, tile), destStorage);
283284 return destStorage->data ();
284285}
285286
@@ -316,7 +317,7 @@ void SpectrogramPlot::getLine(float *dest, size_t sample)
316317
317318int SpectrogramPlot::getStride ()
318319{
319- return fftSize / zoomLevel;
320+ return fftSize * nfftSkip / zoomLevel;
320321}
321322
322323float SpectrogramPlot::getTunerPhaseInc ()
@@ -397,6 +398,11 @@ void SpectrogramPlot::setZoomLevel(int zoom)
397398 zoomLevel = zoom;
398399}
399400
401+ void SpectrogramPlot::setSkip (int skip)
402+ {
403+ nfftSkip = skip;
404+ }
405+
400406void SpectrogramPlot::setSampleRate (double rate)
401407{
402408 sampleRate = rate;
0 commit comments