mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
FreeDV demod: implemented modem input volume control. FreeDV mod: set volume polling to 10ms
This commit is contained in:
parent
2c8cce0940
commit
554db8fe82
@ -306,11 +306,16 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
if (m_agcActive)
|
||||
{
|
||||
m_simpleAGC.feed(demod);
|
||||
demod *= 3276.8f / m_simpleAGC.getValue(); // provision for peak to average ratio (here 10)
|
||||
demod *= (m_settings.m_volumeIn * 3276.8f) / m_simpleAGC.getValue(); // provision for peak to average ratio (here 10) compensated by m_volumeIn
|
||||
// if (i == 0) {
|
||||
// qDebug("FreeDVDemod::feed: m_simpleAGC: %f", m_simpleAGC.getValue());
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
demod *= m_settings.m_volumeIn;
|
||||
}
|
||||
|
||||
|
||||
pushSampleToDV((qint16) demod);
|
||||
}
|
||||
@ -650,6 +655,7 @@ void FreeDVDemod::applySettings(const FreeDVDemodSettings& settings, bool force)
|
||||
qDebug() << "FreeDVDemod::applySettings:"
|
||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||
<< " m_volume: " << settings.m_volume
|
||||
<< " m_volumeIn: " << settings.m_volumeIn
|
||||
<< " m_spanLog2: " << settings.m_spanLog2
|
||||
<< " m_audioMute: " << settings.m_audioMute
|
||||
<< " m_agcActive: " << settings.m_agc
|
||||
@ -669,6 +675,11 @@ void FreeDVDemod::applySettings(const FreeDVDemodSettings& settings, bool force)
|
||||
m_volume /= 4.0; // for 3276.8
|
||||
}
|
||||
|
||||
if ((m_settings.m_volumeIn != settings.m_volumeIn) || force)
|
||||
{
|
||||
reverseAPIKeys.append("volumeIn");
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
{
|
||||
reverseAPIKeys.append("audioDeviceName");
|
||||
@ -781,6 +792,9 @@ int FreeDVDemod::webapiSettingsPutPatch(
|
||||
if (channelSettingsKeys.contains("volume")) {
|
||||
settings.m_volume = response.getFreeDvDemodSettings()->getVolume();
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeIn")) {
|
||||
settings.m_volumeIn = response.getFreeDvDemodSettings()->getVolumeIn();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spanLog2")) {
|
||||
settings.m_spanLog2 = response.getFreeDvDemodSettings()->getSpanLog2();
|
||||
}
|
||||
@ -838,6 +852,7 @@ void FreeDVDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r
|
||||
response.getFreeDvDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
|
||||
response.getFreeDvDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getFreeDvDemodSettings()->setVolume(settings.m_volume);
|
||||
response.getFreeDvDemodSettings()->setVolumeIn(settings.m_volumeIn);
|
||||
response.getFreeDvDemodSettings()->setSpanLog2(settings.m_spanLog2);
|
||||
response.getFreeDvDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
|
||||
response.getFreeDvDemodSettings()->setAgc(settings.m_agc ? 1 : 0);
|
||||
@ -884,6 +899,9 @@ void FreeDVDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys,
|
||||
if (channelSettingsKeys.contains("volume") || force) {
|
||||
swgFreeDVDemodSettings->setVolume(settings.m_volume);
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeIn") || force) {
|
||||
swgFreeDVDemodSettings->setVolumeIn(settings.m_volumeIn);
|
||||
}
|
||||
if (channelSettingsKeys.contains("spanLog2") || force) {
|
||||
swgFreeDVDemodSettings->setSpanLog2(settings.m_spanLog2);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="voluneInLabel">
|
||||
<property name="text">
|
||||
<string>Input</string>
|
||||
<string>In</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -300,6 +300,15 @@
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Modem input volume adjustment</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -310,6 +319,9 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Modem input volume</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2.0</string>
|
||||
</property>
|
||||
@ -361,6 +373,9 @@
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@ -404,64 +419,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="statsLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="snrLabel">
|
||||
<property name="text">
|
||||
<string>SNR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LevelMeterSignalDB" name="snrMeter" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>SNR estimation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="snrText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>52</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>SNR estimation</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-10.0 dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="berLabel">
|
||||
<property name="text">
|
||||
@ -513,6 +470,64 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="snrLabel">
|
||||
<property name="text">
|
||||
<string>SNR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LevelMeterSignalDB" name="snrMeter" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>SNR estimation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="snrText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>52</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>SNR estimation</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-10.0 dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
|
@ -41,7 +41,7 @@ void FreeDVDemodSettings::resetToDefaults()
|
||||
m_audioMute = false;
|
||||
m_agc = true;
|
||||
m_volume = 3.0;
|
||||
m_volumeIn = 3.0;
|
||||
m_volumeIn = 1.0;
|
||||
m_spanLog2 = 3;
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_rgbColor = QColor(0, 255, 204).rgb();
|
||||
@ -109,7 +109,7 @@ bool FreeDVDemodSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
|
||||
d.readU32(5, &m_rgbColor);
|
||||
d.readS32(6, &tmp, 30);
|
||||
d.readS32(6, &tmp, 10);
|
||||
m_volumeIn = tmp / 10.0;
|
||||
d.readS32(7, &m_spanLog2, 3);
|
||||
d.readBool(11, &m_agc, false);
|
||||
|
@ -50,7 +50,7 @@ MESSAGE_CLASS_DEFINITION(FreeDVMod::MsgReportFileSourceStreamTiming, Message)
|
||||
|
||||
const QString FreeDVMod::m_channelIdURI = "sdrangel.channeltx.freedvmod";
|
||||
const QString FreeDVMod::m_channelId = "FreeDVMod";
|
||||
const int FreeDVMod::m_levelNbSamples = 480; // every 10ms
|
||||
const int FreeDVMod::m_levelNbSamples = 80; // every 10ms
|
||||
const int FreeDVMod::m_ssbFftLen = 1024;
|
||||
|
||||
FreeDVMod::FreeDVMod(DeviceSinkAPI *deviceAPI) :
|
||||
|
@ -2580,7 +2580,13 @@ margin-bottom: 20px;
|
||||
},
|
||||
"volume" : {
|
||||
"type" : "number",
|
||||
"format" : "float"
|
||||
"format" : "float",
|
||||
"description" : "Audio volume"
|
||||
},
|
||||
"volumeIn" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "Modem input volume"
|
||||
},
|
||||
"spanLog2" : {
|
||||
"type" : "integer"
|
||||
@ -24528,7 +24534,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-02-28T13:56:13.268+01:00
|
||||
Generated 2019-02-28T17:16:26.748+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,6 +5,11 @@ FreeDVDemodSettings:
|
||||
type: integer
|
||||
format: int64
|
||||
volume:
|
||||
description: Audio volume
|
||||
type: number
|
||||
format: float
|
||||
volumeIn:
|
||||
description: Modem input volume
|
||||
type: number
|
||||
format: float
|
||||
spanLog2:
|
||||
|
@ -5,6 +5,11 @@ FreeDVDemodSettings:
|
||||
type: integer
|
||||
format: int64
|
||||
volume:
|
||||
description: Audio volume
|
||||
type: number
|
||||
format: float
|
||||
volumeIn:
|
||||
description: Modem input volume
|
||||
type: number
|
||||
format: float
|
||||
spanLog2:
|
||||
|
@ -2580,7 +2580,13 @@ margin-bottom: 20px;
|
||||
},
|
||||
"volume" : {
|
||||
"type" : "number",
|
||||
"format" : "float"
|
||||
"format" : "float",
|
||||
"description" : "Audio volume"
|
||||
},
|
||||
"volumeIn" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "Modem input volume"
|
||||
},
|
||||
"spanLog2" : {
|
||||
"type" : "integer"
|
||||
@ -24528,7 +24534,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-02-28T13:56:13.268+01:00
|
||||
Generated 2019-02-28T17:16:26.748+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,6 +32,8 @@ SWGFreeDVDemodSettings::SWGFreeDVDemodSettings() {
|
||||
m_input_frequency_offset_isSet = false;
|
||||
volume = 0.0f;
|
||||
m_volume_isSet = false;
|
||||
volume_in = 0.0f;
|
||||
m_volume_in_isSet = false;
|
||||
span_log2 = 0;
|
||||
m_span_log2_isSet = false;
|
||||
audio_mute = 0;
|
||||
@ -58,6 +60,8 @@ SWGFreeDVDemodSettings::init() {
|
||||
m_input_frequency_offset_isSet = false;
|
||||
volume = 0.0f;
|
||||
m_volume_isSet = false;
|
||||
volume_in = 0.0f;
|
||||
m_volume_in_isSet = false;
|
||||
span_log2 = 0;
|
||||
m_span_log2_isSet = false;
|
||||
audio_mute = 0;
|
||||
@ -82,6 +86,7 @@ SWGFreeDVDemodSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
if(title != nullptr) {
|
||||
delete title;
|
||||
}
|
||||
@ -106,6 +111,8 @@ SWGFreeDVDemodSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&volume_in, pJson["volumeIn"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
|
||||
@ -142,6 +149,9 @@ SWGFreeDVDemodSettings::asJsonObject() {
|
||||
if(m_volume_isSet){
|
||||
obj->insert("volume", QJsonValue(volume));
|
||||
}
|
||||
if(m_volume_in_isSet){
|
||||
obj->insert("volumeIn", QJsonValue(volume_in));
|
||||
}
|
||||
if(m_span_log2_isSet){
|
||||
obj->insert("spanLog2", QJsonValue(span_log2));
|
||||
}
|
||||
@ -187,6 +197,16 @@ SWGFreeDVDemodSettings::setVolume(float volume) {
|
||||
this->m_volume_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGFreeDVDemodSettings::getVolumeIn() {
|
||||
return volume_in;
|
||||
}
|
||||
void
|
||||
SWGFreeDVDemodSettings::setVolumeIn(float volume_in) {
|
||||
this->volume_in = volume_in;
|
||||
this->m_volume_in_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGFreeDVDemodSettings::getSpanLog2() {
|
||||
return span_log2;
|
||||
@ -264,6 +284,7 @@ SWGFreeDVDemodSettings::isSet(){
|
||||
do{
|
||||
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_volume_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_volume_in_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_span_log2_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_agc_isSet){ isObjectUpdated = true; break;}
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
float getVolume();
|
||||
void setVolume(float volume);
|
||||
|
||||
float getVolumeIn();
|
||||
void setVolumeIn(float volume_in);
|
||||
|
||||
qint32 getSpanLog2();
|
||||
void setSpanLog2(qint32 span_log2);
|
||||
|
||||
@ -79,6 +82,9 @@ private:
|
||||
float volume;
|
||||
bool m_volume_isSet;
|
||||
|
||||
float volume_in;
|
||||
bool m_volume_in_isSet;
|
||||
|
||||
qint32 span_log2;
|
||||
bool m_span_log2_isSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user