mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 14:52:43 +00:00
Added persistant setting sto demodulator of radio module
This commit is contained in:
@@ -5,20 +5,38 @@
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <string>
|
||||
#include <config.h>
|
||||
#include <imgui.h>
|
||||
|
||||
class AMDemodulator : public Demodulator {
|
||||
public:
|
||||
AMDemodulator() {}
|
||||
AMDemodulator(std::string prefix, VFOManager::VFO* vfo, float audioSampleRate, float bandWidth) {
|
||||
init(prefix, vfo, audioSampleRate, bandWidth);
|
||||
AMDemodulator(std::string prefix, VFOManager::VFO* vfo, float audioSampleRate, float bandWidth, ConfigManager* config) {
|
||||
init(prefix, vfo, audioSampleRate, bandWidth, config);
|
||||
}
|
||||
|
||||
void init(std::string prefix, VFOManager::VFO* vfo, float audioSampleRate, float bandWidth) {
|
||||
void init(std::string prefix, VFOManager::VFO* vfo, float audioSampleRate, float bandWidth, ConfigManager* config) {
|
||||
uiPrefix = prefix;
|
||||
_vfo = vfo;
|
||||
audioSampRate = audioSampleRate;
|
||||
bw = bandWidth;
|
||||
_config = config;
|
||||
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("AM")) {
|
||||
_config->conf[prefix]["AM"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["AM"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
json conf = _config->conf[prefix]["AM"];
|
||||
bw = conf["bandwidth"];
|
||||
snapInterval = conf["snapInterval"];
|
||||
}
|
||||
else {
|
||||
_config->conf[prefix]["AM"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["AM"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
demod.init(_vfo->output);
|
||||
|
||||
@@ -99,6 +117,9 @@ public:
|
||||
if (ImGui::InputFloat(("##_radio_am_bw_" + uiPrefix).c_str(), &bw, 1, 100, 0)) {
|
||||
bw = std::clamp<float>(bw, bwMin, bwMax);
|
||||
setBandwidth(bw);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Snap Interval");
|
||||
@@ -106,6 +127,9 @@ public:
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::InputFloat(("##_radio_am_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, 0)) {
|
||||
setSnapInterval(snapInterval);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["AM"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,4 +161,6 @@ private:
|
||||
dsp::PolyphaseResampler<float> resamp;
|
||||
dsp::MonoToStereo m2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user