diff --git a/src/demod.c b/src/demod.c index 9f94dd8..4ed2842 100644 --- a/src/demod.c +++ b/src/demod.c @@ -852,7 +852,6 @@ int demod_init (struct audio_s *pa) #define FSK_READ_ERR (256*256) - __attribute__((hot)) int demod_get_sample (int a) { @@ -862,7 +861,6 @@ int demod_get_sample (int a) assert (save_audio_config_p->adev[a].bits_per_sample == 8 || save_audio_config_p->adev[a].bits_per_sample == 16); - if (save_audio_config_p->adev[a].bits_per_sample == 8) { x1 = audio_get(a); @@ -929,6 +927,21 @@ int demod_get_sample (int a) * *--------------------------------------------------------------------*/ +static int mute_input[MAX_CHANS]; + +// New in 1.7. +// A few people have a really bad audio cross talk situation where they receive their own transmissions. +// It usually doesn't cause a problem but it is confusing to look at. +// "half duplex" setting applied only to the transmit logic. i.e. wait for clear channel before sending. +// Receiving was still active. +// I think the simplest solution is to mute/unmute the audio input at this point if not full duplex. +// This is called from ptt_set for half duplex. + +void demod_mute_input (int chan, int mute_during_xmit) +{ + assert (chan >= 0 && chan < MAX_CHANS); + mute_input[chan] = mute_during_xmit; +} __attribute__((hot)) void demod_process_sample (int chan, int subchan, int sam) @@ -942,6 +955,10 @@ void demod_process_sample (int chan, int subchan, int sam) assert (chan >= 0 && chan < MAX_CHANS); assert (subchan >= 0 && subchan < MAX_SUBCHANS); + if (mute_input[chan]) { + sam = 0; + }; + D = &demodulator_state[chan][subchan]; diff --git a/src/demod.h b/src/demod.h index 3233b9b..f1120cd 100644 --- a/src/demod.h +++ b/src/demod.h @@ -8,10 +8,13 @@ int demod_init (struct audio_s *pa); +void demod_mute_input (int chan, int mute); + int demod_get_sample (int a); void demod_process_sample (int chan, int subchan, int sam); void demod_print_agc (int chan, int subchan); -alevel_t demod_get_audio_level (int chan, int subchan); \ No newline at end of file +alevel_t demod_get_audio_level (int chan, int subchan); + diff --git a/src/ptt.c b/src/ptt.c index 3afef5e..fdeff42 100644 --- a/src/ptt.c +++ b/src/ptt.c @@ -1,7 +1,7 @@ // // This file is part of Dire Wolf, an amateur radio packet TNC. // -// Copyright (C) 2011, 2013, 2014, 2015, 2016, 2017 John Langner, WB2OSZ +// Copyright (C) 2011, 2013, 2014, 2015, 2016, 2017, 2023 John Langner, WB2OSZ // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -176,6 +176,7 @@ typedef int HANDLE; #include "audio.h" #include "ptt.h" #include "dlq.h" +#include "demod.h" // to mute recv audio during xmit if half duplex. #if __WIN32__ @@ -1141,6 +1142,8 @@ void ptt_init (struct audio_s *audio_config_p) * *--------------------------------------------------------------------*/ +// JWL - save status and new get_ptt function. + void ptt_set (int ot, int chan, int ptt_signal) { @@ -1164,6 +1167,19 @@ void ptt_set (int ot, int chan, int ptt_signal) return; } +// New in 1.7. +// A few people have a really bad audio cross talk situation where they receive their own transmissions. +// It usually doesn't cause a problem but it is confusing to look at. +// "half duplex" setting applied only to the transmit logic. i.e. wait for clear channel before sending. +// Receiving was still active. +// I think the simplest solution is to mute/unmute the audio input at this point if not full duplex. + +#ifndef TEST + if ( ! save_audio_config_p->achan[chan].fulldup) { + demod_mute_input (chan, ptt_signal); + } +#endif + /* * The data link state machine has an interest in activity on the radio channel. * This is a very convenient place to get that information.