mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
SSB demod: add flip binaural channels option
This commit is contained in:
parent
183701acc5
commit
fc89d3ea5c
@ -30,7 +30,8 @@ SSBDemod::SSBDemod(SampleSink* sampleSink) :
|
||||
m_sampleSink(sampleSink),
|
||||
m_audioFifo(4, 24000),
|
||||
m_settingsMutex(QMutex::Recursive),
|
||||
m_audioBinaual(false)
|
||||
m_audioBinaual(false),
|
||||
m_audioFlipChannels(false)
|
||||
{
|
||||
setObjectName("SSBDemod");
|
||||
|
||||
@ -72,9 +73,10 @@ void SSBDemod::configure(MessageQueue* messageQueue,
|
||||
Real LowCutoff,
|
||||
Real volume,
|
||||
int spanLog2,
|
||||
bool audioBinaural)
|
||||
bool audioBinaural,
|
||||
bool audioFlipChannel)
|
||||
{
|
||||
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural);
|
||||
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannel);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -127,8 +129,16 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_audioBinaual)
|
||||
{
|
||||
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].real() * m_volume * 100);
|
||||
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].imag() * m_volume * 100);
|
||||
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
|
||||
{
|
||||
@ -234,6 +244,7 @@ bool SSBDemod::handleMessage(const Message& cmd)
|
||||
|
||||
m_spanLog2 = cfg.getSpanLog2();
|
||||
m_audioBinaual = cfg.getAudioBinaural();
|
||||
m_audioFlipChannels = cfg.getAudioFlipChannels();
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
@ -241,7 +252,8 @@ bool SSBDemod::handleMessage(const Message& cmd)
|
||||
<< " m_LowCutoff: " << m_LowCutoff
|
||||
<< " m_volume: " << m_volume
|
||||
<< " m_spanLog2: " << m_spanLog2
|
||||
<< " m_audioBinaual: " << m_audioBinaual;
|
||||
<< " m_audioBinaual: " << m_audioBinaual
|
||||
<< " m_audioFlipChannels: " << m_audioFlipChannels;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
Real LowCutoff,
|
||||
Real volume,
|
||||
int spanLog2,
|
||||
bool audioBinaural);
|
||||
bool audioBinaural,
|
||||
bool audioFlipChannels);
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
@ -58,14 +59,16 @@ private:
|
||||
Real getVolume() const { return m_volume; }
|
||||
int getSpanLog2() const { return m_spanLog2; }
|
||||
bool getAudioBinaural() const { return m_audioBinaural; }
|
||||
bool getAudioFlipChannels() const { return m_audioFlipChannels; }
|
||||
|
||||
static MsgConfigureSSBDemod* create(Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
Real volume,
|
||||
int spanLog2,
|
||||
bool audioBinaural)
|
||||
bool audioBinaural,
|
||||
bool audioFlipChannels)
|
||||
{
|
||||
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural);
|
||||
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume, spanLog2, audioBinaural, audioFlipChannels);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -74,18 +77,21 @@ private:
|
||||
Real m_volume;
|
||||
int m_spanLog2;
|
||||
bool m_audioBinaural;
|
||||
bool m_audioFlipChannels;
|
||||
|
||||
MsgConfigureSSBDemod(Real Bandwidth,
|
||||
Real LowCutoff,
|
||||
Real volume,
|
||||
int spanLog2,
|
||||
bool audioBinaural) :
|
||||
bool audioBinaural,
|
||||
bool audioFlipChannels) :
|
||||
Message(),
|
||||
m_Bandwidth(Bandwidth),
|
||||
m_LowCutoff(LowCutoff),
|
||||
m_volume(volume),
|
||||
m_spanLog2(spanLog2),
|
||||
m_audioBinaural(audioBinaural)
|
||||
m_audioBinaural(audioBinaural),
|
||||
m_audioFlipChannels(audioFlipChannels)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -104,6 +110,7 @@ private:
|
||||
int m_sampleRate;
|
||||
int m_frequency;
|
||||
bool m_audioBinaual;
|
||||
bool m_audioFlipChannels;
|
||||
bool m_usb;
|
||||
Real m_magsq;
|
||||
|
||||
|
@ -72,6 +72,7 @@ QByteArray SSBDemodGUI::serialize() const
|
||||
s.writeS32(6, ui->lowCut->value());
|
||||
s.writeS32(7, ui->spanLog2->value());
|
||||
s.writeBool(8, m_audioBinaural);
|
||||
s.writeBool(9, m_audioFlipChannels);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -111,6 +112,8 @@ bool SSBDemodGUI::deserialize(const QByteArray& data)
|
||||
setNewRate(tmp);
|
||||
d.readBool(8, &m_audioBinaural);
|
||||
ui->audioBinaural->setChecked(m_audioBinaural);
|
||||
d.readBool(9, &m_audioFlipChannels);
|
||||
ui->audioFlipChannels->setChecked(m_audioFlipChannels);
|
||||
|
||||
blockApplySettings(false);
|
||||
m_channelMarker.blockSignals(false);
|
||||
@ -152,6 +155,12 @@ void SSBDemodGUI::on_audioBinaural_toggled(bool binaural)
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void SSBDemodGUI::on_audioFlipChannels_toggled(bool flip)
|
||||
{
|
||||
m_audioFlipChannels = flip;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void SSBDemodGUI::on_deltaFrequency_changed(quint64 value)
|
||||
{
|
||||
if (ui->deltaMinus->isChecked())
|
||||
@ -267,6 +276,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
m_rate(6000),
|
||||
m_spanLog2(3),
|
||||
m_audioBinaural(false),
|
||||
m_audioFlipChannels(false),
|
||||
m_channelPowerDbAvg(20,0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -385,7 +395,8 @@ void SSBDemodGUI::applySettings()
|
||||
ui->lowCut->value() * 100.0,
|
||||
ui->volume->value() / 10.0,
|
||||
m_spanLog2,
|
||||
m_audioBinaural);
|
||||
m_audioBinaural,
|
||||
m_audioFlipChannels);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ private slots:
|
||||
void on_deltaFrequency_changed(quint64 value);
|
||||
void on_deltaMinus_toggled(bool minus);
|
||||
void on_audioBinaural_toggled(bool binaural);
|
||||
void on_audioFlipChannels_toggled(bool flip);
|
||||
void on_BW_valueChanged(int value);
|
||||
void on_lowCut_valueChanged(int value);
|
||||
void on_volume_valueChanged(int value);
|
||||
@ -58,6 +59,7 @@ private:
|
||||
int m_rate;
|
||||
int m_spanLog2;
|
||||
bool m_audioBinaural;
|
||||
bool m_audioFlipChannels;
|
||||
MovingAverage<Real> m_channelPowerDbAvg;
|
||||
|
||||
ThreadedSampleSink* m_threadedChannelizer;
|
||||
|
@ -142,10 +142,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="audioVLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="audioBinaural">
|
||||
<property name="toolTip">
|
||||
<string>Binaural audio</string>
|
||||
<string>Binaural I/Q audio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
|
Loading…
Reference in New Issue
Block a user