diff --git a/plugins/channeltx/modam/ammodgui.cpp b/plugins/channeltx/modam/ammodgui.cpp index 1f5ecd9db..30acb1daf 100644 --- a/plugins/channeltx/modam/ammodgui.cpp +++ b/plugins/channeltx/modam/ammodgui.cpp @@ -34,14 +34,15 @@ #include "dsp/dspengine.h" #include "mainwindow.h" -AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - AMModGUI* gui = new AMModGUI(pluginAPI, deviceUISet); + AMModGUI* gui = new AMModGUI(pluginAPI, deviceUISet, channelTx); return gui; } void AMModGUI::destroy() { + delete this; } void AMModGUI::setName(const QString& name) @@ -266,7 +267,7 @@ void AMModGUI::onMenuDoubleClicked() } } -AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::AMModGUI), m_pluginAPI(pluginAPI), @@ -287,7 +288,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pare connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); - m_amMod = new AMMod(m_deviceUISet->m_deviceSinkAPI); + m_amMod = (AMMod*) channelTx; //new AMMod(m_deviceUISet->m_deviceSinkAPI); m_amMod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -326,7 +327,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pare AMModGUI::~AMModGUI() { m_deviceUISet->removeTxChannelInstance(this); - delete m_amMod; + delete m_amMod; // TODO: check this: when the GUI closes it has to delete the modulator delete ui; } diff --git a/plugins/channeltx/modam/ammodgui.h b/plugins/channeltx/modam/ammodgui.h index 5bb7ed9ad..de17bb308 100644 --- a/plugins/channeltx/modam/ammodgui.h +++ b/plugins/channeltx/modam/ammodgui.h @@ -30,6 +30,7 @@ class PluginAPI; class DeviceUISet; class AMMod; +class BasebandSampleSource; namespace Ui { class AMModGUI; @@ -39,7 +40,7 @@ class AMModGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -99,7 +100,7 @@ private: AMMod::AMModInputAF m_modAFInput; MessageQueue m_inputMessageQueue; - explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0); + explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); virtual ~AMModGUI(); void blockApplySettings(bool block); diff --git a/plugins/channeltx/modam/ammodplugin.cpp b/plugins/channeltx/modam/ammodplugin.cpp index 848257e33..c30bfe35c 100644 --- a/plugins/channeltx/modam/ammodplugin.cpp +++ b/plugins/channeltx/modam/ammodplugin.cpp @@ -50,11 +50,11 @@ void AMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(AMMod::m_channelID, this); } -PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == AMMod::m_channelID) { - AMModGUI* gui = AMModGUI::create(m_pluginAPI, deviceUISet); + AMModGUI* gui = AMModGUI::create(m_pluginAPI, deviceUISet, txChannel); return gui; } else { return 0; diff --git a/plugins/channeltx/modam/ammodplugin.h b/plugins/channeltx/modam/ammodplugin.h index 83bfc8759..cdc4aef9a 100644 --- a/plugins/channeltx/modam/ammodplugin.h +++ b/plugins/channeltx/modam/ammodplugin.h @@ -34,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index fe9af1ff4..5d0eb61bd 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -35,14 +35,15 @@ #include "ui_atvmodgui.h" #include "atvmodgui.h" -ATVModGUI* ATVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +ATVModGUI* ATVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - ATVModGUI* gui = new ATVModGUI(pluginAPI, deviceUISet); + ATVModGUI* gui = new ATVModGUI(pluginAPI, deviceUISet, channelTx); return gui; } void ATVModGUI::destroy() { + delete this; } void ATVModGUI::setName(const QString& name) @@ -585,7 +586,7 @@ void ATVModGUI::onMenuDoubleClicked() } } -ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::ATVModGUI), m_pluginAPI(pluginAPI), @@ -607,7 +608,7 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); - m_atvMod = new ATVMod(m_deviceUISet->m_deviceSinkAPI); + m_atvMod = (ATVMod*) channelTx; //new ATVMod(m_deviceUISet->m_deviceSinkAPI); m_atvMod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -652,7 +653,7 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa ATVModGUI::~ATVModGUI() { m_deviceUISet->removeTxChannelInstance(this); - delete m_atvMod; + delete m_atvMod; // TODO: check this: when the GUI closes it has to delete the modulator delete ui; } diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 6f7ba68ff..b1eedddef 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -28,8 +28,7 @@ class PluginAPI; class DeviceUISet; - -class ATVMod; +class BasebandSampleSource; class QMessageBox; namespace Ui { @@ -40,7 +39,7 @@ class ATVModGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static ATVModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static ATVModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -117,7 +116,7 @@ private: int m_rfSliderDivisor; MessageQueue m_inputMessageQueue; - explicit ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0); + explicit ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); virtual ~ATVModGUI(); void blockApplySettings(bool block); diff --git a/plugins/channeltx/modatv/atvmodplugin.cpp b/plugins/channeltx/modatv/atvmodplugin.cpp index 525da188d..7f8808cde 100644 --- a/plugins/channeltx/modatv/atvmodplugin.cpp +++ b/plugins/channeltx/modatv/atvmodplugin.cpp @@ -50,11 +50,11 @@ void ATVModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(ATVMod::m_channelID, this); } -PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == ATVMod::m_channelID) { - ATVModGUI* gui = ATVModGUI::create(m_pluginAPI, deviceUISet); + ATVModGUI* gui = ATVModGUI::create(m_pluginAPI, deviceUISet, txChannel); return gui; } else { return 0; diff --git a/plugins/channeltx/modatv/atvmodplugin.h b/plugins/channeltx/modatv/atvmodplugin.h index d7acb1c18..92f771be4 100644 --- a/plugins/channeltx/modatv/atvmodplugin.h +++ b/plugins/channeltx/modatv/atvmodplugin.h @@ -34,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/plugins/channeltx/modnfm/nfmmodgui.cpp b/plugins/channeltx/modnfm/nfmmodgui.cpp index e0dc2d030..0341e54b9 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.cpp +++ b/plugins/channeltx/modnfm/nfmmodgui.cpp @@ -33,14 +33,15 @@ #include "nfmmodgui.h" -NFMModGUI* NFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +NFMModGUI* NFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - NFMModGUI* gui = new NFMModGUI(pluginAPI, deviceUISet); + NFMModGUI* gui = new NFMModGUI(pluginAPI, deviceUISet, channelTx); return gui; } void NFMModGUI::destroy() { + delete this; } void NFMModGUI::setName(const QString& name) @@ -283,7 +284,7 @@ void NFMModGUI::onMenuDoubleClicked() } } -NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::NFMModGUI), m_pluginAPI(pluginAPI), @@ -315,7 +316,7 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); - m_nfmMod = new NFMMod(m_deviceUISet->m_deviceSinkAPI); + m_nfmMod = (NFMMod*) channelTx; //new NFMMod(m_deviceUISet->m_deviceSinkAPI); m_nfmMod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -358,7 +359,7 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa NFMModGUI::~NFMModGUI() { m_deviceUISet->removeTxChannelInstance(this); - delete m_nfmMod; + delete m_nfmMod; // TODO: check this: when the GUI closes it has to delete the modulator delete ui; } diff --git a/plugins/channeltx/modnfm/nfmmodgui.h b/plugins/channeltx/modnfm/nfmmodgui.h index f2f04645e..d96da9ffc 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.h +++ b/plugins/channeltx/modnfm/nfmmodgui.h @@ -28,7 +28,7 @@ class PluginAPI; class DeviceUISet; -class NFMMod; +class BasebandSampleSource; namespace Ui { class NFMModGUI; @@ -38,7 +38,7 @@ class NFMModGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static NFMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static NFMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -102,7 +102,7 @@ private: NFMMod::NFMModInputAF m_modAFInput; MessageQueue m_inputMessageQueue; - explicit NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0); + explicit NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); virtual ~NFMModGUI(); void blockApplySettings(bool block); diff --git a/plugins/channeltx/modnfm/nfmmodplugin.cpp b/plugins/channeltx/modnfm/nfmmodplugin.cpp index acc23360c..c05251e0c 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.cpp +++ b/plugins/channeltx/modnfm/nfmmodplugin.cpp @@ -49,11 +49,11 @@ void NFMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(NFMMod::m_channelID, this); } -PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == NFMMod::m_channelID) { - NFMModGUI* gui = NFMModGUI::create(m_pluginAPI, deviceUISet); + NFMModGUI* gui = NFMModGUI::create(m_pluginAPI, deviceUISet, txChannel); return gui; } else { return 0; diff --git a/plugins/channeltx/modnfm/nfmmodplugin.h b/plugins/channeltx/modnfm/nfmmodplugin.h index f5387af53..ae1c42216 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.h +++ b/plugins/channeltx/modnfm/nfmmodplugin.h @@ -34,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index 0b5d82ab4..ed2956354 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -33,14 +33,15 @@ #include "dsp/dspengine.h" #include "mainwindow.h" -SSBModGUI* SSBModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +SSBModGUI* SSBModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - SSBModGUI* gui = new SSBModGUI(pluginAPI, deviceUISet); + SSBModGUI* gui = new SSBModGUI(pluginAPI, deviceUISet, channelTx); return gui; } void SSBModGUI::destroy() { + delete this; } void SSBModGUI::setName(const QString& name) @@ -350,7 +351,7 @@ void SSBModGUI::onMenuDoubleClicked() } } -SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::SSBModGUI), m_pluginAPI(pluginAPI), @@ -373,7 +374,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); m_spectrumVis = new SpectrumVis(ui->glSpectrum); - m_ssbMod = new SSBMod(m_deviceUISet->m_deviceSinkAPI); + m_ssbMod = (SSBMod*) channelTx; //new SSBMod(m_deviceUISet->m_deviceSinkAPI); m_ssbMod->setSpectrumSampleSink(m_spectrumVis); m_ssbMod->setMessageQueueToGUI(getInputMessageQueue()); @@ -425,7 +426,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa SSBModGUI::~SSBModGUI() { m_deviceUISet->removeRxChannelInstance(this); - delete m_ssbMod; + delete m_ssbMod; // TODO: check this: when the GUI closes it has to delete the modulator delete m_spectrumVis; delete ui; } diff --git a/plugins/channeltx/modssb/ssbmodgui.h b/plugins/channeltx/modssb/ssbmodgui.h index 07602d761..cbc0f6bb8 100644 --- a/plugins/channeltx/modssb/ssbmodgui.h +++ b/plugins/channeltx/modssb/ssbmodgui.h @@ -28,8 +28,7 @@ class PluginAPI; class DeviceUISet; - -class SSBMod; +class BasebandSampleSource; class SpectrumVis; namespace Ui { @@ -40,7 +39,7 @@ class SSBModGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static SSBModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static SSBModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -111,7 +110,7 @@ private: SSBMod::SSBModInputAF m_modAFInput; MessageQueue m_inputMessageQueue; - explicit SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0); + explicit SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); virtual ~SSBModGUI(); bool blockApplySettings(bool block); diff --git a/plugins/channeltx/modssb/ssbmodplugin.cpp b/plugins/channeltx/modssb/ssbmodplugin.cpp index a6c87d1c4..299a6aa6c 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.cpp +++ b/plugins/channeltx/modssb/ssbmodplugin.cpp @@ -50,11 +50,11 @@ void SSBModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(SSBMod::m_channelID, this); } -PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == SSBMod::m_channelID) { - SSBModGUI* gui = SSBModGUI::create(m_pluginAPI, deviceUISet); + SSBModGUI* gui = SSBModGUI::create(m_pluginAPI, deviceUISet, txChannel); return gui; } else { return 0; diff --git a/plugins/channeltx/modssb/ssbmodplugin.h b/plugins/channeltx/modssb/ssbmodplugin.h index c3cba50cf..b98962acf 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.h +++ b/plugins/channeltx/modssb/ssbmodplugin.h @@ -34,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/plugins/channeltx/modwfm/wfmmodgui.cpp b/plugins/channeltx/modwfm/wfmmodgui.cpp index 3df16817c..34f759487 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.cpp +++ b/plugins/channeltx/modwfm/wfmmodgui.cpp @@ -34,14 +34,15 @@ #include "ui_wfmmodgui.h" #include "wfmmodgui.h" -WFMModGUI* WFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +WFMModGUI* WFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - WFMModGUI* gui = new WFMModGUI(pluginAPI, deviceUISet); + WFMModGUI* gui = new WFMModGUI(pluginAPI, deviceUISet, channelTx); return gui; } void WFMModGUI::destroy() { + delete this; } void WFMModGUI::setName(const QString& name) @@ -272,7 +273,7 @@ void WFMModGUI::onMenuDoubleClicked() } } -WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::WFMModGUI), m_pluginAPI(pluginAPI), @@ -304,7 +305,7 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); - m_wfmMod = new WFMMod(m_deviceUISet->m_deviceSinkAPI); + m_wfmMod = (WFMMod*) channelTx; //new WFMMod(m_deviceUISet->m_deviceSinkAPI); m_wfmMod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -342,7 +343,7 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa WFMModGUI::~WFMModGUI() { m_deviceUISet->removeTxChannelInstance(this); - delete m_wfmMod; + delete m_wfmMod; // TODO: check this: when the GUI closes it has to delete the modulator delete ui; } diff --git a/plugins/channeltx/modwfm/wfmmodgui.h b/plugins/channeltx/modwfm/wfmmodgui.h index 3bacde2d7..5a019cd44 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.h +++ b/plugins/channeltx/modwfm/wfmmodgui.h @@ -28,10 +28,9 @@ class PluginAPI; class DeviceUISet; - +class BasebandSampleSource; class ThreadedBasebandSampleSource; class UpChannelizer; -class WFMMod; namespace Ui { class WFMModGUI; @@ -41,7 +40,7 @@ class WFMModGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static WFMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static WFMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -104,7 +103,7 @@ private: WFMMod::WFMModInputAF m_modAFInput; MessageQueue m_inputMessageQueue; - explicit WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0); + explicit WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); virtual ~WFMModGUI(); void blockApplySettings(bool block); diff --git a/plugins/channeltx/modwfm/wfmmodplugin.cpp b/plugins/channeltx/modwfm/wfmmodplugin.cpp index f4cbe8f98..13371d7d7 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.cpp +++ b/plugins/channeltx/modwfm/wfmmodplugin.cpp @@ -50,11 +50,11 @@ void WFMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(WFMMod::m_channelID, this); } -PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == WFMMod::m_channelID) { - WFMModGUI* gui = WFMModGUI::create(m_pluginAPI, deviceUISet); + WFMModGUI* gui = WFMModGUI::create(m_pluginAPI, deviceUISet, txChannel); return gui; } else { return 0; diff --git a/plugins/channeltx/modwfm/wfmmodplugin.h b/plugins/channeltx/modwfm/wfmmodplugin.h index 594d0aa98..66c644e8f 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.h +++ b/plugins/channeltx/modwfm/wfmmodplugin.h @@ -33,7 +33,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp index 75bd3c62c..d7e8ebdbd 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.cpp +++ b/plugins/channeltx/udpsink/udpsinkgui.cpp @@ -27,14 +27,15 @@ #include "udpsinkgui.h" #include "ui_udpsinkgui.h" -UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) +UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { - UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet); + UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet, channelTx); return gui; } void UDPSinkGUI::destroy() { + delete this; } void UDPSinkGUI::setName(const QString& name) @@ -101,7 +102,7 @@ void UDPSinkGUI::handleSourceMessages() } } -UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) : +UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : RollupWidget(parent), ui(new Ui::UDPSinkGUI), m_pluginAPI(pluginAPI), @@ -119,7 +120,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* setAttribute(Qt::WA_DeleteOnClose, true); m_spectrumVis = new SpectrumVis(ui->glSpectrum); - m_udpSink = new UDPSink(m_deviceUISet->m_deviceSinkAPI); + m_udpSink = (UDPSink*) channelTx; //new UDPSink(m_deviceUISet->m_deviceSinkAPI); m_udpSink->setSpectrumSink(m_spectrumVis); m_udpSink->setMessageQueueToGUI(getInputMessageQueue()); @@ -162,7 +163,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* UDPSinkGUI::~UDPSinkGUI() { m_deviceUISet->removeTxChannelInstance(this); - delete m_udpSink; + delete m_udpSink; // TODO: check this: when the GUI closes it has to delete the modulator delete m_spectrumVis; delete ui; } diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h index ca8043ceb..a067460f8 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.h +++ b/plugins/channeltx/udpsink/udpsinkgui.h @@ -29,7 +29,7 @@ class PluginAPI; class DeviceUISet; -class UDPSink; +class BasebandSampleSource; class SpectrumVis; namespace Ui { @@ -40,7 +40,7 @@ class UDPSinkGUI : public RollupWidget, public PluginInstanceGUI { Q_OBJECT public: - static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet); + static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); virtual void destroy(); void setName(const QString& name); @@ -92,7 +92,7 @@ private: bool m_doApplySettings; MessageQueue m_inputMessageQueue; - explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = NULL); + explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = NULL); virtual ~UDPSinkGUI(); void blockApplySettings(bool block); diff --git a/plugins/channeltx/udpsink/udpsinkplugin.cpp b/plugins/channeltx/udpsink/udpsinkplugin.cpp index 87073cff1..93bf0febd 100644 --- a/plugins/channeltx/udpsink/udpsinkplugin.cpp +++ b/plugins/channeltx/udpsink/udpsinkplugin.cpp @@ -50,11 +50,11 @@ void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerTxChannel(UDPSink::m_channelID, this); } -PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) +PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) { if(channelName == UDPSink::m_channelID) { - UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceUISet); + UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceUISet, txChannel); // deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui); // m_pluginAPI->addChannelRollup(gui); return gui; diff --git a/plugins/channeltx/udpsink/udpsinkplugin.h b/plugins/channeltx/udpsink/udpsinkplugin.h index 0a874afcd..7ee211083 100644 --- a/plugins/channeltx/udpsink/udpsinkplugin.h +++ b/plugins/channeltx/udpsink/udpsinkplugin.h @@ -35,7 +35,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: diff --git a/sdrbase/plugin/plugininterface.h b/sdrbase/plugin/plugininterface.h index 44c738209..54e020834 100644 --- a/sdrbase/plugin/plugininterface.h +++ b/sdrbase/plugin/plugininterface.h @@ -87,7 +87,8 @@ public: virtual PluginInstanceGUI* createTxChannelGUI( const QString& channelName __attribute__((unused)), - DeviceUISet *deviceUISet __attribute__((unused)) ) + DeviceUISet *deviceUISet __attribute__((unused)), + BasebandSampleSource *txChannel __attribute__((unused))) { return 0; } virtual BasebandSampleSource* createTxChannel( diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index 6543f3ca5..20869fb17 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -186,11 +186,13 @@ void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet } } -void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet) +void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceSinkAPI *deviceAPI) { if (channelPluginIndex < m_txChannelRegistrations.size()) { PluginInterface *pluginInterface = m_txChannelRegistrations[channelPluginIndex].m_plugin; - pluginInterface->createTxChannelGUI(m_txChannelRegistrations[channelPluginIndex].m_channelId, deviceUISet); + BasebandSampleSource *txChannel = pluginInterface->createTxChannel( + m_txChannelRegistrations[channelPluginIndex].m_channelId, deviceAPI); + pluginInterface->createTxChannelGUI(m_txChannelRegistrations[channelPluginIndex].m_channelId, deviceUISet, txChannel); } } diff --git a/sdrbase/plugin/pluginmanager.h b/sdrbase/plugin/pluginmanager.h index a49c634b9..e2d7308bc 100644 --- a/sdrbase/plugin/pluginmanager.h +++ b/sdrbase/plugin/pluginmanager.h @@ -59,7 +59,7 @@ public: void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet); void listRxChannels(QList& list); - void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet); + void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceSinkAPI *deviceAPI); void listTxChannels(QList& list); static const QString& getFileSourceDeviceId() { return m_fileSourceDeviceTypeID; } diff --git a/sdrgui/device/deviceuiset.cpp b/sdrgui/device/deviceuiset.cpp index 896735065..84c750ab8 100644 --- a/sdrgui/device/deviceuiset.cpp +++ b/sdrgui/device/deviceuiset.cpp @@ -274,7 +274,13 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA if((*channelRegistrations)[i].m_channelId == channelConfig.m_channel) { qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel)); - reg = ChannelInstanceRegistration(channelConfig.m_channel, (*channelRegistrations)[i].m_plugin->createTxChannelGUI(channelConfig.m_channel, this)); + // TODO: create modulator core + BasebandSampleSource *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannel( + channelConfig.m_channel, m_deviceSinkAPI); + PluginInstanceGUI *txChannelGUI = (*channelRegistrations)[i].m_plugin->createTxChannelGUI( + channelConfig.m_channel, this, txChannel); + reg = ChannelInstanceRegistration( + channelConfig.m_channel, txChannelGUI); break; } } diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 13bcb7137..2d9a2cd75 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -1070,7 +1070,7 @@ void MainWindow::on_channel_addClicked(bool checked __attribute__((unused))) QMessageBox::information(this, tr("Message"), tr("%1 channel(s) already in use. Multiple transmission channels is experimental. You may experience performance problems").arg(nbSources)); } - m_pluginManager->createTxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI); + m_pluginManager->createTxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI, deviceUI->m_deviceSinkAPI); } } }