Merge pull request #300 from thasti/master

respect USB flag for SSBMod REST API calls
This commit is contained in:
f4exb 2019-02-26 00:41:54 +01:00 committed by GitHub
commit ac1a565471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 24 deletions

View File

@ -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;

View File

@ -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);
}
}