]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
added missing #ifdef PURESIGNAL
authorc vw <dl1ycf@darc.de>
Fri, 19 Jul 2019 09:14:32 +0000 (11:14 +0200)
committerc vw <dl1ycf@darc.de>
Fri, 19 Jul 2019 09:14:32 +0000 (11:14 +0200)
receiver.c

index f96cbe3004ca5f6269b9db04c9a445e97bf60325..38a59c980a33f12a536eaf9700263b3991096ffd 100644 (file)
@@ -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);
 }