From 850418cd877b1464bba64ca1241f8ed28ba479dc Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 7 Feb 2017 04:05:38 +0000 Subject: [PATCH] another go at squench for 800XA git-svn-id: https://svn.code.sf.net/p/freetel/code@3021 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/freedv_api.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/codec2-dev/src/freedv_api.c b/codec2-dev/src/freedv_api.c index ace5958a..9026ddcf 100644 --- a/codec2-dev/src/freedv_api.c +++ b/codec2-dev/src/freedv_api.c @@ -917,18 +917,21 @@ int freedv_comprx_fsk(struct freedv *f, COMP demod_in[], int *valid) { (*f->freedv_put_next_proto)(f->proto_callback_state,(char*)proto_bits); } *valid = 1; + + /* squelch if if sync but SNR too low */ + if (f->squelch_en && (f->snr_est < f->snr_squelch_thresh)) { + *valid = 0; + } } else { - /* Fill with silence */ - *valid = 0; + /* squelch if out of sync, or echo input of squelch off */ + if (f->squelch_en) + *valid = 0; + else + *valid = -1; } f->sync = f->deframer->state; f->stats.sync = f->deframer->state; - if (f->squelch_en && (f->stats.snr_est < f->snr_squelch_thresh)) { - //fprintf(stderr,"squelch %f %f !\n", f->stats.snr_est, f->snr_squelch_thresh); - *valid = 0; - } - return f->n_speech_samples; } -- 2.25.1