1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

WFM Modulator: implemented channel mute

This commit is contained in:
f4exb 2016-12-20 16:44:10 +01:00
parent 61df7de043
commit 299317bb2e
5 changed files with 79 additions and 23 deletions

View File

@ -91,15 +91,22 @@ void WFMMod::configure(MessageQueue* messageQueue,
float fmDeviation,
float toneFrequency,
float volumeFactor,
bool audioMute,
bool channelMute,
bool playLoop)
{
Message* cmd = MsgConfigureWFMMod::create(rfBandwidth, afBandwidth, fmDeviation, toneFrequency, volumeFactor, audioMute, playLoop);
Message* cmd = MsgConfigureWFMMod::create(rfBandwidth, afBandwidth, fmDeviation, toneFrequency, volumeFactor, channelMute, playLoop);
messageQueue->push(cmd);
}
void WFMMod::pull(Sample& sample)
{
if (m_running.m_channelMute)
{
sample.m_real = 0.0f;
sample.m_imag = 0.0f;
return;
}
Complex ci, ri;
Real t;
@ -272,7 +279,7 @@ bool WFMMod::handleMessage(const Message& cmd)
m_config.m_fmDeviation = cfg.getFMDeviation();
m_config.m_toneFrequency = cfg.getToneFrequency();
m_config.m_volumeFactor = cfg.getVolumeFactor();
m_config.m_audioMute = cfg.getAudioMute();
m_config.m_channelMute = cfg.getChannelMute();
m_config.m_playLoop = cfg.getPlayLoop();
apply();
@ -283,7 +290,7 @@ bool WFMMod::handleMessage(const Message& cmd)
<< " m_fmDeviation: " << m_config.m_fmDeviation
<< " m_toneFrequency: " << m_config.m_toneFrequency
<< " m_volumeFactor: " << m_config.m_volumeFactor
<< " m_audioMute: " << m_config.m_audioMute
<< " m_channelMute: " << m_config.m_channelMute
<< " m_playLoop: " << m_config.m_playLoop;
return true;
@ -386,7 +393,7 @@ void WFMMod::apply()
m_running.m_fmDeviation = m_config.m_fmDeviation;
m_running.m_volumeFactor = m_config.m_volumeFactor;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
m_running.m_audioMute = m_config.m_audioMute;
m_running.m_channelMute = m_config.m_channelMute;
m_running.m_playLoop = m_config.m_playLoop;
}

View File

@ -216,12 +216,24 @@ private:
float getFMDeviation() const { return m_fmDeviation; }
float getToneFrequency() const { return m_toneFrequency; }
float getVolumeFactor() const { return m_volumeFactor; }
bool getAudioMute() const { return m_audioMute; }
bool getChannelMute() const { return m_channelMute; }
bool getPlayLoop() const { return m_playLoop; }
static MsgConfigureWFMMod* create(Real rfBandwidth, Real afBandwidth, float fmDeviation, float toneFrequency, float volumeFactor, bool audioMute, bool playLoop)
static MsgConfigureWFMMod* create(Real rfBandwidth,
Real afBandwidth,
float fmDeviation,
float toneFrequency,
float volumeFactor,
bool channelMute,
bool playLoop)
{
return new MsgConfigureWFMMod(rfBandwidth, afBandwidth, fmDeviation, toneFrequency, volumeFactor, audioMute, playLoop);
return new MsgConfigureWFMMod(rfBandwidth,
afBandwidth,
fmDeviation,
toneFrequency,
volumeFactor,
channelMute,
playLoop);
}
private:
@ -230,17 +242,23 @@ private:
float m_fmDeviation;
float m_toneFrequency;
float m_volumeFactor;
bool m_audioMute;
bool m_channelMute;
bool m_playLoop;
MsgConfigureWFMMod(Real rfBandwidth, Real afBandwidth, float fmDeviation, float toneFrequency, float volumeFactor, bool audioMute, bool playLoop) :
MsgConfigureWFMMod(Real rfBandwidth,
Real afBandwidth,
float fmDeviation,
float toneFrequency,
float volumeFactor,
bool channelMute,
bool playLoop) :
Message(),
m_rfBandwidth(rfBandwidth),
m_afBandwidth(afBandwidth),
m_fmDeviation(fmDeviation),
m_toneFrequency(toneFrequency),
m_volumeFactor(volumeFactor),
m_audioMute(audioMute),
m_channelMute(channelMute),
m_playLoop(playLoop)
{ }
};
@ -267,7 +285,7 @@ private:
float m_toneFrequency;
float m_volumeFactor;
quint32 m_audioSampleRate;
bool m_audioMute;
bool m_channelMute;
bool m_playLoop;
Config() :
@ -279,7 +297,7 @@ private:
m_toneFrequency(1000.0f),
m_volumeFactor(1.0f),
m_audioSampleRate(0),
m_audioMute(false),
m_channelMute(false),
m_playLoop(false)
{ }
};

View File

@ -242,7 +242,7 @@ void WFMModGUI::on_toneFrequency_valueChanged(int value)
applySettings();
}
void WFMModGUI::on_audioMute_toggled(bool checked)
void WFMModGUI::on_channelMute_toggled(bool checked)
{
applySettings();
}
@ -442,7 +442,7 @@ void WFMModGUI::applySettings()
ui->fmDev->value() * 1000.0f, // value is in '100 Hz
ui->toneFrequency->value() * 10.0f,
ui->volume->value() / 10.0f,
ui->audioMute->isChecked(),
ui->channelMute->isChecked(),
ui->playLoop->isChecked());
}
}

View File

@ -66,7 +66,7 @@ private slots:
void on_fmDev_valueChanged(int value);
void on_toneFrequency_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_audioMute_toggled(bool checked);
void on_channelMute_toggled(bool checked);
void on_tone_toggled(bool checked);
void on_morseKeyer_toggled(bool checked);
void on_mic_toggled(bool checked);

View File

@ -56,7 +56,16 @@
<property name="spacing">
<number>3</number>
</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>
</property>
<item>
@ -158,7 +167,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="audioMute">
<widget class="QToolButton" name="channelMute">
<property name="toolTip">
<string>Mute/Unmute audio</string>
</property>
@ -707,17 +716,17 @@
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterVU</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>CWKeyerGUI</class>
<extends>QWidget</extends>
@ -727,6 +736,28 @@
</customwidgets>
<resources>
<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"/>
<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"/>
<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"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
</resources>
<connections/>
</ui>