Bodge in preset control of NBFM bandwidth/deviation.

This commit is contained in:
Jared Boone 2016-01-29 21:05:43 -08:00
parent a558565886
commit 2fd8b1c4d4
2 changed files with 21 additions and 7 deletions

View File

@ -40,7 +40,7 @@ AnalogAudioModel::AnalogAudioModel(ReceiverModel::Mode mode) {
switch(mode) { switch(mode) {
case ReceiverModel::Mode::NarrowbandFMAudio: case ReceiverModel::Mode::NarrowbandFMAudio:
configure_nbfm(); configure_nbfm(2);
break; break;
case ReceiverModel::Mode::WidebandFMAudio: case ReceiverModel::Mode::WidebandFMAudio:
@ -57,13 +57,27 @@ AnalogAudioModel::AnalogAudioModel(ReceiverModel::Mode mode) {
} }
void AnalogAudioModel::configure_nbfm() { struct NBFMMode {
const fir_taps_real<24> decim_0;
const fir_taps_real<32> decim_1;
const fir_taps_real<32> channel;
const size_t deviation;
};
static constexpr std::array<NBFMMode, 3> nbfm_mode_configs { {
{ taps_4k25_decim_0, taps_4k25_decim_1, taps_4k25_channel, 2500 },
{ taps_11k0_decim_0, taps_11k0_decim_1, taps_11k0_channel, 2500 },
{ taps_16k0_decim_0, taps_16k0_decim_1, taps_16k0_channel, 5000 },
} };
void AnalogAudioModel::configure_nbfm(const size_t index) {
const auto config = nbfm_mode_configs[index];
const NBFMConfigureMessage message { const NBFMConfigureMessage message {
taps_4k25_decim_0, config.decim_0,
taps_4k25_decim_1, config.decim_1,
taps_4k25_channel, config.channel,
2, 2,
2500, config.deviation,
audio_24k_hpf_300hz_config, audio_24k_hpf_300hz_config,
audio_24k_deemph_300_6_config audio_24k_deemph_300_6_config
}; };

View File

@ -30,7 +30,7 @@ public:
AnalogAudioModel(ReceiverModel::Mode mode); AnalogAudioModel(ReceiverModel::Mode mode);
private: private:
void configure_nbfm(); void configure_nbfm(const size_t index);
void configure_wfm(); void configure_wfm();
void configure_am(); void configure_am();
}; };