Browse Source

SoapySDR support: output: fixed sample FIFO resizing

chirpmodem-v8.0.0
f4exb 8 years ago
parent
commit
2bc59154bf
  1. 4
      devices/soapysdr/devicesoapysdrshared.cpp
  2. 4
      devices/soapysdr/devicesoapysdrshared.h
  3. 32
      plugins/samplesink/soapysdroutput/soapysdroutput.cpp

4
devices/soapysdr/devicesoapysdrshared.cpp

@ -18,6 +18,10 @@ @@ -18,6 +18,10 @@
MESSAGE_CLASS_DEFINITION(DeviceSoapySDRShared::MsgReportBuddyChange, Message)
const float DeviceSoapySDRShared::m_sampleFifoLengthInSeconds = 0.25;
const int DeviceSoapySDRShared::m_sampleFifoMinSize = 75000; // 300 kS/s knee
const int DeviceSoapySDRShared::m_sampleFifoMinSize32 = 150000; // Fixed for interpolation by 32
DeviceSoapySDRShared::DeviceSoapySDRShared() :
m_device(0),
m_channel(-1),

4
devices/soapysdr/devicesoapysdrshared.h

@ -87,6 +87,10 @@ public: @@ -87,6 +87,10 @@ public:
int m_channel; //!< allocated channel (-1 if none)
SoapySDRInput *m_source;
SoapySDROutput *m_sink;
static const float m_sampleFifoLengthInSeconds;
static const int m_sampleFifoMinSize;
static const int m_sampleFifoMinSize32;
};

32
plugins/samplesink/soapysdroutput/soapysdroutput.cpp

@ -621,6 +621,38 @@ bool SoapySDROutput::applySettings(const SoapySDROutputSettings& settings, bool @@ -621,6 +621,38 @@ bool SoapySDROutput::applySettings(const SoapySDROutputSettings& settings, bool
xlatedDeviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
xlatedDeviceCenterFrequency = xlatedDeviceCenterFrequency < 0 ? 0 : xlatedDeviceCenterFrequency;
// resize FIFO
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
{
SoapySDROutputThread *soapySDROutputThread = findThread();
SampleSourceFifo *fifo = 0;
if (soapySDROutputThread)
{
fifo = soapySDROutputThread->getFifo(requestedChannel);
soapySDROutputThread->setFifo(requestedChannel, 0);
}
int fifoSize;
if (settings.m_log2Interp >= 5)
{
fifoSize = DeviceSoapySDRShared::m_sampleFifoMinSize32;
}
else
{
fifoSize = std::max(
(int) ((settings.m_devSampleRate/(1<<settings.m_log2Interp)) * DeviceSoapySDRShared::m_sampleFifoLengthInSeconds),
DeviceSoapySDRShared::m_sampleFifoMinSize);
}
m_sampleSourceFifo.resize(fifoSize);
if (fifo) {
soapySDROutputThread->setFifo(requestedChannel, &m_sampleSourceFifo);
}
}
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
{
forwardChangeOwnDSP = true;

Loading…
Cancel
Save