From d23c9f3d48bf4e207fcb53ddcc48549a0ff73101 Mon Sep 17 00:00:00 2001 From: DL1YCF Date: Tue, 18 May 2021 15:48:24 +0200 Subject: [PATCH] When changing the sample rate for the PS_FEEDBACK receiver, quickly return in any case. --- receiver.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/receiver.c b/receiver.c index c83d70f..96cdac1 100644 --- a/receiver.c +++ b/receiver.c @@ -928,7 +928,7 @@ g_print("%s: id=%d buffer_size=%d\n",__FUNCTION__,id,buffer_size); rx->agc_slope=35.0; rx->agc_hang_threshold=0.0; -#if defined(ALSAAUDIO) || defined(PORTAUDIO) +#if defined(ALSA) || defined(PORTAUDIO) rx->playback_handle=NULL; #endif #ifdef PULSEAUDIO @@ -1233,24 +1233,24 @@ void receiver_change_sample_rate(RECEIVER *rx,int sample_rate) { g_print("%s: id=%d rate=%d scale=%d buffer_size=%d output_samples=%d\n",__FUNCTION__,rx->id,sample_rate,scale,rx->buffer_size,rx->output_samples); #ifdef PURESIGNAL - if(can_transmit && transmitter->puresignal) { if (rx->id == PS_RX_FEEDBACK) { - if (protocol == ORIGINAL_PROTOCOL) { - rx->pixels = 2* scale * rx->width; - } else { - // We should never arrive here, since the sample rate of the - // PS feedback receiver is fixed. - rx->pixels = 8 * rx->width; + if (canTransmit) { + if (protocol == ORIGINAL_PROTOCOL) { + rx->pixels = 2* scale * rx->width; + } else { + // We should never arrive here, since the sample rate of the + // PS feedback receiver is fixed. + rx->pixels = 8 * rx->width; + } + g_free(rx->pixel_samples); + rx->pixel_samples=g_new(float,rx->pixels); + init_analyzer(rx); + g_print("%s: PS FEEDBACK: id=%d rate=%d buffer_size=%d output_samples=%d\n", + __FUNCTION__,rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples); } - g_free(rx->pixel_samples); - rx->pixel_samples=g_new(float,rx->pixels); - init_analyzer(rx); - g_print("%s: PS FEEDBACK: id=%d rate=%d buffer_size=%d output_samples=%d\n", - __FUNCTION__,rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples); g_mutex_unlock(&rx->mutex); return; } - } #endif // // re-calculate AGC line for panadapter since it depends on sample rate -- 2.45.2