Added a FFT framerate setting

This commit is contained in:
Ryzerth
2021-07-27 01:57:12 +02:00
parent bd744d07ba
commit 21f4c40e7f
5 changed files with 28 additions and 7 deletions

View File

@ -119,6 +119,15 @@ void SignalPath::setFFTSize(int size) {
reshape.start();
}
void SignalPath::setFFTRate(double rate) {
fftRate = rate;
int skip = (sampleRate / fftRate) - fftSize;
reshape.stop();
reshape.setSkip(skip);
reshape.setKeep(fftSize);
reshape.start();
}
void SignalPath::startFFT() {
reshape.start();
fftHandlerSink.start();
@ -160,7 +169,6 @@ void SignalPath::setDecimation(int dec) {
for (int i = 0; i < dec; i++) {
dsp::HalfDecimator<dsp::complex_t>* decimator = new dsp::HalfDecimator<dsp::complex_t>((i == 0) ? &inputBuffer.out : &decimators[i-1]->out, &halfBandWindow);
if (running) { decimator->start(); }
// TODO: ONLY start if running
decimators.push_back(decimator);
}
split.setInput(&decimators[decimators.size()-1]->out);

View File

@ -19,6 +19,7 @@ public:
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
void unbindIQStream(dsp::stream<dsp::complex_t>* stream);
void setFFTSize(int size);
void setFFTRate(double rate);
void startFFT();
void stopFFT();
void setBuffering(bool enabled);