mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-03 21:34:44 +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["colorMap"] = "Classic";
|
||||||
defConfig["fastFFT"] = false;
|
defConfig["fastFFT"] = false;
|
||||||
defConfig["fftHeight"] = 300;
|
defConfig["fftHeight"] = 300;
|
||||||
|
defConfig["fftRate"] = 20;
|
||||||
defConfig["fftSize"] = 65536;
|
defConfig["fftSize"] = 65536;
|
||||||
defConfig["fftWindow"] = 1;
|
defConfig["fftWindow"] = 1;
|
||||||
defConfig["frequency"] = 100000000.0;
|
defConfig["frequency"] = 100000000.0;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <gui/colormaps.h>
|
#include <gui/colormaps.h>
|
||||||
#include <gui/gui.h>
|
#include <gui/gui.h>
|
||||||
#include <gui/main_window.h>
|
#include <gui/main_window.h>
|
||||||
|
#include <signal_path/signal_path.h>
|
||||||
|
|
||||||
namespace displaymenu {
|
namespace displaymenu {
|
||||||
bool showWaterfall;
|
bool showWaterfall;
|
||||||
@ -15,6 +16,7 @@ namespace displaymenu {
|
|||||||
std::string colorMapNamesTxt = "";
|
std::string colorMapNamesTxt = "";
|
||||||
std::string colorMapAuthor = "";
|
std::string colorMapAuthor = "";
|
||||||
int selectedWindow = 0;
|
int selectedWindow = 0;
|
||||||
|
int fftRate = 20;
|
||||||
|
|
||||||
const int FFTSizes[] = {
|
const int FFTSizes[] = {
|
||||||
65536,
|
65536,
|
||||||
@ -71,6 +73,9 @@ namespace displaymenu {
|
|||||||
}
|
}
|
||||||
gui::mainWindow.setFFTSize(FFTSizes[fftSizeId]);
|
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);
|
selectedWindow = std::clamp<int>((int)core::configManager.conf["fftWindow"], 0, _FFT_WINDOW_COUNT-1);
|
||||||
gui::mainWindow.setFFTWindow(selectedWindow);
|
gui::mainWindow.setFFTWindow(selectedWindow);
|
||||||
}
|
}
|
||||||
@ -99,6 +104,17 @@ namespace displaymenu {
|
|||||||
core::configManager.release(true);
|
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::Text("FFT Size");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
|
@ -119,6 +119,15 @@ void SignalPath::setFFTSize(int size) {
|
|||||||
reshape.start();
|
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() {
|
void SignalPath::startFFT() {
|
||||||
reshape.start();
|
reshape.start();
|
||||||
fftHandlerSink.start();
|
fftHandlerSink.start();
|
||||||
@ -160,7 +169,6 @@ void SignalPath::setDecimation(int dec) {
|
|||||||
for (int i = 0; i < dec; i++) {
|
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);
|
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(); }
|
if (running) { decimator->start(); }
|
||||||
// TODO: ONLY start if running
|
|
||||||
decimators.push_back(decimator);
|
decimators.push_back(decimator);
|
||||||
}
|
}
|
||||||
split.setInput(&decimators[decimators.size()-1]->out);
|
split.setInput(&decimators[decimators.size()-1]->out);
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
|
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
|
||||||
void unbindIQStream(dsp::stream<dsp::complex_t>* stream);
|
void unbindIQStream(dsp::stream<dsp::complex_t>* stream);
|
||||||
void setFFTSize(int size);
|
void setFFTSize(int size);
|
||||||
|
void setFFTRate(double rate);
|
||||||
void startFFT();
|
void startFFT();
|
||||||
void stopFFT();
|
void stopFFT();
|
||||||
void setBuffering(bool enabled);
|
void setBuffering(bool enabled);
|
||||||
|
@ -40,19 +40,15 @@ public:
|
|||||||
_config->release(true);
|
_config->release(true);
|
||||||
|
|
||||||
squelch.init(_vfo->output, squelchLevel);
|
squelch.init(_vfo->output, squelchLevel);
|
||||||
|
|
||||||
c2s.init(&squelch.out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
squelch.start();
|
squelch.start();
|
||||||
c2s.start();
|
|
||||||
running = true;
|
running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
squelch.stop();
|
squelch.stop();
|
||||||
c2s.stop();
|
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +84,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
dsp::stream<dsp::stereo_t>* getOutput() {
|
dsp::stream<dsp::stereo_t>* getOutput() {
|
||||||
return &c2s.out;
|
return (dsp::stream<dsp::stereo_t>*)&squelch.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMenu() {
|
void showMenu() {
|
||||||
@ -137,7 +133,6 @@ private:
|
|||||||
|
|
||||||
VFOManager::VFO* _vfo;
|
VFOManager::VFO* _vfo;
|
||||||
dsp::Squelch squelch;
|
dsp::Squelch squelch;
|
||||||
dsp::ComplexToStereo c2s;
|
|
||||||
|
|
||||||
ConfigManager* _config;
|
ConfigManager* _config;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user