mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 18:15:45 -05:00
DV Serial: prepare multi slot (3)
This commit is contained in:
parent
413ba162c7
commit
01c901a8fe
@ -26,13 +26,8 @@ MESSAGE_CLASS_DEFINITION(DVSerialWorker::MsgTest, Message)
|
||||
DVSerialWorker::DVSerialWorker() :
|
||||
m_running(false),
|
||||
m_currentGainIn(0),
|
||||
m_currentGainOut(0),
|
||||
// m_upsamplerLastValue(0),
|
||||
m_phase(0)
|
||||
m_currentGainOut(0)
|
||||
{
|
||||
// m_audioBuffer.resize(48000);
|
||||
// m_audioBufferFill = 0;
|
||||
// m_audioFifo = 0;
|
||||
}
|
||||
|
||||
DVSerialWorker::~DVSerialWorker()
|
||||
@ -85,11 +80,15 @@ void DVSerialWorker::handleInputMessages()
|
||||
{
|
||||
MsgMbeDecode *decodeMsg = (MsgMbeDecode *) message;
|
||||
int dBVolume = (decodeMsg->getVolumeIndex() - 30) / 2;
|
||||
unsigned int fifoSlot = decodeMsg->getFifoSlot();
|
||||
|
||||
if (m_dvController.decode(m_dvAudioSamples, decodeMsg->getMbeFrame(), decodeMsg->getMbeRate(), dBVolume))
|
||||
if (m_dvController.decode(m_fifoSlots[fifoSlot].m_dvAudioSamples, decodeMsg->getMbeFrame(), decodeMsg->getMbeRate(), dBVolume))
|
||||
{
|
||||
upsample6(m_dvAudioSamples, SerialDV::MBE_AUDIO_BLOCK_SIZE, decodeMsg->getChannels(), decodeMsg->getFifoSlot());
|
||||
audioFifo[decodeMsg->getFifoSlot()] = decodeMsg->getAudioFifo();
|
||||
upsample6(m_fifoSlots[fifoSlot].m_dvAudioSamples,
|
||||
SerialDV::MBE_AUDIO_BLOCK_SIZE,
|
||||
decodeMsg->getChannels(),
|
||||
fifoSlot);
|
||||
audioFifo[fifoSlot] = decodeMsg->getAudioFifo();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -183,67 +182,3 @@ void DVSerialWorker::upsample6(short *in, int nbSamplesIn, unsigned char channel
|
||||
m_fifoSlots[fifoSlot].m_upsamplerLastValue = in[i];
|
||||
}
|
||||
}
|
||||
|
||||
//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;
|
||||
//
|
||||
//// DEBUG:
|
||||
//// for (int j = 0; j < 6; j++)
|
||||
//// {
|
||||
//// up = 32768.0f * cos(m_phase);
|
||||
//// *out = up;
|
||||
//// out ++;
|
||||
//// *out = up;
|
||||
//// out ++;
|
||||
//// m_phase += M_PI / 6.0;
|
||||
//// }
|
||||
////
|
||||
//// if ((i % 2) == 1)
|
||||
//// {
|
||||
//// m_phase = 0.0f;
|
||||
//// }
|
||||
//
|
||||
// up = m_upsampleFilter.run((cur*1 + prev*5) / 6);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// up = m_upsampleFilter.run((cur*2 + prev*4) / 6);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// up = m_upsampleFilter.run((cur*3 + prev*3) / 6);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// up = m_upsampleFilter.run((cur*4 + prev*2) / 6);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// up = m_upsampleFilter.run((cur*5 + prev*1) / 6);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// up = m_upsampleFilter.run(in[i]);
|
||||
// *out = up;
|
||||
// out++;
|
||||
// *out = up;
|
||||
// out++;
|
||||
//
|
||||
// m_upsamplerLastValue = in[i];
|
||||
// }
|
||||
//}
|
||||
|
@ -148,20 +148,17 @@ private:
|
||||
uint m_audioBufferFill;
|
||||
short m_upsamplerLastValue;
|
||||
MBEAudioInterpolatorFilter m_upsampleFilter;
|
||||
short m_dvAudioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
// void upsample6(short *in, short *out, int nbSamplesIn);
|
||||
void upsample6(short *in, int nbSamplesIn, unsigned char channels, unsigned int fifoSlot);
|
||||
|
||||
SerialDV::DVController m_dvController;
|
||||
bool m_running;
|
||||
int m_currentGainIn;
|
||||
int m_currentGainOut;
|
||||
short m_dvAudioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE];
|
||||
//short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE * 6 * 2]; // upsample to 48k and duplicate channel
|
||||
static const unsigned int m_nbFifoSlots = 1;
|
||||
FifoSlot m_fifoSlots[m_nbFifoSlots];
|
||||
float m_phase;
|
||||
};
|
||||
|
||||
#endif /* SDRBASE_DSP_DVSERIALWORKER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user