1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-24 13:05:21 -04:00

Multi device support: access DSPDeviceEngine from the channel plugins using the plubgin API and not a direct access

This commit is contained in:
f4exb 2016-05-11 18:29:01 +02:00
parent 33e5e781c0
commit 66daf9fa4e
14 changed files with 95 additions and 65 deletions

View File

@ -69,11 +69,11 @@ void ChannelAnalyzerGUI::setCenterFrequency(qint64 centerFrequency)
void ChannelAnalyzerGUI::resetToDefaults() void ChannelAnalyzerGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->BW->setValue(30); ui->BW->setValue(30);
ui->deltaFrequency->setValue(0); ui->deltaFrequency->setValue(0);
ui->spanLog2->setValue(3); ui->spanLog2->setValue(3);
blockApplySettings(false); blockApplySettings(false);
applySettings(); applySettings();
} }
@ -96,22 +96,22 @@ bool ChannelAnalyzerGUI::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);
if(!d.isValid()) if(!d.isValid())
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
} }
if(d.getVersion() == 1) if(d.getVersion() == 1)
{ {
QByteArray bytetmp; QByteArray bytetmp;
quint32 u32tmp; quint32 u32tmp;
qint32 tmp, bw, lowCut; qint32 tmp, bw, lowCut;
bool tmpBool; bool tmpBool;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readS32(1, &tmp, 0); d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp); m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &bw, 30); d.readS32(2, &bw, 30);
@ -133,16 +133,16 @@ bool ChannelAnalyzerGUI::deserialize(const QByteArray& data)
ui->ssb->setChecked(tmpBool); ui->ssb->setChecked(tmpBool);
d.readBlob(8, &bytetmp); d.readBlob(8, &bytetmp);
ui->scopeGUI->deserialize(bytetmp); ui->scopeGUI->deserialize(bytetmp);
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
ui->BW->setValue(bw); ui->BW->setValue(bw);
ui->lowCut->setValue(lowCut); // does applySettings(); ui->lowCut->setValue(lowCut); // does applySettings();
return true; return true;
} }
else else
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
@ -324,7 +324,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_channelizer = new Channelizer(m_channelAnalyzer); m_channelizer = new Channelizer(m_channelAnalyzer);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U); ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
@ -358,7 +358,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, QWidget* parent) :
ChannelAnalyzerGUI::~ChannelAnalyzerGUI() ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_channelAnalyzer; delete m_channelAnalyzer;
@ -380,7 +380,7 @@ bool ChannelAnalyzerGUI::setNewRate(int spanLog2)
m_spanLog2 = spanLog2; m_spanLog2 = spanLog2;
//m_rate = 48000 / (1<<spanLog2); //m_rate = 48000 / (1<<spanLog2);
m_rate = m_channelAnalyzer->getSampleRate() / (1<<spanLog2); m_rate = m_channelAnalyzer->getSampleRate() / (1<<spanLog2);
if (ui->BW->value() < -m_rate/200) { if (ui->BW->value() < -m_rate/200) {
ui->BW->setValue(-m_rate/200); ui->BW->setValue(-m_rate/200);
m_channelMarker.setBandwidth(-m_rate*2); m_channelMarker.setBandwidth(-m_rate*2);

View File

@ -52,7 +52,7 @@ void AMDemodGUI::setCenterFrequency(qint64 centerFrequency)
void AMDemodGUI::resetToDefaults() void AMDemodGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->rfBW->setValue(4); ui->rfBW->setValue(4);
ui->afBW->setValue(3); ui->afBW->setValue(3);
ui->volume->setValue(20); ui->volume->setValue(20);
@ -79,21 +79,21 @@ bool AMDemodGUI::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);
if(!d.isValid()) if(!d.isValid())
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
} }
if(d.getVersion() == 1) if(d.getVersion() == 1)
{ {
QByteArray bytetmp; QByteArray bytetmp;
quint32 u32tmp; quint32 u32tmp;
qint32 tmp; qint32 tmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readS32(1, &tmp, 0); d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp); m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &tmp, 4); d.readS32(2, &tmp, 4);
@ -104,19 +104,19 @@ bool AMDemodGUI::deserialize(const QByteArray& data)
ui->volume->setValue(tmp); ui->volume->setValue(tmp);
d.readS32(5, &tmp, -40); d.readS32(5, &tmp, -40);
ui->squelch->setValue(tmp); ui->squelch->setValue(tmp);
if(d.readU32(7, &u32tmp)) if(d.readU32(7, &u32tmp))
{ {
m_channelMarker.setColor(u32tmp); m_channelMarker.setColor(u32tmp);
} }
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettings(); applySettings();
return true; return true;
} }
else else
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
@ -218,7 +218,8 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_amDemod = new AMDemod(); m_amDemod = new AMDemod();
m_channelizer = new Channelizer(m_amDemod); m_channelizer = new Channelizer(m_amDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -237,7 +238,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
AMDemodGUI::~AMDemodGUI() AMDemodGUI::~AMDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_amDemod; delete m_amDemod;

View File

@ -379,7 +379,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_channelizer = new Channelizer(m_bfmDemod); m_channelizer = new Channelizer(m_bfmDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->glSpectrum->setCenterFrequency(m_rate / 4); ui->glSpectrum->setCenterFrequency(m_rate / 4);
ui->glSpectrum->setSampleRate(m_rate / 2); ui->glSpectrum->setSampleRate(m_rate / 2);
@ -413,7 +413,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
BFMDemodGUI::~BFMDemodGUI() BFMDemodGUI::~BFMDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_bfmDemod; delete m_bfmDemod;

View File

@ -276,7 +276,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_channelizer = new Channelizer(m_dsdDemod); m_channelizer = new Channelizer(m_dsdDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
//m_channelMarker = new ChannelMarker(this); //m_channelMarker = new ChannelMarker(this);
m_channelMarker.setColor(Qt::cyan); m_channelMarker.setColor(Qt::cyan);
@ -296,7 +296,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
DSDDemodGUI::~DSDDemodGUI() DSDDemodGUI::~DSDDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_dsdDemod; delete m_dsdDemod;

View File

@ -48,10 +48,10 @@ void LoRaDemodGUI::setCenterFrequency(qint64 centerFrequency)
void LoRaDemodGUI::resetToDefaults() void LoRaDemodGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->BW->setValue(0); ui->BW->setValue(0);
ui->Spread->setValue(0); ui->Spread->setValue(0);
blockApplySettings(false); blockApplySettings(false);
applySettings(); applySettings();
} }
@ -70,20 +70,20 @@ bool LoRaDemodGUI::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);
if(!d.isValid()) if(!d.isValid())
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
} }
if(d.getVersion() == 1) if(d.getVersion() == 1)
{ {
QByteArray bytetmp; QByteArray bytetmp;
qint32 tmp; qint32 tmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readS32(1, &tmp, 0); d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp); m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &tmp, 0); d.readS32(2, &tmp, 0);
@ -92,14 +92,14 @@ bool LoRaDemodGUI::deserialize(const QByteArray& data)
ui->Spread->setValue(tmp); ui->Spread->setValue(tmp);
d.readBlob(4, &bytetmp); d.readBlob(4, &bytetmp);
ui->spectrumGUI->deserialize(bytetmp); ui->spectrumGUI->deserialize(bytetmp);
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettings(); applySettings();
return true; return true;
} }
else else
{ {
resetToDefaults(); resetToDefaults();
return false; return false;
@ -163,7 +163,7 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_LoRaDemod = new LoRaDemod(m_spectrumVis); m_LoRaDemod = new LoRaDemod(m_spectrumVis);
m_channelizer = new Channelizer(m_LoRaDemod); m_channelizer = new Channelizer(m_LoRaDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->glSpectrum->setCenterFrequency(16000); ui->glSpectrum->setCenterFrequency(16000);
ui->glSpectrum->setSampleRate(32000); ui->glSpectrum->setSampleRate(32000);
@ -188,7 +188,7 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
LoRaDemodGUI::~LoRaDemodGUI() LoRaDemodGUI::~LoRaDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_LoRaDemod; delete m_LoRaDemod;

View File

@ -289,7 +289,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_channelizer = new Channelizer(m_nfmDemod); m_channelizer = new Channelizer(m_nfmDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
//m_channelMarker = new ChannelMarker(this); //m_channelMarker = new ChannelMarker(this);
m_channelMarker.setColor(Qt::red); m_channelMarker.setColor(Qt::red);
@ -307,7 +307,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
NFMDemodGUI::~NFMDemodGUI() NFMDemodGUI::~NFMDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_nfmDemod; delete m_nfmDemod;

View File

@ -51,7 +51,7 @@ void SSBDemodGUI::setCenterFrequency(qint64 centerFrequency)
void SSBDemodGUI::resetToDefaults() void SSBDemodGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->BW->setValue(30); ui->BW->setValue(30);
ui->volume->setValue(40); ui->volume->setValue(40);
ui->deltaFrequency->setValue(0); ui->deltaFrequency->setValue(0);
@ -92,10 +92,10 @@ bool SSBDemodGUI::deserialize(const QByteArray& data)
QByteArray bytetmp; QByteArray bytetmp;
quint32 u32tmp; quint32 u32tmp;
qint32 tmp; qint32 tmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readS32(1, &tmp, 0); d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp); m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &tmp, 30); d.readS32(2, &tmp, 30);
@ -117,10 +117,10 @@ bool SSBDemodGUI::deserialize(const QByteArray& data)
ui->audioFlipChannels->setChecked(m_audioFlipChannels); ui->audioFlipChannels->setChecked(m_audioFlipChannels);
d.readBool(10, &m_dsb); d.readBool(10, &m_dsb);
ui->dsb->setChecked(m_dsb); ui->dsb->setChecked(m_dsb);
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettings(); applySettings();
return true; return true;
} }
@ -338,7 +338,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_ssbDemod = new SSBDemod(m_spectrumVis); m_ssbDemod = new SSBDemod(m_spectrumVis);
m_channelizer = new Channelizer(m_ssbDemod); m_channelizer = new Channelizer(m_ssbDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -369,7 +369,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
SSBDemodGUI::~SSBDemodGUI() SSBDemodGUI::~SSBDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_ssbDemod; delete m_ssbDemod;

View File

@ -232,7 +232,7 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_wfmDemod = new WFMDemod(0); m_wfmDemod = new WFMDemod(0);
m_channelizer = new Channelizer(m_wfmDemod); m_channelizer = new Channelizer(m_wfmDemod);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
@ -250,7 +250,7 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
WFMDemodGUI::~WFMDemodGUI() WFMDemodGUI::~WFMDemodGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_wfmDemod; delete m_wfmDemod;

View File

@ -46,7 +46,7 @@ QString TCPSrcGUI::getName() const
void TCPSrcGUI::resetToDefaults() void TCPSrcGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->sampleFormat->setCurrentIndex(0); ui->sampleFormat->setCurrentIndex(0);
ui->sampleRate->setText("48000"); ui->sampleRate->setText("48000");
ui->rfBandwidth->setText("32000"); ui->rfBandwidth->setText("32000");
@ -88,10 +88,10 @@ bool TCPSrcGUI::deserialize(const QByteArray& data)
QByteArray bytetmp; QByteArray bytetmp;
qint32 s32tmp; qint32 s32tmp;
Real realtmp; Real realtmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readBlob(1, &bytetmp); d.readBlob(1, &bytetmp);
restoreState(bytetmp); restoreState(bytetmp);
d.readS32(2, &s32tmp, 0); d.readS32(2, &s32tmp, 0);
@ -123,10 +123,10 @@ bool TCPSrcGUI::deserialize(const QByteArray& data)
ui->boost->setValue(s32tmp); ui->boost->setValue(s32tmp);
d.readS32(9, &s32tmp, 0); d.readS32(9, &s32tmp, 0);
m_channelMarker.setCenterFrequency(s32tmp); m_channelMarker.setCenterFrequency(s32tmp);
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettings(); applySettings();
return true; return true;
} }
@ -199,7 +199,7 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_tcpSrc = new TCPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis); m_tcpSrc = new TCPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis);
m_channelizer = new Channelizer(m_tcpSrc); m_channelizer = new Channelizer(m_tcpSrc);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U); ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
@ -229,7 +229,7 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) :
TCPSrcGUI::~TCPSrcGUI() TCPSrcGUI::~TCPSrcGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_tcpSrc; delete m_tcpSrc;

View File

@ -64,7 +64,7 @@ QString UDPSrcGUI::getName() const
void UDPSrcGUI::resetToDefaults() void UDPSrcGUI::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->sampleFormat->setCurrentIndex(0); ui->sampleFormat->setCurrentIndex(0);
ui->sampleRate->setText("48000"); ui->sampleRate->setText("48000");
ui->rfBandwidth->setText("32000"); ui->rfBandwidth->setText("32000");
@ -121,10 +121,10 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
qint32 s32tmp; qint32 s32tmp;
Real realtmp; Real realtmp;
bool booltmp; bool booltmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readBlob(1, &bytetmp); d.readBlob(1, &bytetmp);
restoreState(bytetmp); restoreState(bytetmp);
d.readS32(2, &s32tmp, 0); d.readS32(2, &s32tmp, 0);
@ -183,10 +183,10 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
ui->audioStereo->setChecked(booltmp); ui->audioStereo->setChecked(booltmp);
d.readS32(15, &s32tmp, 2500); d.readS32(15, &s32tmp, 2500);
ui->fmDeviation->setText(QString("%1").arg(s32tmp)); ui->fmDeviation->setText(QString("%1").arg(s32tmp));
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
applySettingsImmediate(); applySettingsImmediate();
applySettings(); applySettings();
return true; return true;
@ -237,7 +237,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_udpSrc = new UDPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis); m_udpSrc = new UDPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis);
m_channelizer = new Channelizer(m_udpSrc); m_channelizer = new Channelizer(m_udpSrc);
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); m_pluginAPI->addThreadedSink(m_threadedChannelizer);
ui->fmDeviation->setEnabled(false); ui->fmDeviation->setEnabled(false);
@ -270,7 +270,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) :
UDPSrcGUI::~UDPSrcGUI() UDPSrcGUI::~UDPSrcGUI()
{ {
m_pluginAPI->removeChannelInstance(this); m_pluginAPI->removeChannelInstance(this);
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer); m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; delete m_channelizer;
delete m_udpSrc; delete m_udpSrc;

View File

@ -59,6 +59,16 @@ void PluginAPI::registerSampleSource(const QString& sourceName, PluginInterface*
m_pluginManager->registerSampleSource(sourceName, plugin); m_pluginManager->registerSampleSource(sourceName, plugin);
} }
void PluginAPI::addThreadedSink(ThreadedSampleSink* sink)
{
m_pluginManager->addThreadedSink(sink);
}
void PluginAPI::removeThreadedSink(ThreadedSampleSink* sink)
{
m_pluginManager->removeThreadedSink(sink);
}
PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) : PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) :
QObject(mainWindow), QObject(mainWindow),
m_pluginManager(pluginManager), m_pluginManager(pluginManager),

View File

@ -16,6 +16,7 @@ class AudioFifo;
class MessageQueue; class MessageQueue;
class MainWindow; class MainWindow;
class ChannelMarker; class ChannelMarker;
class ThreadedSampleSink;
class PluginGUI; class PluginGUI;
class SDRANGEL_API PluginAPI : public QObject { class SDRANGEL_API PluginAPI : public QObject {
@ -39,6 +40,10 @@ public:
// Sample Source stuff // Sample Source stuff
void registerSampleSource(const QString& sourceName, PluginInterface* plugin); void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
// Device engine stuff
void addThreadedSink(ThreadedSampleSink* sink);
void removeThreadedSink(ThreadedSampleSink* sink);
// R/O access to main window // R/O access to main window
const MainWindow* getMainWindow() const { return m_mainWindow; } const MainWindow* getMainWindow() const { return m_mainWindow; }

View File

@ -86,6 +86,16 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin)); m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
} }
void PluginManager::addThreadedSink(ThreadedSampleSink* sink)
{
m_dspDeviceEngine->addThreadedSink(sink);
}
void PluginManager::removeThreadedSink(ThreadedSampleSink* sink)
{
m_dspDeviceEngine->removeThreadedSink(sink);
}
void PluginManager::loadSettings(const Preset* preset) void PluginManager::loadSettings(const Preset* preset)
{ {
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription())); fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));

View File

@ -15,6 +15,7 @@ class MainWindow;
class SampleSource; class SampleSource;
class Message; class Message;
class DSPDeviceEngine; class DSPDeviceEngine;
class ThreadedSampleSink;
class SDRANGEL_API PluginManager : public QObject { class SDRANGEL_API PluginManager : public QObject {
Q_OBJECT Q_OBJECT
@ -48,6 +49,9 @@ public:
void registerSampleSource(const QString& sourceName, PluginInterface* plugin); void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
void addThreadedSink(ThreadedSampleSink* sink);
void removeThreadedSink(ThreadedSampleSink* sink);
void loadSettings(const Preset* preset); void loadSettings(const Preset* preset);
void loadSourceSettings(const Preset* preset); void loadSourceSettings(const Preset* preset);
void saveSettings(Preset* preset); void saveSettings(Preset* preset);