diff --git a/spectrogramplot.cpp b/spectrogramplot.cpp index 914db2f..c1e2ea8 100644 --- a/spectrogramplot.cpp +++ b/spectrogramplot.cpp @@ -47,9 +47,11 @@ SpectrogramPlot::SpectrogramPlot(std::shared_ptrconnect(memSource, 0, tunerFilter, 0); + tunerFlowGraph->connect(memSource, 0, tunerRotator, 0); + tunerFlowGraph->connect(tunerRotator, 0, tunerFilter, 0); tunerFlowGraph->connect(tunerFilter, 0, memSink, 0); tunerOutput = std::make_shared, std::complex>>( @@ -158,9 +160,10 @@ int SpectrogramPlot::getStride() return fftSize / zoomLevel; } -float SpectrogramPlot::getTunerCentre() +float SpectrogramPlot::getTunerPhaseInc() { - return 0.5f - tuner.centre() / (float)fftSize; + auto freq = 0.5f - tuner.centre() / (float)fftSize; + return -freq * Tau; } std::vector SpectrogramPlot::getTunerTaps() @@ -226,7 +229,7 @@ bool SpectrogramPlot::tunerEnabled() void SpectrogramPlot::tunerMoved() { - tunerFilter->set_center_freq(getTunerCentre()); + tunerRotator->set_phase_inc(getTunerPhaseInc()); tunerFilter->set_taps(getTunerTaps()); // TODO: for invalidating traceplot cache, this shouldn't really go here diff --git a/spectrogramplot.h b/spectrogramplot.h index 7cdf2a2..df18e03 100644 --- a/spectrogramplot.h +++ b/spectrogramplot.h @@ -19,7 +19,8 @@ #pragma once -#include +#include +#include #include #include #include "fft.h" @@ -71,13 +72,14 @@ private: Tuner tuner; std::shared_ptr, std::complex>> tunerOutput; - gr::filter::freq_xlating_fir_filter_ccf::sptr tunerFilter; + gr::blocks::rotator_cc::sptr tunerRotator; + gr::filter::fir_filter_ccf::sptr tunerFilter; QPixmap* getPixmapTile(off_t tile); float* getFFTTile(off_t tile); void getLine(float *dest, off_t sample); int getStride(); - float getTunerCentre(); + float getTunerPhaseInc(); std::vector getTunerTaps(); int linesPerTile(); bool tunerEnabled();