From 8fb3ffaedc3e5165999fbaacae437e033465d83d Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 4 Jan 2016 09:01:51 -0800 Subject: [PATCH] Reorder squelch code to group things a bit more logically. --- firmware/baseband/proc_nfm_audio.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/firmware/baseband/proc_nfm_audio.cpp b/firmware/baseband/proc_nfm_audio.cpp index 8424f0d80..87217851b 100644 --- a/firmware/baseband/proc_nfm_audio.cpp +++ b/firmware/baseband/proc_nfm_audio.cpp @@ -38,14 +38,16 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) { auto audio = demod.execute(channel_out, work_audio_buffer); - static uint64_t audio_present_history = 0; + // Yes, evaluate squelch here, but do audio filtering regardless to keep glitches + // out of the filters. Zero out audio *after* filtering, based on squelch status. const auto audio_present_now = squelch.execute(audio); - audio_present_history = (audio_present_history << 1) | (audio_present_now ? 1 : 0); - const bool audio_present = (audio_present_history != 0); audio_hpf.execute_in_place(audio); audio_deemph.execute_in_place(audio); + static uint64_t audio_present_history = 0; + audio_present_history = (audio_present_history << 1) | (audio_present_now ? 1 : 0); + const bool audio_present = (audio_present_history != 0); if( !audio_present ) { // Zero audio buffer. for(size_t i=0; i