Selection of AM/SSB from application side.

This commit is contained in:
Jared Boone 2016-01-30 18:02:28 -08:00
parent f2dff16820
commit e778be6472
4 changed files with 21 additions and 5 deletions

View File

@ -104,6 +104,7 @@ void AnalogAudioModel::configure_am() {
taps_6k0_decim_1, taps_6k0_decim_1,
taps_6k0_decim_2, taps_6k0_decim_2,
taps_2k8_usb_channel, taps_2k8_usb_channel,
AMConfigureMessage::Modulation::SSB,
audio_12k_hpf_300hz_config audio_12k_hpf_300hz_config
}; };
shared_memory.baseband_queue.push(message); shared_memory.baseband_queue.push(message);

View File

@ -39,12 +39,15 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
feed_channel_stats(channel_out); feed_channel_stats(channel_out);
channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f); channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f);
if( false ) { auto audio = demodulate(channel_out);
auto audio = demod_am.execute(channel_out, audio_buffer); audio_output.write(audio);
audio_output.write(audio); }
buffer_f32_t NarrowbandAMAudio::demodulate(const buffer_c16_t& channel) {
if( modulation_ssb ) {
return demod_ssb.execute(channel, audio_buffer);
} else { } else {
auto audio = demod_ssb.execute(channel_out, audio_buffer); return demod_am.execute(channel, audio_buffer);
audio_output.write(audio);
} }
} }
@ -84,6 +87,7 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs; channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs; channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2))); channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
modulation_ssb = (message.modulation == AMConfigureMessage::Modulation::SSB);
audio_output.configure(message.audio_hpf_config); audio_output.configure(message.audio_hpf_config);
configured = true; configured = true;

View File

@ -61,6 +61,7 @@ private:
uint32_t channel_filter_pass_f = 0; uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0; uint32_t channel_filter_stop_f = 0;
bool modulation_ssb = false;
dsp::demodulate::AM demod_am; dsp::demodulate::AM demod_am;
dsp::demodulate::SSB demod_ssb; dsp::demodulate::SSB demod_ssb;
@ -70,6 +71,8 @@ private:
bool configured { false }; bool configured { false };
void configure(const AMConfigureMessage& message); void configure(const AMConfigureMessage& message);
buffer_f32_t demodulate(const buffer_c16_t& channel);
}; };
#endif/*__PROC_AM_AUDIO_H__*/ #endif/*__PROC_AM_AUDIO_H__*/

View File

@ -373,17 +373,24 @@ public:
class AMConfigureMessage : public Message { class AMConfigureMessage : public Message {
public: public:
enum class Modulation : int32_t {
AM = 0,
SSB = 1,
};
constexpr AMConfigureMessage( constexpr AMConfigureMessage(
const fir_taps_real<24> decim_0_filter, const fir_taps_real<24> decim_0_filter,
const fir_taps_real<32> decim_1_filter, const fir_taps_real<32> decim_1_filter,
const fir_taps_real<32> decim_2_filter, const fir_taps_real<32> decim_2_filter,
const fir_taps_complex<64> channel_filter, const fir_taps_complex<64> channel_filter,
const Modulation modulation,
const iir_biquad_config_t audio_hpf_config const iir_biquad_config_t audio_hpf_config
) : Message { ID::AMConfigure }, ) : Message { ID::AMConfigure },
decim_0_filter(decim_0_filter), decim_0_filter(decim_0_filter),
decim_1_filter(decim_1_filter), decim_1_filter(decim_1_filter),
decim_2_filter(decim_2_filter), decim_2_filter(decim_2_filter),
channel_filter(channel_filter), channel_filter(channel_filter),
modulation { modulation },
audio_hpf_config { audio_hpf_config } audio_hpf_config { audio_hpf_config }
{ {
} }
@ -392,6 +399,7 @@ public:
const fir_taps_real<32> decim_1_filter; const fir_taps_real<32> decim_1_filter;
const fir_taps_real<32> decim_2_filter; const fir_taps_real<32> decim_2_filter;
const fir_taps_complex<64> channel_filter; const fir_taps_complex<64> channel_filter;
const Modulation modulation;
const iir_biquad_config_t audio_hpf_config; const iir_biquad_config_t audio_hpf_config;
}; };