From 08eaca8c0c130dc39518a1f6b760f3a47c2da5da Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 31 Oct 2019 08:44:21 +0100 Subject: [PATCH] Sample MO FIFO: method to resize data vectors --- sdrbase/dsp/samplemofifo.cpp | 16 ++++++++++++++++ sdrbase/dsp/samplemofifo.h | 1 + 2 files changed, 17 insertions(+) diff --git a/sdrbase/dsp/samplemofifo.cpp b/sdrbase/dsp/samplemofifo.cpp index 48fad2407..704fc53fe 100644 --- a/sdrbase/dsp/samplemofifo.cpp +++ b/sdrbase/dsp/samplemofifo.cpp @@ -38,6 +38,22 @@ void SampleMOFifo::init(unsigned int nbStreams, unsigned int size) } } +void SampleMOFifo::resize(unsigned int size) +{ + m_size = size; + m_readCount = 0; + m_readHead = 0; + m_writeHead = size/8; + + for (unsigned int stream = 0; stream < m_nbStreams; stream++) + { + m_data[stream].resize(size); + m_vReadCount.push_back(0); + m_vReadHead.push_back(0); + m_vWriteHead.push_back(size/8); + } +} + SampleMOFifo::SampleMOFifo(QObject *parent) : QObject(parent), m_nbStreams(0), diff --git a/sdrbase/dsp/samplemofifo.h b/sdrbase/dsp/samplemofifo.h index 51c217c5c..6eccfec3b 100644 --- a/sdrbase/dsp/samplemofifo.h +++ b/sdrbase/dsp/samplemofifo.h @@ -31,6 +31,7 @@ public: SampleMOFifo(unsigned int nbStreams, unsigned int size, QObject *parent = nullptr); ~SampleMOFifo(); void init(unsigned int nbStreams, unsigned int size); + void resize(unsigned int size); void reset(); void readSync(