From 13c8f2ea9e215f710047d4a39e4d2c848646954f Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 10 Oct 2017 07:14:52 +0200 Subject: [PATCH] PlutoSDR output: use settings in GUI --- plugins/channeltx/modam/ammodgui.cpp | 14 +++++++------- plugins/channeltx/modam/ammodsettings.cpp | 20 ++++++++------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/plugins/channeltx/modam/ammodgui.cpp b/plugins/channeltx/modam/ammodgui.cpp index 5f03a39e8..4dad78de2 100644 --- a/plugins/channeltx/modam/ammodgui.cpp +++ b/plugins/channeltx/modam/ammodgui.cpp @@ -374,10 +374,11 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pare ui->cwKeyerGUI->setBuddies(m_amMod->getInputMessageQueue(), m_amMod->getCWKeyer()); - applySettings(); - connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(m_amMod, SIGNAL(levelChanged(qreal, qreal, int)), ui->volumeMeter, SLOT(levelChanged(qreal, qreal, int))); + + displaySettings(); + applySettings(true); } AMModGUI::~AMModGUI() @@ -422,18 +423,17 @@ void AMModGUI::displaySettings() { blockApplySettings(true); - ui->rfBW->setValue(m_settings.m_rfBandwidth / 100.0); + ui->rfBW->setValue(roundf(m_settings.m_rfBandwidth / 100.0)); ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1)); - int modPercent = m_settings.m_modFactor * 100.0; + int modPercent = roundf(m_settings.m_modFactor * 100.0); ui->modPercent->setValue(modPercent); ui->modPercentText->setText(QString("%1").arg(modPercent)); - ui->toneFrequency->setValue(m_settings.m_toneFrequency / 10.0); + ui->toneFrequency->setValue(roundf(m_settings.m_toneFrequency / 10.0)); ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2)); - int volume = m_settings.m_volumeFactor * 10.0; - ui->volume->setValue(volume); + ui->volume->setValue(roundf(m_settings.m_volumeFactor * 10.0)); ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1)); ui->channelMute->setChecked(m_settings.m_channelMute); diff --git a/plugins/channeltx/modam/ammodsettings.cpp b/plugins/channeltx/modam/ammodsettings.cpp index eb52f1798..9cbd5707a 100644 --- a/plugins/channeltx/modam/ammodsettings.cpp +++ b/plugins/channeltx/modam/ammodsettings.cpp @@ -48,11 +48,11 @@ QByteArray AMModSettings::serialize() const SimpleSerializer s(1); s.writeS32(1, m_inputFrequencyOffset); - s.writeS32(2, m_rfBandwidth / 100.0); - s.writeS32(3, m_toneFrequency / 10.0); - s.writeS32(4, m_modFactor * 100.0); + s.writeReal(2, m_rfBandwidth); + s.writeReal(3, m_toneFrequency); + s.writeReal(4, m_modFactor); s.writeU32(5, m_rgbColor); - s.writeS32(6, m_volumeFactor * 10.0); + s.writeReal(6, m_volumeFactor); if (m_cwKeyerGUI) { s.writeBlob(7, m_cwKeyerGUI->serialize()); @@ -82,15 +82,11 @@ bool AMModSettings::deserialize(const QByteArray& data) d.readS32(1, &tmp, 0); m_inputFrequencyOffset = tmp; - d.readS32(2, &tmp, 125); - m_rfBandwidth = tmp * 100.0; - d.readS32(3, &tmp, 100); - m_toneFrequency = tmp * 10; - d.readS32(4, &tmp, 20); - m_modFactor = tmp / 100.0; + d.readReal(2, &m_rfBandwidth, 12500.0); + d.readReal(3, &m_toneFrequency, 1000.0); + d.readReal(4, &m_modFactor, 0.2f); d.readU32(5, &m_rgbColor); - d.readS32(6, &tmp, 10); - m_volumeFactor = tmp / 10.0; + d.readReal(6, &m_volumeFactor, 1.0); if (m_cwKeyerGUI) { d.readBlob(7, &bytetmp);