mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-10-01 09:16:39 -04:00
SSB demod plugin: added button to mute/unmute audio
This commit is contained in:
parent
cde3f531e0
commit
98f325d60e
@ -75,9 +75,10 @@ void SSBDemod::configure(MessageQueue* messageQueue,
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool audioBinaural,
|
bool audioBinaural,
|
||||||
bool audioFlipChannel,
|
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);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,25 +144,33 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
m_sum.imag(0.0);
|
m_sum.imag(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_audioBinaual)
|
if (m_audioMute)
|
||||||
{
|
{
|
||||||
if (m_audioFlipChannels)
|
m_audioBuffer[m_audioBufferFill].r = 0;
|
||||||
{
|
m_audioBuffer[m_audioBufferFill].l = 0;
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
Real demod = (sideband[i].real() + sideband[i].imag()) * 0.7;
|
if (m_audioBinaual)
|
||||||
qint16 sample = (qint16)(demod * m_volume * 100);
|
{
|
||||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
if (m_audioFlipChannels)
|
||||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
{
|
||||||
|
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;
|
++m_audioBufferFill;
|
||||||
@ -263,6 +272,7 @@ bool SSBDemod::handleMessage(const Message& cmd)
|
|||||||
m_audioBinaual = cfg.getAudioBinaural();
|
m_audioBinaual = cfg.getAudioBinaural();
|
||||||
m_audioFlipChannels = cfg.getAudioFlipChannels();
|
m_audioFlipChannels = cfg.getAudioFlipChannels();
|
||||||
m_dsb = cfg.getDSB();
|
m_dsb = cfg.getDSB();
|
||||||
|
m_audioMute = cfg.getAudioMute();
|
||||||
|
|
||||||
m_settingsMutex.unlock();
|
m_settingsMutex.unlock();
|
||||||
|
|
||||||
@ -272,7 +282,8 @@ bool SSBDemod::handleMessage(const Message& cmd)
|
|||||||
<< " m_spanLog2: " << m_spanLog2
|
<< " m_spanLog2: " << m_spanLog2
|
||||||
<< " m_audioBinaual: " << m_audioBinaual
|
<< " m_audioBinaual: " << m_audioBinaual
|
||||||
<< " m_audioFlipChannels: " << m_audioFlipChannels
|
<< " m_audioFlipChannels: " << m_audioFlipChannels
|
||||||
<< " m_dsb: " << m_dsb;
|
<< " m_dsb: " << m_dsb
|
||||||
|
<< "m_audioMute: " << m_audioMute;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ public:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool audioBinaural,
|
bool audioBinaural,
|
||||||
bool audioFlipChannels,
|
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 feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
@ -62,6 +63,7 @@ private:
|
|||||||
bool getAudioBinaural() const { return m_audioBinaural; }
|
bool getAudioBinaural() const { return m_audioBinaural; }
|
||||||
bool getAudioFlipChannels() const { return m_audioFlipChannels; }
|
bool getAudioFlipChannels() const { return m_audioFlipChannels; }
|
||||||
bool getDSB() const { return m_dsb; }
|
bool getDSB() const { return m_dsb; }
|
||||||
|
bool getAudioMute() const { return m_audioMute; }
|
||||||
|
|
||||||
static MsgConfigureSSBDemod* create(Real Bandwidth,
|
static MsgConfigureSSBDemod* create(Real Bandwidth,
|
||||||
Real LowCutoff,
|
Real LowCutoff,
|
||||||
@ -69,9 +71,10 @@ private:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool audioBinaural,
|
bool audioBinaural,
|
||||||
bool audioFlipChannels,
|
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:
|
private:
|
||||||
@ -82,6 +85,7 @@ private:
|
|||||||
bool m_audioBinaural;
|
bool m_audioBinaural;
|
||||||
bool m_audioFlipChannels;
|
bool m_audioFlipChannels;
|
||||||
bool m_dsb;
|
bool m_dsb;
|
||||||
|
bool m_audioMute;
|
||||||
|
|
||||||
MsgConfigureSSBDemod(Real Bandwidth,
|
MsgConfigureSSBDemod(Real Bandwidth,
|
||||||
Real LowCutoff,
|
Real LowCutoff,
|
||||||
@ -89,7 +93,8 @@ private:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool audioBinaural,
|
bool audioBinaural,
|
||||||
bool audioFlipChannels,
|
bool audioFlipChannels,
|
||||||
bool dsb) :
|
bool dsb,
|
||||||
|
bool audioMute) :
|
||||||
Message(),
|
Message(),
|
||||||
m_Bandwidth(Bandwidth),
|
m_Bandwidth(Bandwidth),
|
||||||
m_LowCutoff(LowCutoff),
|
m_LowCutoff(LowCutoff),
|
||||||
@ -97,7 +102,8 @@ private:
|
|||||||
m_spanLog2(spanLog2),
|
m_spanLog2(spanLog2),
|
||||||
m_audioBinaural(audioBinaural),
|
m_audioBinaural(audioBinaural),
|
||||||
m_audioFlipChannels(audioFlipChannels),
|
m_audioFlipChannels(audioFlipChannels),
|
||||||
m_dsb(dsb)
|
m_dsb(dsb),
|
||||||
|
m_audioMute(audioMute)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,6 +126,7 @@ private:
|
|||||||
bool m_audioFlipChannels;
|
bool m_audioFlipChannels;
|
||||||
bool m_usb;
|
bool m_usb;
|
||||||
bool m_dsb;
|
bool m_dsb;
|
||||||
|
bool m_audioMute;
|
||||||
Real m_magsq;
|
Real m_magsq;
|
||||||
|
|
||||||
NCO m_nco;
|
NCO m_nco;
|
||||||
|
@ -281,6 +281,12 @@ void SSBDemodGUI::on_volume_valueChanged(int value)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSBDemodGUI::on_audioMute_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_audioMute = checked;
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
void SSBDemodGUI::on_spanLog2_valueChanged(int value)
|
void SSBDemodGUI::on_spanLog2_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if (setNewRate(value))
|
if (setNewRate(value))
|
||||||
@ -319,6 +325,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
m_spanLog2(3),
|
m_spanLog2(3),
|
||||||
m_audioBinaural(false),
|
m_audioBinaural(false),
|
||||||
m_audioFlipChannels(false),
|
m_audioFlipChannels(false),
|
||||||
|
m_audioMute(false),
|
||||||
m_dsb(false),
|
m_dsb(false),
|
||||||
m_channelPowerDbAvg(20,0)
|
m_channelPowerDbAvg(20,0)
|
||||||
{
|
{
|
||||||
@ -461,7 +468,8 @@ void SSBDemodGUI::applySettings()
|
|||||||
m_spanLog2,
|
m_spanLog2,
|
||||||
m_audioBinaural,
|
m_audioBinaural,
|
||||||
m_audioFlipChannels,
|
m_audioFlipChannels,
|
||||||
m_dsb);
|
m_dsb,
|
||||||
|
ui->audioMute->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ private slots:
|
|||||||
void on_BW_valueChanged(int value);
|
void on_BW_valueChanged(int value);
|
||||||
void on_lowCut_valueChanged(int value);
|
void on_lowCut_valueChanged(int value);
|
||||||
void on_volume_valueChanged(int value);
|
void on_volume_valueChanged(int value);
|
||||||
|
void on_audioMute_toggled(bool checked);
|
||||||
void on_spanLog2_valueChanged(int value);
|
void on_spanLog2_valueChanged(int value);
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||||
void onMenuDoubleClicked();
|
void onMenuDoubleClicked();
|
||||||
@ -62,6 +63,7 @@ private:
|
|||||||
bool m_audioBinaural;
|
bool m_audioBinaural;
|
||||||
bool m_audioFlipChannels;
|
bool m_audioFlipChannels;
|
||||||
bool m_dsb;
|
bool m_dsb;
|
||||||
|
bool m_audioMute;
|
||||||
MovingAverage<Real> m_channelPowerDbAvg;
|
MovingAverage<Real> m_channelPowerDbAvg;
|
||||||
|
|
||||||
ThreadedSampleSink* m_threadedChannelizer;
|
ThreadedSampleSink* m_threadedChannelizer;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>302</width>
|
<width>334</width>
|
||||||
<height>461</height>
|
<height>199</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -398,6 +398,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
Reference in New Issue
Block a user