From e33b8952d4ad74ebbe097e3427e11c612cad1c7b Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Tue, 17 Nov 2015 00:21:17 -0500 Subject: [PATCH] Modem factory init --- src/CubicSDR.cpp | 8 ++++++++ src/CubicSDR.h | 8 ++++++++ src/modules/modem/Modem.cpp | 4 ++-- src/modules/modem/Modem.h | 5 ++--- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 3081026..4440072 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -164,6 +164,14 @@ bool CubicSDR::OnInit() { wxApp::SetAppName("CubicSDR"); + Modem::addModemFactory("FM", new ModemFM); + Modem::addModemFactory("WBFM", new ModemFMStereo); + Modem::addModemFactory("AM", new ModemAM); + Modem::addModemFactory("LSB", new ModemLSB); + Modem::addModemFactory("USB", new ModemUSB); + Modem::addModemFactory("DSB", new ModemDSB); + Modem::addModemFactory("I/Q", new ModemIQ); + frequency = wxGetApp().getConfig()->getCenterFreq(); offset = 0; ppm = 0; diff --git a/src/CubicSDR.h b/src/CubicSDR.h index 9cba67a..0253624 100644 --- a/src/CubicSDR.h +++ b/src/CubicSDR.h @@ -27,6 +27,14 @@ #include "SpectrumVisualProcessor.h" #include "SpectrumVisualDataThread.h" #include "SDRDevices.h" +#include "Modem.h" +#include "ModemFM.h" +#include "ModemFMStereo.h" +#include "ModemAM.h" +#include "ModemUSB.h" +#include "ModemLSB.h" +#include "ModemDSB.h" +#include "ModemIQ.h" #include diff --git a/src/modules/modem/Modem.cpp b/src/modules/modem/Modem.cpp index 2502ef3..058b10d 100644 --- a/src/modules/modem/Modem.cpp +++ b/src/modules/modem/Modem.cpp @@ -2,8 +2,8 @@ ModemFactoryList Modem::modemFactories; -void Modem::addModemFactory(std::string modemName, ModemFactoryFunc *factoryFunc) { - modemFactories[modemName] = factoryFunc; +void Modem::addModemFactory(std::string modemName, Modem *factorySingle) { + modemFactories[modemName] = factorySingle; } ModemFactoryList Modem::getFactories() { diff --git a/src/modules/modem/Modem.h b/src/modules/modem/Modem.h index 66c4060..52587fe 100644 --- a/src/modules/modem/Modem.h +++ b/src/modules/modem/Modem.h @@ -30,12 +30,11 @@ public: }; class Modem; -typedef Modem *(Modem::*ModemFactoryFunc)(); -typedef std::map ModemFactoryList; +typedef std::map ModemFactoryList; class Modem { public: - static void addModemFactory(std::string modemName, ModemFactoryFunc *factoryFunc); + static void addModemFactory(std::string modemName, Modem *factorySingle); static ModemFactoryList getFactories(); virtual Modem *factory();