]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Fixed sample rate change wdsp configuration
authorJohn Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Sun, 24 Jul 2016 08:51:29 +0000 (08:51 +0000)
committerJohn Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Sun, 24 Jul 2016 08:51:29 +0000 (08:51 +0000)
menu.c
new_protocol.c
old_protocol.c
pihpsdr
release/pihpsdr.tar
release/pihpsdr/pihpsdr
wdsp_init.c
wdsp_init.h

diff --git a/menu.c b/menu.c
index 43e5f5c020285b3c2b0290d675945bdce9756067..025928499ae6550d6bd7167513e8b59a6f2a5d57 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -57,7 +57,7 @@ static void sample_rate_cb(GtkWidget *widget, gpointer data) {
   if(protocol==ORIGINAL_PROTOCOL) {
     old_protocol_new_sample_rate((int)data);
   } else {
-    sample_rate=(int)data;
+    new_protocol_new_sample_rate((int)data);
   }
 }
 
index 9ef56e1838c0b10f0d8eeed4ec85732e3e518fbe..8c7533a0fa85caf5d428c227f2341fa23731cf53 100644 (file)
@@ -145,6 +145,7 @@ static int freedv_samples=0;
 static int freedv_resample=6;  // convert from 48000 to 8000
 #endif
 
+static void new_protocol_high_priority(int run,int tx,int drive);
 static void* new_protocol_thread(void* arg);
 static void* new_protocol_timer_thread(void* arg);
 static void full_rx_buffer();
@@ -207,6 +208,14 @@ void new_protocol_init(int rx,int pixels) {
 
 }
 
+void new_protocol_new_sample_rate(int rate) {
+  new_protocol_high_priority(0,0,0);
+  sample_rate=rate;
+  old_protocol_calc_buffers();
+  wdsp_new_sample_rate(rate);
+  new_protocol_high_priority(1,0,drive);
+}
+
 static void new_protocol_general() {
     unsigned char buffer[60];
 
@@ -253,7 +262,7 @@ fprintf(stderr,"new_protocol_high_priority: run=%d tx=%d drive=%d\n", run, tx, d
 
     buffer[4]=run|(tx<<1);
 
-    long rxFrequency=ddsFrequency+(long long)rit;
+    long rxFrequency=ddsFrequency;
     if(mode==modeCWU) {
       rxFrequency-=cw_keyer_sidetone_frequency;
     } else if(mode==modeCWL) {
index ae4b570484104059eec68647bebfb436af9a813f..1484df455d2147b30e689ff752e9863b444054fc 100644 (file)
@@ -240,6 +240,7 @@ void old_protocol_new_sample_rate(int rate) {
   metis_start_stop(0);
   sample_rate=rate;
   old_protocol_calc_buffers();
+  wdsp_new_sample_rate(rate);
   metis_restart();
 }
 
diff --git a/pihpsdr b/pihpsdr
index 39edd73bfbfdb139a815be23c1a67934585317c4..042ef466bae7799f31d32002ccad6b407c2cc72b 100755 (executable)
Binary files a/pihpsdr and b/pihpsdr differ
index b7d73392074faec1a45536bd47d9ceb36d43c144..c5f4e7a53865e41d31966d7b372aa29d586cbc01 100644 (file)
Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ
index a0fbcba6a213835a0bf06718b1831d1c5d2b35aa..042ef466bae7799f31d32002ccad6b407c2cc72b 100755 (executable)
Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ
index 6279a38b1dc4a98c6cb456e4b205f2958b810e4b..ae414d9ac4e55612aa47aa817af1265e35c21249 100644 (file)
@@ -191,7 +191,6 @@ static void setupTX(int tx) {
     SetTXAPostGenRun(tx, 0);
 
     SetChannelState(tx,1,0);
-    SetChannelState(tx,1,0);
 }
 
 void wdsp_init(int rx,int pixels,int protocol) {
@@ -248,7 +247,7 @@ void wdsp_init(int rx,int pixels,int protocol) {
     }
     fprintf(stderr,"OpenChannel %d buffer_size=%d fft_size=%d sample_rate=%d dspRate=%d outputRate=%d\n",
                 CHANNEL_TX,
-                tx_buffer_size,
+                buffer_size,
                 fft_size,
                 sample_rate, //micSampleRate,
                 micDspRate,
@@ -296,6 +295,16 @@ void wdsp_init(int rx,int pixels,int protocol) {
 
 }
 
+void wdsp_new_sample_rate(int rate) {
+  SetChannelState(CHANNEL_TX,0,0);
+  SetInputSamplerate(CHANNEL_TX,rate);
+  SetChannelState(CHANNEL_TX,1,0);
+
+  SetChannelState(receiver,0,0);
+  SetInputSamplerate(receiver,rate);
+  SetChannelState(receiver,1,0);
+}
+
 static void initAnalyzer(int channel,int buffer_size) {
     int flp[] = {0};
     double KEEP_TIME = 0.1;
index 80325219c2f861f5fff19d6e2b1577a063a78a1c..f19f87117f60bdd9772ee96eb818f712d046c2de 100644 (file)
@@ -25,3 +25,4 @@ extern void setFilter(int low,int high);
 extern int getFilterLow();
 extern int getFilterHigh();
 extern void wdsp_init(int rx,int pixels,int protocol);
+extern void wdsp_new_sample_rate(int rate);