mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Selection of AM/SSB from application side.
This commit is contained in:
parent
f2dff16820
commit
e778be6472
@ -104,6 +104,7 @@ void AnalogAudioModel::configure_am() {
|
||||
taps_6k0_decim_1,
|
||||
taps_6k0_decim_2,
|
||||
taps_2k8_usb_channel,
|
||||
AMConfigureMessage::Modulation::SSB,
|
||||
audio_12k_hpf_300hz_config
|
||||
};
|
||||
shared_memory.baseband_queue.push(message);
|
||||
|
@ -39,12 +39,15 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
|
||||
feed_channel_stats(channel_out);
|
||||
channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f);
|
||||
|
||||
if( false ) {
|
||||
auto audio = demod_am.execute(channel_out, audio_buffer);
|
||||
audio_output.write(audio);
|
||||
auto audio = demodulate(channel_out);
|
||||
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 {
|
||||
auto audio = demod_ssb.execute(channel_out, audio_buffer);
|
||||
audio_output.write(audio);
|
||||
return demod_am.execute(channel, audio_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_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)));
|
||||
modulation_ssb = (message.modulation == AMConfigureMessage::Modulation::SSB);
|
||||
audio_output.configure(message.audio_hpf_config);
|
||||
|
||||
configured = true;
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
uint32_t channel_filter_pass_f = 0;
|
||||
uint32_t channel_filter_stop_f = 0;
|
||||
|
||||
bool modulation_ssb = false;
|
||||
dsp::demodulate::AM demod_am;
|
||||
dsp::demodulate::SSB demod_ssb;
|
||||
|
||||
@ -70,6 +71,8 @@ private:
|
||||
|
||||
bool configured { false };
|
||||
void configure(const AMConfigureMessage& message);
|
||||
|
||||
buffer_f32_t demodulate(const buffer_c16_t& channel);
|
||||
};
|
||||
|
||||
#endif/*__PROC_AM_AUDIO_H__*/
|
||||
|
@ -373,17 +373,24 @@ public:
|
||||
|
||||
class AMConfigureMessage : public Message {
|
||||
public:
|
||||
enum class Modulation : int32_t {
|
||||
AM = 0,
|
||||
SSB = 1,
|
||||
};
|
||||
|
||||
constexpr AMConfigureMessage(
|
||||
const fir_taps_real<24> decim_0_filter,
|
||||
const fir_taps_real<32> decim_1_filter,
|
||||
const fir_taps_real<32> decim_2_filter,
|
||||
const fir_taps_complex<64> channel_filter,
|
||||
const Modulation modulation,
|
||||
const iir_biquad_config_t audio_hpf_config
|
||||
) : Message { ID::AMConfigure },
|
||||
decim_0_filter(decim_0_filter),
|
||||
decim_1_filter(decim_1_filter),
|
||||
decim_2_filter(decim_2_filter),
|
||||
channel_filter(channel_filter),
|
||||
modulation { modulation },
|
||||
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_2_filter;
|
||||
const fir_taps_complex<64> channel_filter;
|
||||
const Modulation modulation;
|
||||
const iir_biquad_config_t audio_hpf_config;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user