mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-28 21:12:26 -04:00
SoapySDR output: support floating point type samples
This commit is contained in:
parent
7eef772b55
commit
2d44fa3b99
@ -169,7 +169,7 @@ void SoapySDROutputThread::run()
|
|||||||
break;
|
break;
|
||||||
case InterpolatorFloat:
|
case InterpolatorFloat:
|
||||||
default:
|
default:
|
||||||
// TODO
|
callbackSOIF((float*) buffs[0], numElems);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ void SoapySDROutputThread::callbackMO(std::vector<void *>& buffs, qint32 samples
|
|||||||
break;
|
break;
|
||||||
case InterpolatorFloat:
|
case InterpolatorFloat:
|
||||||
default:
|
default:
|
||||||
// TODO
|
std::fill((float*) buffs[ichan], (float*) buffs[ichan] + 2*samplesPerChannel, 0.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,3 +437,57 @@ void SoapySDROutputThread::callbackSO16(qint16* buf, qint32 len, unsigned int ch
|
|||||||
std::fill(buf, buf+2*len, 0);
|
std::fill(buf, buf+2*len, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SoapySDROutputThread::callbackSOIF(float* buf, qint32 len, unsigned int channel)
|
||||||
|
{
|
||||||
|
if (m_channels[channel].m_sampleFifo)
|
||||||
|
{
|
||||||
|
float bal = m_channels[channel].m_sampleFifo->getRWBalance();
|
||||||
|
|
||||||
|
if (bal < -0.25) {
|
||||||
|
qDebug("SoapySDROutputThread::callbackSO16: read lags: %f", bal);
|
||||||
|
} else if (bal > 0.25) {
|
||||||
|
qDebug("SoapySDROutputThread::callbackSO16: read leads: %f", bal);
|
||||||
|
}
|
||||||
|
|
||||||
|
SampleVector::iterator beginRead;
|
||||||
|
m_channels[channel].m_sampleFifo->readAdvance(beginRead, len/(1<<m_channels[channel].m_log2Interp));
|
||||||
|
beginRead -= len;
|
||||||
|
|
||||||
|
if (m_channels[channel].m_log2Interp == 0)
|
||||||
|
{
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate1(&beginRead, buf, len*2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (m_channels[channel].m_log2Interp)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate2_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate4_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate8_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate16_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate32_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
m_channels[channel].m_interpolatorsIF.interpolate64_cen(&beginRead, buf, len*2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::fill(buf, buf+2*len, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "soapysdr/devicesoapysdrshared.h"
|
#include "soapysdr/devicesoapysdrshared.h"
|
||||||
#include "dsp/interpolators.h"
|
#include "dsp/interpolators.h"
|
||||||
|
#include "dsp/interpolatorsif.h"
|
||||||
|
|
||||||
class SampleSourceFifo;
|
class SampleSourceFifo;
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ private:
|
|||||||
Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators8;
|
Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators8;
|
||||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators12;
|
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators12;
|
||||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 16> m_interpolators16;
|
Interpolators<qint16, SDR_TX_SAMP_SZ, 16> m_interpolators16;
|
||||||
|
InterpolatorsIF<SDR_TX_SAMP_SZ, SDR_TX_SAMP_SZ> m_interpolatorsIF;
|
||||||
|
|
||||||
Channel() :
|
Channel() :
|
||||||
m_sampleFifo(0),
|
m_sampleFifo(0),
|
||||||
@ -90,6 +92,7 @@ private:
|
|||||||
void callbackSO8(qint8* buf, qint32 len, unsigned int channel = 0);
|
void callbackSO8(qint8* buf, qint32 len, unsigned int channel = 0);
|
||||||
void callbackSO12(qint16* buf, qint32 len, unsigned int channel = 0);
|
void callbackSO12(qint16* buf, qint32 len, unsigned int channel = 0);
|
||||||
void callbackSO16(qint16* buf, qint32 len, unsigned int channel = 0);
|
void callbackSO16(qint16* buf, qint32 len, unsigned int channel = 0);
|
||||||
|
void callbackSOIF(float* buf, qint32 len, unsigned int channel = 0);
|
||||||
void callbackMO(std::vector<void *>& buffs, qint32 samplesPerChannel);
|
void callbackMO(std::vector<void *>& buffs, qint32 samplesPerChannel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,6 +133,7 @@ set(sdrbase_HEADERS
|
|||||||
dsp/decimatorsfi.h
|
dsp/decimatorsfi.h
|
||||||
dsp/decimatorsu.h
|
dsp/decimatorsu.h
|
||||||
dsp/interpolators.h
|
dsp/interpolators.h
|
||||||
|
dsp/interpolatorsif.h
|
||||||
dsp/dspcommands.h
|
dsp/dspcommands.h
|
||||||
dsp/dspengine.h
|
dsp/dspengine.h
|
||||||
dsp/dspdevicesourceengine.h
|
dsp/dspdevicesourceengine.h
|
||||||
|
1386
sdrbase/dsp/interpolatorsif.h
Normal file
1386
sdrbase/dsp/interpolatorsif.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user