From 13d9397a7dc07434dd4467b4665421eea417571d Mon Sep 17 00:00:00 2001 From: c vw Date: Fri, 19 Jul 2019 11:14:32 +0200 Subject: [PATCH] added missing #ifdef PURESIGNAL --- receiver.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/receiver.c b/receiver.c index f96cbe3..38a59c9 100644 --- a/receiver.c +++ b/receiver.c @@ -1107,22 +1107,20 @@ void receiver_change_adc(RECEIVER *rx,int adc) { void receiver_change_sample_rate(RECEIVER *rx,int sample_rate) { // -// This must be done also for PS_RX_FEEDBACK to change +// For the PS_RX_FEEDBACK receiver we have to change // the number of pixels in the display (needed for -// conversion from higher sample rates to 48K +// conversion from higher sample rates to 48K such +// that the central part can be displayed in the TX panadapter // -// However, some of these operations must only be done -// if this is a "normal" receiver -// - int normal=(rx->id != PS_RX_FEEDBACK); - float *fp, *ofp; rx->sample_rate=sample_rate; int scale=rx->sample_rate/48000; rx->output_samples=rx->buffer_size/scale; rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->width; - if (!normal) { +#ifdef PURESIGNAL + if (rx->id == PS_RX_FEEDBACK) { + float *fp, *ofp; if (protocol == ORIGINAL_PROTOCOL) { rx->pixels = scale * rx->width; } else { @@ -1130,25 +1128,29 @@ void receiver_change_sample_rate(RECEIVER *rx,int sample_rate) { // PS feedback receiver is fixed. rx->pixels = 4 * rx->width; } - // make sure the pixel samples are always valid + // make sure pixel_samples is always a valid pointer // ... probably pure DL1YCF's paranoia fp=malloc(sizeof(float)*rx->pixels); ofp=rx->pixel_samples; rx->pixel_samples=fp; free(ofp); + init_analyzer(rx); + fprintf(stderr,"PS FEEDBACK change sample rate:id=%d rate=%d buffer_size=%d output_samples=%d\n", + rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples); + return; } +#endif + init_analyzer(rx); - if (normal) { - SetChannelState(rx->id,0,1); - free(rx->audio_output_buffer); - rx->audio_output_buffer=malloc(sizeof(double)*2*rx->output_samples); - rx->audio_buffer=malloc(AUDIO_BUFFER_SIZE); - SetInputSamplerate(rx->id, sample_rate); - SetEXTANBSamplerate (rx->id, sample_rate); - SetEXTNOBSamplerate (rx->id, sample_rate); - SetChannelState(rx->id,1,0); - } + SetChannelState(rx->id,0,1); + free(rx->audio_output_buffer); + rx->audio_output_buffer=malloc(sizeof(double)*2*rx->output_samples); + rx->audio_buffer=malloc(AUDIO_BUFFER_SIZE); + SetInputSamplerate(rx->id, sample_rate); + SetEXTANBSamplerate (rx->id, sample_rate); + SetEXTNOBSamplerate (rx->id, sample_rate); + SetChannelState(rx->id,1,0); fprintf(stderr,"receiver_change_sample_rate: id=%d rate=%d buffer_size=%d output_samples=%d\n",rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples); } -- 2.45.2