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); };