1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-18 13:48:37 -04:00

Deep redesign: debug AM demod removing extraneous interpolator init in start method

This commit is contained in:
f4exb
2015-08-24 00:51:27 +02:00
parent bc287a4c33
commit 19b234c4df
16 changed files with 181 additions and 124 deletions
+27 -10
View File
@@ -1,10 +1,26 @@
#include <QThread>
#include <QDebug>
#include <QApplication>
#include "dsp/threadedsamplesink.h"
#include "dsp/dspcommands.h"
#include "util/message.h"
ThreadedSampleFifo::ThreadedSampleFifo(SampleSink *sampleSink, std::size_t size) :
m_sampleSink(sampleSink)
{
connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleFifoData()));
m_sampleFifo.setSize(size);
}
ThreadedSampleFifo::~ThreadedSampleFifo()
{
m_sampleFifo.readCommit(m_sampleFifo.fill());
}
void ThreadedSampleFifo::writeToFifo(SampleVector::const_iterator& begin, SampleVector::const_iterator& end)
{
m_sampleFifo.write(begin, end);
}
ThreadedSampleSink::ThreadedSampleSink(SampleSink* sampleSink, QObject *parent) :
m_sampleSink(sampleSink)
{
@@ -14,11 +30,13 @@ ThreadedSampleSink::ThreadedSampleSink(SampleSink* sampleSink, QObject *parent)
qDebug() << "ThreadedSampleSink::ThreadedSampleSink: " << name;
m_thread = new QThread(parent);
moveToThread(m_thread); // FIXME: the intermediate FIFO should be handled within the sink. Define a new type of sink that is compatible with threading
m_threadedSampleFifo = new ThreadedSampleFifo(m_sampleSink);
//moveToThread(m_thread); // FIXME: Fixed? the intermediate FIFO should be handled within the sink. Define a new type of sink that is compatible with threading
m_sampleSink->moveToThread(m_thread);
m_sampleFifo.moveToThread(m_thread);
connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData()));
m_sampleFifo.setSize(262144);
m_threadedSampleFifo->moveToThread(m_thread);
//m_sampleFifo.moveToThread(m_thread);
//connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData()));
//m_sampleFifo.setSize(262144);
qDebug() << "ThreadedSampleSink::ThreadedSampleSink: thread: " << thread() << " m_thread: " << m_thread;
}
@@ -41,14 +59,13 @@ void ThreadedSampleSink::stop()
m_sampleSink->stop();
m_thread->exit();
m_thread->wait();
m_sampleFifo.readCommit(m_sampleFifo.fill());
}
void ThreadedSampleSink::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
{
// m_sampleSink->feed(begin, end, positiveOnly);
m_sampleFifo.write(begin, end);
//m_sampleSink->feed(begin, end, positiveOnly);
//m_sampleFifo.write(begin, end);
m_threadedSampleFifo->writeToFifo(begin, end);
}
bool ThreadedSampleSink::handleSinkMessage(Message& cmd)
@@ -62,7 +79,7 @@ QString ThreadedSampleSink::getSampleSinkObjectName() const
}
void ThreadedSampleSink::handleData() // FIXME: Move it to the new threadable sink class
void ThreadedSampleFifo::handleFifoData() // FIXME: Fixed? Move it to the new threadable sink class
{
bool positiveOnly = false;