From c38423c251eec630c6fd7930e15542a12f5da469 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sun, 30 Jul 2023 13:41:25 -0400 Subject: [PATCH] DMR Stereo Tweak; Clear Stale Audio Buffers; --- src/dmr_bs.c | 8 +++++++- src/dsd_audio2.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dmr_bs.c b/src/dmr_bs.c index 649d260..acfb5fe 100644 --- a/src/dmr_bs.c +++ b/src/dmr_bs.c @@ -488,7 +488,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state) if (internalslot == 0 && opts->floating_point == 0 && opts->pulse_digi_rate_out == 8000) playSynthesizedVoiceSS3 (opts, state); //Short Stereo Mix 3v2 - if (skipcount > 2) //after 2 consecutive data frames, drop back to getFrameSync and process with dmr_data_sync + if (skipcount > 3) //after 3 onsecutive data frames, drop back to getFrameSync and process with dmr_data_sync (need one more in order to push last voice on slot 2 only voice) { //set tests to all good so we don't get a bogus/redundant voice error cach_err = 0; @@ -516,6 +516,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state) if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state); if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state); + //clear out any stale audio storage buffers + memset (state->f_l4, 0.1f, sizeof(state->f_l4)); + memset (state->f_r4, 0.1f, sizeof(state->f_r4)); + memset (state->s_l4, 0, sizeof(state->s_l4)); + memset (state->s_r4, 0, sizeof(state->s_r4)); + //if we have a tact or emb err, then produce sync pattern/err message if (tact_okay != 1 || emb_ok != 1) { diff --git a/src/dsd_audio2.c b/src/dsd_audio2.c index f697410..3f0c011 100644 --- a/src/dsd_audio2.c +++ b/src/dsd_audio2.c @@ -19,6 +19,11 @@ //TODO: Continue to work on AGF function for best gain/normalization +//TODO: Either clear out stale s_l4 and f_l4 buffers or push playback on them somehow (particularly DMR) +//stale buffered audio may be present when playing voice in slot 2 but the last sample isn't played but +//is later played when the DMR BS loop resumes on a new call in slot 1...may need to expand the BS loop to cover an extra tdma frame to force the push +//or just clear the stale values upon exit of the BS loop + void agf (dsd_opts * opts, dsd_state * state, float samp[160], int slot) { int i, run;