mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-01 12:47:53 -04:00
digital modem wrap-up and re-connect
- Compiles but untested
This commit is contained in:
parent
001f4ee23b
commit
dfd7496175
@ -164,24 +164,24 @@ bool CubicSDR::OnInit() {
|
||||
|
||||
wxApp::SetAppName("CubicSDR");
|
||||
|
||||
Modem::addModemFactory("FM", new ModemFM);
|
||||
Modem::addModemFactory("FMS", 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);
|
||||
Modem::addModemFactory(new ModemFM);
|
||||
Modem::addModemFactory(new ModemFMStereo);
|
||||
Modem::addModemFactory(new ModemAM);
|
||||
Modem::addModemFactory(new ModemLSB);
|
||||
Modem::addModemFactory(new ModemUSB);
|
||||
Modem::addModemFactory(new ModemDSB);
|
||||
Modem::addModemFactory(new ModemIQ);
|
||||
|
||||
Modem::addModemFactory("APSK", new ModemAPSK);
|
||||
Modem::addModemFactory("ASK", new ModemASK);
|
||||
Modem::addModemFactory("BPSK", new ModemBPSK);
|
||||
Modem::addModemFactory("DPSK", new ModemDPSK);
|
||||
Modem::addModemFactory("OOK", new ModemOOK);
|
||||
Modem::addModemFactory("PSK", new ModemPSK);
|
||||
Modem::addModemFactory("QAM", new ModemQAM);
|
||||
Modem::addModemFactory("QPSK", new ModemQPSK);
|
||||
Modem::addModemFactory("SQAM", new ModemSQAM);
|
||||
Modem::addModemFactory("ST", new ModemST);
|
||||
Modem::addModemFactory(new ModemAPSK);
|
||||
Modem::addModemFactory(new ModemASK);
|
||||
Modem::addModemFactory(new ModemBPSK);
|
||||
Modem::addModemFactory(new ModemDPSK);
|
||||
Modem::addModemFactory(new ModemOOK);
|
||||
Modem::addModemFactory(new ModemPSK);
|
||||
Modem::addModemFactory(new ModemQAM);
|
||||
Modem::addModemFactory(new ModemQPSK);
|
||||
Modem::addModemFactory(new ModemSQAM);
|
||||
Modem::addModemFactory(new ModemST);
|
||||
|
||||
frequency = wxGetApp().getConfig()->getCenterFreq();
|
||||
offset = 0;
|
||||
|
@ -45,7 +45,6 @@ DemodulatorInstance::DemodulatorInstance() :
|
||||
audioThread->setOutputQueue("NotifyQueue", pipeDemodNotify);
|
||||
|
||||
currentDemodType = demodulatorPreThread->getParams().demodType;
|
||||
currentDemodCons = demodulatorThread->getDemodulatorCons();
|
||||
}
|
||||
|
||||
DemodulatorInstance::~DemodulatorInstance() {
|
||||
@ -75,7 +74,6 @@ void DemodulatorInstance::run() {
|
||||
|
||||
currentFrequency = demodulatorPreThread->getParams().frequency;
|
||||
currentDemodType = demodulatorPreThread->getParams().demodType;
|
||||
currentDemodCons = demodulatorThread->getDemodulatorCons();
|
||||
currentAudioSampleRate = AudioThread::deviceSampleRate[getOutputDevice()];
|
||||
demodulatorPreThread->getParams().audioSampleRate = currentAudioSampleRate;
|
||||
|
||||
@ -300,19 +298,35 @@ std::string DemodulatorInstance::getDemodulatorType() {
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorLock(bool demod_lock_in) {
|
||||
demodulatorThread->setDemodulatorLock(demod_lock_in);
|
||||
Modem *cModem = demodulatorPreThread->getModem();
|
||||
if (cModem && cModem->getType() == "digital") {
|
||||
((ModemDigital *)cModem)->setDemodulatorLock(demod_lock_in);
|
||||
}
|
||||
}
|
||||
|
||||
int DemodulatorInstance::getDemodulatorLock() {
|
||||
return demodulatorThread->getDemodulatorLock();
|
||||
Modem *cModem = demodulatorPreThread->getModem();
|
||||
|
||||
if (cModem && cModem->getType() == "digital") {
|
||||
return ((ModemDigital *)cModem)->getDemodulatorLock();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorCons(int demod_cons_in) {
|
||||
demodulatorThread->setDemodulatorCons(demod_cons_in);
|
||||
Modem *cModem = demodulatorPreThread->getModem();
|
||||
if (cModem && cModem->getType() == "digital") {
|
||||
((ModemDigital *)cModem)->setDemodulatorCons(demod_cons_in);
|
||||
}
|
||||
}
|
||||
|
||||
int DemodulatorInstance::getDemodulatorCons() {
|
||||
return demodulatorThread->getDemodulatorCons();
|
||||
Modem *cModem = demodulatorPreThread->getModem();
|
||||
if (cModem && cModem->getType() == "digital") {
|
||||
return ((ModemDigital *)cModem)->getDemodulatorCons();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setBandwidth(int bw) {
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include "DemodulatorThread.h"
|
||||
#include "DemodulatorPreThread.h"
|
||||
|
||||
#include "ModemDigital.h"
|
||||
#include "ModemAnalog.h"
|
||||
|
||||
class DemodulatorInstance {
|
||||
public:
|
||||
|
||||
@ -112,7 +115,6 @@ private:
|
||||
std::atomic_llong currentFrequency;
|
||||
std::atomic_int currentBandwidth;
|
||||
std::string currentDemodType;
|
||||
std::atomic_int currentDemodCons;
|
||||
std::atomic_int currentOutputDevice;
|
||||
std::atomic_int currentAudioSampleRate;
|
||||
std::atomic<float> currentAudioGain;
|
||||
|
@ -284,3 +284,12 @@ void DemodulatorPreThread::terminate() {
|
||||
delete workerResults;
|
||||
delete workerQueue;
|
||||
}
|
||||
|
||||
|
||||
Modem *DemodulatorPreThread::getModem() {
|
||||
return cModem;
|
||||
}
|
||||
|
||||
ModemKit *DemodulatorPreThread::getModemKit() {
|
||||
return cModemKit;
|
||||
}
|
||||
|
@ -24,11 +24,8 @@ public:
|
||||
void initialize();
|
||||
void terminate();
|
||||
|
||||
#ifdef __APPLE__
|
||||
static void *pthread_helper(void *context) {
|
||||
return ((DemodulatorPreThread *) context)->threadMain();
|
||||
}
|
||||
#endif
|
||||
Modem *getModem();
|
||||
ModemKit *getModemKit();
|
||||
|
||||
protected:
|
||||
msresamp_crcf iqResampler;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
ModemFactoryList Modem::modemFactories;
|
||||
|
||||
void Modem::addModemFactory(std::string modemName, Modem *factorySingle) {
|
||||
modemFactories[modemName] = factorySingle;
|
||||
void Modem::addModemFactory(Modem *factorySingle) {
|
||||
modemFactories[factorySingle->getName()] = factorySingle;
|
||||
}
|
||||
|
||||
ModemFactoryList Modem::getFactories() {
|
||||
|
@ -14,7 +14,6 @@ public:
|
||||
int audioSampleRate;
|
||||
};
|
||||
|
||||
|
||||
class ModemIQData: public ReferenceCounter {
|
||||
public:
|
||||
std::vector<liquid_float_complex> data;
|
||||
@ -34,10 +33,11 @@ typedef std::map<std::string,Modem *> ModemFactoryList;
|
||||
|
||||
class Modem {
|
||||
public:
|
||||
static void addModemFactory(std::string modemName, Modem *factorySingle);
|
||||
static void addModemFactory(Modem *factorySingle);
|
||||
static ModemFactoryList getFactories();
|
||||
static Modem *makeModem(std::string modemType);
|
||||
|
||||
virtual std::string getType() = 0;
|
||||
virtual std::string getName() = 0;
|
||||
virtual Modem *factory() = 0;
|
||||
|
||||
Modem();
|
||||
|
@ -4,6 +4,10 @@ ModemAnalog::ModemAnalog() : aOutputCeil(1), aOutputCeilMA(1), aOutputCeilMAA(1)
|
||||
|
||||
}
|
||||
|
||||
std::string ModemAnalog::getType() {
|
||||
return "analog";
|
||||
}
|
||||
|
||||
ModemKit *ModemAnalog::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKitAnalog *akit = new ModemKitAnalog;
|
||||
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
class ModemAnalog : public Modem {
|
||||
public:
|
||||
ModemAnalog();
|
||||
std::string getType();
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input);
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include "ModemDigital.h"
|
||||
|
||||
ModemDigital::ModemDigital() {
|
||||
|
||||
}
|
||||
|
||||
std::string ModemDigital::getType() {
|
||||
return "digital";
|
||||
}
|
||||
|
||||
ModemKit *ModemDigital::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
|
@ -12,6 +12,7 @@ public:
|
||||
class ModemDigital : public Modem {
|
||||
public:
|
||||
ModemDigital();
|
||||
std::string getType();
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
void digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input);
|
||||
|
@ -8,6 +8,10 @@ Modem *ModemAM::factory() {
|
||||
return new ModemAM;
|
||||
}
|
||||
|
||||
std::string ModemAM::getName() {
|
||||
return "AM";
|
||||
}
|
||||
|
||||
void ModemAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *amkit = (ModemKitAnalog *)kit;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
class ModemAM : public ModemAnalog {
|
||||
public:
|
||||
ModemAM();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
@ -8,6 +8,10 @@ Modem *ModemDSB::factory() {
|
||||
return new ModemDSB;
|
||||
}
|
||||
|
||||
std::string ModemDSB::getName() {
|
||||
return "DSB";
|
||||
}
|
||||
|
||||
void ModemDSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *amkit = (ModemKitAnalog *)kit;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
class ModemDSB : public ModemAnalog {
|
||||
public:
|
||||
ModemDSB();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
@ -8,6 +8,10 @@ Modem *ModemFM::factory() {
|
||||
return new ModemFM;
|
||||
}
|
||||
|
||||
std::string ModemFM::getName() {
|
||||
return "FM";
|
||||
}
|
||||
|
||||
void ModemFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *fmkit = (ModemKitAnalog *)kit;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
class ModemFM : public ModemAnalog {
|
||||
public:
|
||||
ModemFM();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
@ -18,6 +18,14 @@ ModemFMStereo::~ModemFMStereo() {
|
||||
nco_crcf_destroy(stereoPilot);
|
||||
}
|
||||
|
||||
std::string ModemFMStereo::getType() {
|
||||
return "analog";
|
||||
}
|
||||
|
||||
std::string ModemFMStereo::getName() {
|
||||
return "FMS";
|
||||
}
|
||||
|
||||
Modem *ModemFMStereo::factory() {
|
||||
return new ModemFMStereo;
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ class ModemFMStereo : public Modem {
|
||||
public:
|
||||
ModemFMStereo();
|
||||
~ModemFMStereo();
|
||||
std::string getType();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
|
@ -13,6 +13,14 @@ ModemKit *ModemIQ::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
return kit;
|
||||
}
|
||||
|
||||
std::string ModemIQ::getType() {
|
||||
return "analog";
|
||||
}
|
||||
|
||||
std::string ModemIQ::getName() {
|
||||
return "I/Q";
|
||||
}
|
||||
|
||||
void ModemIQ::disposeKit(ModemKit *kit) {
|
||||
delete kit;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
class ModemIQ : public Modem {
|
||||
public:
|
||||
ModemIQ();
|
||||
std::string getType();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
|
@ -10,6 +10,10 @@ Modem *ModemLSB::factory() {
|
||||
return new ModemLSB;
|
||||
}
|
||||
|
||||
std::string ModemLSB::getName() {
|
||||
return "LSB";
|
||||
}
|
||||
|
||||
ModemLSB::~ModemLSB() {
|
||||
resamp2_crcf_destroy(ssbFilt);
|
||||
ampmodem_destroy(demodAM_LSB);
|
||||
|
@ -6,6 +6,7 @@ class ModemLSB : public ModemAnalog {
|
||||
public:
|
||||
ModemLSB();
|
||||
~ModemLSB();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
@ -10,6 +10,10 @@ Modem *ModemUSB::factory() {
|
||||
return new ModemUSB;
|
||||
}
|
||||
|
||||
std::string ModemUSB::getName() {
|
||||
return "USB";
|
||||
}
|
||||
|
||||
ModemUSB::~ModemUSB() {
|
||||
resamp2_crcf_destroy(ssbFilt);
|
||||
ampmodem_destroy(demodAM_USB);
|
||||
|
@ -5,6 +5,7 @@ class ModemUSB : public ModemAnalog {
|
||||
public:
|
||||
ModemUSB();
|
||||
~ModemUSB();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
@ -27,6 +27,10 @@ ModemAPSK::~ModemAPSK() {
|
||||
modem_destroy(demodAPSK256);
|
||||
}
|
||||
|
||||
std::string ModemAPSK::getName() {
|
||||
return "APSK";
|
||||
}
|
||||
|
||||
void ModemAPSK::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
currentDemodCons = cons;
|
||||
|
@ -5,6 +5,7 @@ class ModemAPSK : public ModemDigital {
|
||||
public:
|
||||
ModemAPSK();
|
||||
~ModemAPSK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -29,10 +29,13 @@ ModemASK::~ModemASK() {
|
||||
modem_destroy(demodASK256);
|
||||
}
|
||||
|
||||
std::string ModemASK::getName() {
|
||||
return "ASK";
|
||||
}
|
||||
|
||||
void ModemASK::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
currentDemodCons = cons;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ class ModemASK : public ModemDigital {
|
||||
public:
|
||||
ModemASK();
|
||||
~ModemASK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -12,6 +12,10 @@ ModemBPSK::~ModemBPSK() {
|
||||
modem_destroy(demodBPSK);
|
||||
}
|
||||
|
||||
std::string ModemBPSK::getName() {
|
||||
return "BPSK";
|
||||
}
|
||||
|
||||
void ModemBPSK::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
currentDemodCons = cons;
|
||||
|
@ -5,6 +5,7 @@ class ModemBPSK : public ModemDigital {
|
||||
public:
|
||||
ModemBPSK();
|
||||
~ModemBPSK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -18,6 +18,10 @@ Modem *ModemDPSK::factory() {
|
||||
return new ModemDPSK;
|
||||
}
|
||||
|
||||
std::string ModemDPSK::getName() {
|
||||
return "DPSK";
|
||||
}
|
||||
|
||||
ModemDPSK::~ModemDPSK() {
|
||||
modem_destroy(demodDPSK2);
|
||||
modem_destroy(demodDPSK4);
|
||||
|
@ -5,6 +5,7 @@ class ModemDPSK : public ModemDigital {
|
||||
public:
|
||||
ModemDPSK();
|
||||
~ModemDPSK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -12,6 +12,9 @@ ModemOOK::~ModemOOK() {
|
||||
modem_destroy(demodOOK);
|
||||
}
|
||||
|
||||
std::string ModemOOK::getName() {
|
||||
return "OOK";
|
||||
}
|
||||
|
||||
void ModemOOK::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
|
@ -5,6 +5,7 @@ class ModemOOK : public ModemDigital {
|
||||
public:
|
||||
ModemOOK();
|
||||
~ModemOOK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -18,6 +18,10 @@ Modem *ModemPSK::factory() {
|
||||
return new ModemPSK;
|
||||
}
|
||||
|
||||
std::string ModemPSK::getName() {
|
||||
return "PSK";
|
||||
}
|
||||
|
||||
ModemPSK::~ModemPSK() {
|
||||
modem_destroy(demodPSK2);
|
||||
modem_destroy(demodPSK4);
|
||||
|
@ -5,6 +5,7 @@ class ModemPSK : public ModemDigital {
|
||||
public:
|
||||
ModemPSK();
|
||||
~ModemPSK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -17,6 +17,10 @@ Modem *ModemQAM::factory() {
|
||||
return new ModemQAM;
|
||||
}
|
||||
|
||||
std::string ModemQAM::getName() {
|
||||
return "QAM";
|
||||
}
|
||||
|
||||
ModemQAM::~ModemQAM() {
|
||||
modem_destroy(demodQAM4);
|
||||
modem_destroy(demodQAM8);
|
||||
|
@ -5,6 +5,7 @@ class ModemQAM : public ModemDigital {
|
||||
public:
|
||||
ModemQAM();
|
||||
~ModemQAM();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -12,6 +12,10 @@ ModemQPSK::~ModemQPSK() {
|
||||
modem_destroy(demodQPSK);
|
||||
}
|
||||
|
||||
std::string ModemQPSK::getName() {
|
||||
return "QPSK";
|
||||
}
|
||||
|
||||
void ModemQPSK::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
currentDemodCons = cons;
|
||||
|
@ -5,6 +5,7 @@ class ModemQPSK : public ModemDigital {
|
||||
public:
|
||||
ModemQPSK();
|
||||
~ModemQPSK();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -17,6 +17,10 @@ ModemSQAM::~ModemSQAM() {
|
||||
modem_destroy(demodSQAM128);
|
||||
}
|
||||
|
||||
std::string ModemSQAM::getName() {
|
||||
return "SQAM";
|
||||
}
|
||||
|
||||
void ModemSQAM::updateDemodulatorCons(int cons) {
|
||||
if (currentDemodCons.load() != cons) {
|
||||
currentDemodCons = cons;
|
||||
|
@ -5,6 +5,7 @@ class ModemSQAM : public ModemDigital {
|
||||
public:
|
||||
ModemSQAM();
|
||||
~ModemSQAM();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
@ -8,6 +8,10 @@ Modem *ModemST::factory() {
|
||||
return new ModemST;
|
||||
}
|
||||
|
||||
std::string ModemST::getName() {
|
||||
return "ST";
|
||||
}
|
||||
|
||||
ModemST::~ModemST() {
|
||||
modem_destroy(demodST);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ class ModemST : public ModemDigital {
|
||||
public:
|
||||
ModemST();
|
||||
~ModemST();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
void updateDemodulatorCons(int cons);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
Loading…
x
Reference in New Issue
Block a user