mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-14 16:11:47 -05:00
Cleanup: analog modems
This commit is contained in:
parent
02fdcb2aa3
commit
74f63d0e84
@ -27,7 +27,7 @@ int ModemAM::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput* audioOut) {
|
||||
ModemKitAnalog *amkit = (ModemKitAnalog *)kit;
|
||||
auto *amkit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(amkit,input);
|
||||
|
||||
|
@ -8,15 +8,15 @@
|
||||
class ModemAM : public ModemAnalog {
|
||||
public:
|
||||
ModemAM();
|
||||
~ModemAM();
|
||||
~ModemAM() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int getDefaultSampleRate();
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
firfilt_rrrf mDCBlock;
|
||||
|
@ -116,7 +116,7 @@ int ModemCW::getDefaultSampleRate() {
|
||||
// the input IQ to audioOut, frequency shift, then pass the real part.
|
||||
// Simple solution is just interpolate the IQ data to the audio sample rate.
|
||||
ModemKit *ModemCW::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKitCW *kit = new ModemKitCW();
|
||||
auto *kit = new ModemKitCW();
|
||||
float As = 60.0f;
|
||||
double ratio = double(audioSampleRate) / double(sampleRate);
|
||||
kit->sampleRate = sampleRate;
|
||||
@ -127,7 +127,7 @@ ModemKit *ModemCW::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
}
|
||||
|
||||
void ModemCW::disposeKit(ModemKit *kit) {
|
||||
ModemKitCW *cwkit = (ModemKitCW *) kit;
|
||||
auto *cwkit = (ModemKitCW *) kit;
|
||||
msresamp_cccf_destroy(cwkit->mInputResampler);
|
||||
delete kit;
|
||||
}
|
||||
@ -156,7 +156,7 @@ void ModemCW::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *au
|
||||
unsigned int outSize;
|
||||
float lsb;
|
||||
liquid_float_complex sig;
|
||||
ModemKitCW *cwkit = (ModemKitCW *) kit;
|
||||
auto *cwkit = (ModemKitCW *) kit;
|
||||
|
||||
initOutputBuffers(cwkit, input);
|
||||
|
||||
|
@ -17,32 +17,32 @@ class ModemCW : public ModemAnalog {
|
||||
public:
|
||||
ModemCW();
|
||||
|
||||
~ModemCW();
|
||||
~ModemCW() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int checkSampleRate(long long srate, int arate);
|
||||
int checkSampleRate(long long srate, int arate) override;
|
||||
|
||||
ModemKit *buildKit(long long srate, int arate);
|
||||
ModemKit *buildKit(long long srate, int arate) override;
|
||||
|
||||
void disposeKit(ModemKit *kit);
|
||||
void disposeKit(ModemKit *kit) override;
|
||||
|
||||
void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input);
|
||||
void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input) override;
|
||||
|
||||
int getDefaultSampleRate();
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
ModemArgInfoList getSettings();
|
||||
ModemArgInfoList getSettings() override;
|
||||
|
||||
void writeSetting(std::string setting, std::string value);
|
||||
void writeSetting(std::string setting, std::string value) override;
|
||||
|
||||
std::string readSetting(std::string setting);
|
||||
std::string readSetting(std::string setting) override;
|
||||
|
||||
// No resampling required.
|
||||
std::vector<float> *getResampledOutputData() { return &demodOutputData; }
|
||||
std::vector<float> *getResampledOutputData() override { return &demodOutputData; }
|
||||
|
||||
private:
|
||||
float mBeepFrequency;
|
||||
|
@ -25,7 +25,7 @@ int ModemDSB::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemDSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *amkit = (ModemKitAnalog *)kit;
|
||||
auto *amkit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(amkit, input);
|
||||
|
||||
|
@ -8,15 +8,15 @@
|
||||
class ModemDSB : public ModemAnalog {
|
||||
public:
|
||||
ModemDSB();
|
||||
~ModemDSB();
|
||||
~ModemDSB() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int getDefaultSampleRate();
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
ampmodem demodAM_DSB;
|
||||
|
@ -24,7 +24,7 @@ int ModemFM::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *fmkit = (ModemKitAnalog *)kit;
|
||||
auto *fmkit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(fmkit, input);
|
||||
|
||||
|
@ -8,15 +8,15 @@
|
||||
class ModemFM : public ModemAnalog {
|
||||
public:
|
||||
ModemFM();
|
||||
~ModemFM();
|
||||
~ModemFM() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int getDefaultSampleRate();
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
freqdem demodFM;
|
||||
|
@ -87,7 +87,7 @@ std::string ModemFMStereo::readSetting(std::string setting) {
|
||||
}
|
||||
|
||||
ModemKit *ModemFMStereo::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKitFMStereo *kit = new ModemKitFMStereo;
|
||||
auto *kit = new ModemKitFMStereo;
|
||||
|
||||
kit->audioResampleRatio = double(audioSampleRate) / double(sampleRate);
|
||||
kit->sampleRate = sampleRate;
|
||||
@ -161,7 +161,7 @@ ModemKit *ModemFMStereo::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
}
|
||||
|
||||
void ModemFMStereo::disposeKit(ModemKit *kit) {
|
||||
ModemKitFMStereo *fmkit = (ModemKitFMStereo *)kit;
|
||||
auto *fmkit = (ModemKitFMStereo *)kit;
|
||||
|
||||
msresamp_rrrf_destroy(fmkit->audioResampler);
|
||||
msresamp_rrrf_destroy(fmkit->stereoResampler);
|
||||
@ -176,7 +176,7 @@ void ModemFMStereo::disposeKit(ModemKit *kit) {
|
||||
|
||||
|
||||
void ModemFMStereo::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitFMStereo *fmkit = (ModemKitFMStereo *)kit;
|
||||
auto *fmkit = (ModemKitFMStereo *)kit;
|
||||
size_t bufSize = input->data.size();
|
||||
liquid_float_complex u, v, w, x, y;
|
||||
|
||||
|
@ -31,24 +31,24 @@ public:
|
||||
class ModemFMStereo : public Modem {
|
||||
public:
|
||||
ModemFMStereo();
|
||||
~ModemFMStereo();
|
||||
~ModemFMStereo() override;
|
||||
|
||||
std::string getType();
|
||||
std::string getName();
|
||||
std::string getType() override;
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
int getDefaultSampleRate();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate) override;
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
ModemArgInfoList getSettings();
|
||||
void writeSetting(std::string setting, std::string value);
|
||||
std::string readSetting(std::string setting);
|
||||
ModemArgInfoList getSettings() override;
|
||||
void writeSetting(std::string setting, std::string value) override;
|
||||
std::string readSetting(std::string setting) override;
|
||||
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate) override;
|
||||
void disposeKit(ModemKit *kit) override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
std::vector<float> demodOutputData;
|
||||
|
@ -3,9 +3,7 @@
|
||||
|
||||
#include "ModemIQ.h"
|
||||
|
||||
ModemIQ::ModemIQ() {
|
||||
|
||||
}
|
||||
ModemIQ::ModemIQ() = default;
|
||||
|
||||
std::string ModemIQ::getType() {
|
||||
return "analog";
|
||||
@ -20,7 +18,7 @@ ModemBase *ModemIQ::factory() {
|
||||
}
|
||||
|
||||
ModemKit *ModemIQ::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKit *kit = new ModemKit;
|
||||
auto *kit = new ModemKit;
|
||||
kit->sampleRate = sampleRate;
|
||||
kit->audioSampleRate = audioSampleRate;
|
||||
return kit;
|
||||
|
@ -8,19 +8,19 @@ class ModemIQ : public Modem {
|
||||
public:
|
||||
ModemIQ();
|
||||
|
||||
std::string getType();
|
||||
std::string getName();
|
||||
std::string getType() override;
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
int getDefaultSampleRate();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate) override;
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate) override;
|
||||
|
||||
void disposeKit(ModemKit *kit);
|
||||
void disposeKit(ModemKit *kit) override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -41,7 +41,7 @@ int ModemLSB::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemLSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *akit = (ModemKitAnalog *)kit;
|
||||
auto *akit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(akit,input);
|
||||
|
||||
|
@ -7,16 +7,16 @@
|
||||
class ModemLSB : public ModemAnalog {
|
||||
public:
|
||||
ModemLSB();
|
||||
~ModemLSB();
|
||||
~ModemLSB() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
int getDefaultSampleRate();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate) override;
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
iirfilt_crcf ssbFilt;
|
||||
|
@ -24,7 +24,7 @@ int ModemNBFM::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemNBFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *fmkit = (ModemKitAnalog *)kit;
|
||||
auto *fmkit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(fmkit, input);
|
||||
|
||||
|
@ -8,15 +8,15 @@
|
||||
class ModemNBFM : public ModemAnalog {
|
||||
public:
|
||||
ModemNBFM();
|
||||
~ModemNBFM();
|
||||
~ModemNBFM() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int getDefaultSampleRate();
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
freqdem demodFM;
|
||||
|
@ -41,7 +41,7 @@ int ModemUSB::getDefaultSampleRate() {
|
||||
}
|
||||
|
||||
void ModemUSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *akit = (ModemKitAnalog *)kit;
|
||||
auto *akit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(akit,input);
|
||||
|
||||
|
@ -7,16 +7,16 @@
|
||||
class ModemUSB : public ModemAnalog {
|
||||
public:
|
||||
ModemUSB();
|
||||
~ModemUSB();
|
||||
~ModemUSB() override;
|
||||
|
||||
std::string getName();
|
||||
std::string getName() override;
|
||||
|
||||
static ModemBase *factory();
|
||||
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
int getDefaultSampleRate();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate) override;
|
||||
int getDefaultSampleRate() override;
|
||||
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override;
|
||||
|
||||
private:
|
||||
iirfilt_crcf ssbFilt;
|
||||
|
Loading…
Reference in New Issue
Block a user