mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-13 20:01:46 -05:00
NFM Modulator: corrected volume setting
This commit is contained in:
parent
328e0ad630
commit
ab60cac358
@ -75,11 +75,11 @@ void NFMMod::configure(MessageQueue* messageQueue,
|
|||||||
Real afBandwidth,
|
Real afBandwidth,
|
||||||
float fmDeviation,
|
float fmDeviation,
|
||||||
float toneFrequency,
|
float toneFrequency,
|
||||||
int volumeTenths,
|
float volumeFactor,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool playLoop)
|
bool playLoop)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureNFMMod::create(rfBandwidth, afBandwidth, fmDeviation, toneFrequency, volumeTenths, audioMute, playLoop);
|
Message* cmd = MsgConfigureNFMMod::create(rfBandwidth, afBandwidth, fmDeviation, toneFrequency, volumeFactor, audioMute, playLoop);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +163,7 @@ void NFMMod::pullAF(Real& sample)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ifstream.read(reinterpret_cast<char*>(&sample), sizeof(Real));
|
m_ifstream.read(reinterpret_cast<char*>(&sample), sizeof(Real));
|
||||||
|
sample *= m_running.m_volumeFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -172,7 +173,7 @@ void NFMMod::pullAF(Real& sample)
|
|||||||
break;
|
break;
|
||||||
case NFMModInputAudio:
|
case NFMModInputAudio:
|
||||||
m_audioFifo.read(reinterpret_cast<quint8*>(audioSample), 1, 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(audioSample), 1, 10);
|
||||||
sample = ((audioSample[0] + audioSample[1]) * m_running.m_volumeFactor) / 6553600.0f;
|
sample = ((audioSample[0] + audioSample[1]) / 131072.0f) * m_running.m_volumeFactor;
|
||||||
break;
|
break;
|
||||||
case NFMModInputNone:
|
case NFMModInputNone:
|
||||||
default:
|
default:
|
||||||
|
@ -180,7 +180,7 @@ public:
|
|||||||
Real afBandwidth,
|
Real afBandwidth,
|
||||||
float fmDeviation,
|
float fmDeviation,
|
||||||
float toneFrequency,
|
float toneFrequency,
|
||||||
int volumeFactor,
|
float volumeFactor,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool playLoop);
|
bool playLoop);
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ private:
|
|||||||
Real getAFBandwidth() const { return m_afBandwidth; }
|
Real getAFBandwidth() const { return m_afBandwidth; }
|
||||||
float getFMDeviation() const { return m_fmDeviation; }
|
float getFMDeviation() const { return m_fmDeviation; }
|
||||||
float getToneFrequency() const { return m_toneFrequency; }
|
float getToneFrequency() const { return m_toneFrequency; }
|
||||||
int getVolumeFactor() const { return m_volumeFactor; }
|
float getVolumeFactor() const { return m_volumeFactor; }
|
||||||
bool getAudioMute() const { return m_audioMute; }
|
bool getAudioMute() const { return m_audioMute; }
|
||||||
bool getPlayLoop() const { return m_playLoop; }
|
bool getPlayLoop() const { return m_playLoop; }
|
||||||
|
|
||||||
@ -215,11 +215,11 @@ private:
|
|||||||
Real m_afBandwidth;
|
Real m_afBandwidth;
|
||||||
float m_fmDeviation;
|
float m_fmDeviation;
|
||||||
float m_toneFrequency;
|
float m_toneFrequency;
|
||||||
int m_volumeFactor;
|
float m_volumeFactor;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
bool m_playLoop;
|
bool m_playLoop;
|
||||||
|
|
||||||
MsgConfigureNFMMod(Real rfBandwidth, Real afBandwidth, float fmDeviation, float toneFrequency, int volumeFactor, bool audioMute, bool playLoop) :
|
MsgConfigureNFMMod(Real rfBandwidth, Real afBandwidth, float fmDeviation, float toneFrequency, float volumeFactor, bool audioMute, bool playLoop) :
|
||||||
Message(),
|
Message(),
|
||||||
m_rfBandwidth(rfBandwidth),
|
m_rfBandwidth(rfBandwidth),
|
||||||
m_afBandwidth(afBandwidth),
|
m_afBandwidth(afBandwidth),
|
||||||
@ -251,7 +251,7 @@ private:
|
|||||||
Real m_afBandwidth;
|
Real m_afBandwidth;
|
||||||
float m_fmDeviation;
|
float m_fmDeviation;
|
||||||
float m_toneFrequency;
|
float m_toneFrequency;
|
||||||
int m_volumeFactor;
|
float m_volumeFactor;
|
||||||
quint32 m_audioSampleRate;
|
quint32 m_audioSampleRate;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
bool m_playLoop;
|
bool m_playLoop;
|
||||||
@ -263,7 +263,7 @@ private:
|
|||||||
m_afBandwidth(-1),
|
m_afBandwidth(-1),
|
||||||
m_fmDeviation(5000.0f),
|
m_fmDeviation(5000.0f),
|
||||||
m_toneFrequency(1000.0f),
|
m_toneFrequency(1000.0f),
|
||||||
m_volumeFactor(20),
|
m_volumeFactor(1.0f),
|
||||||
m_audioSampleRate(0),
|
m_audioSampleRate(0),
|
||||||
m_audioMute(false),
|
m_audioMute(false),
|
||||||
m_playLoop(false)
|
m_playLoop(false)
|
||||||
|
@ -78,7 +78,7 @@ void NFMModGUI::resetToDefaults()
|
|||||||
ui->afBW->setValue(3);
|
ui->afBW->setValue(3);
|
||||||
ui->fmDev->setValue(50);
|
ui->fmDev->setValue(50);
|
||||||
ui->toneFrequency->setValue(100);
|
ui->toneFrequency->setValue(100);
|
||||||
ui->micVolume->setValue(50);
|
ui->micVolume->setValue(10);
|
||||||
ui->deltaFrequency->setValue(0);
|
ui->deltaFrequency->setValue(0);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -94,6 +94,7 @@ QByteArray NFMModGUI::serialize() const
|
|||||||
s.writeS32(4, ui->fmDev->value());
|
s.writeS32(4, ui->fmDev->value());
|
||||||
s.writeU32(5, m_channelMarker.getColor().rgb());
|
s.writeU32(5, m_channelMarker.getColor().rgb());
|
||||||
s.writeS32(6, ui->toneFrequency->value());
|
s.writeS32(6, ui->toneFrequency->value());
|
||||||
|
s.writeS32(7, ui->micVolume->value());
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +133,8 @@ bool NFMModGUI::deserialize(const QByteArray& data)
|
|||||||
|
|
||||||
d.readS32(6, &tmp, 100);
|
d.readS32(6, &tmp, 100);
|
||||||
ui->toneFrequency->setValue(tmp);
|
ui->toneFrequency->setValue(tmp);
|
||||||
|
d.readS32(7, &tmp, 10);
|
||||||
|
ui->micVolume->setValue(tmp);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
@ -224,6 +227,12 @@ void NFMModGUI::on_fmDev_valueChanged(int value)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NFMModGUI::on_micVolume_valueChanged(int value)
|
||||||
|
{
|
||||||
|
ui->micVolumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
void NFMModGUI::on_toneFrequency_valueChanged(int value)
|
void NFMModGUI::on_toneFrequency_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
|
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
|
||||||
@ -413,7 +422,7 @@ void NFMModGUI::applySettings()
|
|||||||
ui->afBW->value() * 1000.0,
|
ui->afBW->value() * 1000.0,
|
||||||
ui->fmDev->value() * 100.0f, // value is in '100 Hz
|
ui->fmDev->value() * 100.0f, // value is in '100 Hz
|
||||||
ui->toneFrequency->value() * 10.0f,
|
ui->toneFrequency->value() * 10.0f,
|
||||||
ui->micVolume->value(),
|
ui->micVolume->value() / 10.0f,
|
||||||
ui->audioMute->isChecked(),
|
ui->audioMute->isChecked(),
|
||||||
ui->playLoop->isChecked());
|
ui->playLoop->isChecked());
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,9 @@ private slots:
|
|||||||
void on_deltaMinus_toggled(bool minus);
|
void on_deltaMinus_toggled(bool minus);
|
||||||
void on_rfBW_currentIndexChanged(int index);
|
void on_rfBW_currentIndexChanged(int index);
|
||||||
void on_afBW_valueChanged(int value);
|
void on_afBW_valueChanged(int value);
|
||||||
void on_modPercent_valueChanged(int value);
|
|
||||||
void on_fmDev_valueChanged(int value);
|
void on_fmDev_valueChanged(int value);
|
||||||
void on_toneFrequency_valueChanged(int value);
|
void on_toneFrequency_valueChanged(int value);
|
||||||
|
void on_micVolume_valueChanged(int value);
|
||||||
void on_audioMute_toggled(bool checked);
|
void on_audioMute_toggled(bool checked);
|
||||||
void on_tone_toggled(bool checked);
|
void on_tone_toggled(bool checked);
|
||||||
void on_mic_toggled(bool checked);
|
void on_mic_toggled(bool checked);
|
||||||
|
@ -50,7 +50,16 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -387,28 +396,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QDial" name="micVolume">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Audio input volume</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="ButtonSwitch" name="mic">
|
<widget class="ButtonSwitch" name="mic">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -426,28 +413,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="micVolumeText">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Audio input volume level</string>
|
|
||||||
</property>
|
|
||||||
<property name="statusTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>50</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -461,6 +426,64 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="volLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vol</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDial" name="micVolume">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Audio input volume</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="micVolumeText">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Audio input volume level</string>
|
||||||
|
</property>
|
||||||
|
<property name="statusTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1.0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -669,6 +692,7 @@
|
|||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user