Refactor digital code, prepare for implementation

This commit is contained in:
Charles J. Cliffe 2015-11-18 21:09:51 -05:00
parent bb62fd1999
commit ea005014ae
26 changed files with 820 additions and 510 deletions

View File

@ -236,6 +236,7 @@ SET (cubicsdr_sources
src/demod/DemodulatorMgr.cpp
src/modules/modem/Modem.cpp
src/modules/modem/ModemAnalog.cpp
src/modules/modem/ModemDigital.cpp
src/modules/modem/digital/ModemASK.cpp
src/modules/modem/digital/ModemAPSK.cpp
src/modules/modem/digital/ModemBPSK.cpp
@ -314,6 +315,7 @@ SET (cubicsdr_headers
src/demod/DemodDefs.h
src/modules/modem/Modem.h
src/modules/modem/ModemAnalog.h
src/modules/modem/ModemDigital.h
src/modules/modem/digital/ModemASK.h
src/modules/modem/digital/ModemAPSK.h
src/modules/modem/digital/ModemBPSK.h

View File

@ -12,80 +12,12 @@
#include <pthread.h>
#endif
DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent) : IOThread(), iqAutoGain(NULL), amOutputCeil(1), amOutputCeilMA(1), amOutputCeilMAA(1), audioSampleRate(0), squelchLevel(0), signalLevel(0), squelchEnabled(false), iqInputQueue(NULL), audioOutputQueue(NULL), audioVisOutputQueue(NULL), threadQueueControl(NULL), threadQueueNotify(NULL), cModem(nullptr), cModemKit(nullptr) {
DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent) : IOThread(), iqAutoGain(NULL), audioSampleRate(0), squelchLevel(0), signalLevel(0), squelchEnabled(false), iqInputQueue(NULL), audioOutputQueue(NULL), audioVisOutputQueue(NULL), threadQueueControl(NULL), threadQueueNotify(NULL), cModem(nullptr), cModemKit(nullptr) {
demodInstance = parent;
muted.store(false);
agcEnabled.store(false);
// advanced demodulators
/* demodulatorCons.store(2);
currentDemodCons = 0;
demodASK = demodASK2;
demodASK2 = modem_create(LIQUID_MODEM_ASK2);
demodASK4 = modem_create(LIQUID_MODEM_ASK4);
demodASK8 = modem_create(LIQUID_MODEM_ASK8);
demodASK16 = modem_create(LIQUID_MODEM_ASK16);
demodASK32 = modem_create(LIQUID_MODEM_ASK32);
demodASK64 = modem_create(LIQUID_MODEM_ASK64);
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
demodAPSK = demodAPSK4;
demodAPSK4 = modem_create(LIQUID_MODEM_APSK4);
demodAPSK8 = modem_create(LIQUID_MODEM_APSK8);
demodAPSK16 = modem_create(LIQUID_MODEM_APSK16);
demodAPSK32 = modem_create(LIQUID_MODEM_APSK32);
demodAPSK64 = modem_create(LIQUID_MODEM_APSK64);
demodAPSK128 = modem_create(LIQUID_MODEM_APSK128);
demodAPSK256 = modem_create(LIQUID_MODEM_APSK256);
demodBPSK = modem_create(LIQUID_MODEM_BPSK);
demodDPSK = demodDPSK2;
demodDPSK2 = modem_create(LIQUID_MODEM_DPSK2);
demodDPSK4 = modem_create(LIQUID_MODEM_DPSK4);
demodDPSK8 = modem_create(LIQUID_MODEM_DPSK8);
demodDPSK16 = modem_create(LIQUID_MODEM_DPSK16);
demodDPSK32 = modem_create(LIQUID_MODEM_DPSK32);
demodDPSK64 = modem_create(LIQUID_MODEM_DPSK64);
demodDPSK128 = modem_create(LIQUID_MODEM_DPSK128);
demodDPSK256 = modem_create(LIQUID_MODEM_DPSK256);
demodPSK = demodPSK2;
demodPSK2 = modem_create(LIQUID_MODEM_PSK2);
demodPSK4 = modem_create(LIQUID_MODEM_PSK4);
demodPSK8 = modem_create(LIQUID_MODEM_PSK8);
demodPSK16 = modem_create(LIQUID_MODEM_PSK16);
demodPSK32 = modem_create(LIQUID_MODEM_PSK32);
demodPSK64 = modem_create(LIQUID_MODEM_PSK64);
demodPSK128 = modem_create(LIQUID_MODEM_PSK128);
demodPSK256 = modem_create(LIQUID_MODEM_PSK256);
demodOOK = modem_create(LIQUID_MODEM_OOK);
demodSQAM = demodSQAM32;
demodSQAM32 = modem_create(LIQUID_MODEM_SQAM32);
demodSQAM128 = modem_create(LIQUID_MODEM_SQAM128);
demodST = modem_create(LIQUID_MODEM_V29);
demodQAM = demodQAM4;
demodQAM4 = modem_create(LIQUID_MODEM_QAM4);
demodQAM8 = modem_create(LIQUID_MODEM_QAM8);
demodQAM16 = modem_create(LIQUID_MODEM_QAM16);
demodQAM32 = modem_create(LIQUID_MODEM_QAM32);
demodQAM64 = modem_create(LIQUID_MODEM_QAM64);
demodQAM128 = modem_create(LIQUID_MODEM_QAM128);
demodQAM256 = modem_create(LIQUID_MODEM_QAM256);
demodQPSK = modem_create(LIQUID_MODEM_QPSK);
currentDemodLock = false; */
}
DemodulatorThread::~DemodulatorThread() {
}
@ -133,7 +65,6 @@ void DemodulatorThread::run() {
continue;
}
if (inp->modemKit && inp->modemKit != cModemKit) {
if (cModemKit != nullptr) {
cModem->disposeKit(cModemKit);
@ -182,8 +113,6 @@ void DemodulatorThread::run() {
modemData.data.assign(inputData->begin(), inputData->end());
modemData.setRefCount(1);
AudioThreadInput *ati = NULL;
ati = outputBuffers.getBuffer();
@ -192,311 +121,6 @@ void DemodulatorThread::run() {
ati->setRefCount(1);
cModem->demodulate(cModemKit, &modemData, ati);
// Reset demodulator Constellations & Lock
// updateDemodulatorCons(0);
/*
{
switch (demodulatorType.load()) {
// advanced demodulators
case DEMOD_TYPE_ASK:
switch (demodulatorCons.load()) {
case 2:
demodASK = demodASK2;
updateDemodulatorCons(2);
break;
case 4:
demodASK = demodASK4;
updateDemodulatorCons(4);
break;
case 8:
demodASK = demodASK8;
updateDemodulatorCons(8);
break;
case 16:
demodASK = demodASK16;
updateDemodulatorCons(16);
break;
case 32:
demodASK = demodASK32;
updateDemodulatorCons(32);
break;
case 64:
demodASK = demodASK64;
updateDemodulatorCons(64);
break;
case 128:
demodASK = demodASK128;
updateDemodulatorCons(128);
break;
case 256:
demodASK = demodASK256;
updateDemodulatorCons(256);
break;
default:
demodASK = demodASK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodASK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodASK, 0.005f);
break;
case DEMOD_TYPE_APSK:
switch (demodulatorCons.load()) {
case 2:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 4:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodAPSK = demodAPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodAPSK = demodAPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodAPSK = demodAPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodAPSK = demodAPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodAPSK = demodAPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodAPSK = demodAPSK256;
updateDemodulatorCons(256);
break;
default:
demodAPSK = demodAPSK4;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodAPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodAPSK, 0.005f);
break;
case DEMOD_TYPE_BPSK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodBPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodBPSK, 0.005f);
break;
case DEMOD_TYPE_DPSK:
switch (demodulatorCons.load()) {
case 2:
demodDPSK = demodDPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodDPSK = demodDPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodDPSK = demodDPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodDPSK = demodDPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodDPSK = demodDPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodDPSK = demodDPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodDPSK = demodDPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodDPSK = demodDPSK256;
updateDemodulatorCons(256);
break;
default:
demodDPSK = demodDPSK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodDPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodDPSK, 0.005f);
break;
case DEMOD_TYPE_PSK:
switch (demodulatorCons.load()) {
case 2:
demodPSK = demodPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodPSK = demodPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodPSK = demodPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodPSK = demodPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodPSK = demodPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodPSK = demodPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodPSK = demodPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodPSK = demodPSK256;
updateDemodulatorCons(256);
break;
default:
demodPSK = demodPSK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodPSK, 0.005f);
break;
case DEMOD_TYPE_OOK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodOOK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodOOK, 0.005f);
break;
case DEMOD_TYPE_SQAM:
switch (demodulatorCons.load()) {
case 2:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 4:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 8:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 16:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 32:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 128:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
default:
demodSQAM = demodSQAM32;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodSQAM, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodSQAM, 0.005f);
break;
case DEMOD_TYPE_ST:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodST, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodST, 0.005f);
break;
case DEMOD_TYPE_QAM:
switch (demodulatorCons.load()) {
case 2:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 4:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 8:
demodQAM = demodQAM8;
updateDemodulatorCons(8);
break;
case 16:
demodQAM = demodQAM16;
updateDemodulatorCons(16);
break;
case 32:
demodQAM = demodQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodQAM = demodQAM64;
updateDemodulatorCons(64);
break;
case 128:
demodQAM = demodQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodQAM = demodQAM256;
updateDemodulatorCons(256);
break;
default:
demodQAM = demodQAM4;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodQAM, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodQAM, 0.5f);
break;
case DEMOD_TYPE_QPSK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodQPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodQPSK, 0.8f);
break;
}
}
}*/
if (currentSignalLevel > signalLevel) {
signalLevel = signalLevel + (currentSignalLevel - signalLevel) * 0.5;
@ -504,7 +128,6 @@ void DemodulatorThread::run() {
signalLevel = signalLevel + (currentSignalLevel - signalLevel) * 0.05;
}
if (audioOutputQueue != NULL) {
if (ati && (!squelchEnabled || (signalLevel >= squelchLevel))) {
std::vector<float>::iterator data_i;
@ -596,7 +219,6 @@ void DemodulatorThread::run() {
}
}
// demodOutputDataDigital.empty();
inp->decRefCount();
}
@ -654,29 +276,3 @@ void DemodulatorThread::setSquelchLevel(float signal_level_in) {
float DemodulatorThread::getSquelchLevel() {
return squelchLevel;
}
void DemodulatorThread::setDemodulatorLock(bool demod_lock_in) {
demod_lock_in ? currentDemodLock = true : currentDemodLock = false;
}
int DemodulatorThread::getDemodulatorLock() {
return currentDemodLock;
}
void DemodulatorThread::setDemodulatorCons(int demod_cons_in) {
demodulatorCons.store(demod_cons_in);
}
int DemodulatorThread::getDemodulatorCons() {
return currentDemodCons;
}
void DemodulatorThread::updateDemodulatorLock(modem demod, float sensitivity) {
modem_get_demodulator_evm(demod) <= sensitivity ? setDemodulatorLock(true) : setDemodulatorLock(false);
}
void DemodulatorThread::updateDemodulatorCons(int Cons) {
if (currentDemodCons != Cons) {
currentDemodCons = Cons;
}
}

View File

@ -32,12 +32,7 @@ public:
float getSignalLevel();
void setSquelchLevel(float signal_level_in);
float getSquelchLevel();
void setDemodulatorLock(bool demod_lock_in);
int getDemodulatorLock();
void setDemodulatorCons(int demod_cons_in);
int getDemodulatorCons();
//
//#ifdef __APPLE__
// static void *pthread_helper(void *context) {
@ -51,104 +46,17 @@ protected:
std::vector<liquid_float_complex> agcData;
std::vector<float> agcAMData;
// std::vector<float> demodOutputData;
// std::vector<float> demodStereoData;
// std::vector<float> resampledOutputData;
// std::vector<float> resampledStereoData;
std::vector<unsigned int> demodOutputDataDigital;
//std::vector<unsigned int> demodOutputDataDigitalTest;
//std::vector<unsigned char> demodOutputSoftbits;
//std::vector<unsigned char> demodOutputSoftbitsTest;
// freqdem demodFM;
// ampmodem demodAM;
// ampmodem demodAM_DSB_CSP;
// ampmodem demodAM_DSB;
// ampmodem demodAM_LSB;
// ampmodem demodAM_USB;
/*
modem demodASK;
modem demodASK2;
modem demodASK4;
modem demodASK8;
modem demodASK16;
modem demodASK32;
modem demodASK64;
modem demodASK128;
modem demodASK256;
modem demodAPSK;
modem demodAPSK4;
modem demodAPSK8;
modem demodAPSK16;
modem demodAPSK32;
modem demodAPSK64;
modem demodAPSK128;
modem demodAPSK256;
modem demodBPSK;
modem demodDPSK;
modem demodDPSK2;
modem demodDPSK4;
modem demodDPSK8;
modem demodDPSK16;
modem demodDPSK32;
modem demodDPSK64;
modem demodDPSK128;
modem demodDPSK256;
modem demodPSK;
modem demodPSK2;
modem demodPSK4;
modem demodPSK8;
modem demodPSK16;
modem demodPSK32;
modem demodPSK64;
modem demodPSK128;
modem demodPSK256;
modem demodOOK;
modem demodSQAM;
modem demodSQAM32;
modem demodSQAM128;
modem demodST;
modem demodQAM;
modem demodQAM4;
modem demodQAM8;
modem demodQAM16;
modem demodQAM32;
modem demodQAM64;
modem demodQAM128;
modem demodQAM256;
modem demodQPSK;
*/
agc_crcf iqAutoGain;
float amOutputCeil;
float amOutputCeilMA;
float amOutputCeilMAA;
std::atomic_bool muted;
std::atomic_bool agcEnabled;
std::atomic_int demodulatorCons;
int audioSampleRate;
std::atomic<float> squelchLevel;
std::atomic<float> signalLevel;
bool squelchEnabled;
bool currentDemodLock;
int currentDemodCons;
void updateDemodulatorCons(int Cons);
void updateDemodulatorLock(modem demod, float sensitivity);
Modem *cModem;
ModemKit *cModemKit;

View File

@ -22,7 +22,7 @@ void ModemAnalog::disposeKit(ModemKit *kit) {
ModemKitAnalog *akit = (ModemKitAnalog *)kit;
msresamp_rrrf_destroy(akit->audioResampler);
delete kit;
delete akit;
}
void ModemAnalog::initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input) {

View File

@ -0,0 +1,70 @@
#include "ModemDigital.h"
ModemDigital::ModemDigital() {
demodulatorCons.store(2);
currentDemodCons = 0;
currentDemodLock = false;
}
ModemKit *ModemDigital::buildKit(long long sampleRate, int audioSampleRate) {
ModemKitDigital *dkit = new ModemKitDigital;
dkit->sampleRate = sampleRate;
dkit->audioSampleRate = audioSampleRate;
return dkit;
}
void ModemDigital::disposeKit(ModemKit *kit) {
ModemKitDigital *dkit = (ModemKitDigital *)kit;
delete dkit;
}
void ModemDigital::setDemodulatorLock(bool demod_lock_in) {
demod_lock_in ? currentDemodLock = true : currentDemodLock = false;
}
int ModemDigital::getDemodulatorLock() {
return currentDemodLock;
}
void ModemDigital::setDemodulatorCons(int demod_cons_in) {
demodulatorCons.store(demod_cons_in);
}
int ModemDigital::getDemodulatorCons() {
return currentDemodCons;
}
void ModemDigital::updateDemodulatorLock(modem demod, float sensitivity) {
modem_get_demodulator_evm(demod) <= sensitivity ? setDemodulatorLock(true) : setDemodulatorLock(false);
}
void ModemDigital::updateDemodulatorCons(int Cons) {
if (currentDemodCons != Cons) {
currentDemodCons = Cons;
}
}
// Demodulate
/*
// Reset demodulator Constellations & Lock
// updateDemodulatorCons(0);
{
switch (demodulatorType.load()) {
// advanced demodulators
}
}
}
// demodOutputDataDigital.empty();
*/

View File

@ -0,0 +1,38 @@
#pragma once
#include "Modem.h"
class ModemKitDigital : public ModemKit {
public:
ModemKitDigital() : ModemKit() {
};
};
class ModemDigital : public Modem {
public:
ModemDigital();
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
void disposeKit(ModemKit *kit);
void setDemodulatorLock(bool demod_lock_in);
int getDemodulatorLock();
void setDemodulatorCons(int demod_cons_in);
int getDemodulatorCons();
void updateDemodulatorCons(int Cons);
void updateDemodulatorLock(modem demod, float sensitivity);
protected:
std::vector<unsigned int> demodOutputDataDigital;
std::atomic_int demodulatorCons;
bool currentDemodLock;
int currentDemodCons;
int bufSize;
// std::vector<unsigned int> demodOutputDataDigitalTest;
// std::vector<unsigned char> demodOutputSoftbits;
// std::vector<unsigned char> demodOutputSoftbitsTest;
};

View File

@ -1 +1,76 @@
#include "ModemAPSK.h"
#include "ModemAPSK.h"
ModemAPSK::ModemAPSK() {
demodAPSK4 = modem_create(LIQUID_MODEM_APSK4);
demodAPSK8 = modem_create(LIQUID_MODEM_APSK8);
demodAPSK16 = modem_create(LIQUID_MODEM_APSK16);
demodAPSK32 = modem_create(LIQUID_MODEM_APSK32);
demodAPSK64 = modem_create(LIQUID_MODEM_APSK64);
demodAPSK128 = modem_create(LIQUID_MODEM_APSK128);
demodAPSK256 = modem_create(LIQUID_MODEM_APSK256);
demodAPSK = demodAPSK4;
}
Modem *ModemAPSK::factory() {
return new ModemAPSK;
}
ModemAPSK::~ModemAPSK() {
modem_destroy(demodAPSK4);
modem_destroy(demodAPSK8);
modem_destroy(demodAPSK16);
modem_destroy(demodAPSK32);
modem_destroy(demodAPSK64);
modem_destroy(demodAPSK128);
modem_destroy(demodAPSK256);
}
void ModemAPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_APSK:
switch (demodulatorCons.load()) {
case 2:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 4:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodAPSK = demodAPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodAPSK = demodAPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodAPSK = demodAPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodAPSK = demodAPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodAPSK = demodAPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodAPSK = demodAPSK256;
updateDemodulatorCons(256);
break;
default:
demodAPSK = demodAPSK4;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodAPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodAPSK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,20 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemAPSK : public ModemDigital {
public:
ModemAPSK();
~ModemAPSK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodAPSK;
modem demodAPSK4;
modem demodAPSK8;
modem demodAPSK16;
modem demodAPSK32;
modem demodAPSK64;
modem demodAPSK128;
modem demodAPSK256;
};

View File

@ -1 +1,78 @@
#include "ModemASK.h"
ModemASK::ModemASK() {
demodASK2 = modem_create(LIQUID_MODEM_ASK2);
demodASK4 = modem_create(LIQUID_MODEM_ASK4);
demodASK8 = modem_create(LIQUID_MODEM_ASK8);
demodASK16 = modem_create(LIQUID_MODEM_ASK16);
demodASK32 = modem_create(LIQUID_MODEM_ASK32);
demodASK64 = modem_create(LIQUID_MODEM_ASK64);
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
demodASK = demodASK2;
}
Modem *ModemASK::factory() {
return new ModemASK;
}
ModemASK::~ModemASK() {
modem_destroy(demodASK4);
modem_destroy(demodASK8);
modem_destroy(demodASK16);
modem_destroy(demodASK32);
modem_destroy(demodASK64);
modem_destroy(demodASK128);
modem_destroy(demodASK256);
}
void ModemASK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_ASK:
switch (demodulatorCons.load()) {
case 2:
demodASK = demodASK2;
updateDemodulatorCons(2);
break;
case 4:
demodASK = demodASK4;
updateDemodulatorCons(4);
break;
case 8:
demodASK = demodASK8;
updateDemodulatorCons(8);
break;
case 16:
demodASK = demodASK16;
updateDemodulatorCons(16);
break;
case 32:
demodASK = demodASK32;
updateDemodulatorCons(32);
break;
case 64:
demodASK = demodASK64;
updateDemodulatorCons(64);
break;
case 128:
demodASK = demodASK128;
updateDemodulatorCons(128);
break;
case 256:
demodASK = demodASK256;
updateDemodulatorCons(256);
break;
default:
demodASK = demodASK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodASK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodASK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,21 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemASK : public ModemDigital {
public:
ModemASK();
~ModemASK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodASK;
modem demodASK2;
modem demodASK4;
modem demodASK8;
modem demodASK16;
modem demodASK32;
modem demodASK64;
modem demodASK128;
modem demodASK256;
};

View File

@ -1 +1,25 @@
#include "ModemBPSK.h"
ModemBPSK::ModemBPSK() {
demodBPSK = modem_create(LIQUID_MODEM_BPSK);
}
Modem *ModemBPSK::factory() {
return new ModemBPSK;
}
ModemBPSK::~ModemBPSK() {
modem_destroy(demodBPSK);
}
void ModemBPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_BPSK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodBPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodBPSK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,14 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemBPSK : public ModemDigital {
public:
ModemBPSK();
~ModemBPSK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodBPSK;
};

View File

@ -1 +1,79 @@
#include "ModemDPSK.h"
ModemDPSK::ModemDPSK() {
demodDPSK2 = modem_create(LIQUID_MODEM_DPSK2);
demodDPSK4 = modem_create(LIQUID_MODEM_DPSK4);
demodDPSK8 = modem_create(LIQUID_MODEM_DPSK8);
demodDPSK16 = modem_create(LIQUID_MODEM_DPSK16);
demodDPSK32 = modem_create(LIQUID_MODEM_DPSK32);
demodDPSK64 = modem_create(LIQUID_MODEM_DPSK64);
demodDPSK128 = modem_create(LIQUID_MODEM_DPSK128);
demodDPSK256 = modem_create(LIQUID_MODEM_DPSK256);
demodDPSK = demodDPSK2;
}
Modem *ModemDPSK::factory() {
return new ModemDPSK;
}
ModemDPSK::~ModemDPSK() {
modem_destroy(demodDPSK2);
modem_destroy(demodDPSK4);
modem_destroy(demodDPSK8);
modem_destroy(demodDPSK16);
modem_destroy(demodDPSK32);
modem_destroy(demodDPSK64);
modem_destroy(demodDPSK128);
modem_destroy(demodDPSK256);
}
void ModemDPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_DPSK:
switch (demodulatorCons.load()) {
case 2:
demodDPSK = demodDPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodDPSK = demodDPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodDPSK = demodDPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodDPSK = demodDPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodDPSK = demodDPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodDPSK = demodDPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodDPSK = demodDPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodDPSK = demodDPSK256;
updateDemodulatorCons(256);
break;
default:
demodDPSK = demodDPSK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodDPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodDPSK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,22 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemDPSK : public ModemDigital {
public:
ModemDPSK();
~ModemDPSK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodDPSK;
modem demodDPSK2;
modem demodDPSK4;
modem demodDPSK8;
modem demodDPSK16;
modem demodDPSK32;
modem demodDPSK64;
modem demodDPSK128;
modem demodDPSK256;
};

View File

@ -1 +1,25 @@
#include "ModemOOK.h"
ModemOOK::ModemOOK() {
demodOOK = modem_create(LIQUID_MODEM_OOK);
}
Modem *ModemOOK::factory() {
return new ModemOOK;
}
ModemOOK::~ModemOOK() {
modem_destroy(demodOOK);
}
void ModemOOK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_OOK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodOOK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodOOK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,14 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemOOK : public ModemDigital {
public:
ModemOOK();
~ModemOOK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodOOK;
};

View File

@ -1 +1,80 @@
#include "ModemPSK.h"
ModemPSK::ModemPSK() {
demodPSK = demodPSK2;
demodPSK2 = modem_create(LIQUID_MODEM_PSK2);
demodPSK4 = modem_create(LIQUID_MODEM_PSK4);
demodPSK8 = modem_create(LIQUID_MODEM_PSK8);
demodPSK16 = modem_create(LIQUID_MODEM_PSK16);
demodPSK32 = modem_create(LIQUID_MODEM_PSK32);
demodPSK64 = modem_create(LIQUID_MODEM_PSK64);
demodPSK128 = modem_create(LIQUID_MODEM_PSK128);
demodPSK256 = modem_create(LIQUID_MODEM_PSK256);
}
Modem *ModemPSK::factory() {
return new ModemPSK;
}
ModemPSK::~ModemPSK() {
modem_destroy(demodPSK2);
modem_destroy(demodPSK4);
modem_destroy(demodPSK8);
modem_destroy(demodPSK16);
modem_destroy(demodPSK32);
modem_destroy(demodPSK64);
modem_destroy(demodPSK128);
modem_destroy(demodPSK256);
}
void ModemPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_PSK:
switch (demodulatorCons.load()) {
case 2:
demodPSK = demodPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodPSK = demodPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodPSK = demodPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodPSK = demodPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodPSK = demodPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodPSK = demodPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodPSK = demodPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodPSK = demodPSK256;
updateDemodulatorCons(256);
break;
default:
demodPSK = demodPSK2;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodPSK, 0.005f);
break;
*/
}

View File

@ -1,3 +1,22 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemPSK : public ModemDigital {
public:
ModemPSK();
~ModemPSK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodPSK;
modem demodPSK2;
modem demodPSK4;
modem demodPSK8;
modem demodPSK16;
modem demodPSK32;
modem demodPSK64;
modem demodPSK128;
modem demodPSK256;
};

View File

@ -1 +1,77 @@
#include "ModemQAM.h"
ModemQAM::ModemQAM() {
demodQAM4 = modem_create(LIQUID_MODEM_QAM4);
demodQAM8 = modem_create(LIQUID_MODEM_QAM8);
demodQAM16 = modem_create(LIQUID_MODEM_QAM16);
demodQAM32 = modem_create(LIQUID_MODEM_QAM32);
demodQAM64 = modem_create(LIQUID_MODEM_QAM64);
demodQAM128 = modem_create(LIQUID_MODEM_QAM128);
demodQAM256 = modem_create(LIQUID_MODEM_QAM256);
demodQAM = demodQAM4;
}
Modem *ModemQAM::factory() {
return new ModemQAM;
}
ModemQAM::~ModemQAM() {
modem_destroy(demodQAM4);
modem_destroy(demodQAM8);
modem_destroy(demodQAM16);
modem_destroy(demodQAM32);
modem_destroy(demodQAM64);
modem_destroy(demodQAM128);
modem_destroy(demodQAM256);
}
void ModemQAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_QAM:
switch (demodulatorCons.load()) {
case 2:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 4:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 8:
demodQAM = demodQAM8;
updateDemodulatorCons(8);
break;
case 16:
demodQAM = demodQAM16;
updateDemodulatorCons(16);
break;
case 32:
demodQAM = demodQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodQAM = demodQAM64;
updateDemodulatorCons(64);
break;
case 128:
demodQAM = demodQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodQAM = demodQAM256;
updateDemodulatorCons(256);
break;
default:
demodQAM = demodQAM4;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodQAM, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodQAM, 0.5f);
break;
*/
}

View File

@ -1,3 +1,22 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemQAM : public ModemDigital {
public:
ModemQAM();
~ModemQAM();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodQAM;
modem demodQAM4;
modem demodQAM8;
modem demodQAM16;
modem demodQAM32;
modem demodQAM64;
modem demodQAM128;
modem demodQAM256;
};

View File

@ -1 +1,25 @@
#include "ModemQPSK.h"
ModemQPSK::ModemQPSK() {
demodQPSK = modem_create(LIQUID_MODEM_QPSK);
}
Modem *ModemQPSK::factory() {
return new ModemQPSK;
}
ModemQPSK::~ModemQPSK() {
modem_destroy(demodQPSK);
}
void ModemQPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_QPSK:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodQPSK, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodQPSK, 0.8f);
break;
*/
}

View File

@ -1,3 +1,13 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemQPSK : public ModemDigital {
public:
ModemQPSK();
~ModemQPSK();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodQPSK;
};

View File

@ -1 +1,67 @@
#include "ModemSQAM.h"
ModemSQAM::ModemSQAM() {
demodSQAM = demodSQAM32;
demodSQAM32 = modem_create(LIQUID_MODEM_SQAM32);
demodSQAM128 = modem_create(LIQUID_MODEM_SQAM128);
}
Modem *ModemSQAM::factory() {
return new ModemSQAM;
}
ModemSQAM::~ModemSQAM() {
modem_destroy(demodSQAM32);
modem_destroy(demodSQAM128);
}
void ModemSQAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_SQAM:
switch (demodulatorCons.load()) {
case 2:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 4:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 8:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 16:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 32:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 128:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
default:
demodSQAM = demodSQAM32;
break;
}
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodSQAM, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodSQAM, 0.005f);
break;
*/
}

View File

@ -1,3 +1,15 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemSQAM : public ModemDigital {
public:
ModemSQAM();
~ModemSQAM();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodSQAM;
modem demodSQAM32;
modem demodSQAM128;
};

View File

@ -1,2 +1,27 @@
#include "ModemST.h"
ModemST::ModemST() {
demodST = modem_create(LIQUID_MODEM_V29);
}
Modem *ModemST::factory() {
return new ModemST;
}
ModemST::~ModemST() {
modem_destroy(demodST);
}
void ModemST::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
/*
case DEMOD_TYPE_ST:
for (int i = 0; i < bufSize; i++) {
modem_demodulate(demodST, inp->data[i], &demodOutputDataDigital[i]);
}
updateDemodulatorLock(demodST, 0.005f);
break;
*/
}

View File

@ -1,2 +1,14 @@
#pragma once
#include "Modem.h"
#include "ModemDigital.h"
class ModemST : public ModemDigital {
public:
ModemST();
~ModemST();
Modem *factory();
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodST;
};