mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-29 22:07:51 +02:00
Added squelch to radio
This commit is contained in:
@ -25,8 +25,8 @@ public:
|
||||
_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;
|
||||
if (!_config->conf[prefix]["AM"].contains("bandwidth")) { _config->conf[prefix]["AM"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["AM"].contains("snapInterval")) { _config->conf[prefix]["AM"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["AM"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -37,8 +37,10 @@ public:
|
||||
_config->conf[prefix]["AM"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output);
|
||||
demod.init(&squelch.out);
|
||||
|
||||
agc.init(&demod.out, 1.0f / 125.0f);
|
||||
|
||||
@ -52,6 +54,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
agc.start();
|
||||
resamp.start();
|
||||
@ -60,6 +63,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
resamp.stop();
|
||||
@ -79,7 +83,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -131,6 +135,16 @@ public:
|
||||
_config->conf[uiPrefix]["AM"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_am_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["AM"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -153,8 +167,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 12500;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::AMDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
|
@ -28,8 +28,8 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("CW")) {
|
||||
_config->conf[prefix]["CW"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["CW"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["CW"].contains("bandwidth")) { _config->conf[prefix]["CW"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["CW"].contains("snapInterval")) { _config->conf[prefix]["CW"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["CW"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -40,10 +40,12 @@ public:
|
||||
_config->conf[prefix]["CW"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
|
||||
win.init(audioBW, audioBW, bbSampRate);
|
||||
resamp.init(vfo->output, &win, bbSampRate, audioSampRate);
|
||||
resamp.init(&squelch.out, &win, bbSampRate, audioSampRate);
|
||||
win.setSampleRate(bbSampRate * resamp.getInterpolation());
|
||||
resamp.updateWindow(&win);
|
||||
|
||||
@ -57,6 +59,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
resamp.start();
|
||||
xlator.start();
|
||||
c2r.start();
|
||||
@ -66,6 +69,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
resamp.stop();
|
||||
xlator.stop();
|
||||
c2r.stop();
|
||||
@ -86,7 +90,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
resamp.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -141,6 +145,16 @@ public:
|
||||
_config->conf[uiPrefix]["CW"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_cw_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["CW"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -163,8 +177,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 200;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
dsp::PolyphaseResampler<dsp::complex_t> resamp;
|
||||
dsp::FrequencyXlator<dsp::complex_t> xlator;
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("DSB")) {
|
||||
_config->conf[prefix]["DSB"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["DSB"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["DSB"].contains("bandwidth")) { _config->conf[prefix]["DSB"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["DSB"].contains("snapInterval")) { _config->conf[prefix]["DSB"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["DSB"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -37,8 +37,10 @@ public:
|
||||
_config->conf[prefix]["DSB"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output, bbSampRate, bandWidth, dsp::SSBDemod::MODE_DSB);
|
||||
demod.init(&squelch.out, bbSampRate, bandWidth, dsp::SSBDemod::MODE_DSB);
|
||||
|
||||
agc.init(&demod.out, 1.0f / 125.0f);
|
||||
|
||||
@ -52,6 +54,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
agc.start();
|
||||
resamp.start();
|
||||
@ -60,6 +63,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
resamp.stop();
|
||||
@ -79,7 +83,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -131,6 +135,16 @@ public:
|
||||
_config->conf[uiPrefix]["DSB"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_dsb_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["DSB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -153,8 +167,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 6000;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("FM")) {
|
||||
_config->conf[prefix]["FM"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["FM"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["FM"].contains("bandwidth")) { _config->conf[prefix]["FM"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["FM"].contains("snapInterval")) { _config->conf[prefix]["FM"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["FM"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -37,8 +37,10 @@ public:
|
||||
_config->conf[prefix]["FM"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output, bbSampRate, bandWidth / 2.0f);
|
||||
demod.init(&squelch.out, bbSampRate, bandWidth / 2.0f);
|
||||
|
||||
float audioBW = std::min<float>(audioSampleRate / 2.0f, bw / 2.0f);
|
||||
win.init(audioBW, audioBW, bbSampRate);
|
||||
@ -50,6 +52,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
resamp.start();
|
||||
m2s.start();
|
||||
@ -57,6 +60,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
resamp.stop();
|
||||
m2s.stop();
|
||||
@ -75,7 +79,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -127,6 +131,16 @@ public:
|
||||
_config->conf[uiPrefix]["FM"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_fm_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["FM"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -150,8 +164,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 12500;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::FMDemod demod;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
dsp::PolyphaseResampler<float> resamp;
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("LSB")) {
|
||||
_config->conf[prefix]["LSB"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["LSB"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["LSB"].contains("bandwidth")) { _config->conf[prefix]["LSB"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["LSB"].contains("snapInterval")) { _config->conf[prefix]["LSB"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["LSB"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -37,8 +37,10 @@ public:
|
||||
_config->conf[prefix]["LSB"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output, bbSampRate, bandWidth, dsp::SSBDemod::MODE_LSB);
|
||||
demod.init(&squelch.out, bbSampRate, bandWidth, dsp::SSBDemod::MODE_LSB);
|
||||
|
||||
agc.init(&demod.out, 1.0f / 125.0f);
|
||||
|
||||
@ -52,6 +54,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
agc.start();
|
||||
resamp.start();
|
||||
@ -60,6 +63,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
resamp.stop();
|
||||
@ -79,7 +83,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -131,6 +135,16 @@ public:
|
||||
_config->conf[uiPrefix]["LSB"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_lsb_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["LSB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -153,8 +167,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 3000;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("RAW")) {
|
||||
_config->conf[prefix]["RAW"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["RAW"].contains("snapInterval")) { _config->conf[prefix]["RAW"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["RAW"];
|
||||
snapInterval = conf["snapInterval"];
|
||||
@ -34,16 +34,20 @@ public:
|
||||
_config->conf[prefix]["RAW"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
c2s.init(_vfo->output);
|
||||
c2s.init(&squelch.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
c2s.start();
|
||||
running = true;
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
c2s.stop();
|
||||
running = false;
|
||||
}
|
||||
@ -60,7 +64,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
c2s.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -95,6 +99,16 @@ public:
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_raw_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["RAW"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
// TODO: Allow selection of the bandwidth
|
||||
}
|
||||
|
||||
@ -109,8 +123,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 12500;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::ComplexToStereo c2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("USB")) {
|
||||
_config->conf[prefix]["USB"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["USB"]["snapInterval"] = snapInterval;
|
||||
if (!_config->conf[prefix]["USB"].contains("bandwidth")) { _config->conf[prefix]["USB"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["USB"].contains("snapInterval")) { _config->conf[prefix]["USB"]["snapInterval"] = snapInterval; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["USB"];
|
||||
bw = conf["bandwidth"];
|
||||
@ -37,8 +37,10 @@ public:
|
||||
_config->conf[prefix]["USB"]["snapInterval"] = snapInterval;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output, bbSampRate, bandWidth, dsp::SSBDemod::MODE_USB);
|
||||
demod.init(&squelch.out, bbSampRate, bandWidth, dsp::SSBDemod::MODE_USB);
|
||||
|
||||
agc.init(&demod.out, 1.0f / 125.0f);
|
||||
|
||||
@ -52,6 +54,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
agc.start();
|
||||
resamp.start();
|
||||
@ -60,6 +63,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
resamp.stop();
|
||||
@ -79,7 +83,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -131,6 +135,16 @@ public:
|
||||
_config->conf[uiPrefix]["USB"]["snapInterval"] = snapInterval;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_usb_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["USB"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -153,8 +167,10 @@ private:
|
||||
float audioSampRate = 48000;
|
||||
float bw = 3000;
|
||||
bool running = false;
|
||||
float squelchLevel = -100.0f;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
|
@ -25,24 +25,28 @@ public:
|
||||
_config->aquire();
|
||||
if(_config->conf.contains(prefix)) {
|
||||
if(!_config->conf[prefix].contains("WFM")) {
|
||||
_config->conf[prefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[prefix]["WFM"]["deempMode"] = deempId;
|
||||
if (!_config->conf[prefix]["WFM"].contains("bandwidth")) { _config->conf[prefix]["WFM"]["bandwidth"] = bw; }
|
||||
if (!_config->conf[prefix]["WFM"].contains("snapInterval")) { _config->conf[prefix]["WFM"]["snapInterval"] = snapInterval; }
|
||||
if (!_config->conf[prefix]["WFM"].contains("deempMode")) { _config->conf[prefix]["WFM"]["deempMode"] = deempId; }
|
||||
if (!_config->conf[prefix]["WFM"].contains("squelchLevel")) { _config->conf[prefix]["WFM"]["squelchLevel"] = squelchLevel; }
|
||||
}
|
||||
json conf = _config->conf[prefix]["WFM"];
|
||||
bw = conf["bandwidth"];
|
||||
snapInterval = conf["snapInterval"];
|
||||
deempId = conf["deempMode"];
|
||||
squelchLevel = conf["squelchLevel"];
|
||||
}
|
||||
else {
|
||||
_config->conf[prefix]["WFM"]["bandwidth"] = bw;
|
||||
_config->conf[prefix]["WFM"]["snapInterval"] = snapInterval;
|
||||
_config->conf[prefix]["WFM"]["deempMode"] = deempId;
|
||||
_config->conf[prefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
}
|
||||
_config->release(true);
|
||||
|
||||
squelch.init(_vfo->output, squelchLevel);
|
||||
|
||||
demod.init(_vfo->output, bbSampRate, bandWidth / 2.0f);
|
||||
demod.init(&squelch.out, bbSampRate, bandWidth / 2.0f);
|
||||
|
||||
float audioBW = std::min<float>(audioSampleRate / 2.0f, 16000.0f);
|
||||
win.init(audioBW, audioBW, bbSampRate);
|
||||
@ -56,6 +60,7 @@ public:
|
||||
}
|
||||
|
||||
void start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
resamp.start();
|
||||
deemp.start();
|
||||
@ -64,6 +69,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
squelch.stop();
|
||||
demod.stop();
|
||||
resamp.stop();
|
||||
deemp.stop();
|
||||
@ -83,7 +89,7 @@ public:
|
||||
|
||||
void setVFO(VFOManager::VFO* vfo) {
|
||||
_vfo = vfo;
|
||||
demod.setInput(_vfo->output);
|
||||
squelch.setInput(_vfo->output);
|
||||
}
|
||||
|
||||
VFOManager::VFO* getVFO() {
|
||||
@ -149,6 +155,16 @@ public:
|
||||
_config->conf[uiPrefix]["WFM"]["deempMode"] = deempId;
|
||||
_config->release(true);
|
||||
}
|
||||
|
||||
ImGui::Text("Squelch");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_wfm_deemp_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
|
||||
squelch.setLevel(squelchLevel);
|
||||
_config->aquire();
|
||||
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -181,12 +197,14 @@ private:
|
||||
std::string uiPrefix;
|
||||
float snapInterval = 100000;
|
||||
float audioSampRate = 48000;
|
||||
float squelchLevel = -100.0f;
|
||||
float bw = 200000;
|
||||
int deempId = 0;
|
||||
float tau = 50e-6;
|
||||
bool running = false;
|
||||
|
||||
VFOManager::VFO* _vfo;
|
||||
dsp::Squelch squelch;
|
||||
dsp::FMDemod demod;
|
||||
dsp::filter_window::BlackmanWindow win;
|
||||
dsp::PolyphaseResampler<float> resamp;
|
||||
|
Reference in New Issue
Block a user