Issue 401 - Avoid receiving own transmission due to audio crosstalk.

This commit is contained in:
wb2osz 2023-05-08 02:27:59 +01:00
parent 8e32286604
commit b1727345e0
3 changed files with 40 additions and 4 deletions

View File

@ -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];

View File

@ -8,6 +8,8 @@
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);
@ -15,3 +17,4 @@ 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);

View File

@ -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.