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