CubicSDR/src/modules/modem/analog/ModemLSB.cpp
Charles J. Cliffe c0eca0b2f3 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
2015-11-22 19:56:25 -05:00

47 lines
1.1 KiB
C++

#include "ModemLSB.h"
ModemLSB::ModemLSB() {
// half band filter used for side-band elimination
ssbFilt = resamp2_crcf_create(12,-0.25f,60.0f);
demodAM_LSB = ampmodem_create(0.5, 0.0, LIQUID_AMPMODEM_LSB, 1);
}
Modem *ModemLSB::factory() {
return new ModemLSB;
}
std::string ModemLSB::getName() {
return "LSB";
}
ModemLSB::~ModemLSB() {
resamp2_crcf_destroy(ssbFilt);
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;
initOutputBuffers(akit,input);
if (!bufSize) {
input->decRefCount();
return;
}
liquid_float_complex x, y;
for (int i = 0; i < bufSize; i++) { // Reject upper band
resamp2_crcf_filter_execute(ssbFilt,input->data[i],&x,&y);
ampmodem_demodulate(demodAM_LSB, x, &demodOutputData[i]);
}
buildAudioOutput(akit, audioOut, true);
}