From: John Melton G0ORX <john.d.melton@googlemail.com>
Date: Sun, 6 Oct 2019 13:05:45 +0000 (+0100)
Subject: Set tx smaple rate correctly for SoapySDR
X-Git-Url: https://git.rkrishnan.org/components//%22file:/%22?a=commitdiff_plain;h=4bd75ae6487608d9522acfa005aa68adffa21791;p=pihpsdr.git

Set tx smaple rate correctly for SoapySDR
---

diff --git a/transmitter.c b/transmitter.c
index ed212f2..f767486 100644
--- a/transmitter.c
+++ b/transmitter.c
@@ -554,18 +554,31 @@ TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps,
   tx->fft_size=fft_size;
   tx->fps=fps;
 
-  if(protocol==ORIGINAL_PROTOCOL) {
-    tx->mic_sample_rate=48000;
-    tx->mic_dsp_rate=48000;
-    tx->iq_output_rate=48000;
-    tx->output_samples=tx->buffer_size;
-    tx->pixels=width; // to allow 48k to 24k conversion
-  } else {
-    tx->mic_sample_rate=48000;
-    tx->mic_dsp_rate=96000;
-    tx->iq_output_rate=192000;
-    tx->output_samples=tx->buffer_size*4;
-    tx->pixels=width*4; // to allow 192k to 24k conversion
+  switch(protocol) {
+    case ORIGINAL_PROTOCOL:
+      tx->mic_sample_rate=48000;
+      tx->mic_dsp_rate=48000;
+      tx->iq_output_rate=48000;
+      tx->output_samples=tx->buffer_size;
+      tx->pixels=width; // to allow 48k to 24k conversion
+      break;
+    case NEW_PROTOCOL:
+      tx->mic_sample_rate=48000;
+      tx->mic_dsp_rate=96000;
+      tx->iq_output_rate=192000;
+      tx->output_samples=tx->buffer_size*4;
+      tx->pixels=width*4; // to allow 192k to 24k conversion
+      break;
+#ifdef SOAPYSDR
+    case SOAPYSDR_PROTOCOL:
+      tx->mic_sample_rate=48000;
+      tx->mic_dsp_rate=96000;
+      tx->iq_output_rate=radio_sample_rate;
+      tx->buffer_size=1024;
+      tx->output_samples=1024*(tx->iq_output_rate/tx->mic_sample_rate);
+      break;
+#endif
+
   }
 
   tx->width=width;