From 5021d15162c2240c548f04678779f70405d70edc Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 24 Oct 2016 18:31:14 +0200 Subject: [PATCH] Tx ph.1: Connect sample source FIFO read signal with forwarding samples to spectrum sink --- sdrbase/dsp/dspdevicesinkengine.cpp | 21 +++++++++++++++++---- sdrbase/dsp/dspdevicesinkengine.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sdrbase/dsp/dspdevicesinkengine.cpp b/sdrbase/dsp/dspdevicesinkengine.cpp index 65c696e95..0a80efc14 100644 --- a/sdrbase/dsp/dspdevicesinkengine.cpp +++ b/sdrbase/dsp/dspdevicesinkengine.cpp @@ -218,10 +218,10 @@ void DSPDeviceSinkEngine::work() } // feed the mix to the main spectrum sink - if (m_spectrumSink) - { - m_spectrumSink->feed(writeBegin, writeBegin + nbWriteSamples, false); - } +// if (m_spectrumSink) +// { +// m_spectrumSink->feed(writeBegin, writeBegin + nbWriteSamples, false); +// } } } @@ -263,6 +263,8 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle() (*it)->stop(); } + disconnect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); + m_spectrumSink->stop(); m_deviceSampleSink->stop(); m_deviceDescription.clear(); @@ -374,6 +376,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning() (*it)->start(); } + connect(m_deviceSampleSink->getSampleFifo(), SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int))); m_spectrumSink->start(); qDebug() << "DSPDeviceSinkEngine::gotoRunning: input message queue pending: " << m_inputMessageQueue.size(); @@ -551,3 +554,13 @@ void DSPDeviceSinkEngine::handleInputMessages() } } +void DSPDeviceSinkEngine::handleForwardToSpectrumSink(int nbSamples) +{ + if (m_spectrumSink) + { + SampleSourceFifo* sampleFifo = m_deviceSampleSink->getSampleFifo(); + SampleVector::iterator readUntil; + sampleFifo->getReadIterator(readUntil); + m_spectrumSink->feed(readUntil - nbSamples, readUntil, false); + } +} diff --git a/sdrbase/dsp/dspdevicesinkengine.h b/sdrbase/dsp/dspdevicesinkengine.h index 9d8c2cbba..45155dc38 100644 --- a/sdrbase/dsp/dspdevicesinkengine.h +++ b/sdrbase/dsp/dspdevicesinkengine.h @@ -118,6 +118,7 @@ private slots: void handleData(); //!< Handle data when samples from source FIFO are ready to be processed void handleInputMessages(); //!< Handle input message queue void handleSynchronousMessages(); //!< Handle synchronous messages with the thread + void handleForwardToSpectrumSink(int nbSamples); };