2015-11-16 23:49:54 -05:00
|
|
|
#include "ModemFM.h"
|
|
|
|
|
2015-11-28 23:03:07 -05:00
|
|
|
ModemFM::ModemFM() : ModemAnalog() {
|
2015-11-16 23:49:54 -05:00
|
|
|
demodFM = freqdem_create(0.5);
|
|
|
|
}
|
|
|
|
|
2015-11-30 21:58:54 -05:00
|
|
|
ModemFM::~ModemFM() {
|
|
|
|
freqdem_destroy(demodFM);
|
|
|
|
}
|
|
|
|
|
2015-11-16 23:49:54 -05:00
|
|
|
Modem *ModemFM::factory() {
|
|
|
|
return new ModemFM;
|
|
|
|
}
|
|
|
|
|
2015-11-18 23:40:30 -05:00
|
|
|
std::string ModemFM::getName() {
|
|
|
|
return "FM";
|
|
|
|
}
|
|
|
|
|
2015-11-30 21:58:54 -05:00
|
|
|
int ModemFM::getDefaultSampleRate() {
|
|
|
|
return 200000;
|
|
|
|
}
|
|
|
|
|
2015-11-16 23:49:54 -05:00
|
|
|
void ModemFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
|
|
|
ModemKitAnalog *fmkit = (ModemKitAnalog *)kit;
|
|
|
|
|
|
|
|
initOutputBuffers(fmkit, input);
|
|
|
|
|
|
|
|
if (!bufSize) {
|
|
|
|
input->decRefCount();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
freqdem_demodulate_block(demodFM, &input->data[0], bufSize, &demodOutputData[0]);
|
|
|
|
|
|
|
|
buildAudioOutput(fmkit, audioOut, false);
|
|
|
|
}
|