mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-03 13:24:46 +01:00
Added a FFT framerate setting
This commit is contained in:
parent
bd744d07ba
commit
21f4c40e7f
@ -120,6 +120,7 @@ int sdrpp_main(int argc, char *argv[]) {
|
||||
defConfig["colorMap"] = "Classic";
|
||||
defConfig["fastFFT"] = false;
|
||||
defConfig["fftHeight"] = 300;
|
||||
defConfig["fftRate"] = 20;
|
||||
defConfig["fftSize"] = 65536;
|
||||
defConfig["fftWindow"] = 1;
|
||||
defConfig["frequency"] = 100000000.0;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <gui/colormaps.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/main_window.h>
|
||||
#include <signal_path/signal_path.h>
|
||||
|
||||
namespace displaymenu {
|
||||
bool showWaterfall;
|
||||
@ -15,6 +16,7 @@ namespace displaymenu {
|
||||
std::string colorMapNamesTxt = "";
|
||||
std::string colorMapAuthor = "";
|
||||
int selectedWindow = 0;
|
||||
int fftRate = 20;
|
||||
|
||||
const int FFTSizes[] = {
|
||||
65536,
|
||||
@ -71,6 +73,9 @@ namespace displaymenu {
|
||||
}
|
||||
gui::mainWindow.setFFTSize(FFTSizes[fftSizeId]);
|
||||
|
||||
fftRate = core::configManager.conf["fftRate"];
|
||||
sigpath::signalPath.setFFTRate(fftRate);
|
||||
|
||||
selectedWindow = std::clamp<int>((int)core::configManager.conf["fftWindow"], 0, _FFT_WINDOW_COUNT-1);
|
||||
gui::mainWindow.setFFTWindow(selectedWindow);
|
||||
}
|
||||
@ -99,6 +104,17 @@ namespace displaymenu {
|
||||
core::configManager.release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("FFT Framerate");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::InputInt("##sdrpp_fft_rate", &fftRate, 1, 10)) {
|
||||
std::clamp<int>(fftRate, 1, 200);
|
||||
sigpath::signalPath.setFFTRate(fftRate);
|
||||
core::configManager.acquire();
|
||||
core::configManager.conf["fftRate"] = fftRate;
|
||||
core::configManager.release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("FFT Size");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -40,19 +40,15 @@ public:
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
c2s.init(&squelch.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
c2s.start();
|
||||
running = true;
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
c2s.stop();
|
||||
running = false;
|
||||
}
|
||||
|
||||
@ -88,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
dsp::stream<dsp::stereo_t>* getOutput() {
|
||||
return &c2s.out;
|
||||
return (dsp::stream<dsp::stereo_t>*)&squelch.out;
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
@ -137,7 +133,6 @@ private:
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::ComplexToStereo c2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user