From b31ddaec73761d5d41c3a24afada8409da86a55c Mon Sep 17 00:00:00 2001
From: John Melton G0ORX <john.d.melton@googlemail.com>
Date: Sun, 13 Oct 2019 16:59:19 +0100
Subject: [PATCH] fixed typo fro GINT_TO_POINTER

---
 ps_menu.c        |   2 +-
 receiver.c       |   5 --
 receiver.h       | 136 +++++++++++++++++++++++------------------------
 soapy_protocol.c |   3 ++
 4 files changed, 72 insertions(+), 74 deletions(-)

diff --git a/ps_menu.c b/ps_menu.c
index 58dac1f..c560b7d 100644
--- a/ps_menu.c
+++ b/ps_menu.c
@@ -286,7 +286,7 @@ static void ps_ant_cb(GtkWidget *widget, gpointer data) {
 }
 
 static void enable_cb(GtkWidget *widget, gpointer data) {
-  g_idle_add(ext_tx_set_ps,GINT_TO_PTR(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))));
+  g_idle_add(ext_tx_set_ps,GINT_TO_POINTER(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))));
 }
 
 static void auto_cb(GtkWidget *widget, gpointer data) {
diff --git a/receiver.c b/receiver.c
index 99f3d52..524ff11 100644
--- a/receiver.c
+++ b/receiver.c
@@ -456,11 +456,6 @@ fprintf(stderr,"receiver_restore_state: id=%d\n",rx->id);
   if(value) rx->audio_channel=atoi(value);
   sprintf(name,"receiver.%d.local_audio",rx->id);
   value=getProperty(name);
-if(value) {
-  fprintf(stderr,"%s=%s\n",name,value);
-} else {
-  fprintf(stderr,"%s=NULL\n",name);
-}
   if(value) rx->local_audio=atoi(value);
   sprintf(name,"receiver.%d.mute_when_not_active",rx->id);
   value=getProperty(name);
diff --git a/receiver.h b/receiver.h
index 0464c63..8a98c2a 100644
--- a/receiver.h
+++ b/receiver.h
@@ -37,47 +37,47 @@ enum _audio_t {
 typedef enum _audio_t audio_t;
 
 typedef struct _receiver {
-  int id;
-
-  int ddc;
-  int adc;
-
-  double volume;
-  int agc;
-  double agc_gain;
-  double agc_slope;
-  double agc_hang_threshold;
-  int fps;
-  int displaying;
+  gint id;
+
+  gint ddc;
+  gint adc;
+
+  gdouble volume;
+  gint agc;
+  gdouble agc_gain;
+  gdouble agc_slope;
+  gdouble agc_hang_threshold;
+  gint fps;
+  gint displaying;
   audio_t audio_channel;
-  int sample_rate;
-  int buffer_size;
-  int fft_size;
-  int pixels;
-  int samples;
-  int output_samples;
-  double *iq_input_buffer;
-  double *audio_output_buffer;
-  unsigned char *audio_buffer;
-  int audio_index;
-  long audio_sequence;
-  float *pixel_samples;
-  int display_panadapter;
-  int display_waterfall;
+  gint sample_rate;
+  gint buffer_size;
+  gint fft_size;
+  gint pixels;
+  gint samples;
+  gint output_samples;
+  gdouble *iq_input_buffer;
+  gdouble *audio_output_buffer;
+  guchar *audio_buffer;
+  gint audio_index;
+  guint32 audio_sequence;
+  gfloat *pixel_samples;
+  gint display_panadapter;
+  gint display_waterfall;
   gint update_timer_id;
 
-  double hz_per_pixel;
+  gdouble hz_per_pixel;
 
-  int dither;
-  int random;
-  int preamp;
+  gint dither;
+  gint random;
+  gint preamp;
 
-  int nb;
-  int nb2;
-  int nr;
-  int nr2;
-  int anf;
-  int snb;
+  gint nb;
+  gint nb2;
+  gint nr;
+  gint nr2;
+  gint anf;
+  gint snb;
 
   int nr_agc;
   int nr2_gain_method;
@@ -85,64 +85,64 @@ typedef struct _receiver {
   int nr2_ae;
 
 
-  int alex_antenna;
-  int alex_attenuation;
+  gint alex_antenna;
+  gint alex_attenuation;
 
-  int filter_low;
-  int filter_high;
+  gint filter_low;
+  gint filter_high;
 
-  int width;
-  int height;
+  gint width;
+  gint height;
 
   GtkWidget *panel;
   GtkWidget *panadapter;
   GtkWidget *waterfall;
 
-  int panadapter_low;
-  int panadapter_high;
-  int panadapter_step;
+  gint panadapter_low;
+  gint panadapter_high;
+  gint panadapter_step;
 
-  int waterfall_low;
-  int waterfall_high;
-  int waterfall_automatic;
+  gint waterfall_low;
+  gint waterfall_high;
+  gint waterfall_automatic;
   cairo_surface_t *panadapter_surface;
   GdkPixbuf *pixbuf;
-  int local_audio;
-  int mute_when_not_active;
-  int audio_device;
+  gint local_audio;
+  gint mute_when_not_active;
+  gint audio_device;
 #ifdef PORTAUDIO
   PaStream *playback_handle;
-  float *playback_buffer;
+  gfloat *playback_buffer;
 #else
   snd_pcm_t *playback_handle;
-  unsigned char *playback_buffer;
+  guchar *playback_buffer;
 #endif
-  int playback_offset;
-  int low_latency;
+  gint playback_offset;
+  gint low_latency;
 
-  int squelch_enable;
-  double squelch;
+  gint squelch_enable;
+  gdouble squelch;
 
-  int deviation;
+  gint deviation;
 
-  long long waterfall_frequency;
-  int waterfall_sample_rate;
+  gint64 waterfall_frequency;
+  gint waterfall_sample_rate;
 
-  int mute_radio;
+  gint mute_radio;
 
   gdouble *buffer;
-  int resample_step;
+  gint resample_step;
 
 #ifdef FREEDV
   GMutex freedv_mutex;
-  int freedv;
-  int freedv_samples;
-  char freedv_text_data[64];
-  int freedv_text_index;
+  gint freedv;
+  gint freedv_samples;
+  gchar freedv_text_data[64];
+  gint freedv_text_index;
 #endif
 
-  int x;
-  int y;
+  gint x;
+  gint y;
 } RECEIVER;
 
 extern RECEIVER *create_pure_signal_receiver(int id, int buffer_size,int sample_rate,int pixels);
diff --git a/soapy_protocol.c b/soapy_protocol.c
index b66e28f..a556300 100644
--- a/soapy_protocol.c
+++ b/soapy_protocol.c
@@ -102,6 +102,9 @@ void soapy_protocol_create_receiver(RECEIVER *rx) {
   int rc;
 
   soapy_rx_sample_rate=rx->sample_rate;
+  if(rx->sample_rate!=radio_sample_rate) {
+    soapy_rx_sample_rate=radio_sample_rate;
+  }
 
 fprintf(stderr,"soapy_protocol_create_receiver: setting samplerate=%f adc=%d\n",(double)soapy_rx_sample_rate,rx->adc);
   rc=SoapySDRDevice_setSampleRate(soapy_device,SOAPY_SDR_RX,rx->adc,(double)soapy_rx_sample_rate);
-- 
2.45.2