From: John Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Date: Sat, 20 Aug 2016 07:54:36 +0000 (+0000)
Subject: fixed missing call to WDSP TX Analyzer when sample rate changed
X-Git-Url: https://git.rkrishnan.org/pf/module-simplejson.html?a=commitdiff_plain;h=12d5354af778d1edd588c1524c52890578aa1a67;p=pihpsdr.git

fixed missing call to WDSP TX Analyzer when sample rate changed
---

diff --git a/pihpsdr b/pihpsdr
index 3111125..bfef73a 100755
Binary files a/pihpsdr and b/pihpsdr differ
diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar
index 5b5e2a6..fdadee6 100644
Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ
diff --git a/release/pihpsdr/pihpsdr b/release/pihpsdr/pihpsdr
index 3111125..bfef73a 100755
Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ
diff --git a/wdsp_init.c b/wdsp_init.c
index 87df8fa..70a2b60 100644
--- a/wdsp_init.c
+++ b/wdsp_init.c
@@ -79,6 +79,23 @@ static int SPECTRUM_UPDATES_PER_SECOND=10;
 
 static void initAnalyzer(int channel,int buffer_size);
 
+static void calc_tx_buffer_size() {
+  switch(sample_rate) {
+    case 48000:
+      tx_buffer_size=BUFFER_SIZE;
+      break;
+    case 96000:
+      tx_buffer_size=BUFFER_SIZE/2;
+      break;
+    case 192000:
+      tx_buffer_size=BUFFER_SIZE/4;
+      break;
+    case 384000:
+      tx_buffer_size=BUFFER_SIZE/8;
+      break;
+  }
+}
+
 void setRXMode(int rx,int m) {
 fprintf(stderr,"SetRXAMode: rx=%d mode=%d\n",rx,m);
   SetRXAMode(rx, m);
@@ -320,20 +337,8 @@ void wdsp_init(int rx,int pixels,int protocol) {
     while (gtk_events_pending ())
       gtk_main_iteration ();
 
-    switch(sample_rate) {
-      case 48000:
-        tx_buffer_size=BUFFER_SIZE;
-        break;
-      case 96000:
-        tx_buffer_size=BUFFER_SIZE/2;
-        break;
-      case 192000:
-        tx_buffer_size=BUFFER_SIZE/4;
-        break;
-      case 384000:
-        tx_buffer_size=BUFFER_SIZE/8;
-        break;
-    }
+    calc_tx_buffer_size();
+
     fprintf(stderr,"OpenChannel %d buffer_size=%d fft_size=%d sample_rate=%d dspRate=%d outputRate=%d\n",
                 CHANNEL_TX,
                 buffer_size,
@@ -394,6 +399,8 @@ void wdsp_init(int rx,int pixels,int protocol) {
 
 void wdsp_new_sample_rate(int rate) {
   SetChannelState(CHANNEL_TX,0,0);
+  calc_tx_buffer_size();
+  initAnalyzer(CHANNEL_TX,tx_buffer_size);
   SetInputSamplerate(CHANNEL_TX,rate);
   SetChannelState(CHANNEL_TX,1,0);