mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
SDRDaemon input: adaptation for 24 bit Rx DSP
This commit is contained in:
parent
4448b57b60
commit
3d77c9af9b
@ -51,6 +51,8 @@ SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo,
|
||||
m_throttlems(SDRDAEMONSOURCE_THROTTLE_MS),
|
||||
m_readLengthSamples(0),
|
||||
m_readLength(0),
|
||||
m_converterBuffer(0),
|
||||
m_converterBufferNbSamples(0),
|
||||
m_throttleToggle(false),
|
||||
m_rateDivider(1000/SDRDAEMONSOURCE_THROTTLE_MS),
|
||||
m_autoCorrBuffer(true)
|
||||
@ -72,6 +74,7 @@ SDRdaemonSourceUDPHandler::~SDRdaemonSourceUDPHandler()
|
||||
{
|
||||
stop();
|
||||
delete[] m_udpBuf;
|
||||
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||
#ifdef USE_INTERNAL_TIMER
|
||||
if (m_timer) {
|
||||
delete m_timer;
|
||||
@ -263,9 +266,32 @@ void SDRdaemonSourceUDPHandler::tick()
|
||||
|
||||
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
||||
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
// read samples directly feeding the SampleFifo (no callback)
|
||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
||||
m_samplesCount += m_readLengthSamples;
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
if (m_readLengthSamples > m_converterBufferNbSamples)
|
||||
{
|
||||
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
||||
}
|
||||
|
||||
uint8_t *buf = m_sdrDaemonBuffer.readData(m_readLength);
|
||||
|
||||
for (unsigned int is = 0; is < m_readLengthSamples; is++)
|
||||
{
|
||||
m_converterBuffer[2*is] = ((int16_t*)buf)[2*is];
|
||||
m_converterBuffer[2*is]<<=8;
|
||||
m_converterBuffer[2*is+1] = ((int16_t*)buf)[2*is+1];
|
||||
m_converterBuffer[2*is+1]<<=8;
|
||||
}
|
||||
|
||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*4*2);
|
||||
}
|
||||
|
||||
if (m_tickCount < m_rateDivider)
|
||||
{
|
||||
|
@ -77,6 +77,8 @@ private:
|
||||
int m_throttlems;
|
||||
uint32_t m_readLengthSamples;
|
||||
uint32_t m_readLength;
|
||||
int32_t *m_converterBuffer;
|
||||
uint32_t m_converterBufferNbSamples;
|
||||
bool m_throttleToggle;
|
||||
uint32_t m_rateDivider;
|
||||
bool m_autoCorrBuffer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@ -74,7 +74,7 @@ uint SampleSinkFifo::write(const quint8* data, uint count)
|
||||
uint remaining;
|
||||
uint len;
|
||||
const Sample* begin = (const Sample*)data;
|
||||
count /= 4;
|
||||
count /= sizeof(Sample);
|
||||
|
||||
total = MIN(count, m_size - m_fill);
|
||||
if(total < count) {
|
||||
|
Loading…
Reference in New Issue
Block a user