mirror of https://github.com/f4exb/sdrangel.git
Removed ThreadedBasebandSampleSink
This commit is contained in:
parent
1e1cfba178
commit
1359aac9b6
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "device/deviceapi.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "chanalyzer.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "device/deviceuiset.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/spectrumscopecombovis.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "dsp/dspengine.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "device/deviceuiset.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "ui_amdemodgui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "device/deviceuiset.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/scopevis.h"
|
||||
#include "ui_atvdemodgui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "gui/glspectrum.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "device/deviceuiset.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "device/deviceapi.h"
|
||||
|
||||
#include "datvdemodreport.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "device/deviceuiset.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "ui_dsddemodgui.h"
|
||||
#include "dsp/scopevisxy.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <QThread>
|
||||
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/deviceapi.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "SWGWFMDemodReport.h"
|
||||
|
||||
#include <dsp/downchannelizer.h>
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "dsp/downchannelizer.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "SWGChannelSettings.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspdevicesourceengine.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "dsp/dspengine.h"
|
||||
#include "util/db.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
#include "device/deviceapi.h"
|
||||
|
|
|
@ -108,7 +108,6 @@ set(sdrbase_SOURCES
|
|||
dsp/basebandsamplesource.cpp
|
||||
dsp/nullsink.cpp
|
||||
dsp/recursivefilters.cpp
|
||||
dsp/threadedbasebandsamplesink.cpp
|
||||
dsp/wfir.cpp
|
||||
dsp/devicesamplesource.cpp
|
||||
dsp/devicesamplesink.cpp
|
||||
|
@ -248,7 +247,6 @@ set(sdrbase_HEADERS
|
|||
dsp/basebandsamplesink.h
|
||||
dsp/basebandsamplesource.h
|
||||
dsp/nullsink.h
|
||||
dsp/threadedbasebandsamplesink.h
|
||||
dsp/wfir.h
|
||||
dsp/devicesamplesource.h
|
||||
dsp/devicesamplesink.h
|
||||
|
|
|
@ -87,26 +87,6 @@ void DeviceAPI::setSpectrumSinkInput(bool sourceElseSink, unsigned int index)
|
|||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::addChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex)
|
||||
{
|
||||
if (m_deviceSourceEngine) {
|
||||
m_deviceSourceEngine->addThreadedSink(sink);
|
||||
} else if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addChannelSink(sink, streamIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::removeChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex)
|
||||
{
|
||||
(void) streamIndex;
|
||||
|
||||
if (m_deviceSourceEngine) {
|
||||
m_deviceSourceEngine->removeThreadedSink(sink);
|
||||
} else if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->removeChannelSink(sink, streamIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::addChannelSink(BasebandSampleSink* sink, int streamIndex)
|
||||
{
|
||||
if (m_deviceSourceEngine) {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "export.h"
|
||||
|
||||
class BasebandSampleSink;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class BasebandSampleSource;
|
||||
class MIMOChannel;
|
||||
class ChannelAPI;
|
||||
|
@ -71,8 +70,6 @@ public:
|
|||
void removeAncillarySink(BasebandSampleSink* sink, unsigned int index = 0); //!< Removes it
|
||||
void setSpectrumSinkInput(bool sourceElseSink = true, unsigned int index = 0); //!< Used in the MIMO case to select which stream is used as input to main spectrum
|
||||
|
||||
void addChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex = 0); //!< Add a channel sink (Rx)
|
||||
void removeChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex = 0); //!< Remove a channel sink (Rx)
|
||||
void addChannelSink(BasebandSampleSink* sink, int streamIndex = 0); //!< Add a channel sink (Rx)
|
||||
void removeChannelSink(BasebandSampleSink* sink, int streamIndex = 0); //!< Remove a channel sink (Rx)
|
||||
void addChannelSource(BasebandSampleSource* sink, int streamIndex = 0); //!< Add a channel source (Tx)
|
||||
|
|
|
@ -35,8 +35,6 @@ MESSAGE_CLASS_DEFINITION(DSPAddBasebandSampleSource, Message)
|
|||
MESSAGE_CLASS_DEFINITION(DSPRemoveBasebandSampleSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPRemoveSpectrumSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPRemoveBasebandSampleSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPAddThreadedBasebandSampleSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPRemoveThreadedBasebandSampleSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPAddAudioSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPRemoveAudioSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPConfigureCorrection, Message)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
class DeviceSampleSource;
|
||||
class BasebandSampleSink;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DeviceSampleSink;
|
||||
class BasebandSampleSource;
|
||||
class AudioFifo;
|
||||
|
@ -184,30 +183,6 @@ private:
|
|||
BasebandSampleSource* m_sampleSource;
|
||||
};
|
||||
|
||||
class SDRBASE_API DSPAddThreadedBasebandSampleSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
DSPAddThreadedBasebandSampleSink(ThreadedBasebandSampleSink* threadedSampleSink) : Message(), m_threadedSampleSink(threadedSampleSink) { }
|
||||
|
||||
ThreadedBasebandSampleSink* getThreadedSampleSink() const { return m_threadedSampleSink; }
|
||||
|
||||
private:
|
||||
ThreadedBasebandSampleSink* m_threadedSampleSink;
|
||||
};
|
||||
|
||||
class SDRBASE_API DSPRemoveThreadedBasebandSampleSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
DSPRemoveThreadedBasebandSampleSink(ThreadedBasebandSampleSink* threadedSampleSink) : Message(), m_threadedSampleSink(threadedSampleSink) { }
|
||||
|
||||
ThreadedBasebandSampleSink* getThreadedSampleSink() const { return m_threadedSampleSink; }
|
||||
|
||||
private:
|
||||
ThreadedBasebandSampleSink* m_threadedSampleSink;
|
||||
};
|
||||
|
||||
class SDRBASE_API DSPAddAudioSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "dspcommands.h"
|
||||
#include "threadedbasebandsamplesink.h"
|
||||
#include "basebandsamplesink.h"
|
||||
#include "basebandsamplesource.h"
|
||||
#include "devicesamplemimo.h"
|
||||
#include "mimochannel.h"
|
||||
|
@ -29,8 +29,6 @@
|
|||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::SetSampleMIMO, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddBasebandSampleSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveBasebandSampleSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddThreadedBasebandSampleSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveThreadedBasebandSampleSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddMIMOChannel, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveMIMOChannel, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddBasebandSampleSink, Message)
|
||||
|
@ -171,26 +169,6 @@ void DSPDeviceMIMOEngine::removeChannelSource(BasebandSampleSource* source, int
|
|||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::addChannelSink(ThreadedBasebandSampleSink* sink, int index)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::addThreadedSink: "
|
||||
<< sink->objectName().toStdString().c_str()
|
||||
<< " at: "
|
||||
<< index;
|
||||
AddThreadedBasebandSampleSink cmd(sink, index);
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::removeChannelSink(ThreadedBasebandSampleSink* sink, int index)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::removeThreadedSink: "
|
||||
<< sink->objectName().toStdString().c_str()
|
||||
<< " at: "
|
||||
<< index;
|
||||
RemoveThreadedBasebandSampleSink cmd(sink, index);
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::addChannelSink(BasebandSampleSink* sink, int index)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::addChannelSink: "
|
||||
|
@ -442,12 +420,6 @@ void DSPDeviceMIMOEngine::workSamplesSink(const SampleVector::const_iterator& vb
|
|||
m_spectrumSink->feed(vbegin, vend, positiveOnly);
|
||||
}
|
||||
|
||||
// feed data to threaded sinks
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks[streamIndex].begin(); it != m_threadedBasebandSampleSinks[streamIndex].end(); ++it)
|
||||
{
|
||||
(*it)->feed(vbegin, vend, positiveOnly);
|
||||
}
|
||||
|
||||
// feed data to MIMO channels
|
||||
for (MIMOChannels::const_iterator it = m_mimoChannels.begin(); it != m_mimoChannels.end(); ++it) {
|
||||
(*it)->feed(vbegin, vend, streamIndex);
|
||||
|
@ -559,17 +531,6 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoIdle(int subsystemIndex)
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<ThreadedBasebandSampleSinks>::const_iterator vtSinkIt = m_threadedBasebandSampleSinks.begin();
|
||||
|
||||
for (; vtSinkIt != m_threadedBasebandSampleSinks.end(); vtSinkIt++)
|
||||
{
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = vtSinkIt->begin(); it != vtSinkIt->end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping ThreadedBasebandSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->stop();
|
||||
}
|
||||
}
|
||||
|
||||
for (MIMOChannels::const_iterator it = m_mimoChannels.begin(); it != m_mimoChannels.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::gotoIdle: stopping MIMOChannel sinks: " << (*it)->objectName().toStdString().c_str();
|
||||
|
@ -676,15 +637,6 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit(int subsystemIndex)
|
|||
(*it)->handleMessage(notif);
|
||||
}
|
||||
}
|
||||
|
||||
if (isource < m_threadedBasebandSampleSinks.size())
|
||||
{
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks[isource].begin(); it != m_threadedBasebandSampleSinks[isource].end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::gotoInit: initializing ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->handleSinkMessage(notif);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (subsystemIndex == 1) // Tx
|
||||
|
@ -771,17 +723,6 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoRunning(int subsystemIndex)
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<ThreadedBasebandSampleSinks>::const_iterator vtSinkIt = m_threadedBasebandSampleSinks.begin();
|
||||
|
||||
for (; vtSinkIt != m_threadedBasebandSampleSinks.end(); vtSinkIt++)
|
||||
{
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = vtSinkIt->begin(); it != vtSinkIt->end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting ThreadedBasebandSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->start();
|
||||
}
|
||||
}
|
||||
|
||||
for (MIMOChannels::const_iterator it = m_mimoChannels.begin(); it != m_mimoChannels.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::gotoRunning: starting MIMOChannel sinks: " << (*it)->objectName().toStdString().c_str();
|
||||
|
@ -893,7 +834,6 @@ void DSPDeviceMIMOEngine::handleSetMIMO(DeviceSampleMIMO* mimo)
|
|||
for (int i = 0; i < m_deviceSampleMIMO->getNbSinkFifos(); i++)
|
||||
{
|
||||
m_basebandSampleSinks.push_back(BasebandSampleSinks());
|
||||
m_threadedBasebandSampleSinks.push_back(ThreadedBasebandSampleSinks());
|
||||
m_sourcesCorrections.push_back(SourceCorrection());
|
||||
}
|
||||
|
||||
|
@ -1060,38 +1000,6 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
|
|||
m_basebandSampleSinks[isource].remove(sink);
|
||||
}
|
||||
}
|
||||
else if (AddThreadedBasebandSampleSink::match(*message))
|
||||
{
|
||||
const AddThreadedBasebandSampleSink *msg = (AddThreadedBasebandSampleSink *) message;
|
||||
ThreadedBasebandSampleSink *threadedSink = msg->getThreadedSampleSink();
|
||||
unsigned int isource = msg->getIndex();
|
||||
|
||||
if (isource < m_threadedBasebandSampleSinks.size())
|
||||
{
|
||||
m_threadedBasebandSampleSinks[isource].push_back(threadedSink);
|
||||
// initialize sample rate and center frequency in the sink:
|
||||
int sourceStreamSampleRate = m_deviceSampleMIMO->getSourceSampleRate(isource);
|
||||
quint64 sourceCenterFrequency = m_deviceSampleMIMO->getSourceCenterFrequency(isource);
|
||||
DSPSignalNotification msg(sourceStreamSampleRate, sourceCenterFrequency);
|
||||
threadedSink->handleSinkMessage(msg);
|
||||
// start the sink:
|
||||
if (m_stateRx == StRunning) {
|
||||
threadedSink->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (RemoveThreadedBasebandSampleSink::match(*message))
|
||||
{
|
||||
const RemoveThreadedBasebandSampleSink *msg = (RemoveThreadedBasebandSampleSink *) message;
|
||||
ThreadedBasebandSampleSink* threadedSink = msg->getThreadedSampleSink();
|
||||
unsigned int isource = msg->getIndex();
|
||||
|
||||
if (isource < m_threadedBasebandSampleSinks.size())
|
||||
{
|
||||
threadedSink->stop();
|
||||
m_threadedBasebandSampleSinks[isource].remove(threadedSink);
|
||||
}
|
||||
}
|
||||
else if (AddBasebandSampleSource::match(*message))
|
||||
{
|
||||
const AddBasebandSampleSource *msg = (AddBasebandSampleSource *) message;
|
||||
|
@ -1313,16 +1221,6 @@ void DSPDeviceMIMOEngine::handleInputMessages()
|
|||
}
|
||||
}
|
||||
|
||||
// forward source changes to channel sinks with immediate execution (no queuing)
|
||||
if (istream < m_threadedBasebandSampleSinks.size())
|
||||
{
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks[istream].begin(); it != m_threadedBasebandSampleSinks[istream].end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::handleSourceMessages: forward message to ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->handleSinkMessage(*message);
|
||||
}
|
||||
}
|
||||
|
||||
// forward changes to MIMO GUI input queue
|
||||
MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
|
||||
qDebug("DeviceMIMOEngine::handleInputMessages: DSPMIMOSignalNotification: guiMessageQueue: %p", guiMessageQueue);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "export.h"
|
||||
|
||||
class DeviceSampleMIMO;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class BasebandSampleSink;
|
||||
class MIMOChannel;
|
||||
|
||||
|
@ -78,36 +77,6 @@ public:
|
|||
unsigned int m_index;
|
||||
};
|
||||
|
||||
class AddThreadedBasebandSampleSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
AddThreadedBasebandSampleSink(ThreadedBasebandSampleSink* threadedSampleSink, unsigned int index) :
|
||||
Message(),
|
||||
m_threadedSampleSink(threadedSampleSink),
|
||||
m_index(index)
|
||||
{ }
|
||||
ThreadedBasebandSampleSink* getThreadedSampleSink() const { return m_threadedSampleSink; }
|
||||
unsigned int getIndex() const { return m_index; }
|
||||
private:
|
||||
ThreadedBasebandSampleSink* m_threadedSampleSink;
|
||||
unsigned int m_index;
|
||||
};
|
||||
|
||||
class RemoveThreadedBasebandSampleSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
RemoveThreadedBasebandSampleSink(ThreadedBasebandSampleSink* threadedSampleSink, unsigned int index) :
|
||||
Message(),
|
||||
m_threadedSampleSink(threadedSampleSink),
|
||||
m_index(index)
|
||||
{ }
|
||||
ThreadedBasebandSampleSink* getThreadedSampleSink() const { return m_threadedSampleSink; }
|
||||
unsigned int getIndex() const { return m_index; }
|
||||
private:
|
||||
ThreadedBasebandSampleSink* m_threadedSampleSink;
|
||||
unsigned int m_index;
|
||||
};
|
||||
|
||||
class AddMIMOChannel : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
|
@ -264,8 +233,6 @@ public:
|
|||
void removeChannelSource(BasebandSampleSource* source, int index = 0); //!< Remove a channel source
|
||||
void addChannelSink(BasebandSampleSink* sink, int index = 0); //!< Add a channel sink
|
||||
void removeChannelSink(BasebandSampleSink* sink, int index = 0); //!< Remove a channel sink
|
||||
void addChannelSink(ThreadedBasebandSampleSink* sink, int index = 0); //!< Add a channel sink that will run on its own thread
|
||||
void removeChannelSink(ThreadedBasebandSampleSink* sink, int index = 0); //!< Remove a channel sink that runs on its own thread
|
||||
void addMIMOChannel(MIMOChannel *channel); //!< Add a MIMO channel
|
||||
void removeMIMOChannel(MIMOChannel *channel); //!< Remove a MIMO channel
|
||||
|
||||
|
@ -359,9 +326,6 @@ private:
|
|||
|
||||
typedef std::list<BasebandSampleSink*> BasebandSampleSinks;
|
||||
std::vector<BasebandSampleSinks> m_basebandSampleSinks; //!< ancillary sample sinks on main thread (per input stream)
|
||||
typedef std::list<ThreadedBasebandSampleSink*> ThreadedBasebandSampleSinks;
|
||||
std::vector<ThreadedBasebandSampleSinks> m_threadedBasebandSampleSinks; //!< channel sample sinks on their own thread (per input stream)
|
||||
|
||||
typedef std::list<BasebandSampleSource*> BasebandSampleSources;
|
||||
std::vector<BasebandSampleSources> m_basebandSampleSources; //!< channel sample sources (per output stream)
|
||||
std::vector<IncrementalVector<Sample>> m_sourceSampleBuffers;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "dsp/dspcommands.h"
|
||||
#include "util/fixed.h"
|
||||
#include "samplesinkfifo.h"
|
||||
#include "threadedbasebandsamplesink.h"
|
||||
|
||||
DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
|
||||
QThread(parent),
|
||||
|
@ -136,20 +135,6 @@ void DSPDeviceSourceEngine::removeSink(BasebandSampleSink* sink)
|
|||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceSourceEngine::addThreadedSink(ThreadedBasebandSampleSink* sink)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::addThreadedSink: " << sink->objectName().toStdString().c_str();
|
||||
DSPAddThreadedBasebandSampleSink cmd(sink);
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceSourceEngine::removeThreadedSink(ThreadedBasebandSampleSink* sink)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::removeThreadedSink: " << sink->objectName().toStdString().c_str();
|
||||
DSPRemoveThreadedBasebandSampleSink cmd(sink);
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceSourceEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::configureCorrections";
|
||||
|
@ -347,27 +332,12 @@ void DSPDeviceSourceEngine::work()
|
|||
iqCorrections(part1begin, part1end, m_iqImbalanceCorrection);
|
||||
}
|
||||
|
||||
// if (m_dcOffsetCorrection)
|
||||
// {
|
||||
// dcOffset(part1begin, part1end);
|
||||
// }
|
||||
//
|
||||
// if (m_iqImbalanceCorrection)
|
||||
// {
|
||||
// imbalance(part1begin, part1end);
|
||||
// }
|
||||
|
||||
// feed data to direct sinks
|
||||
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); ++it)
|
||||
{
|
||||
(*it)->feed(part1begin, part1end, positiveOnly);
|
||||
}
|
||||
|
||||
// feed data to threaded sinks
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
|
||||
{
|
||||
(*it)->feed(part1begin, part1end, positiveOnly);
|
||||
}
|
||||
}
|
||||
|
||||
// second part of FIFO data (used when block wraps around)
|
||||
|
@ -379,27 +349,12 @@ void DSPDeviceSourceEngine::work()
|
|||
iqCorrections(part2begin, part2end, m_iqImbalanceCorrection);
|
||||
}
|
||||
|
||||
// if (m_dcOffsetCorrection)
|
||||
// {
|
||||
// dcOffset(part2begin, part2end);
|
||||
// }
|
||||
//
|
||||
// if (m_iqImbalanceCorrection)
|
||||
// {
|
||||
// imbalance(part2begin, part2end);
|
||||
// }
|
||||
|
||||
// feed data to direct sinks
|
||||
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
|
||||
{
|
||||
(*it)->feed(part2begin, part2end, positiveOnly);
|
||||
}
|
||||
|
||||
// feed data to threaded sinks
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
|
||||
{
|
||||
(*it)->feed(part2begin, part2end, positiveOnly);
|
||||
}
|
||||
}
|
||||
|
||||
// adjust FIFO pointers
|
||||
|
@ -442,11 +397,6 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
|
|||
(*it)->stop();
|
||||
}
|
||||
|
||||
for(ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); it++)
|
||||
{
|
||||
(*it)->stop();
|
||||
}
|
||||
|
||||
m_deviceDescription.clear();
|
||||
m_sampleRate = 0;
|
||||
|
||||
|
@ -499,12 +449,6 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
|
|||
(*it)->handleMessage(notif);
|
||||
}
|
||||
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::gotoInit: initializing ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->handleSinkMessage(notif);
|
||||
}
|
||||
|
||||
// pass data to listeners
|
||||
if (m_deviceSampleSource->getMessageQueueToGUI())
|
||||
{
|
||||
|
@ -554,12 +498,6 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
|
|||
(*it)->start();
|
||||
}
|
||||
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::gotoRunning: starting ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->start();
|
||||
}
|
||||
|
||||
qDebug() << "DSPDeviceSourceEngine::gotoRunning:input message queue pending: " << m_inputMessageQueue.size();
|
||||
|
||||
return StRunning;
|
||||
|
@ -661,24 +599,6 @@ void DSPDeviceSourceEngine::handleSynchronousMessages()
|
|||
|
||||
m_basebandSampleSinks.remove(sink);
|
||||
}
|
||||
else if (DSPAddThreadedBasebandSampleSink::match(*message))
|
||||
{
|
||||
ThreadedBasebandSampleSink *threadedSink = ((DSPAddThreadedBasebandSampleSink*) message)->getThreadedSampleSink();
|
||||
m_threadedBasebandSampleSinks.push_back(threadedSink);
|
||||
// initialize sample rate and center frequency in the sink:
|
||||
DSPSignalNotification msg(m_sampleRate, m_centerFrequency);
|
||||
threadedSink->handleSinkMessage(msg);
|
||||
// start the sink:
|
||||
if(m_state == StRunning) {
|
||||
threadedSink->start();
|
||||
}
|
||||
}
|
||||
else if (DSPRemoveThreadedBasebandSampleSink::match(*message))
|
||||
{
|
||||
ThreadedBasebandSampleSink* threadedSink = ((DSPRemoveThreadedBasebandSampleSink*) message)->getThreadedSampleSink();
|
||||
threadedSink->stop();
|
||||
m_threadedBasebandSampleSinks.remove(threadedSink);
|
||||
}
|
||||
|
||||
m_syncMessenger.done(m_state);
|
||||
}
|
||||
|
@ -743,12 +663,6 @@ void DSPDeviceSourceEngine::handleInputMessages()
|
|||
(*it)->handleMessage(*message);
|
||||
}
|
||||
|
||||
for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
|
||||
{
|
||||
qDebug() << "DSPDeviceSourceEngine::handleSourceMessages: forward message to ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
|
||||
(*it)->handleSinkMessage(*message);
|
||||
}
|
||||
|
||||
// forward changes to source GUI input queue
|
||||
|
||||
MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI();
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
class DeviceSampleSource;
|
||||
class BasebandSampleSink;
|
||||
class ThreadedBasebandSampleSink;
|
||||
|
||||
class SDRBASE_API DSPDeviceSourceEngine : public QThread {
|
||||
Q_OBJECT
|
||||
|
@ -67,9 +66,6 @@ public:
|
|||
void addSink(BasebandSampleSink* sink); //!< Add a sample sink
|
||||
void removeSink(BasebandSampleSink* sink); //!< Remove a sample sink
|
||||
|
||||
void addThreadedSink(ThreadedBasebandSampleSink* sink); //!< Add a sample sink that will run on its own thread
|
||||
void removeThreadedSink(ThreadedBasebandSampleSink* sink); //!< Remove a sample sink that runs on its own thread
|
||||
|
||||
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure DSP corrections
|
||||
|
||||
State state() const { return m_state; } //!< Return DSP engine current state
|
||||
|
@ -94,9 +90,6 @@ private:
|
|||
typedef std::list<BasebandSampleSink*> BasebandSampleSinks;
|
||||
BasebandSampleSinks m_basebandSampleSinks; //!< sample sinks within main thread (usually spectrum, file output)
|
||||
|
||||
typedef std::list<ThreadedBasebandSampleSink*> ThreadedBasebandSampleSinks;
|
||||
ThreadedBasebandSampleSinks m_threadedBasebandSampleSinks; //!< sample sinks on their own threads (usually channels)
|
||||
|
||||
uint m_sampleRate;
|
||||
quint64 m_centerFrequency;
|
||||
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
#include "threadedbasebandsamplesink.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "util/message.h"
|
||||
|
||||
ThreadedBasebandSampleSinkFifo::ThreadedBasebandSampleSinkFifo(BasebandSampleSink *sampleSink, std::size_t size) :
|
||||
m_sampleSink(sampleSink)
|
||||
{
|
||||
connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleFifoData()));
|
||||
m_sampleFifo.setSize(size);
|
||||
}
|
||||
|
||||
ThreadedBasebandSampleSinkFifo::~ThreadedBasebandSampleSinkFifo()
|
||||
{
|
||||
m_sampleFifo.readCommit(m_sampleFifo.fill());
|
||||
}
|
||||
|
||||
void ThreadedBasebandSampleSinkFifo::writeToFifo(SampleVector::const_iterator& begin, SampleVector::const_iterator& end)
|
||||
{
|
||||
m_sampleFifo.write(begin, end);
|
||||
}
|
||||
|
||||
void ThreadedBasebandSampleSinkFifo::handleFifoData() // FIXME: Fixed? Move it to the new threadable sink class
|
||||
{
|
||||
bool positiveOnly = false;
|
||||
|
||||
while ((m_sampleFifo.fill() > 0) && (m_sampleSink->getInputMessageQueue()->size() == 0))
|
||||
{
|
||||
SampleVector::iterator part1begin;
|
||||
SampleVector::iterator part1end;
|
||||
SampleVector::iterator part2begin;
|
||||
SampleVector::iterator part2end;
|
||||
|
||||
std::size_t count = m_sampleFifo.readBegin(m_sampleFifo.fill(), &part1begin, &part1end, &part2begin, &part2end);
|
||||
|
||||
// first part of FIFO data
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
// handle data
|
||||
if(m_sampleSink != NULL)
|
||||
{
|
||||
m_sampleSink->feed(part1begin, part1end, positiveOnly);
|
||||
}
|
||||
|
||||
m_sampleFifo.readCommit(part1end - part1begin);
|
||||
}
|
||||
|
||||
// second part of FIFO data (used when block wraps around)
|
||||
|
||||
if(part2begin != part2end)
|
||||
{
|
||||
// handle data
|
||||
if(m_sampleSink != NULL)
|
||||
{
|
||||
m_sampleSink->feed(part2begin, part2end, positiveOnly);
|
||||
}
|
||||
|
||||
m_sampleFifo.readCommit(part2end - part2begin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThreadedBasebandSampleSink::ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent) :
|
||||
m_basebandSampleSink(sampleSink)
|
||||
{
|
||||
QString name = "ThreadedBasebandSampleSink(" + m_basebandSampleSink->objectName() + ")";
|
||||
setObjectName(name);
|
||||
|
||||
qDebug() << "ThreadedBasebandSampleSink::ThreadedBasebandSampleSink: " << name;
|
||||
|
||||
m_thread = new QThread(parent);
|
||||
m_threadedBasebandSampleSinkFifo = new ThreadedBasebandSampleSinkFifo(m_basebandSampleSink);
|
||||
//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_basebandSampleSink->moveToThread(m_thread);
|
||||
m_threadedBasebandSampleSinkFifo->moveToThread(m_thread);
|
||||
BasebandSampleSink::MsgThreadedSink *msg = BasebandSampleSink::MsgThreadedSink::create(m_thread); // inform of the new thread
|
||||
m_basebandSampleSink->handleMessage(*msg);
|
||||
delete msg;
|
||||
//m_sampleFifo.moveToThread(m_thread);
|
||||
//connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData()));
|
||||
//m_sampleFifo.setSize(262144);
|
||||
|
||||
qDebug() << "ThreadedBasebandSampleSink::ThreadedBasebandSampleSink: thread: " << thread() << " m_thread: " << m_thread;
|
||||
}
|
||||
|
||||
ThreadedBasebandSampleSink::~ThreadedBasebandSampleSink()
|
||||
{
|
||||
if (m_thread->isRunning()) {
|
||||
stop();
|
||||
}
|
||||
|
||||
delete m_threadedBasebandSampleSinkFifo; // Valgrind memcheck
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
void ThreadedBasebandSampleSink::start()
|
||||
{
|
||||
qDebug() << "ThreadedBasebandSampleSink::start";
|
||||
m_thread->start();
|
||||
m_basebandSampleSink->start();
|
||||
}
|
||||
|
||||
void ThreadedBasebandSampleSink::stop()
|
||||
{
|
||||
qDebug() << "ThreadedBasebandSampleSink::stop";
|
||||
m_basebandSampleSink->stop();
|
||||
m_thread->exit();
|
||||
m_thread->wait();
|
||||
}
|
||||
|
||||
void ThreadedBasebandSampleSink::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
|
||||
{
|
||||
(void) positiveOnly;
|
||||
//m_sampleSink->feed(begin, end, positiveOnly);
|
||||
//m_sampleFifo.write(begin, end);
|
||||
m_threadedBasebandSampleSinkFifo->writeToFifo(begin, end);
|
||||
}
|
||||
|
||||
bool ThreadedBasebandSampleSink::handleSinkMessage(const Message& cmd)
|
||||
{
|
||||
return m_basebandSampleSink->handleMessage(cmd);
|
||||
}
|
||||
|
||||
QString ThreadedBasebandSampleSink::getSampleSinkObjectName() const
|
||||
{
|
||||
return m_basebandSampleSink->objectName();
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_THREADEDSAMPLESINK_H
|
||||
#define INCLUDE_THREADEDSAMPLESINK_H
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include <QMutex>
|
||||
|
||||
#include "samplesinkfifo.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "export.h"
|
||||
|
||||
class BasebandSampleSink;
|
||||
class QThread;
|
||||
|
||||
/**
|
||||
* Because Qt is a piece of shit this class cannot be a nested protected class of ThreadedSampleSink
|
||||
* So let's make everything public
|
||||
*/
|
||||
class SDRBASE_API ThreadedBasebandSampleSinkFifo : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ThreadedBasebandSampleSinkFifo(BasebandSampleSink* sampleSink, std::size_t size = 1<<18);
|
||||
~ThreadedBasebandSampleSinkFifo();
|
||||
void writeToFifo(SampleVector::const_iterator& begin, SampleVector::const_iterator& end);
|
||||
|
||||
BasebandSampleSink* m_sampleSink;
|
||||
SampleSinkFifo m_sampleFifo;
|
||||
|
||||
public slots:
|
||||
void handleFifoData();
|
||||
};
|
||||
|
||||
/**
|
||||
* This class is a wrapper for SampleSink that runs the SampleSink object in its own thread
|
||||
*/
|
||||
class SDRBASE_API ThreadedBasebandSampleSink : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent = 0);
|
||||
~ThreadedBasebandSampleSink();
|
||||
|
||||
const BasebandSampleSink *getSink() const { return m_basebandSampleSink; }
|
||||
|
||||
void start(); //!< this thread start()
|
||||
void stop(); //!< this thread exit() and wait()
|
||||
|
||||
bool handleSinkMessage(const Message& cmd); //!< Send message to sink synchronously
|
||||
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly); //!< Feed sink with samples
|
||||
|
||||
QString getSampleSinkObjectName() const;
|
||||
const QThread *getThread() const { return m_thread; }
|
||||
|
||||
protected:
|
||||
|
||||
QThread *m_thread; //!< The thead object
|
||||
ThreadedBasebandSampleSinkFifo *m_threadedBasebandSampleSinkFifo;
|
||||
BasebandSampleSink* m_basebandSampleSink;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_THREADEDSAMPLESINK_H
|
Loading…
Reference in New Issue