From 299317bb2eaf43282fb4a77c5273d62a53973678 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 20 Dec 2016 16:44:10 +0100 Subject: [PATCH] WFM Modulator: implemented channel mute --- plugins/channeltx/modwfm/wfmmod.cpp | 17 +++++++--- plugins/channeltx/modwfm/wfmmod.h | 34 ++++++++++++++----- plugins/channeltx/modwfm/wfmmodgui.cpp | 4 +-- plugins/channeltx/modwfm/wfmmodgui.h | 2 +- plugins/channeltx/modwfm/wfmmodgui.ui | 45 ++++++++++++++++++++++---- 5 files changed, 79 insertions(+), 23 deletions(-) diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index cd41e8aa3..2c296713c 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -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; } diff --git a/plugins/channeltx/modwfm/wfmmod.h b/plugins/channeltx/modwfm/wfmmod.h index a8fc61181..0d7e2eb2c 100644 --- a/plugins/channeltx/modwfm/wfmmod.h +++ b/plugins/channeltx/modwfm/wfmmod.h @@ -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) { } }; diff --git a/plugins/channeltx/modwfm/wfmmodgui.cpp b/plugins/channeltx/modwfm/wfmmodgui.cpp index 5382df4c3..dacf851e4 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.cpp +++ b/plugins/channeltx/modwfm/wfmmodgui.cpp @@ -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()); } } diff --git a/plugins/channeltx/modwfm/wfmmodgui.h b/plugins/channeltx/modwfm/wfmmodgui.h index f19d11047..037c1407c 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.h +++ b/plugins/channeltx/modwfm/wfmmodgui.h @@ -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); diff --git a/plugins/channeltx/modwfm/wfmmodgui.ui b/plugins/channeltx/modwfm/wfmmodgui.ui index a82f12270..ba9c63b24 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.ui +++ b/plugins/channeltx/modwfm/wfmmodgui.ui @@ -56,7 +56,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -158,7 +167,7 @@ - + Mute/Unmute audio @@ -707,17 +716,17 @@
gui/valuedial.h
1 - - ButtonSwitch - QToolButton -
gui/buttonswitch.h
-
LevelMeterVU QWidget
gui/levelmeter.h
1
+ + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
CWKeyerGUI QWidget @@ -727,6 +736,28 @@ + + + + + + + + + + + + + + + + + + + + + +