mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-25 05:25:27 -04: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_throttlems(SDRDAEMONSOURCE_THROTTLE_MS),
|
||||||
m_readLengthSamples(0),
|
m_readLengthSamples(0),
|
||||||
m_readLength(0),
|
m_readLength(0),
|
||||||
|
m_converterBuffer(0),
|
||||||
|
m_converterBufferNbSamples(0),
|
||||||
m_throttleToggle(false),
|
m_throttleToggle(false),
|
||||||
m_rateDivider(1000/SDRDAEMONSOURCE_THROTTLE_MS),
|
m_rateDivider(1000/SDRDAEMONSOURCE_THROTTLE_MS),
|
||||||
m_autoCorrBuffer(true)
|
m_autoCorrBuffer(true)
|
||||||
@ -72,6 +74,7 @@ SDRdaemonSourceUDPHandler::~SDRdaemonSourceUDPHandler()
|
|||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
delete[] m_udpBuf;
|
delete[] m_udpBuf;
|
||||||
|
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||||
#ifdef USE_INTERNAL_TIMER
|
#ifdef USE_INTERNAL_TIMER
|
||||||
if (m_timer) {
|
if (m_timer) {
|
||||||
delete m_timer;
|
delete m_timer;
|
||||||
@ -263,9 +266,32 @@ void SDRdaemonSourceUDPHandler::tick()
|
|||||||
|
|
||||||
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
||||||
|
|
||||||
|
if (SDR_RX_SAMP_SZ == 16)
|
||||||
|
{
|
||||||
// read samples directly feeding the SampleFifo (no callback)
|
// read samples directly feeding the SampleFifo (no callback)
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
||||||
m_samplesCount += m_readLengthSamples;
|
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)
|
if (m_tickCount < m_rateDivider)
|
||||||
{
|
{
|
||||||
|
@ -77,6 +77,8 @@ private:
|
|||||||
int m_throttlems;
|
int m_throttlems;
|
||||||
uint32_t m_readLengthSamples;
|
uint32_t m_readLengthSamples;
|
||||||
uint32_t m_readLength;
|
uint32_t m_readLength;
|
||||||
|
int32_t *m_converterBuffer;
|
||||||
|
uint32_t m_converterBufferNbSamples;
|
||||||
bool m_throttleToggle;
|
bool m_throttleToggle;
|
||||||
uint32_t m_rateDivider;
|
uint32_t m_rateDivider;
|
||||||
bool m_autoCorrBuffer;
|
bool m_autoCorrBuffer;
|
||||||
|
@ -74,7 +74,7 @@ uint SampleSinkFifo::write(const quint8* data, uint count)
|
|||||||
uint remaining;
|
uint remaining;
|
||||||
uint len;
|
uint len;
|
||||||
const Sample* begin = (const Sample*)data;
|
const Sample* begin = (const Sample*)data;
|
||||||
count /= 4;
|
count /= sizeof(Sample);
|
||||||
|
|
||||||
total = MIN(count, m_size - m_fill);
|
total = MIN(count, m_size - m_fill);
|
||||||
if(total < count) {
|
if(total < count) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user