Use the modulator constructor separated from the modulator GUI constructor

This commit is contained in:
f4exb 2017-11-08 22:54:58 +01:00
parent 9c68da780e
commit f2b53fe3aa
29 changed files with 87 additions and 74 deletions

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

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

View File

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

View File

@ -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;

View File

@ -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:

View File

@ -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(

View File

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

View File

@ -59,7 +59,7 @@ public:
void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet);
void listRxChannels(QList<QString>& list);
void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet);
void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceSinkAPI *deviceAPI);
void listTxChannels(QList<QString>& list);
static const QString& getFileSourceDeviceId() { return m_fileSourceDeviceTypeID; }

View File

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

View File

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