mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-23 08:08:39 -04:00
Allow modems to limit/control input rate
- Modems can now over-ride user rate input and lock/step as needed - Separate digital code defs a bit more so it’s not required when disabled - Testing FSK based on @andresv ’s example at https://github.com/jgaeddert/liquid-dsp/issues/9
This commit is contained in:
@@ -30,6 +30,14 @@ Modem *ModemFMStereo::factory() {
|
||||
return new ModemFMStereo;
|
||||
}
|
||||
|
||||
int ModemFMStereo::checkSampleRate(long long sampleRate, int audioSampleRate) {
|
||||
if (sampleRate < 100000) {
|
||||
return 100000;
|
||||
} else {
|
||||
return sampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
ModemKit *ModemFMStereo::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKitFMStereo *kit = new ModemKitFMStereo;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
std::string getType();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
@@ -10,6 +10,8 @@ Modem *ModemIQ::factory() {
|
||||
|
||||
ModemKit *ModemIQ::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKit *kit = new ModemKit;
|
||||
kit->sampleRate = sampleRate;
|
||||
kit->audioSampleRate = audioSampleRate;
|
||||
return kit;
|
||||
}
|
||||
|
||||
@@ -25,6 +27,10 @@ void ModemIQ::disposeKit(ModemKit *kit) {
|
||||
delete kit;
|
||||
}
|
||||
|
||||
int ModemIQ::checkSampleRate(long long sampleRate, int audioSampleRate) {
|
||||
return audioSampleRate;
|
||||
}
|
||||
|
||||
void ModemIQ::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
int bufSize = input->data.size();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ public:
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
void disposeKit(ModemKit *kit);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
|
||||
@@ -19,6 +19,13 @@ ModemLSB::~ModemLSB() {
|
||||
ampmodem_destroy(demodAM_LSB);
|
||||
}
|
||||
|
||||
int ModemLSB::checkSampleRate(long long sampleRate, int audioSampleRate) {
|
||||
if (sampleRate % 2 == 0) {
|
||||
return sampleRate;
|
||||
}
|
||||
return sampleRate+1;
|
||||
}
|
||||
|
||||
void ModemLSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *akit = (ModemKitAnalog *)kit;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ public:
|
||||
~ModemLSB();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,6 +19,13 @@ ModemUSB::~ModemUSB() {
|
||||
ampmodem_destroy(demodAM_USB);
|
||||
}
|
||||
|
||||
int ModemUSB::checkSampleRate(long long sampleRate, int audioSampleRate) {
|
||||
if (sampleRate % 2 == 0) {
|
||||
return sampleRate;
|
||||
}
|
||||
return sampleRate+1;
|
||||
}
|
||||
|
||||
void ModemUSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
ModemKitAnalog *akit = (ModemKitAnalog *)kit;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ public:
|
||||
~ModemUSB();
|
||||
std::string getName();
|
||||
Modem *factory();
|
||||
int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user