1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-14 20:31:53 -05:00

Added mod constructor interface in the plugin API. Created method in all Tx channel plugins

This commit is contained in:
f4exb 2017-11-08 17:09:25 +01:00
parent 4ad038ed9d
commit 9c68da780e
36 changed files with 133 additions and 52 deletions

View File

@ -36,6 +36,7 @@ MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamTiming, Message)
const QString AMMod::m_channelID = "sdrangel.channeltx.modam";
const int AMMod::m_levelNbSamples = 480; // every 10ms const int AMMod::m_levelNbSamples = 480; // every 10ms
AMMod::AMMod(DeviceSinkAPI *deviceAPI) : AMMod::AMMod(DeviceSinkAPI *deviceAPI) :

View File

@ -238,6 +238,8 @@ public:
CWKeyer *getCWKeyer() { return &m_cwKeyer; } CWKeyer *getCWKeyer() { return &m_cwKeyer; }
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -34,8 +34,6 @@
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "mainwindow.h" #include "mainwindow.h"
const QString AMModGUI::m_channelID = "sdrangel.channeltx.modam";
AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
{ {
AMModGUI* gui = new AMModGUI(pluginAPI, 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())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -53,8 +53,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void channelMarkerChanged(); void channelMarkerChanged();
void handleSourceMessages(); void handleSourceMessages();

View File

@ -19,11 +19,12 @@
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "ammodgui.h" #include "ammodgui.h"
#include "ammod.h"
#include "ammodplugin.h" #include "ammodplugin.h"
const PluginDescriptor AMModPlugin::m_pluginDescriptor = { const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
QString("AM Modulator"), QString("AM Modulator"),
QString("3.8.0"), QString("3.8.2"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,
@ -46,12 +47,12 @@ void AMModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register AM modulator // 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) 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); AMModGUI* gui = AMModGUI::create(m_pluginAPI, deviceUISet);
return gui; return gui;
@ -59,3 +60,14 @@ PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, D
return 0; 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;
}
}

View File

@ -21,6 +21,7 @@
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
class DeviceUISet; class DeviceUISet;
class BasebandSampleSource;
class AMModPlugin : public QObject, PluginInterface { class AMModPlugin : public QObject, PluginInterface {
Q_OBJECT Q_OBJECT
@ -34,6 +35,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -40,6 +40,7 @@ MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureOverlayText, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureShowOverlayText, Message) MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureShowOverlayText, Message)
MESSAGE_CLASS_DEFINITION(ATVMod::MsgReportEffectiveSampleRate, 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_blackLevel = 0.3f;
const float ATVMod::m_spanLevel = 0.7f; const float ATVMod::m_spanLevel = 0.7f;
const int ATVMod::m_levelNbSamples = 10000; // every 10ms const int ATVMod::m_levelNbSamples = 10000; // every 10ms

View File

@ -407,6 +407,8 @@ public:
static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit); static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit);
static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation); static float getRFBandwidthDivisor(ATVModSettings::ATVModulation modulation);
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -35,8 +35,6 @@
#include "ui_atvmodgui.h" #include "ui_atvmodgui.h"
#include "atvmodgui.h" #include "atvmodgui.h"
const QString ATVModGUI::m_channelID = "sdrangel.channeltx.modatv";
ATVModGUI* ATVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) ATVModGUI* ATVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
{ {
ATVModGUI* gui = new ATVModGUI(pluginAPI, 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())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -54,8 +54,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void channelMarkerChanged(); void channelMarkerChanged();
void handleSourceMessages(); void handleSourceMessages();

View File

@ -19,6 +19,7 @@
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "atvmodgui.h" #include "atvmodgui.h"
#include "atvmod.h"
#include "atvmodplugin.h" #include "atvmodplugin.h"
const PluginDescriptor ATVModPlugin::m_pluginDescriptor = { const PluginDescriptor ATVModPlugin::m_pluginDescriptor = {
@ -46,12 +47,12 @@ void ATVModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register ATV modulator // 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) 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); ATVModGUI* gui = ATVModGUI::create(m_pluginAPI, deviceUISet);
return gui; 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;
}
}

View File

@ -21,6 +21,7 @@
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
class DeviceSinkAPI; class DeviceSinkAPI;
class BasebandSampleSource;
class ATVModPlugin : public QObject, PluginInterface { class ATVModPlugin : public QObject, PluginInterface {
Q_OBJECT Q_OBJECT
@ -34,6 +35,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -39,6 +39,7 @@ MESSAGE_CLASS_DEFINITION(NFMMod::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamTiming, Message) MESSAGE_CLASS_DEFINITION(NFMMod::MsgReportFileSourceStreamTiming, Message)
const QString NFMMod::m_channelID = "sdrangel.channeltx.modnfm";
const int NFMMod::m_levelNbSamples = 480; // every 10ms const int NFMMod::m_levelNbSamples = 480; // every 10ms
NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) : NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) :

View File

@ -240,6 +240,8 @@ public:
CWKeyer *getCWKeyer() { return &m_cwKeyer; } CWKeyer *getCWKeyer() { return &m_cwKeyer; }
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -32,8 +32,6 @@
#include "ui_nfmmodgui.h" #include "ui_nfmmodgui.h"
#include "nfmmodgui.h" #include "nfmmodgui.h"
const QString NFMModGUI::m_channelID = "sdrangel.channeltx.modnfm";
NFMModGUI* NFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) 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())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -52,8 +52,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void channelMarkerChanged(); void channelMarkerChanged();
void handleSourceMessages(); void handleSourceMessages();

View File

@ -46,12 +46,12 @@ void NFMModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register AM modulator // 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) 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); NFMModGUI* gui = NFMModGUI::create(m_pluginAPI, deviceUISet);
return gui; return gui;
@ -59,3 +59,14 @@ PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName,
return 0; 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;
}
}

View File

@ -21,6 +21,7 @@
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
class DeviceUISet; class DeviceUISet;
class BasebandSampleSource;
class NFMModPlugin : public QObject, PluginInterface { class NFMModPlugin : public QObject, PluginInterface {
Q_OBJECT Q_OBJECT
@ -34,6 +35,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -37,10 +37,11 @@ MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamTiming, 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_levelNbSamples = 480; // every 10ms
const int SSBMod::m_ssbFftLen = 1024; const int SSBMod::m_ssbFftLen = 1024;
SSBMod::SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink) : SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_SSBFilter(0), m_SSBFilter(0),
m_DSBFilter(0), m_DSBFilter(0),
@ -48,7 +49,7 @@ SSBMod::SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink) :
m_DSBFilterBuffer(0), m_DSBFilterBuffer(0),
m_SSBFilterBufferIndex(0), m_SSBFilterBufferIndex(0),
m_DSBFilterBufferIndex(0), m_DSBFilterBufferIndex(0),
m_sampleSink(sampleSink), m_sampleSink(0),
m_movingAverage(40, 0), m_movingAverage(40, 0),
m_audioFifo(4800), m_audioFifo(4800),
m_settingsMutex(QMutex::Recursive), m_settingsMutex(QMutex::Recursive),

View File

@ -226,9 +226,11 @@ public:
//================================================================= //=================================================================
SSBMod(DeviceSinkAPI *deviceAPI, BasebandSampleSink* sampleSink); SSBMod(DeviceSinkAPI *deviceAPI);
~SSBMod(); ~SSBMod();
void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; }
virtual void pull(Sample& sample); virtual void pull(Sample& sample);
virtual void pullAudio(int nbSamples); virtual void pullAudio(int nbSamples);
virtual void start(); virtual void start();
@ -239,6 +241,8 @@ public:
CWKeyer *getCWKeyer() { return &m_cwKeyer; } CWKeyer *getCWKeyer() { return &m_cwKeyer; }
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -33,8 +33,6 @@
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "mainwindow.h" #include "mainwindow.h"
const QString SSBModGUI::m_channelID = "sdrangel.channeltx.modssb";
SSBModGUI* SSBModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) SSBModGUI* SSBModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
{ {
SSBModGUI* gui = new SSBModGUI(pluginAPI, 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())); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
m_spectrumVis = new SpectrumVis(ui->glSpectrum); 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()); m_ssbMod->setMessageQueueToGUI(getInputMessageQueue());
resetToDefaults(); resetToDefaults();
@ -405,7 +404,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* pa
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -54,8 +54,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
void channelMarkerChanged(); void channelMarkerChanged();

View File

@ -19,6 +19,7 @@
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "ssbmodgui.h" #include "ssbmodgui.h"
#include "ssbmod.h"
#include "ssbmodplugin.h" #include "ssbmodplugin.h"
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = { const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
@ -46,12 +47,12 @@ void SSBModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register SSB modulator // 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) 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); SSBModGUI* gui = SSBModGUI::create(m_pluginAPI, deviceUISet);
return gui; return gui;
@ -59,3 +60,14 @@ PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName,
return 0; 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;
}
}

View File

@ -21,6 +21,7 @@
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
class DeviceUISet; class DeviceUISet;
class BasebandSampleSource;
class SSBModPlugin : public QObject, PluginInterface { class SSBModPlugin : public QObject, PluginInterface {
Q_OBJECT Q_OBJECT
@ -34,6 +35,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -39,6 +39,7 @@ MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamData, Message) MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamTiming, 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_levelNbSamples = 480; // every 10ms
const int WFMMod::m_rfFilterFFTLength = 1024; const int WFMMod::m_rfFilterFFTLength = 1024;

View File

@ -239,6 +239,8 @@ public:
CWKeyer *getCWKeyer() { return &m_cwKeyer; } CWKeyer *getCWKeyer() { return &m_cwKeyer; }
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -34,8 +34,6 @@
#include "ui_wfmmodgui.h" #include "ui_wfmmodgui.h"
#include "wfmmodgui.h" #include "wfmmodgui.h"
const QString WFMModGUI::m_channelID = "sdrangel.channeltx.modwfm";
WFMModGUI* WFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) WFMModGUI* WFMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
{ {
WFMModGUI* gui = new WFMModGUI(pluginAPI, 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())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -55,8 +55,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void channelMarkerChanged(); void channelMarkerChanged();
void handleSourceMessages(); void handleSourceMessages();

View File

@ -19,6 +19,7 @@
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "wfmmodgui.h" #include "wfmmodgui.h"
#include "wfmmod.h"
#include "wfmmodplugin.h" #include "wfmmodplugin.h"
const PluginDescriptor WFMModPlugin::m_pluginDescriptor = { const PluginDescriptor WFMModPlugin::m_pluginDescriptor = {
@ -46,12 +47,12 @@ void WFMModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register AM modulator // 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) 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); WFMModGUI* gui = WFMModGUI::create(m_pluginAPI, deviceUISet);
return gui; return gui;
@ -59,3 +60,14 @@ PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName,
return 0; 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;
}
}

View File

@ -34,6 +34,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -29,10 +29,12 @@ MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, 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_deviceAPI(deviceAPI),
m_squelch(1e-6), m_squelch(1e-6),
m_spectrum(spectrum), m_spectrum(0),
m_spectrumEnabled(false), m_spectrumEnabled(false),
m_spectrumChunkSize(2160), m_spectrumChunkSize(2160),
m_spectrumChunkCounter(0), m_spectrumChunkCounter(0),
@ -255,7 +257,7 @@ void UDPSink::modulateSample()
m_sampleBuffer.push_back(s); m_sampleBuffer.push_back(s);
m_spectrumChunkCounter++; m_spectrumChunkCounter++;
} }
else else if (m_spectrum)
{ {
m_spectrum->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false); m_spectrum->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false);
m_sampleBuffer.clear(); m_sampleBuffer.clear();

View File

@ -85,9 +85,11 @@ public:
{ } { }
}; };
UDPSink(DeviceSinkAPI *deviceAPI, BasebandSampleSink* spectrum); UDPSink(DeviceSinkAPI *deviceAPI);
virtual ~UDPSink(); virtual ~UDPSink();
void setSpectrumSink(BasebandSampleSink* spectrum) { m_spectrum = spectrum; }
virtual void start(); virtual void start();
virtual void stop(); virtual void stop();
virtual void pull(Sample& sample); virtual void pull(Sample& sample);
@ -101,6 +103,8 @@ public:
void setSpectrum(bool enabled); void setSpectrum(bool enabled);
void resetReadIndex(); void resetReadIndex();
static const QString m_channelID;
signals: signals:
/** /**
* Level changed * Level changed

View File

@ -27,8 +27,6 @@
#include "udpsinkgui.h" #include "udpsinkgui.h"
#include "ui_udpsinkgui.h" #include "ui_udpsinkgui.h"
const QString UDPSinkGUI::m_channelID = "sdrangel.channeltx.udpsink";
UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet) UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
{ {
UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet); UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet);
@ -121,7 +119,8 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget*
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
m_spectrumVis = new SpectrumVis(ui->glSpectrum); 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()); m_udpSink->setMessageQueueToGUI(getInputMessageQueue());
ui->fmDeviation->setEnabled(false); ui->fmDeviation->setEnabled(false);
@ -147,7 +146,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget*
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); 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->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);

View File

@ -53,8 +53,6 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
static const QString m_channelID;
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
void channelMarkerChanged(); void channelMarkerChanged();

View File

@ -47,12 +47,12 @@ void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI; m_pluginAPI = pluginAPI;
// register TCP Channel Source // 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) 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); UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceUISet);
// deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui); // deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui);
@ -62,3 +62,14 @@ PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName,
return 0; 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;
}
}

View File

@ -22,6 +22,7 @@
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
class DeviceUISet; class DeviceUISet;
class BasebandSampleSource;
class UDPSinkPlugin : public QObject, PluginInterface { class UDPSinkPlugin : public QObject, PluginInterface {
Q_OBJECT Q_OBJECT
@ -35,6 +36,7 @@ public:
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);
PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet); PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet);
BasebandSampleSource* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;