diff --git a/doc/img/SSBModulator_plugin.png b/doc/img/SSBModulator_plugin.png index 38933d4b1..ccfd65932 100644 Binary files a/doc/img/SSBModulator_plugin.png and b/doc/img/SSBModulator_plugin.png differ diff --git a/doc/img/SSBModulator_plugin.xcf b/doc/img/SSBModulator_plugin.xcf index e77f4519c..89257eec6 100644 Binary files a/doc/img/SSBModulator_plugin.xcf and b/doc/img/SSBModulator_plugin.xcf differ diff --git a/doc/img/SSBModulator_plugin_cmp.png b/doc/img/SSBModulator_plugin_cmp.png index 1ecf6a486..f08ab70d8 100644 Binary files a/doc/img/SSBModulator_plugin_cmp.png and b/doc/img/SSBModulator_plugin_cmp.png differ diff --git a/doc/img/SSBModulator_plugin_cmp.xcf b/doc/img/SSBModulator_plugin_cmp.xcf index aa95a0813..333e6aad4 100644 Binary files a/doc/img/SSBModulator_plugin_cmp.xcf and b/doc/img/SSBModulator_plugin_cmp.xcf differ diff --git a/plugins/channeltx/modssb/readme.md b/plugins/channeltx/modssb/readme.md index c158f5988..11a7c70ca 100644 --- a/plugins/channeltx/modssb/readme.md +++ b/plugins/channeltx/modssb/readme.md @@ -113,26 +113,44 @@ Use this button to toggle audio compression on or off.

13: Input source control

-![Modulator input source control GUI](../../../doc/img/ModControls.png) +![Modulator input source control GUI](../../../doc/img/SSBModulator_plugin_cmp.png) -

13.1: Tone input select

+

13.1: Audio compressor

+ +Activate/deactivate it for file and audio input only. + +

13.2: Audio compressor input gain

+ +Gain in dB before compression + +

13.3: Audio compressor threshold

+ +Threshold in dB above which compression applies a.k.a. "knee" point. The lower the value the harder is the compression and consequently higher the distorsion. + +

13.4: Tone input select

Switches to the tone input. You must switch it off to make other inputs available. -

13.2: Morse keyer input select

+

13.5: Morse keyer input select

Switches to the Morse keyer input. You must switch it off to make other inputs available. -

13.3: Tone frequency (kHz)

+

13.6: Tone frequency (kHz)

Adjusts the tone frequency from 0.1 to 2.5 kHz in 0.01 kHz steps -

13.4: Audio input select and select audio input device

+

13.7: Audio input select and select audio input device

Left click to switch to the audio input. You must switch it off to make other inputs available. Right click to select audio input device. See [audio management documentation](../../../sdrgui/audio.md) for details. +

13.8: Audio feedback

+ +Left click to activate audio feedback. + +Right click to select audio output device for audio feedback. See [audio management documentation](../../../sdrgui/audio.md) for details. +

14: CW (Morse) text

Enter the text to be keyed when Morse input is active and in text mode diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 0ac6b8f3f..dfba4b8d9 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -262,6 +262,12 @@ void SSBMod::applySettings(const SSBModSettings& settings, bool force) if ((settings.m_agc != m_settings.m_agc) || force) { reverseAPIKeys.append("agc"); } + if ((settings.m_cmpPreGainDB != m_settings.m_cmpPreGainDB) || force) { + reverseAPIKeys.append("cmpPreGainDB"); + } + if ((settings.m_cmpThresholdDB != m_settings.m_cmpThresholdDB) || force) { + reverseAPIKeys.append("cmpThresholdDB"); + } if ((settings.m_rgbColor != m_settings.m_rgbColor) || force) { reverseAPIKeys.append("rgbColor"); } @@ -449,6 +455,12 @@ void SSBMod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("agc")) { settings.m_agc = response.getSsbModSettings()->getAgc() != 0; } + if (channelSettingsKeys.contains("cmpPreGainDB")) { + settings.m_cmpPreGainDB = response.getSsbModSettings()->getCmpPreGainDb(); + } + if (channelSettingsKeys.contains("cmpThresholdDB")) { + settings.m_cmpThresholdDB = response.getSsbModSettings()->getCmpThresholdDb(); + } if (channelSettingsKeys.contains("rgbColor")) { settings.m_rgbColor = response.getSsbModSettings()->getRgbColor(); } @@ -507,6 +519,8 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon response.getSsbModSettings()->setAudioMute(settings.m_audioMute ? 1 : 0); response.getSsbModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0); response.getSsbModSettings()->setAgc(settings.m_agc ? 1 : 0); + response.getSsbModSettings()->setCmpPreGainDb(settings.m_cmpPreGainDB); + response.getSsbModSettings()->setCmpThresholdDb(settings.m_cmpThresholdDB); response.getSsbModSettings()->setRgbColor(settings.m_rgbColor); if (response.getSsbModSettings()->getTitle()) { @@ -687,6 +701,12 @@ void SSBMod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("agc") || force) { swgSSBModSettings->setAgc(settings.m_agc ? 1 : 0); } + if (channelSettingsKeys.contains("cmpPreGainDB") || force) { + swgSSBModSettings->setCmpPreGainDb(settings.m_cmpPreGainDB); + } + if (channelSettingsKeys.contains("cmpThresholdDB") || force) { + swgSSBModSettings->setCmpThresholdDb(settings.m_cmpThresholdDB); + } if (channelSettingsKeys.contains("rgbColor") || force) { swgSSBModSettings->setRgbColor(settings.m_rgbColor); } diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index 0990b8654..7afae21b8 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -292,6 +292,20 @@ void SSBModGUI::on_agc_toggled(bool checked) applySettings(); } +void SSBModGUI::on_cmpPreGain_valueChanged(int value) +{ + m_settings.m_cmpPreGainDB = value; + ui->cmpPreGainText->setText(QString("%1").arg(value)); + applySettings(); +} + +void SSBModGUI::on_cmpThreshold_valueChanged(int value) +{ + m_settings.m_cmpThresholdDB = value; + ui->cmpThresholdText->setText(QString("%1").arg(value)); + applySettings(); +} + void SSBModGUI::on_navTimeSlider_valueChanged(int value) { if (m_enableNavTime && ((value >= 0) && (value <= 100))) @@ -633,6 +647,8 @@ void SSBModGUI::displaySettings() blockApplySettings(true); ui->agc->setChecked(m_settings.m_agc); + ui->cmpPreGainText->setText(QString("%1").arg(m_settings.m_cmpPreGainDB)); + ui->cmpThresholdText->setText(QString("%1").arg(m_settings.m_cmpThresholdDB)); ui->audioBinaural->setChecked(m_settings.m_audioBinaural); ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels); ui->audioMute->setChecked(m_settings.m_audioMute); diff --git a/plugins/channeltx/modssb/ssbmodgui.h b/plugins/channeltx/modssb/ssbmodgui.h index 39a4f62cc..acdb36e90 100644 --- a/plugins/channeltx/modssb/ssbmodgui.h +++ b/plugins/channeltx/modssb/ssbmodgui.h @@ -110,6 +110,8 @@ private slots: void on_toneFrequency_valueChanged(int value); void on_mic_toggled(bool checked); void on_agc_toggled(bool checked); + void on_cmpPreGain_valueChanged(int value); + void on_cmpThreshold_valueChanged(int value); void on_play_toggled(bool checked); void on_playLoop_toggled(bool checked); void on_morseKeyer_toggled(bool checked); diff --git a/plugins/channeltx/modssb/ssbmodgui.ui b/plugins/channeltx/modssb/ssbmodgui.ui index a533b312c..72b85e22d 100644 --- a/plugins/channeltx/modssb/ssbmodgui.ui +++ b/plugins/channeltx/modssb/ssbmodgui.ui @@ -6,7 +6,7 @@ 0 0 - 390 + 430 643 @@ -18,7 +18,7 @@ - 390 + 430 0 @@ -36,7 +36,7 @@ 0 0 - 385 + 430 331 @@ -739,6 +739,121 @@ + + + + G + + + + + + + + 24 + 24 + + + + Compressor input gain (dB) + + + -20 + + + 20 + + + 1 + + + 0 + + + + + + + + 25 + 0 + + + + Audio input gain value + + + + + + -10 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + + + + + T + + + + + + + + 24 + 24 + + + + Compressor threshold (dB) + + + -80 + + + -20 + + + 1 + + + -60 + + + + + + + + 25 + 0 + + + + Audio input gain value + + + + + + -60 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -1092,7 +1207,7 @@ 0 340 - 351 + 430 284 diff --git a/plugins/channeltx/modssb/ssbmodsettings.cpp b/plugins/channeltx/modssb/ssbmodsettings.cpp index 2da2c2020..ab80fd6db 100644 --- a/plugins/channeltx/modssb/ssbmodsettings.cpp +++ b/plugins/channeltx/modssb/ssbmodsettings.cpp @@ -59,6 +59,8 @@ void SSBModSettings::resetToDefaults() m_audioMute = false; m_playLoop = false; m_agc = false; + m_cmpPreGainDB = -10; + m_cmpThresholdDB = -60; m_rgbColor = QColor(0, 255, 0).rgb(); m_title = "SSB Modulator"; m_modAFInput = SSBModInputAF::SSBModInputNone; @@ -100,6 +102,8 @@ QByteArray SSBModSettings::serialize() const s.writeBool(10, m_audioFlipChannels); s.writeBool(11, m_dsb); s.writeBool(12, m_agc); + s.writeS32(13, m_cmpPreGainDB); + s.writeS32(14, m_cmpThresholdDB); if (m_channelMarker) { s.writeBlob(18, m_channelMarker->serialize()); @@ -169,7 +173,8 @@ bool SSBModSettings::deserialize(const QByteArray& data) d.readBool(10, &m_audioFlipChannels, false); d.readBool(11, &m_dsb, false); d.readBool(12, &m_agc, false); - d.readS32(13, &tmp, 7); + d.readS32(13, &m_cmpPreGainDB, -10); + d.readS32(14, &m_cmpThresholdDB, -60); if (m_channelMarker) { d.readBlob(18, &bytetmp); diff --git a/plugins/channeltx/modssb/ssbmodsettings.h b/plugins/channeltx/modssb/ssbmodsettings.h index 088cbbd2a..9a802a833 100644 --- a/plugins/channeltx/modssb/ssbmodsettings.h +++ b/plugins/channeltx/modssb/ssbmodsettings.h @@ -53,6 +53,8 @@ struct SSBModSettings bool m_audioMute; bool m_playLoop; bool m_agc; + int m_cmpPreGainDB; + int m_cmpThresholdDB; quint32 m_rgbColor; QString m_title; diff --git a/plugins/channeltx/modssb/ssbmodsource.cpp b/plugins/channeltx/modssb/ssbmodsource.cpp index 737639917..219de61c5 100644 --- a/plugins/channeltx/modssb/ssbmodsource.cpp +++ b/plugins/channeltx/modssb/ssbmodsource.cpp @@ -64,8 +64,8 @@ SSBModSource::SSBModSource() : m_audioCompressor.initSimple( m_audioSampleRate, - -10, // pregain (dB) -3 - -60, // threshold (dB) -50 + m_settings.m_cmpPreGainDB, // pregain (dB) + m_settings.m_cmpThresholdDB, // threshold (dB) 20, // knee (dB) 12, // ratio (dB) 0.003, // attack (s) @@ -648,6 +648,20 @@ void SSBModSource::applySettings(const SSBModSettings& settings, bool force) } } + if ((settings.m_cmpThresholdDB != m_settings.m_cmpThresholdDB) || + (settings.m_cmpPreGainDB != m_settings.m_cmpPreGainDB) || force) + { + m_audioCompressor.initSimple( + m_audioSampleRate, + settings.m_cmpPreGainDB, // pregain (dB) + settings.m_cmpThresholdDB, // threshold (dB) + 20, // knee (dB) + 12, // ratio (dB) + 0.003, // attack (s) + 0.25 // release (s) + ); + } + m_settings = settings; m_settings.m_bandwidth = band; m_settings.m_lowCutoff = lowCutoff; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index b35e94c0f..caa03fdce 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -7968,6 +7968,12 @@ margin-bottom: 20px; "agc" : { "type" : "integer" }, + "cmpPreGainDB" : { + "type" : "integer" + }, + "cmpThresholdDB" : { + "type" : "integer" + }, "rgbColor" : { "type" : "integer" }, @@ -44706,7 +44712,7 @@ except ApiException as e:
- Generated 2020-11-24T20:20:00.458+01:00 + Generated 2020-11-25T13:34:12.214+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml b/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml index 49de3f04a..103cd9bee 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml @@ -32,6 +32,10 @@ SSBModSettings: type: integer agc: type: integer + cmpPreGainDB: + type: integer + cmpThresholdDB: + type: integer rgbColor: type: integer title: diff --git a/swagger/sdrangel/api/swagger/include/SSBMod.yaml b/swagger/sdrangel/api/swagger/include/SSBMod.yaml index 5885edc6f..bb07fc91b 100644 --- a/swagger/sdrangel/api/swagger/include/SSBMod.yaml +++ b/swagger/sdrangel/api/swagger/include/SSBMod.yaml @@ -32,6 +32,10 @@ SSBModSettings: type: integer agc: type: integer + cmpPreGainDB: + type: integer + cmpThresholdDB: + type: integer rgbColor: type: integer title: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index b35e94c0f..caa03fdce 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -7968,6 +7968,12 @@ margin-bottom: 20px; "agc" : { "type" : "integer" }, + "cmpPreGainDB" : { + "type" : "integer" + }, + "cmpThresholdDB" : { + "type" : "integer" + }, "rgbColor" : { "type" : "integer" }, @@ -44706,7 +44712,7 @@ except ApiException as e:
- Generated 2020-11-24T20:20:00.458+01:00 + Generated 2020-11-25T13:34:12.214+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp index 90f7d55e9..b1a91c482 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp @@ -54,6 +54,10 @@ SWGSSBModSettings::SWGSSBModSettings() { m_play_loop_isSet = false; agc = 0; m_agc_isSet = false; + cmp_pre_gain_db = 0; + m_cmp_pre_gain_db_isSet = false; + cmp_threshold_db = 0; + m_cmp_threshold_db_isSet = false; rgb_color = 0; m_rgb_color_isSet = false; title = nullptr; @@ -110,6 +114,10 @@ SWGSSBModSettings::init() { m_play_loop_isSet = false; agc = 0; m_agc_isSet = false; + cmp_pre_gain_db = 0; + m_cmp_pre_gain_db_isSet = false; + cmp_threshold_db = 0; + m_cmp_threshold_db_isSet = false; rgb_color = 0; m_rgb_color_isSet = false; title = new QString(""); @@ -150,6 +158,8 @@ SWGSSBModSettings::cleanup() { + + if(title != nullptr) { delete title; } @@ -207,6 +217,10 @@ SWGSSBModSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", ""); + ::SWGSDRangel::setValue(&cmp_pre_gain_db, pJson["cmpPreGainDB"], "qint32", ""); + + ::SWGSDRangel::setValue(&cmp_threshold_db, pJson["cmpThresholdDB"], "qint32", ""); + ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); @@ -284,6 +298,12 @@ SWGSSBModSettings::asJsonObject() { if(m_agc_isSet){ obj->insert("agc", QJsonValue(agc)); } + if(m_cmp_pre_gain_db_isSet){ + obj->insert("cmpPreGainDB", QJsonValue(cmp_pre_gain_db)); + } + if(m_cmp_threshold_db_isSet){ + obj->insert("cmpThresholdDB", QJsonValue(cmp_threshold_db)); + } if(m_rgb_color_isSet){ obj->insert("rgbColor", QJsonValue(rgb_color)); } @@ -451,6 +471,26 @@ SWGSSBModSettings::setAgc(qint32 agc) { this->m_agc_isSet = true; } +qint32 +SWGSSBModSettings::getCmpPreGainDb() { + return cmp_pre_gain_db; +} +void +SWGSSBModSettings::setCmpPreGainDb(qint32 cmp_pre_gain_db) { + this->cmp_pre_gain_db = cmp_pre_gain_db; + this->m_cmp_pre_gain_db_isSet = true; +} + +qint32 +SWGSSBModSettings::getCmpThresholdDb() { + return cmp_threshold_db; +} +void +SWGSSBModSettings::setCmpThresholdDb(qint32 cmp_threshold_db) { + this->cmp_threshold_db = cmp_threshold_db; + this->m_cmp_threshold_db_isSet = true; +} + qint32 SWGSSBModSettings::getRgbColor() { return rgb_color; @@ -605,6 +645,12 @@ SWGSSBModSettings::isSet(){ if(m_agc_isSet){ isObjectUpdated = true; break; } + if(m_cmp_pre_gain_db_isSet){ + isObjectUpdated = true; break; + } + if(m_cmp_threshold_db_isSet){ + isObjectUpdated = true; break; + } if(m_rgb_color_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h index b41d7d143..08d545a63 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h @@ -82,6 +82,12 @@ public: qint32 getAgc(); void setAgc(qint32 agc); + qint32 getCmpPreGainDb(); + void setCmpPreGainDb(qint32 cmp_pre_gain_db); + + qint32 getCmpThresholdDb(); + void setCmpThresholdDb(qint32 cmp_threshold_db); + qint32 getRgbColor(); void setRgbColor(qint32 rgb_color); @@ -158,6 +164,12 @@ private: qint32 agc; bool m_agc_isSet; + qint32 cmp_pre_gain_db; + bool m_cmp_pre_gain_db_isSet; + + qint32 cmp_threshold_db; + bool m_cmp_threshold_db_isSet; + qint32 rgb_color; bool m_rgb_color_isSet;