diff --git a/sdrbase/dsp/devicesamplemimo.cpp b/sdrbase/dsp/devicesamplemimo.cpp index d2c9eff2e..ede058a4c 100644 --- a/sdrbase/dsp/devicesamplemimo.cpp +++ b/sdrbase/dsp/devicesamplemimo.cpp @@ -42,12 +42,3 @@ void DeviceSampleMIMO::handleInputMessages() } } } - -SampleSourceFifo* DeviceSampleMIMO::getSampleSourceFifo(unsigned int index) -{ - if (index >= m_sampleSourceFifos.size()) { - return nullptr; - } else { - return &m_sampleSourceFifos[index]; - } -} diff --git a/sdrbase/dsp/devicesamplemimo.h b/sdrbase/dsp/devicesamplemimo.h index 4114dc727..793bdecd7 100644 --- a/sdrbase/dsp/devicesamplemimo.h +++ b/sdrbase/dsp/devicesamplemimo.h @@ -23,6 +23,7 @@ #include "samplesourcefifo.h" #include "samplemififo.h" +#include "samplemofifo.h" #include "util/message.h" #include "util/messagequeue.h" #include "export.h" @@ -132,23 +133,23 @@ public: virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } - unsigned int getNbSourceFifos() const { return m_sampleSourceFifos.size(); } //!< Get the number of Tx FIFOs - unsigned int getNbSinkFifos() const { return m_sampleMIFifo.getNbStreams(); } //!< Get the number of Rx FIFOs - SampleSourceFifo* getSampleSourceFifo(unsigned int index); //!< Get Tx FIFO at index + unsigned int getNbSourceFifos() const { return m_sampleMOFifo.getNbStreams(); } //!< Get the number of Tx FIFOs + unsigned int getNbSinkFifos() const { return m_sampleMIFifo.getNbStreams(); } //!< Get the number of Rx FIFOs SampleMIFifo* getSampleMIFifo() { return &m_sampleMIFifo; } + SampleMOFifo* getSampleMOFifo() { return &m_sampleMOFifo; } // Streams and FIFOs are in opposed source/sink type whick makes it confusing when stream direction is involved: // Rx: source stream -> sink FIFO -> channel sinks // Tx: sink stream <- source FIFO <- channel sources unsigned int getNbSourceStreams() const { return m_sampleMIFifo.getNbStreams(); } //!< Commodity function same as getNbSinkFifos (Rx or source streams) - unsigned int getNbSinkStreams() const { return m_sampleSourceFifos.size(); } //!< Commodity function same as getNbSourceFifos (Tx or sink streams) + unsigned int getNbSinkStreams() const { return m_sampleMOFifo.getNbStreams(); } //!< Commodity function same as getNbSourceFifos (Tx or sink streams) protected slots: void handleInputMessages(); protected: MIMOType m_mimoType; - std::vector m_sampleSourceFifos; //!< Tx FIFOs SampleMIFifo m_sampleMIFifo; //!< Multiple Input FIFO + SampleMOFifo m_sampleMOFifo; //!< Multiple Output FIFO MessageQueue m_inputMessageQueue; //!< Input queue to the sink MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI }; diff --git a/sdrbase/dsp/dspdevicemimoengine.cpp b/sdrbase/dsp/dspdevicemimoengine.cpp index cf8b26ebf..0e37872e1 100644 --- a/sdrbase/dsp/dspdevicemimoengine.cpp +++ b/sdrbase/dsp/dspdevicemimoengine.cpp @@ -834,11 +834,11 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages() BasebandSampleSink* spectrumSink = ((DSPRemoveSpectrumSink*) message)->getSampleSink(); spectrumSink->stop(); - if (!m_spectrumInputSourceElseSink && m_deviceSampleMIMO && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) - { - SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex); - disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); - } + // if (!m_spectrumInputSourceElseSink && m_deviceSampleMIMO && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) + // { + // SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex); + // disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + // } m_spectrumSink = nullptr; } @@ -850,16 +850,16 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages() if ((spectrumInputSourceElseSink != m_spectrumInputSourceElseSink) || (spectrumInputIndex != m_spectrumInputIndex)) { - if (!m_spectrumInputSourceElseSink) // remove the source listener - { - SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex); - disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); - } + // if (!m_spectrumInputSourceElseSink) // remove the source listener + // { + // SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex); + // disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + // } if ((!spectrumInputSourceElseSink) && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) // add the source listener { - SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex); - connect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + // SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex); + // connect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); if (m_spectrumSink) { @@ -1043,18 +1043,6 @@ void DSPDeviceMIMOEngine::configureCorrections(bool dcOffsetCorrection, bool iqI m_inputMessageQueue.push(cmd); } -// This is used for the Tx (sink streams) side -void DSPDeviceMIMOEngine::handleForwardToSpectrumSink(int nbSamples) -{ - if ((m_spectrumSink) && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) - { - SampleSourceFifo* sampleFifo = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex); - SampleVector::iterator readUntil; - sampleFifo->getReadIterator(readUntil); - m_spectrumSink->feed(readUntil - nbSamples, readUntil, false); - } -} - void DSPDeviceMIMOEngine::iqCorrections(SampleVector::iterator begin, SampleVector::iterator end, int isource, bool imbalanceCorrection) { for(SampleVector::iterator it = begin; it < end; it++) diff --git a/sdrbase/dsp/dspdevicemimoengine.h b/sdrbase/dsp/dspdevicemimoengine.h index bc0e24f14..20eb06400 100644 --- a/sdrbase/dsp/dspdevicemimoengine.h +++ b/sdrbase/dsp/dspdevicemimoengine.h @@ -375,7 +375,6 @@ private slots: void handleDataRxAsync(int streamIndex); //!< Handle data when Rx samples have to be processed asynchronously void handleSynchronousMessages(); //!< Handle synchronous messages with the thread void handleInputMessages(); //!< Handle input message queue - void handleForwardToSpectrumSink(int nbSamples); }; #endif // SDRBASE_DSP_DSPDEVICEMIMOENGINE_H_ diff --git a/sdrbase/dsp/samplemofifo.h b/sdrbase/dsp/samplemofifo.h index 3382d6d89..72c037619 100644 --- a/sdrbase/dsp/samplemofifo.h +++ b/sdrbase/dsp/samplemofifo.h @@ -48,6 +48,10 @@ public: ); void writeAsync(const SampleVector::const_iterator& begin, unsigned int amount, unsigned int stream); + const std::vector& getData() { return m_data; } + const SampleVector& getData(unsigned int stream) { return m_data[stream]; } + unsigned int getNbStreams() const { return m_data.size(); } + unsigned int remainderSync() { QMutexLocker mutexLocker(&m_mutex);