From 9c68da780e699461fe15abaccfee61b42f9c187e Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 8 Nov 2017 17:09:25 +0100 Subject: [PATCH] Added mod constructor interface in the plugin API. Created method in all Tx channel plugins --- plugins/channeltx/modam/ammod.cpp | 1 + plugins/channeltx/modam/ammod.h | 2 ++ plugins/channeltx/modam/ammodgui.cpp | 4 +--- plugins/channeltx/modam/ammodgui.h | 2 -- plugins/channeltx/modam/ammodplugin.cpp | 18 +++++++++++++++--- plugins/channeltx/modam/ammodplugin.h | 2 ++ plugins/channeltx/modatv/atvmod.cpp | 1 + plugins/channeltx/modatv/atvmod.h | 2 ++ plugins/channeltx/modatv/atvmodgui.cpp | 4 +--- plugins/channeltx/modatv/atvmodgui.h | 2 -- plugins/channeltx/modatv/atvmodplugin.cpp | 15 +++++++++++++-- plugins/channeltx/modatv/atvmodplugin.h | 2 ++ plugins/channeltx/modnfm/nfmmod.cpp | 1 + plugins/channeltx/modnfm/nfmmod.h | 2 ++ plugins/channeltx/modnfm/nfmmodgui.cpp | 4 +--- plugins/channeltx/modnfm/nfmmodgui.h | 2 -- plugins/channeltx/modnfm/nfmmodplugin.cpp | 15 +++++++++++++-- plugins/channeltx/modnfm/nfmmodplugin.h | 2 ++ plugins/channeltx/modssb/ssbmod.cpp | 5 +++-- plugins/channeltx/modssb/ssbmod.h | 6 +++++- plugins/channeltx/modssb/ssbmodgui.cpp | 7 +++---- plugins/channeltx/modssb/ssbmodgui.h | 2 -- plugins/channeltx/modssb/ssbmodplugin.cpp | 16 ++++++++++++++-- plugins/channeltx/modssb/ssbmodplugin.h | 2 ++ plugins/channeltx/modwfm/wfmmod.cpp | 1 + plugins/channeltx/modwfm/wfmmod.h | 2 ++ plugins/channeltx/modwfm/wfmmodgui.cpp | 4 +--- plugins/channeltx/modwfm/wfmmodgui.h | 2 -- plugins/channeltx/modwfm/wfmmodplugin.cpp | 16 ++++++++++++++-- plugins/channeltx/modwfm/wfmmodplugin.h | 1 + plugins/channeltx/udpsink/udpsink.cpp | 8 +++++--- plugins/channeltx/udpsink/udpsink.h | 6 +++++- plugins/channeltx/udpsink/udpsinkgui.cpp | 7 +++---- plugins/channeltx/udpsink/udpsinkgui.h | 2 -- plugins/channeltx/udpsink/udpsinkplugin.cpp | 15 +++++++++++++-- plugins/channeltx/udpsink/udpsinkplugin.h | 2 ++ 36 files changed, 133 insertions(+), 52 deletions(-) diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index dc2b92601..320bb9fee 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -36,6 +36,7 @@ MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamTiming, Message) +const QString AMMod::m_channelID = "sdrangel.channeltx.modam"; const int AMMod::m_levelNbSamples = 480; // every 10ms AMMod::AMMod(DeviceSinkAPI *deviceAPI) : diff --git a/plugins/channeltx/modam/ammod.h b/plugins/channeltx/modam/ammod.h index 220c4a0b0..ab6f0522c 100644 --- a/plugins/channeltx/modam/ammod.h +++ b/plugins/channeltx/modam/ammod.h @@ -238,6 +238,8 @@ public: CWKeyer *getCWKeyer() { return &m_cwKeyer; } + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/modam/ammodgui.cpp b/plugins/channeltx/modam/ammodgui.cpp index 576ca5123..1f5ecd9db 100644 --- a/plugins/channeltx/modam/ammodgui.cpp +++ b/plugins/channeltx/modam/ammodgui.cpp @@ -34,8 +34,6 @@ #include "dsp/dspengine.h" #include "mainwindow.h" -const QString AMModGUI::m_channelID = "sdrangel.channeltx.modam"; - AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { AMModGUI* gui = new AMModGUI(pluginAPI, deviceUISet); @@ -306,7 +304,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pare connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(AMMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/modam/ammodgui.h b/plugins/channeltx/modam/ammodgui.h index 4d148ee6e..5bb7ed9ad 100644 --- a/plugins/channeltx/modam/ammodgui.h +++ b/plugins/channeltx/modam/ammodgui.h @@ -53,8 +53,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void channelMarkerChanged(); void handleSourceMessages(); diff --git a/plugins/channeltx/modam/ammodplugin.cpp b/plugins/channeltx/modam/ammodplugin.cpp index 817e49d6e..848257e33 100644 --- a/plugins/channeltx/modam/ammodplugin.cpp +++ b/plugins/channeltx/modam/ammodplugin.cpp @@ -19,11 +19,12 @@ #include "plugin/pluginapi.h" #include "ammodgui.h" +#include "ammod.h" #include "ammodplugin.h" const PluginDescriptor AMModPlugin::m_pluginDescriptor = { QString("AM Modulator"), - QString("3.8.0"), + QString("3.8.2"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -46,12 +47,12 @@ void AMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register AM modulator - m_pluginAPI->registerTxChannel(AMModGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(AMMod::m_channelID, this); } PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == AMModGUI::m_channelID) + if(channelName == AMMod::m_channelID) { AMModGUI* gui = AMModGUI::create(m_pluginAPI, deviceUISet); return gui; @@ -59,3 +60,14 @@ PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, D return 0; } } + +BasebandSampleSource* AMModPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == AMMod::m_channelID) + { + AMMod* source = new AMMod(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/modam/ammodplugin.h b/plugins/channeltx/modam/ammodplugin.h index a11d74ab8..83bfc8759 100644 --- a/plugins/channeltx/modam/ammodplugin.h +++ b/plugins/channeltx/modam/ammodplugin.h @@ -21,6 +21,7 @@ #include "plugin/plugininterface.h" class DeviceUISet; +class BasebandSampleSource; class AMModPlugin : public QObject, PluginInterface { Q_OBJECT @@ -34,6 +35,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 32cdeac3a..b65ac31e7 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -40,6 +40,7 @@ MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureOverlayText, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureShowOverlayText, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportEffectiveSampleRate, Message) +const QString ATVMod::m_channelID = "sdrangel.channeltx.modatv"; const float ATVMod::m_blackLevel = 0.3f; const float ATVMod::m_spanLevel = 0.7f; const int ATVMod::m_levelNbSamples = 10000; // every 10ms diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index 153717f9f..0c4588ee2 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -407,6 +407,8 @@ public: static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit); static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation); + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index 7365c9114..fe9af1ff4 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -35,8 +35,6 @@ #include "ui_atvmodgui.h" #include "atvmodgui.h" -const QString ATVModGUI::m_channelID = "sdrangel.channeltx.modatv"; - ATVModGUI* ATVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { ATVModGUI* gui = new ATVModGUI(pluginAPI, deviceUISet); @@ -628,7 +626,7 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(ATVMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 75b969181..6f7ba68ff 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -54,8 +54,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void channelMarkerChanged(); void handleSourceMessages(); diff --git a/plugins/channeltx/modatv/atvmodplugin.cpp b/plugins/channeltx/modatv/atvmodplugin.cpp index 12add2464..525da188d 100644 --- a/plugins/channeltx/modatv/atvmodplugin.cpp +++ b/plugins/channeltx/modatv/atvmodplugin.cpp @@ -19,6 +19,7 @@ #include "plugin/pluginapi.h" #include "atvmodgui.h" +#include "atvmod.h" #include "atvmodplugin.h" const PluginDescriptor ATVModPlugin::m_pluginDescriptor = { @@ -46,12 +47,12 @@ void ATVModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register ATV modulator - m_pluginAPI->registerTxChannel(ATVModGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(ATVMod::m_channelID, this); } PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == ATVModGUI::m_channelID) + if(channelName == ATVMod::m_channelID) { ATVModGUI* gui = ATVModGUI::create(m_pluginAPI, deviceUISet); return gui; @@ -60,5 +61,15 @@ PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(const QString& channelName, } } +BasebandSampleSource* ATVModPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == ATVMod::m_channelID) + { + ATVMod* source = new ATVMod(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/modatv/atvmodplugin.h b/plugins/channeltx/modatv/atvmodplugin.h index 7dff2dd5b..d7acb1c18 100644 --- a/plugins/channeltx/modatv/atvmodplugin.h +++ b/plugins/channeltx/modatv/atvmodplugin.h @@ -21,6 +21,7 @@ #include "plugin/plugininterface.h" class DeviceSinkAPI; +class BasebandSampleSource; class ATVModPlugin : public QObject, PluginInterface { Q_OBJECT @@ -34,6 +35,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 77ea92898..b80233def 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -39,6 +39,7 @@ MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamTiming, Message) +const QString NFMMod::m_channelID = "sdrangel.channeltx.modnfm"; const int NFMMod::m_levelNbSamples = 480; // every 10ms NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) : diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index f334b4994..3f639209d 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -240,6 +240,8 @@ public: CWKeyer *getCWKeyer() { return &m_cwKeyer; } + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/modnfm/nfmmodgui.cpp b/plugins/channeltx/modnfm/nfmmodgui.cpp index 720ac8c44..e0dc2d030 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.cpp +++ b/plugins/channeltx/modnfm/nfmmodgui.cpp @@ -32,8 +32,6 @@ #include "ui_nfmmodgui.h" #include "nfmmodgui.h" -const QString NFMModGUI::m_channelID = "sdrangel.channeltx.modnfm"; - NFMModGUI* NFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { @@ -331,7 +329,7 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(NFMMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/modnfm/nfmmodgui.h b/plugins/channeltx/modnfm/nfmmodgui.h index c58fb84ea..f2f04645e 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.h +++ b/plugins/channeltx/modnfm/nfmmodgui.h @@ -52,8 +52,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void channelMarkerChanged(); void handleSourceMessages(); diff --git a/plugins/channeltx/modnfm/nfmmodplugin.cpp b/plugins/channeltx/modnfm/nfmmodplugin.cpp index 51d8071fc..acc23360c 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.cpp +++ b/plugins/channeltx/modnfm/nfmmodplugin.cpp @@ -46,12 +46,12 @@ void NFMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register AM modulator - m_pluginAPI->registerTxChannel(NFMModGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(NFMMod::m_channelID, this); } PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == NFMModGUI::m_channelID) + if(channelName == NFMMod::m_channelID) { NFMModGUI* gui = NFMModGUI::create(m_pluginAPI, deviceUISet); return gui; @@ -59,3 +59,14 @@ PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName, return 0; } } + +BasebandSampleSource* NFMModPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == NFMMod::m_channelID) + { + NFMMod* source = new NFMMod(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/modnfm/nfmmodplugin.h b/plugins/channeltx/modnfm/nfmmodplugin.h index 966fc53aa..f5387af53 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.h +++ b/plugins/channeltx/modnfm/nfmmodplugin.h @@ -21,6 +21,7 @@ #include "plugin/plugininterface.h" class DeviceUISet; +class BasebandSampleSource; class NFMModPlugin : public QObject, PluginInterface { Q_OBJECT @@ -34,6 +35,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 04ad4545c..801578233 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -37,10 +37,11 @@ MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamTiming, Message) +const QString SSBMod::m_channelID = "sdrangel.channeltx.modssb"; const int SSBMod::m_levelNbSamples = 480; // every 10ms const int SSBMod::m_ssbFftLen = 1024; -SSBMod::SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink) : +SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) : m_deviceAPI(deviceAPI), m_SSBFilter(0), m_DSBFilter(0), @@ -48,7 +49,7 @@ SSBMod::SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink) : m_DSBFilterBuffer(0), m_SSBFilterBufferIndex(0), m_DSBFilterBufferIndex(0), - m_sampleSink(sampleSink), + m_sampleSink(0), m_movingAverage(40, 0), m_audioFifo(4800), m_settingsMutex(QMutex::Recursive), diff --git a/plugins/channeltx/modssb/ssbmod.h b/plugins/channeltx/modssb/ssbmod.h index cb772fd00..f9ee89615 100644 --- a/plugins/channeltx/modssb/ssbmod.h +++ b/plugins/channeltx/modssb/ssbmod.h @@ -226,9 +226,11 @@ public: //================================================================= - SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink); + SSBMod(DeviceSinkAPI *deviceAPI); ~SSBMod(); + void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; } + virtual void pull(Sample& sample); virtual void pullAudio(int nbSamples); virtual void start(); @@ -239,6 +241,8 @@ public: CWKeyer *getCWKeyer() { return &m_cwKeyer; } + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index 49f827d77..0b5d82ab4 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -33,8 +33,6 @@ #include "dsp/dspengine.h" #include "mainwindow.h" -const QString SSBModGUI::m_channelID = "sdrangel.channeltx.modssb"; - SSBModGUI* SSBModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { SSBModGUI* gui = new SSBModGUI(pluginAPI, deviceUISet); @@ -375,7 +373,8 @@ 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_spectrumVis); + m_ssbMod = new SSBMod(m_deviceUISet->m_deviceSinkAPI); + m_ssbMod->setSpectrumSampleSink(m_spectrumVis); m_ssbMod->setMessageQueueToGUI(getInputMessageQueue()); resetToDefaults(); @@ -405,7 +404,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(SSBMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/modssb/ssbmodgui.h b/plugins/channeltx/modssb/ssbmodgui.h index 7dfe92738..07602d761 100644 --- a/plugins/channeltx/modssb/ssbmodgui.h +++ b/plugins/channeltx/modssb/ssbmodgui.h @@ -54,8 +54,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void handleSourceMessages(); void channelMarkerChanged(); diff --git a/plugins/channeltx/modssb/ssbmodplugin.cpp b/plugins/channeltx/modssb/ssbmodplugin.cpp index c19e711a5..a6c87d1c4 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.cpp +++ b/plugins/channeltx/modssb/ssbmodplugin.cpp @@ -19,6 +19,7 @@ #include "plugin/pluginapi.h" #include "ssbmodgui.h" +#include "ssbmod.h" #include "ssbmodplugin.h" const PluginDescriptor SSBModPlugin::m_pluginDescriptor = { @@ -46,12 +47,12 @@ void SSBModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register SSB modulator - m_pluginAPI->registerTxChannel(SSBModGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(SSBMod::m_channelID, this); } PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == SSBModGUI::m_channelID) + if(channelName == SSBMod::m_channelID) { SSBModGUI* gui = SSBModGUI::create(m_pluginAPI, deviceUISet); return gui; @@ -59,3 +60,14 @@ PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName, return 0; } } + +BasebandSampleSource* SSBModPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == SSBMod::m_channelID) + { + SSBMod* source = new SSBMod(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/modssb/ssbmodplugin.h b/plugins/channeltx/modssb/ssbmodplugin.h index 54d181670..c3cba50cf 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.h +++ b/plugins/channeltx/modssb/ssbmodplugin.h @@ -21,6 +21,7 @@ #include "plugin/plugininterface.h" class DeviceUISet; +class BasebandSampleSource; class SSBModPlugin : public QObject, PluginInterface { Q_OBJECT @@ -34,6 +35,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index fe8725bd1..a7b9d1b20 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -39,6 +39,7 @@ MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamTiming, Message) +const QString WFMMod::m_channelID = "sdrangel.channeltx.modwfm"; const int WFMMod::m_levelNbSamples = 480; // every 10ms const int WFMMod::m_rfFilterFFTLength = 1024; diff --git a/plugins/channeltx/modwfm/wfmmod.h b/plugins/channeltx/modwfm/wfmmod.h index 00d08d3ef..2803f758f 100644 --- a/plugins/channeltx/modwfm/wfmmod.h +++ b/plugins/channeltx/modwfm/wfmmod.h @@ -239,6 +239,8 @@ public: CWKeyer *getCWKeyer() { return &m_cwKeyer; } + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/modwfm/wfmmodgui.cpp b/plugins/channeltx/modwfm/wfmmodgui.cpp index e6192edd4..3df16817c 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.cpp +++ b/plugins/channeltx/modwfm/wfmmodgui.cpp @@ -34,8 +34,6 @@ #include "ui_wfmmodgui.h" #include "wfmmodgui.h" -const QString WFMModGUI::m_channelID = "sdrangel.channeltx.modwfm"; - WFMModGUI* WFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { WFMModGUI* gui = new WFMModGUI(pluginAPI, deviceUISet); @@ -320,7 +318,7 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(WFMMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/modwfm/wfmmodgui.h b/plugins/channeltx/modwfm/wfmmodgui.h index 65b8abe09..3bacde2d7 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.h +++ b/plugins/channeltx/modwfm/wfmmodgui.h @@ -55,8 +55,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void channelMarkerChanged(); void handleSourceMessages(); diff --git a/plugins/channeltx/modwfm/wfmmodplugin.cpp b/plugins/channeltx/modwfm/wfmmodplugin.cpp index 9ce2c9e2f..f4cbe8f98 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.cpp +++ b/plugins/channeltx/modwfm/wfmmodplugin.cpp @@ -19,6 +19,7 @@ #include "plugin/pluginapi.h" #include "wfmmodgui.h" +#include "wfmmod.h" #include "wfmmodplugin.h" const PluginDescriptor WFMModPlugin::m_pluginDescriptor = { @@ -46,12 +47,12 @@ void WFMModPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register AM modulator - m_pluginAPI->registerTxChannel(WFMModGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(WFMMod::m_channelID, this); } PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == WFMModGUI::m_channelID) + if(channelName == WFMMod::m_channelID) { WFMModGUI* gui = WFMModGUI::create(m_pluginAPI, deviceUISet); return gui; @@ -59,3 +60,14 @@ PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName, return 0; } } + +BasebandSampleSource* WFMModPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == WFMMod::m_channelID) + { + WFMMod* source = new WFMMod(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/modwfm/wfmmodplugin.h b/plugins/channeltx/modwfm/wfmmodplugin.h index 5cf603de1..594d0aa98 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.h +++ b/plugins/channeltx/modwfm/wfmmodplugin.h @@ -34,6 +34,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp index 193776c08..c9916d780 100644 --- a/plugins/channeltx/udpsink/udpsink.cpp +++ b/plugins/channeltx/udpsink/udpsink.cpp @@ -29,10 +29,12 @@ MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message) -UDPSink::UDPSink(DeviceSinkAPI *deviceAPI, BasebandSampleSink* spectrum) : +const QString UDPSink::m_channelID = "sdrangel.channeltx.udpsink"; + +UDPSink::UDPSink(DeviceSinkAPI *deviceAPI) : m_deviceAPI(deviceAPI), m_squelch(1e-6), - m_spectrum(spectrum), + m_spectrum(0), m_spectrumEnabled(false), m_spectrumChunkSize(2160), m_spectrumChunkCounter(0), @@ -255,7 +257,7 @@ void UDPSink::modulateSample() m_sampleBuffer.push_back(s); m_spectrumChunkCounter++; } - else + else if (m_spectrum) { m_spectrum->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false); m_sampleBuffer.clear(); diff --git a/plugins/channeltx/udpsink/udpsink.h b/plugins/channeltx/udpsink/udpsink.h index 286fc0234..e15568a4d 100644 --- a/plugins/channeltx/udpsink/udpsink.h +++ b/plugins/channeltx/udpsink/udpsink.h @@ -85,9 +85,11 @@ public: { } }; - UDPSink(DeviceSinkAPI *deviceAPI, BasebandSampleSink* spectrum); + UDPSink(DeviceSinkAPI *deviceAPI); virtual ~UDPSink(); + void setSpectrumSink(BasebandSampleSink* spectrum) { m_spectrum = spectrum; } + virtual void start(); virtual void stop(); virtual void pull(Sample& sample); @@ -101,6 +103,8 @@ public: void setSpectrum(bool enabled); void resetReadIndex(); + static const QString m_channelID; + signals: /** * Level changed diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp index d42d0cd9c..75bd3c62c 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.cpp +++ b/plugins/channeltx/udpsink/udpsinkgui.cpp @@ -27,8 +27,6 @@ #include "udpsinkgui.h" #include "ui_udpsinkgui.h" -const QString UDPSinkGUI::m_channelID = "sdrangel.channeltx.udpsink"; - UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) { UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet); @@ -121,7 +119,8 @@ 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_spectrumVis); + m_udpSink = new UDPSink(m_deviceUISet->m_deviceSinkAPI); + m_udpSink->setSpectrumSink(m_spectrumVis); m_udpSink->setMessageQueueToGUI(getInputMessageQueue()); ui->fmDeviation->setEnabled(false); @@ -147,7 +146,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerTxChannelInstance(m_channelID, this); + m_deviceUISet->registerTxChannelInstance(UDPSink::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h index d19c16d9d..ca8043ceb 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.h +++ b/plugins/channeltx/udpsink/udpsinkgui.h @@ -53,8 +53,6 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); - static const QString m_channelID; - private slots: void handleSourceMessages(); void channelMarkerChanged(); diff --git a/plugins/channeltx/udpsink/udpsinkplugin.cpp b/plugins/channeltx/udpsink/udpsinkplugin.cpp index dd67f0d84..87073cff1 100644 --- a/plugins/channeltx/udpsink/udpsinkplugin.cpp +++ b/plugins/channeltx/udpsink/udpsinkplugin.cpp @@ -47,12 +47,12 @@ void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI = pluginAPI; // register TCP Channel Source - m_pluginAPI->registerTxChannel(UDPSinkGUI::m_channelID, this); + m_pluginAPI->registerTxChannel(UDPSink::m_channelID, this); } PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet) { - if(channelName == UDPSinkGUI::m_channelID) + if(channelName == UDPSink::m_channelID) { UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceUISet); // deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui); @@ -62,3 +62,14 @@ PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName, return 0; } } + +BasebandSampleSource* UDPSinkPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) +{ + if(channelName == UDPSink::m_channelID) + { + UDPSink* source = new UDPSink(deviceAPI); + return source; + } else { + return 0; + } +} diff --git a/plugins/channeltx/udpsink/udpsinkplugin.h b/plugins/channeltx/udpsink/udpsinkplugin.h index 08802500a..0a874afcd 100644 --- a/plugins/channeltx/udpsink/udpsinkplugin.h +++ b/plugins/channeltx/udpsink/udpsinkplugin.h @@ -22,6 +22,7 @@ #include "plugin/plugininterface.h" class DeviceUISet; +class BasebandSampleSource; class UDPSinkPlugin : public QObject, PluginInterface { Q_OBJECT @@ -35,6 +36,7 @@ public: void initPlugin(PluginAPI* pluginAPI); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); + BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor;