1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-03 13:35:28 -05:00

DSD demod plugin: activate dual TDMA slot audio handling

This commit is contained in:
f4exb 2016-09-04 01:06:10 +02:00
parent 409a4e2292
commit 2294fce2e8
4 changed files with 85 additions and 19 deletions

View File

@ -31,13 +31,21 @@ public:
void pushSample(short sample) { m_decoder.run(sample); } void pushSample(short sample) { m_decoder.run(sample); }
short getFilteredSample() const { return m_decoder.getFilteredSample(); } short getFilteredSample() const { return m_decoder.getFilteredSample(); }
short getSymbolSyncSample() const { return m_decoder.getSymbolSyncSample(); } short getSymbolSyncSample() const { return m_decoder.getSymbolSyncSample(); }
short *getAudio1(int& nbSamples) { return m_decoder.getAudio1(nbSamples); } short *getAudio1(int& nbSamples) { return m_decoder.getAudio1(nbSamples); }
void resetAudio1() { m_decoder.resetAudio1(); } void resetAudio1() { m_decoder.resetAudio1(); }
short *getAudio2(int& nbSamples) { return m_decoder.getAudio2(nbSamples); }
void resetAudio2() { m_decoder.resetAudio2(); }
void enableMbelib(bool enable) { m_decoder.enableMbelib(enable); } void enableMbelib(bool enable) { m_decoder.enableMbelib(enable); }
bool mbeDVReady1() const { return m_decoder.mbeDVReady1(); } bool mbeDVReady1() const { return m_decoder.mbeDVReady1(); }
void resetMbeDV1() { m_decoder.resetMbeDV1(); } void resetMbeDV1() { m_decoder.resetMbeDV1(); }
bool mbeDVReady2() const { return m_decoder.mbeDVReady2(); }
void resetMbeDV2() { m_decoder.resetMbeDV2(); }
const unsigned char *getMbeDVFrame1() const { return m_decoder.getMbeDVFrame1(); } const unsigned char *getMbeDVFrame1() const { return m_decoder.getMbeDVFrame1(); }
const unsigned char *getMbeDVFrame2() const { return m_decoder.getMbeDVFrame2(); }
int getMbeRateIndex() const { return (int) m_decoder.getMbeRate(); } int getMbeRateIndex() const { return (int) m_decoder.getMbeRate(); }
int getInLevel() const { return m_decoder.getInLevel(); } int getInLevel() const { return m_decoder.getInLevel(); }

View File

@ -34,7 +34,8 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
m_sampleCount(0), m_sampleCount(0),
m_squelchCount(0), m_squelchCount(0),
m_squelchOpen(false), m_squelchOpen(false),
m_audioFifo(4, 48000), m_audioFifo1(4, 48000),
m_audioFifo2(4, 48000),
m_fmExcursion(24), m_fmExcursion(24),
m_settingsMutex(QMutex::Recursive), m_settingsMutex(QMutex::Recursive),
m_scope(sampleSink), m_scope(sampleSink),
@ -66,13 +67,15 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
m_movingAverage.resize(50, 0); m_movingAverage.resize(50, 0);
DSPEngine::instance()->addAudioSink(&m_audioFifo); DSPEngine::instance()->addAudioSink(&m_audioFifo1);
DSPEngine::instance()->addAudioSink(&m_audioFifo2);
} }
DSDDemod::~DSDDemod() DSDDemod::~DSDDemod()
{ {
delete[] m_sampleBuffer; delete[] m_sampleBuffer;
DSPEngine::instance()->removeAudioSink(&m_audioFifo); DSPEngine::instance()->removeAudioSink(&m_audioFifo1);
DSPEngine::instance()->removeAudioSink(&m_audioFifo2);
} }
void DSDDemod::configure(MessageQueue* messageQueue, void DSDDemod::configure(MessageQueue* messageQueue,
@ -192,31 +195,84 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_scopeSampleBuffer.push_back(s); m_scopeSampleBuffer.push_back(s);
} }
if (DSPEngine::instance()->hasDVSerialSupport() && m_dsdDecoder.mbeDVReady1()) if (DSPEngine::instance()->hasDVSerialSupport())
{ {
if (!m_running.m_audioMute) { if ((m_running.m_slot1On) && m_dsdDecoder.mbeDVReady1())
DSPEngine::instance()->pushMbeFrame(m_dsdDecoder.getMbeDVFrame1(), m_dsdDecoder.getMbeRateIndex(), m_running.m_volume, &m_audioFifo); {
if (!m_running.m_audioMute) {
DSPEngine::instance()->pushMbeFrame(m_dsdDecoder.getMbeDVFrame1(), m_dsdDecoder.getMbeRateIndex(), m_running.m_volume, &m_audioFifo1);
}
m_dsdDecoder.resetMbeDV1();
}
if ((m_running.m_slot2On) && m_dsdDecoder.mbeDVReady2())
{
if (!m_running.m_audioMute) {
DSPEngine::instance()->pushMbeFrame(m_dsdDecoder.getMbeDVFrame2(), m_dsdDecoder.getMbeRateIndex(), m_running.m_volume, &m_audioFifo2);
}
m_dsdDecoder.resetMbeDV2();
} }
m_dsdDecoder.resetMbeDV1();
} }
// if (DSPEngine::instance()->hasDVSerialSupport() && m_dsdDecoder.mbeDVReady1())
// {
// if (!m_running.m_audioMute)
// {
// DSPEngine::instance()->pushMbeFrame(m_dsdDecoder.getMbeDVFrame1(), m_dsdDecoder.getMbeRateIndex(), m_running.m_volume, &m_audioFifo1);
// }
//
// m_dsdDecoder.resetMbeDV1();
// }
m_interpolatorDistanceRemain += m_interpolatorDistance; m_interpolatorDistanceRemain += m_interpolatorDistance;
} }
} }
if (!DSPEngine::instance()->hasDVSerialSupport()) if (!DSPEngine::instance()->hasDVSerialSupport())
{ {
int nbAudioSamples; if (m_running.m_slot1On)
short *dsdAudio = m_dsdDecoder.getAudio1(nbAudioSamples);
if (nbAudioSamples > 0)
{ {
if (!m_running.m_audioMute) { int nbAudioSamples;
uint res = m_audioFifo.write((const quint8*) dsdAudio, nbAudioSamples, 10); short *dsdAudio = m_dsdDecoder.getAudio1(nbAudioSamples);
}
m_dsdDecoder.resetAudio1(); if (nbAudioSamples > 0)
{
if (!m_running.m_audioMute) {
uint res = m_audioFifo1.write((const quint8*) dsdAudio, nbAudioSamples, 10);
}
m_dsdDecoder.resetAudio1();
}
} }
if (m_running.m_slot2On)
{
int nbAudioSamples;
short *dsdAudio = m_dsdDecoder.getAudio2(nbAudioSamples);
if (nbAudioSamples > 0)
{
if (!m_running.m_audioMute) {
uint res = m_audioFifo2.write((const quint8*) dsdAudio, nbAudioSamples, 10);
}
m_dsdDecoder.resetAudio2();
}
}
// int nbAudioSamples;
// short *dsdAudio = m_dsdDecoder.getAudio1(nbAudioSamples);
//
// if (nbAudioSamples > 0)
// {
// if (!m_running.m_audioMute) {
// uint res = m_audioFifo1.write((const quint8*) dsdAudio, nbAudioSamples, 10);
// }
//
// m_dsdDecoder.resetAudio1();
// }
} }
@ -230,7 +286,8 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
void DSDDemod::start() void DSDDemod::start()
{ {
m_audioFifo.clear(); m_audioFifo1.clear();
m_audioFifo2.clear();
m_phaseDiscri.reset(); m_phaseDiscri.reset();
} }

View File

@ -228,7 +228,8 @@ private:
qint16 *m_sampleBuffer; //!< samples ring buffer qint16 *m_sampleBuffer; //!< samples ring buffer
int m_sampleBufferIndex; int m_sampleBufferIndex;
AudioFifo m_audioFifo; AudioFifo m_audioFifo1;
AudioFifo m_audioFifo2;
SampleSink* m_scope; SampleSink* m_scope;
bool m_scopeEnabled; bool m_scopeEnabled;

View File

@ -712,7 +712,7 @@
<item> <item>
<widget class="QToolButton" name="audioMute"> <widget class="QToolButton" name="audioMute">
<property name="toolTip"> <property name="toolTip">
<string>Mute/Unmute audio</string> <string>Mute/Unmute audio (all slots)</string>
</property> </property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
@ -784,7 +784,7 @@
<item> <item>
<widget class="QToolButton" name="slot1On"> <widget class="QToolButton" name="slot1On">
<property name="toolTip"> <property name="toolTip">
<string>TDMA slot1 voice on/off</string> <string>TDMA slot1 or FDMA unique slot voice on/off</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>