mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
Implement own FIFO in BasebandSampleSource. SampleSourceFIFO: remove useless chunk size completely and set initial fill to only half the FIFO size
This commit is contained in:
parent
ce77f95a2c
commit
e05822ba02
@ -86,7 +86,7 @@ void FileSinkThread::setSamplerate(int samplerate)
|
||||
|
||||
// resize sample FIFO
|
||||
if (m_sampleFifo) {
|
||||
m_sampleFifo->resize(samplerate, samplerate/4); // 1s buffer with 250ms write chunk size
|
||||
m_sampleFifo->resize(samplerate); // 1s buffer
|
||||
}
|
||||
|
||||
m_samplerate = samplerate;
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include "dsp/basebandsamplesource.h"
|
||||
#include "util/message.h"
|
||||
|
||||
BasebandSampleSource::BasebandSampleSource()
|
||||
BasebandSampleSource::BasebandSampleSource() :
|
||||
m_sampleFifo(48000) // arbitrary, will be adjusted to match device sink FIFO size
|
||||
{
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
protected:
|
||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||
MessageQueue m_outputMessageQueue; //!< Queue for asynchronous outbound communication
|
||||
SampleSourceFifo m_sampleFifo; //!< Internal FIFO for multi-channel processing
|
||||
|
||||
protected slots:
|
||||
void handleInputMessages();
|
||||
|
@ -380,12 +380,14 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
|
||||
for(BasebandSampleSources::const_iterator it = m_basebandSampleSources.begin(); it != m_basebandSampleSources.end(); it++)
|
||||
{
|
||||
qDebug() << "DSPDeviceSinkEngine::gotoRunning: starting " << (*it)->objectName().toStdString().c_str();
|
||||
// TODO: equalize channel source FIFO size with device sink FIFO size
|
||||
(*it)->start();
|
||||
}
|
||||
|
||||
for (ThreadedBasebandSampleSources::const_iterator it = m_threadedBasebandSampleSources.begin(); it != m_threadedBasebandSampleSources.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceSinkEngine::gotoRunning: starting ThreadedSampleSource(" << (*it)->getSampleSourceObjectName().toStdString().c_str() << ")";
|
||||
// TODO: equalize channel source FIFO size with device sink FIFO size
|
||||
(*it)->start();
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,9 @@ SampleSourceFifo::SampleSourceFifo(uint32_t size) :
|
||||
SampleSourceFifo::~SampleSourceFifo()
|
||||
{}
|
||||
|
||||
void SampleSourceFifo::resize(uint32_t size, uint32_t samplesChunkSize)
|
||||
void SampleSourceFifo::resize(uint32_t size)
|
||||
{
|
||||
qDebug("SampleSourceFifo::resize: %d, %d", size, samplesChunkSize);
|
||||
assert(samplesChunkSize <= size/4);
|
||||
qDebug("SampleSourceFifo::resize: %d", size);
|
||||
|
||||
m_size = size;
|
||||
m_data.resize(2*m_size);
|
||||
@ -60,7 +59,7 @@ void SampleSourceFifo::readAdvance(SampleVector::iterator& readUntil, unsigned i
|
||||
|
||||
if (m_init)
|
||||
{
|
||||
emit dataWrite(m_size);
|
||||
emit dataWrite(m_size/2);
|
||||
m_init = false;
|
||||
}
|
||||
else if (i_delta > 0)
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
SampleSourceFifo(uint32_t size);
|
||||
~SampleSourceFifo();
|
||||
|
||||
void resize(uint32_t size, uint32_t samplesChunkSize);
|
||||
void resize(uint32_t size);
|
||||
void init();
|
||||
/** advance read pointer for the given length and activate R/W signals */
|
||||
void readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples);
|
||||
|
Loading…
Reference in New Issue
Block a user