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

SSB demod plugin: added button to mute/unmute audio

This commit is contained in:
f4exb 2016-04-05 09:20:02 +02:00
parent cde3f531e0
commit 98f325d60e
5 changed files with 72 additions and 26 deletions

View File

@ -75,9 +75,10 @@ void SSBDemod::configure(MessageQueue* messageQueue,
int spanLog2,
bool audioBinaural,
bool audioFlipChannel,
bool dsb)
bool dsb,
bool audioMute)
{
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannel, dsb);
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannel, dsb, audioMute);
messageQueue->push(cmd);
}
@ -143,25 +144,33 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_sum.imag(0.0);
}
if (m_audioBinaual)
if (m_audioMute)
{
if (m_audioFlipChannels)
{
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].imag() * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].real() * m_volume * 100);
}
else
{
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].real() * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].imag() * m_volume * 100);
}
m_audioBuffer[m_audioBufferFill].r = 0;
m_audioBuffer[m_audioBufferFill].l = 0;
}
else
{
Real demod = (sideband[i].real() + sideband[i].imag()) * 0.7;
qint16 sample = (qint16)(demod * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample;
if (m_audioBinaual)
{
if (m_audioFlipChannels)
{
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].imag() * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].real() * m_volume * 100);
}
else
{
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].real() * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].imag() * m_volume * 100);
}
}
else
{
Real demod = (sideband[i].real() + sideband[i].imag()) * 0.7;
qint16 sample = (qint16)(demod * m_volume * 100);
m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample;
}
}
++m_audioBufferFill;
@ -263,6 +272,7 @@ bool SSBDemod::handleMessage(const Message& cmd)
m_audioBinaual = cfg.getAudioBinaural();
m_audioFlipChannels = cfg.getAudioFlipChannels();
m_dsb = cfg.getDSB();
m_audioMute = cfg.getAudioMute();
m_settingsMutex.unlock();
@ -272,7 +282,8 @@ bool SSBDemod::handleMessage(const Message& cmd)
<< " m_spanLog2: " << m_spanLog2
<< " m_audioBinaual: " << m_audioBinaual
<< " m_audioFlipChannels: " << m_audioFlipChannels
<< " m_dsb: " << m_dsb;
<< " m_dsb: " << m_dsb
<< "m_audioMute: " << m_audioMute;
return true;
}

View File

@ -41,7 +41,8 @@ public:
int spanLog2,
bool audioBinaural,
bool audioFlipChannels,
bool dsb);
bool dsb,
bool audioMute);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
virtual void start();
@ -62,6 +63,7 @@ private:
bool getAudioBinaural() const { return m_audioBinaural; }
bool getAudioFlipChannels() const { return m_audioFlipChannels; }
bool getDSB() const { return m_dsb; }
bool getAudioMute() const { return m_audioMute; }
static MsgConfigureSSBDemod* create(Real Bandwidth,
Real LowCutoff,
@ -69,9 +71,10 @@ private:
int spanLog2,
bool audioBinaural,
bool audioFlipChannels,
bool dsb)
bool dsb,
bool audioMute)
{
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannels, dsb);
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannels, dsb, audioMute);
}
private:
@ -82,6 +85,7 @@ private:
bool m_audioBinaural;
bool m_audioFlipChannels;
bool m_dsb;
bool m_audioMute;
MsgConfigureSSBDemod(Real Bandwidth,
Real LowCutoff,
@ -89,7 +93,8 @@ private:
int spanLog2,
bool audioBinaural,
bool audioFlipChannels,
bool dsb) :
bool dsb,
bool audioMute) :
Message(),
m_Bandwidth(Bandwidth),
m_LowCutoff(LowCutoff),
@ -97,7 +102,8 @@ private:
m_spanLog2(spanLog2),
m_audioBinaural(audioBinaural),
m_audioFlipChannels(audioFlipChannels),
m_dsb(dsb)
m_dsb(dsb),
m_audioMute(audioMute)
{ }
};
@ -120,6 +126,7 @@ private:
bool m_audioFlipChannels;
bool m_usb;
bool m_dsb;
bool m_audioMute;
Real m_magsq;
NCO m_nco;

View File

@ -281,6 +281,12 @@ void SSBDemodGUI::on_volume_valueChanged(int value)
applySettings();
}
void SSBDemodGUI::on_audioMute_toggled(bool checked)
{
m_audioMute = checked;
applySettings();
}
void SSBDemodGUI::on_spanLog2_valueChanged(int value)
{
if (setNewRate(value))
@ -319,6 +325,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_spanLog2(3),
m_audioBinaural(false),
m_audioFlipChannels(false),
m_audioMute(false),
m_dsb(false),
m_channelPowerDbAvg(20,0)
{
@ -461,7 +468,8 @@ void SSBDemodGUI::applySettings()
m_spanLog2,
m_audioBinaural,
m_audioFlipChannels,
m_dsb);
m_dsb,
ui->audioMute->isChecked());
}
}

View File

@ -46,6 +46,7 @@ private slots:
void on_BW_valueChanged(int value);
void on_lowCut_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_audioMute_toggled(bool checked);
void on_spanLog2_valueChanged(int value);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDoubleClicked();
@ -62,6 +63,7 @@ private:
bool m_audioBinaural;
bool m_audioFlipChannels;
bool m_dsb;
bool m_audioMute;
MovingAverage<Real> m_channelPowerDbAvg;
ThreadedSampleSink* m_threadedChannelizer;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>302</width>
<height>461</height>
<width>334</width>
<height>199</height>
</rect>
</property>
<property name="minimumSize">
@ -398,6 +398,24 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioMute">
<property name="toolTip">
<string>Mute/Unmute audio</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/sound_on.png</normaloff>
<normalon>:/sound_off.png</normalon>:/sound_on.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>