From 9a4f91210246d26ebc49ce638b9493daf989f274 Mon Sep 17 00:00:00 2001 From: Stefan Biereigel Date: Mon, 25 Feb 2019 18:39:25 +0100 Subject: [PATCH 1/2] respect usb flag for ssbmod REST API calls --- plugins/channeltx/modssb/ssbmod.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index d2ba1324b..aa68cd6c1 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -684,17 +684,6 @@ void SSBMod::applyAudioSampleRate(int sampleRate) float lowCutoff = m_settings.m_lowCutoff; bool usb = m_settings.m_usb; - if (band < 0) // negative means LSB - { - band = -band; // turn to positive - lowCutoff = -lowCutoff; - usb = false; // and take note of side band - } - else - { - usb = true; - } - if (band < 100.0f) // at least 100 Hz { band = 100.0f; @@ -838,17 +827,6 @@ void SSBMod::applySettings(const SSBModSettings& settings, bool force) if ((settings.m_bandwidth != m_settings.m_bandwidth) || (settings.m_lowCutoff != m_settings.m_lowCutoff) || force) { - if (band < 0) // negative means LSB - { - band = -band; // turn to positive - lowCutoff = -lowCutoff; - usb = false; // and take note of side band - } - else - { - usb = true; - } - if (band < 100.0f) // at least 100 Hz { band = 100.0f; From c7a5c06624f4bacc3d552b5ebba457e120e46e16 Mon Sep 17 00:00:00 2001 From: Stefan Biereigel Date: Mon, 25 Feb 2019 20:07:20 +0100 Subject: [PATCH 2/2] handle ssbmod/ssbmodgui USB/LSB convention inconsistency --- plugins/channeltx/modssb/ssbmodgui.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index b7d41b0c6..5c177fcfd 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -120,8 +120,14 @@ bool SSBModGUI::handleMessage(const Message& message) } else if (SSBMod::MsgConfigureSSBMod::match(message)) { + SSBModSettings mod_settings; // different USB/LSB convention between modulator and GUI const SSBMod::MsgConfigureSSBMod& cfg = (SSBMod::MsgConfigureSSBMod&) message; - m_settings = cfg.getSettings(); + mod_settings = cfg.getSettings(); + if (mod_settings.m_usb == false) { + mod_settings.m_bandwidth = -mod_settings.m_bandwidth; + mod_settings.m_lowCutoff = -mod_settings.m_lowCutoff; + } + m_settings = mod_settings; blockApplySettings(true); displaySettings(); blockApplySettings(false); @@ -497,7 +503,17 @@ void SSBModGUI::applySettings(bool force) 48000, m_settings.m_inputFrequencyOffset); m_ssbMod->getInputMessageQueue()->push(msgChan); - SSBMod::MsgConfigureSSBMod *msg = SSBMod::MsgConfigureSSBMod::create(m_settings, force); + SSBModSettings mod_settings; // different USB/LSB convention between modulator and GUI + mod_settings = m_settings; + if (mod_settings.m_bandwidth > 0) { + mod_settings.m_usb = true; + } else { + mod_settings.m_bandwidth = -mod_settings.m_bandwidth; + mod_settings.m_lowCutoff = -mod_settings.m_lowCutoff; + mod_settings.m_usb = false; + } + + SSBMod::MsgConfigureSSBMod *msg = SSBMod::MsgConfigureSSBMod::create(mod_settings, force); m_ssbMod->getInputMessageQueue()->push(msg); } }