mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-13 19:29:08 -04:00
Convert demodulator type ids to strings for now
This commit is contained in:
+21
-21
@@ -7,23 +7,23 @@
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
#define DEMOD_TYPE_NULL 0
|
||||
#define DEMOD_TYPE_FM 1
|
||||
#define DEMOD_TYPE_AM 2
|
||||
#define DEMOD_TYPE_LSB 3
|
||||
#define DEMOD_TYPE_USB 4
|
||||
#define DEMOD_TYPE_DSB 5
|
||||
#define DEMOD_TYPE_ASK 6
|
||||
#define DEMOD_TYPE_APSK 7
|
||||
#define DEMOD_TYPE_BPSK 8
|
||||
#define DEMOD_TYPE_DPSK 9
|
||||
#define DEMOD_TYPE_PSK 10
|
||||
#define DEMOD_TYPE_OOK 11
|
||||
#define DEMOD_TYPE_ST 12
|
||||
#define DEMOD_TYPE_SQAM 13
|
||||
#define DEMOD_TYPE_QAM 14
|
||||
#define DEMOD_TYPE_QPSK 15
|
||||
#define DEMOD_TYPE_RAW 16
|
||||
//#define DEMOD_TYPE_NULL 0
|
||||
//#define DEMOD_TYPE_FM 1
|
||||
//#define DEMOD_TYPE_AM 2
|
||||
//#define DEMOD_TYPE_LSB 3
|
||||
//#define DEMOD_TYPE_USB 4
|
||||
//#define DEMOD_TYPE_DSB 5
|
||||
//#define DEMOD_TYPE_ASK 6
|
||||
//#define DEMOD_TYPE_APSK 7
|
||||
//#define DEMOD_TYPE_BPSK 8
|
||||
//#define DEMOD_TYPE_DPSK 9
|
||||
//#define DEMOD_TYPE_PSK 10
|
||||
//#define DEMOD_TYPE_OOK 11
|
||||
//#define DEMOD_TYPE_ST 12
|
||||
//#define DEMOD_TYPE_SQAM 13
|
||||
//#define DEMOD_TYPE_QAM 14
|
||||
//#define DEMOD_TYPE_QPSK 15
|
||||
//#define DEMOD_TYPE_RAW 16
|
||||
|
||||
#include "IOThread.h"
|
||||
|
||||
@@ -62,11 +62,11 @@ public:
|
||||
};
|
||||
|
||||
DemodulatorThreadControlCommand() :
|
||||
cmd(DEMOD_THREAD_CMD_CTL_NULL), demodType(DEMOD_TYPE_NULL) {
|
||||
cmd(DEMOD_THREAD_CMD_CTL_NULL), demodType("") {
|
||||
}
|
||||
|
||||
DemodulatorThreadControlCommandEnum cmd;
|
||||
int demodType;
|
||||
std::string demodType;
|
||||
};
|
||||
|
||||
class DemodulatorThreadIQData: public ReferenceCounter {
|
||||
@@ -145,11 +145,11 @@ public:
|
||||
unsigned int bandwidth; // set equal to disable second stage re-sampling?
|
||||
unsigned int audioSampleRate;
|
||||
|
||||
int demodType;
|
||||
std::string demodType;
|
||||
|
||||
DemodulatorThreadParameters() :
|
||||
frequency(0), sampleRate(DEFAULT_SAMPLE_RATE), bandwidth(200000), audioSampleRate(0),
|
||||
demodType(DEMOD_TYPE_FM) {
|
||||
demodType("FM") {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -271,16 +271,16 @@ void DemodulatorInstance::checkBandwidth() {
|
||||
// }
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorType(int demod_type_in) {
|
||||
void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
|
||||
currentDemodType = demod_type_in;
|
||||
|
||||
if (currentDemodType == DEMOD_TYPE_RAW) {
|
||||
if (currentDemodType == "I/Q") {
|
||||
if (currentAudioSampleRate) {
|
||||
setBandwidth(currentAudioSampleRate);
|
||||
} else {
|
||||
setBandwidth(AudioThread::deviceSampleRate[getOutputDevice()]);
|
||||
}
|
||||
} else if (currentDemodType == DEMOD_TYPE_USB || currentDemodType == DEMOD_TYPE_LSB || currentDemodType == DEMOD_TYPE_DSB || currentDemodType == DEMOD_TYPE_AM) {
|
||||
} else if (currentDemodType == "USB" || currentDemodType == "LSB" || currentDemodType == "DSB" || currentDemodType == "AM") {
|
||||
demodulatorThread->setAGC(false);
|
||||
} else {
|
||||
demodulatorThread->setAGC(true);
|
||||
@@ -300,7 +300,7 @@ void DemodulatorInstance::setDemodulatorType(int demod_type_in) {
|
||||
}
|
||||
}
|
||||
|
||||
int DemodulatorInstance::getDemodulatorType() {
|
||||
std::string DemodulatorInstance::getDemodulatorType() {
|
||||
return currentDemodType;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ int DemodulatorInstance::getDemodulatorCons() {
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setBandwidth(int bw) {
|
||||
if (currentDemodType == DEMOD_TYPE_RAW) {
|
||||
if (currentDemodType == "I/Q") {
|
||||
if (currentAudioSampleRate) {
|
||||
bw = currentAudioSampleRate;
|
||||
} else {
|
||||
@@ -384,7 +384,7 @@ void DemodulatorInstance::setAudioSampleRate(int sampleRate) {
|
||||
command.llong_value = sampleRate;
|
||||
pipeDemodCommand->push(command);
|
||||
}
|
||||
if (currentDemodType == DEMOD_TYPE_RAW) {
|
||||
if (currentDemodType == "I/Q") {
|
||||
setBandwidth(currentAudioSampleRate);
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ int DemodulatorInstance::getAudioSampleRate() {
|
||||
void DemodulatorInstance::setGain(float gain_in) {
|
||||
currentAudioGain = gain_in;
|
||||
|
||||
if (currentDemodType == DEMOD_TYPE_RAW) {
|
||||
if (currentDemodType == "I/Q") {
|
||||
if (gain_in < 0.25) {
|
||||
audioThread->setGain(1.0);
|
||||
demodulatorThread->setAGC(false);
|
||||
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
void setOutputDevice(int device_id);
|
||||
int getOutputDevice();
|
||||
|
||||
void setDemodulatorType(int demod_type_in);
|
||||
int getDemodulatorType();
|
||||
void setDemodulatorType(std::string demod_type_in);
|
||||
std::string getDemodulatorType();
|
||||
|
||||
void setDemodulatorLock(bool demod_lock_in);
|
||||
int getDemodulatorLock();
|
||||
@@ -99,6 +99,9 @@ private:
|
||||
|
||||
void checkBandwidth();
|
||||
|
||||
Modem *currentModem;
|
||||
ModemKit *currentModemKit;
|
||||
|
||||
std::atomic<std::string *> label; //
|
||||
std::atomic_bool terminated; //
|
||||
std::atomic_bool demodTerminated; //
|
||||
@@ -111,7 +114,7 @@ private:
|
||||
|
||||
std::atomic_llong currentFrequency;
|
||||
std::atomic_int currentBandwidth;
|
||||
std::atomic_int currentDemodType;
|
||||
std::string currentDemodType;
|
||||
std::atomic_int currentDemodCons;
|
||||
std::atomic_int currentOutputDevice;
|
||||
std::atomic_int currentAudioSampleRate;
|
||||
|
||||
@@ -76,7 +76,7 @@ std::vector<DemodulatorInstance *> *DemodulatorMgr::getDemodulatorsAt(long long
|
||||
|
||||
long long halfBuffer = bandwidth / 2;
|
||||
|
||||
if ((freq <= (freqTest + ((testDemod->getDemodulatorType() != DEMOD_TYPE_LSB)?halfBandwidthTest:0) + halfBuffer)) && (freq >= (freqTest - ((testDemod->getDemodulatorType() != DEMOD_TYPE_USB)?halfBandwidthTest:0) - halfBuffer))) {
|
||||
if ((freq <= (freqTest + ((testDemod->getDemodulatorType() != "LSB")?halfBandwidthTest:0) + halfBuffer)) && (freq >= (freqTest - ((testDemod->getDemodulatorType() != "USB")?halfBandwidthTest:0) - halfBuffer))) {
|
||||
foundDemods->push_back(testDemod);
|
||||
}
|
||||
}
|
||||
@@ -184,11 +184,11 @@ void DemodulatorMgr::setLastBandwidth(int lastBandwidth) {
|
||||
this->lastBandwidth = lastBandwidth;
|
||||
}
|
||||
|
||||
int DemodulatorMgr::getLastDemodulatorType() const {
|
||||
std::string DemodulatorMgr::getLastDemodulatorType() const {
|
||||
return lastDemodType;
|
||||
}
|
||||
|
||||
void DemodulatorMgr::setLastDemodulatorType(int lastDemodType) {
|
||||
void DemodulatorMgr::setLastDemodulatorType(std::string lastDemodType) {
|
||||
this->lastDemodType = lastDemodType;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public:
|
||||
int getLastBandwidth() const;
|
||||
void setLastBandwidth(int lastBandwidth);
|
||||
|
||||
int getLastDemodulatorType() const;
|
||||
void setLastDemodulatorType(int lastDemodType);
|
||||
std::string getLastDemodulatorType() const;
|
||||
void setLastDemodulatorType(std::string lastDemodType);
|
||||
|
||||
int getLastDemodulatorCons() const;
|
||||
void setLastDemodulatorCons(int lastDemodCons);
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
DemodulatorInstance *activeVisualDemodulator;
|
||||
|
||||
int lastBandwidth;
|
||||
int lastDemodType;
|
||||
std::string lastDemodType;
|
||||
bool lastDemodLock;
|
||||
int lastDemodCons;
|
||||
bool lastSquelchEnabled;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "DemodulatorPreThread.h"
|
||||
#include "CubicSDR.h"
|
||||
|
||||
DemodulatorPreThread::DemodulatorPreThread() : IOThread(), iqResampler(NULL), iqResampleRatio(1), audioResampler(NULL), stereoResampler(NULL), audioResampleRatio(1), firStereoLeft(NULL), firStereoRight(NULL), iirStereoPilot(NULL), iqInputQueue(NULL), iqOutputQueue(NULL), threadQueueNotify(NULL), commandQueue(NULL)
|
||||
DemodulatorPreThread::DemodulatorPreThread() : IOThread(), iqResampler(NULL), iqResampleRatio(1), iqInputQueue(NULL), iqOutputQueue(NULL), threadQueueNotify(NULL), commandQueue(NULL)
|
||||
{
|
||||
initialized.store(false);
|
||||
|
||||
@@ -272,27 +272,27 @@ void DemodulatorPreThread::run() {
|
||||
iqResampleRatio = result.iqResampleRatio;
|
||||
}
|
||||
|
||||
if (result.firStereoLeft) {
|
||||
firStereoLeft = result.firStereoLeft;
|
||||
}
|
||||
|
||||
if (result.firStereoRight) {
|
||||
firStereoRight = result.firStereoRight;
|
||||
}
|
||||
|
||||
if (result.iirStereoPilot) {
|
||||
iirStereoPilot = result.iirStereoPilot;
|
||||
}
|
||||
|
||||
if (result.audioResampler) {
|
||||
audioResampler = result.audioResampler;
|
||||
audioResampleRatio = result.audioResamplerRatio;
|
||||
stereoResampler = result.stereoResampler;
|
||||
}
|
||||
|
||||
if (result.audioSampleRate) {
|
||||
params.audioSampleRate = result.audioSampleRate;
|
||||
}
|
||||
// if (result.firStereoLeft) {
|
||||
// firStereoLeft = result.firStereoLeft;
|
||||
// }
|
||||
//
|
||||
// if (result.firStereoRight) {
|
||||
// firStereoRight = result.firStereoRight;
|
||||
// }
|
||||
//
|
||||
// if (result.iirStereoPilot) {
|
||||
// iirStereoPilot = result.iirStereoPilot;
|
||||
// }
|
||||
//
|
||||
// if (result.audioResampler) {
|
||||
// audioResampler = result.audioResampler;
|
||||
// audioResampleRatio = result.audioResamplerRatio;
|
||||
// stereoResampler = result.stereoResampler;
|
||||
// }
|
||||
//
|
||||
// if (result.audioSampleRate) {
|
||||
// params.audioSampleRate = result.audioSampleRate;
|
||||
// }
|
||||
|
||||
if (result.bandwidth) {
|
||||
params.bandwidth = result.bandwidth;
|
||||
|
||||
@@ -37,13 +37,13 @@ protected:
|
||||
double iqResampleRatio;
|
||||
std::vector<liquid_float_complex> resampledData;
|
||||
|
||||
msresamp_rrrf audioResampler;
|
||||
msresamp_rrrf stereoResampler;
|
||||
double audioResampleRatio;
|
||||
// msresamp_rrrf audioResampler;
|
||||
// msresamp_rrrf stereoResampler;
|
||||
// double audioResampleRatio;
|
||||
|
||||
firfilt_rrrf firStereoLeft;
|
||||
firfilt_rrrf firStereoRight;
|
||||
iirfilt_crcf iirStereoPilot;
|
||||
// firfilt_rrrf firStereoLeft;
|
||||
// firfilt_rrrf firStereoRight;
|
||||
// iirfilt_crcf iirStereoPilot;
|
||||
|
||||
DemodulatorThreadParameters params;
|
||||
DemodulatorThreadParameters lastParams;
|
||||
|
||||
@@ -16,7 +16,7 @@ DemodulatorThread::DemodulatorThread() : IOThread(), iqAutoGain(NULL), amOutputC
|
||||
// stereo.store(false);
|
||||
muted.store(false);
|
||||
agcEnabled.store(false);
|
||||
demodulatorType.store(DEMOD_TYPE_FM);
|
||||
demodulatorType = "FM";
|
||||
|
||||
// demodFM = freqdem_create(0.5);
|
||||
// demodAM_USB = ampmodem_create(0.5, 0.0, LIQUID_AMPMODEM_USB, 1);
|
||||
@@ -965,11 +965,11 @@ float DemodulatorThread::getSquelchLevel() {
|
||||
return squelchLevel;
|
||||
}
|
||||
|
||||
void DemodulatorThread::setDemodulatorType(int demod_type_in) {
|
||||
void DemodulatorThread::setDemodulatorType(std::string demod_type_in) {
|
||||
demodulatorType = demod_type_in;
|
||||
}
|
||||
|
||||
int DemodulatorThread::getDemodulatorType() {
|
||||
std::string DemodulatorThread::getDemodulatorType() {
|
||||
return demodulatorType;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
void setSquelchLevel(float signal_level_in);
|
||||
float getSquelchLevel();
|
||||
|
||||
void setDemodulatorType(int demod_type_in);
|
||||
int getDemodulatorType();
|
||||
void setDemodulatorType(std::string demod_type_in);
|
||||
std::string getDemodulatorType();
|
||||
|
||||
void setDemodulatorLock(bool demod_lock_in);
|
||||
int getDemodulatorLock();
|
||||
@@ -140,7 +140,7 @@ protected:
|
||||
// std::atomic_bool stereo;
|
||||
std::atomic_bool muted;
|
||||
std::atomic_bool agcEnabled;
|
||||
std::atomic_int demodulatorType;
|
||||
std::string demodulatorType;
|
||||
std::atomic_int demodulatorCons;
|
||||
int audioSampleRate;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "AudioThread.h"
|
||||
#include "ThreadQueue.h"
|
||||
#include "CubicSDRDefs.h"
|
||||
#include "Modem.h"
|
||||
|
||||
class DemodulatorWorkerThreadResult {
|
||||
public:
|
||||
@@ -15,8 +16,7 @@ public:
|
||||
};
|
||||
|
||||
DemodulatorWorkerThreadResult() :
|
||||
cmd(DEMOD_WORKER_THREAD_RESULT_NULL), iqResampler(NULL), iqResampleRatio(0), audioResampler(NULL), stereoResampler(NULL), audioResamplerRatio(
|
||||
0), firStereoLeft(NULL), firStereoRight(NULL), iirStereoPilot(NULL), sampleRate(0), bandwidth(0), audioSampleRate(0) {
|
||||
cmd(DEMOD_WORKER_THREAD_RESULT_NULL), iqResampler(nullptr), iqResampleRatio(0), sampleRate(0), bandwidth(0), modemKit(nullptr) {
|
||||
|
||||
}
|
||||
|
||||
@@ -29,20 +29,12 @@ public:
|
||||
|
||||
msresamp_crcf iqResampler;
|
||||
double iqResampleRatio;
|
||||
msresamp_rrrf audioResampler;
|
||||
msresamp_rrrf stereoResampler;
|
||||
double audioResamplerRatio;
|
||||
|
||||
firfilt_rrrf firStereoLeft;
|
||||
firfilt_rrrf firStereoRight;
|
||||
iirfilt_crcf iirStereoPilot;
|
||||
|
||||
DemodulatorThread *demodThread;
|
||||
|
||||
long long sampleRate;
|
||||
unsigned int bandwidth;
|
||||
unsigned int audioSampleRate;
|
||||
|
||||
ModemKit *modemKit;
|
||||
};
|
||||
|
||||
class DemodulatorWorkerThreadCommand {
|
||||
|
||||
Reference in New Issue
Block a user