mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Change audio sampling rates on NBFM, AM modes.
This commit is contained in:
parent
0e436ded14
commit
db642cac8d
@ -62,6 +62,7 @@ void AnalogAudioModel::configure_nbfm() {
|
||||
2500,
|
||||
};
|
||||
shared_memory.baseband_queue.push(message);
|
||||
clock_manager.set_base_audio_clock_divider(3);
|
||||
}
|
||||
|
||||
void AnalogAudioModel::configure_wfm() {
|
||||
@ -72,6 +73,7 @@ void AnalogAudioModel::configure_wfm() {
|
||||
75000,
|
||||
};
|
||||
shared_memory.baseband_queue.push(message);
|
||||
clock_manager.set_base_audio_clock_divider(1);
|
||||
}
|
||||
|
||||
void AnalogAudioModel::configure_am() {
|
||||
@ -81,4 +83,5 @@ void AnalogAudioModel::configure_am() {
|
||||
taps_6k0_channel,
|
||||
};
|
||||
shared_memory.baseband_queue.push(message);
|
||||
clock_manager.set_base_audio_clock_divider(6);
|
||||
}
|
||||
|
@ -39,9 +39,12 @@ 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);
|
||||
|
||||
auto audio = demod.execute(channel_out, work_audio_buffer);
|
||||
|
||||
audio_output.write(audio);
|
||||
channel_block_buffer.feed(
|
||||
channel_out, [this](const buffer_c16_t buffer) {
|
||||
auto audio = this->demod.execute(buffer, this->audio_buffer);
|
||||
this->audio_output.write(audio);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void NarrowbandAMAudio::on_message(const Message* const message) {
|
||||
@ -81,7 +84,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)));
|
||||
audio_output.configure(audio_hpf_300hz_config);
|
||||
audio_output.configure(audio_8k_hpf_300hz_config);
|
||||
|
||||
configured = true;
|
||||
}
|
||||
|
@ -44,9 +44,10 @@ private:
|
||||
dst.data(),
|
||||
dst.size()
|
||||
};
|
||||
const buffer_f32_t work_audio_buffer {
|
||||
(float*)dst.data(),
|
||||
sizeof(dst) / sizeof(float)
|
||||
std::array<float, 32> audio;
|
||||
const buffer_f32_t audio_buffer {
|
||||
audio.data(),
|
||||
audio.size()
|
||||
};
|
||||
|
||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||
@ -55,6 +56,9 @@ private:
|
||||
uint32_t channel_filter_pass_f;
|
||||
uint32_t channel_filter_stop_f;
|
||||
|
||||
static constexpr size_t post_channel_decimation_factor = 6;
|
||||
BlockDecimator<32> channel_block_buffer { post_channel_decimation_factor };
|
||||
|
||||
dsp::demodulate::AM demod;
|
||||
|
||||
AudioOutput audio_output;
|
||||
|
@ -39,9 +39,12 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
|
||||
feed_channel_stats(channel_out);
|
||||
channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f);
|
||||
|
||||
auto audio = demod.execute(channel_out, work_audio_buffer);
|
||||
|
||||
audio_output.write(audio);
|
||||
channel_block_buffer.feed(
|
||||
channel_out, [this](const buffer_c16_t buffer) {
|
||||
auto audio = this->demod.execute(buffer, this->audio_buffer);
|
||||
this->audio_output.write(audio);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void NarrowbandFMAudio::on_message(const Message* const message) {
|
||||
@ -75,7 +78,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
|
||||
constexpr size_t channel_filter_decimation_factor = 1;
|
||||
constexpr size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
||||
|
||||
constexpr size_t demod_input_fs = channel_filter_output_fs;
|
||||
constexpr size_t demod_input_fs = channel_filter_output_fs / post_channel_decimation_factor;
|
||||
|
||||
decim_0.configure(message.decim_0_filter.taps, 33554432);
|
||||
decim_1.configure(message.decim_1_filter.taps, 131072);
|
||||
@ -84,7 +87,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& 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)));
|
||||
audio_output.configure(audio_hpf_300hz_config, audio_deemph_300_6_config, 6144);
|
||||
audio_output.configure(audio_16k_hpf_300hz_config, audio_16k_deemph_300_6_config, 0);
|
||||
|
||||
configured = true;
|
||||
}
|
||||
|
@ -42,9 +42,10 @@ private:
|
||||
dst.data(),
|
||||
dst.size()
|
||||
};
|
||||
const buffer_f32_t work_audio_buffer {
|
||||
(float*)dst.data(),
|
||||
sizeof(dst) / sizeof(float)
|
||||
std::array<float, 32> audio;
|
||||
const buffer_f32_t audio_buffer {
|
||||
audio.data(),
|
||||
audio.size()
|
||||
};
|
||||
|
||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||
@ -54,6 +55,9 @@ private:
|
||||
uint32_t channel_filter_pass_f = 0;
|
||||
uint32_t channel_filter_stop_f = 0;
|
||||
|
||||
static constexpr size_t post_channel_decimation_factor = 3;
|
||||
BlockDecimator<32> channel_block_buffer { post_channel_decimation_factor };
|
||||
|
||||
dsp::demodulate::FM demod;
|
||||
|
||||
AudioOutput audio_output;
|
||||
|
Loading…
Reference in New Issue
Block a user