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 {
// 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);
}