mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-30 03:38:55 -05:00
DV serial support implemented
This commit is contained in:
parent
4daa54b8b7
commit
0cc8bc3c89
@ -26,7 +26,8 @@ MESSAGE_CLASS_DEFINITION(DVSerialWorker::MsgTest, Message)
|
|||||||
DVSerialWorker::DVSerialWorker() :
|
DVSerialWorker::DVSerialWorker() :
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_currentGainIn(0),
|
m_currentGainIn(0),
|
||||||
m_currentGainOut(0)
|
m_currentGainOut(0),
|
||||||
|
m_upsamplerLastValue(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,19 +70,66 @@ void DVSerialWorker::handleInputMessages()
|
|||||||
|
|
||||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||||
{
|
{
|
||||||
qDebug("DVSerialWorker::handleInputMessages: message");
|
|
||||||
|
|
||||||
if (MsgMbeDecode::match(*message))
|
if (MsgMbeDecode::match(*message))
|
||||||
{
|
{
|
||||||
MsgMbeDecode *decodeMsg = (MsgMbeDecode *) message;
|
MsgMbeDecode *decodeMsg = (MsgMbeDecode *) message;
|
||||||
int dBVolume = (decodeMsg->getVolumeIndex() - 50) / 5;
|
int dBVolume = (decodeMsg->getVolumeIndex() - 50) / 5;
|
||||||
|
|
||||||
if (m_dvController.decode(m_audioSamples, decodeMsg->getMbeFrame(), decodeMsg->getMbeRate(), dBVolume))
|
if (m_dvController.decode(m_dvAudioSamples, decodeMsg->getMbeFrame(), decodeMsg->getMbeRate(), dBVolume))
|
||||||
{
|
{
|
||||||
decodeMsg->getAudioFifo()->write((const quint8 *) m_audioSamples, SerialDV::MBE_AUDIO_BLOCK_SIZE, 10);
|
upsample6(m_dvAudioSamples, m_audioSamples, SerialDV::MBE_AUDIO_BLOCK_SIZE);
|
||||||
|
decodeMsg->getAudioFifo()->write((const quint8 *) m_audioSamples, SerialDV::MBE_AUDIO_BLOCK_SIZE * 6, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete message;
|
delete message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DVSerialWorker::upsample6(short *in, short *out, int nbSamplesIn)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < nbSamplesIn; i++)
|
||||||
|
{
|
||||||
|
int cur = (int) in[i];
|
||||||
|
int prev = (int) m_upsamplerLastValue;
|
||||||
|
short up;
|
||||||
|
|
||||||
|
up = (cur*1 + prev*5) / 6;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
up = (cur*2 + prev*4) / 6;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
up = (cur*3 + prev*3) / 6;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
up = (cur*4 + prev*2) / 6;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
up = (cur*5 + prev*1) / 6;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
up = in[i];
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
*out = up;
|
||||||
|
out++;
|
||||||
|
|
||||||
|
m_upsamplerLastValue = in[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -97,11 +97,15 @@ public slots:
|
|||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void upsample6(short *in, short *out, int nbSamplesIn);
|
||||||
|
|
||||||
SerialDV::DVController m_dvController;
|
SerialDV::DVController m_dvController;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
int m_currentGainIn;
|
int m_currentGainIn;
|
||||||
int m_currentGainOut;
|
int m_currentGainOut;
|
||||||
short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE];
|
short m_dvAudioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE];
|
||||||
|
short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE * 6 * 2]; // upsample to 48k and duplicate channel
|
||||||
|
short m_upsamplerLastValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDRBASE_DSP_DVSERIALWORKER_H_ */
|
#endif /* SDRBASE_DSP_DVSERIALWORKER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user