mirror of https://github.com/f4exb/sdrangel.git
DV Serial: implement FIFO slots
This commit is contained in:
parent
13e832a20e
commit
18a8e7c903
|
@ -258,10 +258,12 @@ void DVSerialEngine::pushMbeFrame(const unsigned char *mbeFrame, int mbeRateInde
|
||||||
{
|
{
|
||||||
it->worker->pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo);
|
it->worker->pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo);
|
||||||
done = true;
|
done = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (it->worker->isAvailable())
|
else if (it->worker->isAvailable())
|
||||||
{
|
{
|
||||||
itAvail = it;
|
itAvail = it;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
|
|
|
@ -32,7 +32,7 @@ DVSerialWorker::DVSerialWorker() :
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(48000);
|
m_audioBuffer.resize(48000);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
m_audioFifo = 0;
|
// m_audioFifo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVSerialWorker::~DVSerialWorker()
|
DVSerialWorker::~DVSerialWorker()
|
||||||
|
@ -105,7 +105,7 @@ void DVSerialWorker::handleInputMessages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timestamp = QDateTime::currentDateTime();
|
m_fifoSlots[0].m_timestamp = QDateTime::currentDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DVSerialWorker::pushMbeFrame(const unsigned char *mbeFrame,
|
void DVSerialWorker::pushMbeFrame(const unsigned char *mbeFrame,
|
||||||
|
@ -113,22 +113,22 @@ void DVSerialWorker::pushMbeFrame(const unsigned char *mbeFrame,
|
||||||
int mbeVolumeIndex,
|
int mbeVolumeIndex,
|
||||||
unsigned char channels, AudioFifo *audioFifo)
|
unsigned char channels, AudioFifo *audioFifo)
|
||||||
{
|
{
|
||||||
m_audioFifo = audioFifo;
|
m_fifoSlots[0].m_audioFifo = audioFifo;
|
||||||
m_inputMessageQueue.push(MsgMbeDecode::create(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo));
|
m_inputMessageQueue.push(MsgMbeDecode::create(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DVSerialWorker::isAvailable()
|
bool DVSerialWorker::isAvailable()
|
||||||
{
|
{
|
||||||
if (m_audioFifo == 0) {
|
if (m_fifoSlots[0].m_audioFifo == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_timestamp.time().msecsTo(QDateTime::currentDateTime().time()) > 1000; // 1 second inactivity timeout
|
return m_fifoSlots[0].m_timestamp.time().msecsTo(QDateTime::currentDateTime().time()) > 1000; // 1 second inactivity timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DVSerialWorker::hasFifo(AudioFifo *audioFifo)
|
bool DVSerialWorker::hasFifo(AudioFifo *audioFifo)
|
||||||
{
|
{
|
||||||
return m_audioFifo == audioFifo;
|
return m_fifoSlots[0].m_audioFifo == audioFifo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DVSerialWorker::upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo)
|
void DVSerialWorker::upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo)
|
||||||
|
|
|
@ -105,8 +105,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||||
AudioFifo *m_audioFifo;
|
|
||||||
QDateTime m_timestamp;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished();
|
||||||
|
@ -122,6 +120,13 @@ private:
|
||||||
|
|
||||||
typedef std::vector<AudioSample> AudioVector;
|
typedef std::vector<AudioSample> AudioVector;
|
||||||
|
|
||||||
|
struct FifoSlot
|
||||||
|
{
|
||||||
|
FifoSlot() : m_audioFifo(0), m_timestamp(QDate(2000, 1, 1)) {}
|
||||||
|
AudioFifo *m_audioFifo;
|
||||||
|
QDateTime m_timestamp;
|
||||||
|
};
|
||||||
|
|
||||||
void upsample6(short *in, short *out, int nbSamplesIn);
|
void upsample6(short *in, short *out, int nbSamplesIn);
|
||||||
void upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo);
|
void upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo);
|
||||||
|
|
||||||
|
@ -133,6 +138,7 @@ private:
|
||||||
//short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE * 6 * 2]; // upsample to 48k and duplicate channel
|
//short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE * 6 * 2]; // upsample to 48k and duplicate channel
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
uint m_audioBufferFill;
|
uint m_audioBufferFill;
|
||||||
|
FifoSlot m_fifoSlots[2];
|
||||||
short m_upsamplerLastValue;
|
short m_upsamplerLastValue;
|
||||||
float m_phase;
|
float m_phase;
|
||||||
MBEAudioInterpolatorFilter m_upsampleFilter;
|
MBEAudioInterpolatorFilter m_upsampleFilter;
|
||||||
|
|
Loading…
Reference in New Issue