New features + waterfall code cleanup

This commit is contained in:
Ryzerth
2021-04-17 22:37:50 +02:00
parent d1e553f05a
commit d91934955b
18 changed files with 263 additions and 84 deletions

View File

@ -80,6 +80,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -126,6 +127,15 @@ public:
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
_config->release(true);
}
if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["AM"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
ImGui::SameLine();
@ -150,9 +160,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
win.setSampleRate(bbSampRate * resamp.getInterpolation());
win.setCutoff(audioBW);

View File

@ -87,6 +87,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -133,6 +134,14 @@ public:
_config->aquire();
_config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
_config->release(true);
}if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["CW"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
@ -158,9 +167,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
}
void setSnapInterval(float snapInt) {

View File

@ -80,6 +80,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -126,6 +127,15 @@ public:
_config->conf[uiPrefix]["DSB"]["bandwidth"] = bw;
_config->release(true);
}
if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["DSB"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
ImGui::SameLine();
@ -150,9 +160,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
}
void setSnapInterval(float snapInt) {

View File

@ -72,6 +72,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -118,6 +119,15 @@ public:
_config->conf[uiPrefix]["FM"]["bandwidth"] = bw;
_config->release(true);
}
if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["FM"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
ImGui::SameLine();
@ -142,9 +152,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
demod.setDeviation(bw / 2.0f);
setAudioSampleRate(audioSampRate);
}

View File

@ -80,6 +80,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_UPPER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -125,6 +126,14 @@ public:
_config->aquire();
_config->conf[uiPrefix]["LSB"]["bandwidth"] = bw;
_config->release(true);
}if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["LSB"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
@ -150,9 +159,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
demod.setBandWidth(bw);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
win.setSampleRate(bbSampRate * resamp.getInterpolation());

View File

@ -33,7 +33,7 @@ public:
RadioModule(std::string name) {
this->name = name;
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 200000, 200000, 1);
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 200000, 200000, 50000, 200000, false);
ns.init(vfo->output);
@ -70,7 +70,7 @@ public:
}
void enable() {
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 200000, 200000, 1);
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 200000, 200000, 50000, 200000, false);
wfmDemod.setVFO(vfo);
fmDemod.setVFO(vfo);

View File

@ -61,6 +61,7 @@ public:
_vfo->setSampleRate(audioSampRate, audioSampRate);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(0, 0, true);
}
void setVFO(VFOManager::VFO* vfo) {

View File

@ -80,6 +80,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_LOWER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -125,6 +126,14 @@ public:
_config->aquire();
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw;
_config->release(true);
}if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["USB"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
@ -150,9 +159,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
demod.setBandWidth(bw);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
win.setSampleRate(bbSampRate * resamp.getInterpolation());

View File

@ -85,6 +85,7 @@ public:
_vfo->setSampleRate(bbSampRate, bw);
_vfo->setSnapInterval(snapInterval);
_vfo->setReference(ImGui::WaterfallVFO::REF_CENTER);
_vfo->setBandwidthLimits(bwMin, bwMax, false);
}
void setVFO(VFOManager::VFO* vfo) {
@ -128,12 +129,22 @@ public:
ImGui::SetNextItemWidth(menuWidth);
if (ImGui::InputFloat(("##_radio_wfm_bw_" + uiPrefix).c_str(), &bw, 1, 100, "%.0f", 0)) {
spdlog::warn("TEST");
bw = std::clamp<float>(bw, bwMin, bwMax);
setBandwidth(bw);
_config->aquire();
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
_config->release(true);
}
if (running) {
if (_vfo->getBandwidthChanged()) {
bw = _vfo->getBandwidth();
setBandwidth(bw, false);
_config->aquire();
_config->conf[uiPrefix]["WFM"]["bandwidth"] = bw;
_config->release(true);
}
}
ImGui::Text("Snap Interval");
ImGui::SameLine();
@ -169,9 +180,9 @@ public:
}
private:
void setBandwidth(float bandWidth) {
void setBandwidth(float bandWidth, bool updateWaterfall = true) {
bw = bandWidth;
_vfo->setBandwidth(bw);
_vfo->setBandwidth(bw, updateWaterfall);
demod.setDeviation(bw / 2.0f);
}