]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Corrections that become important if sound devices named in the props file
authorc vw <dl1ycf@darc.de>
Wed, 9 Sep 2020 15:58:40 +0000 (17:58 +0200)
committerc vw <dl1ycf@darc.de>
Wed, 9 Sep 2020 15:58:40 +0000 (17:58 +0200)
are no longer present.

radio.c
receiver.c
rx_menu.c
tx_menu.c

diff --git a/radio.c b/radio.c
index 4a04e697330944003d772a41894fc88bef7ec30b..12ed146ddca56094a6ba7060e5912a34d11b45e9 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -2551,7 +2551,7 @@ int remote_start(void *data) {
   for(int i=0;i<receivers;i++) {
     receiver_restore_state(receiver[i]);
     if(receiver[i]->local_audio) {
-      audio_open_output(receiver[i]);
+      if (audio_open_output(receiver[i]) < 0) receiver[i].local_audio=0;
     }
   }
   reconfigure_radio();
index a0975798fd542151956d015a4147a8e108064e7a..a13493d190fa9df2aa3a5885575c7372a0dda0c9 100644 (file)
@@ -1158,7 +1158,7 @@ fprintf(stderr,"RXASetMP %d\n",rx->low_latency);
 
 fprintf(stderr,"create_receiver: rx=%p id=%d local_audio=%d\n",rx,rx->id,rx->local_audio);
   if(rx->local_audio) {
-    audio_open_output(rx);
+    if (audio_open_output(rx) < 0) rx->local_audio=0;
   }
 
   return rx;
index 3fff41311a8908f7045a6c4a85cb2cbb01d117a7..b47ef25177fe52c7e54bb11a97c22a4669a15a3b 100644 (file)
--- a/rx_menu.c
+++ b/rx_menu.c
@@ -380,6 +380,11 @@ void rx_menu(GtkWidget *parent) {
     i=gtk_combo_box_get_active(GTK_COMBO_BOX(output));
     if (i < 0) {
       gtk_combo_box_set_active(GTK_COMBO_BOX(output),0);
+      if (active_receiver->audio_name != NULL) {
+        g_free(active_receiver->audio_name);
+        active_receiver->audio_name=g_new(gchar,strlen(output_devices[0].name)+1);
+        strcpy(active_receiver->audio_name,output_devices[0].name);
+      }
     }
 
     gtk_grid_attach(GTK_GRID(grid),output,x,++row,1,1);
index 1bdb86647bd80c87730c75f54af1173839b235a9..af4c6085776b4b006fa6d5da323c8d92453b08c2 100644 (file)
--- a/tx_menu.c
+++ b/tx_menu.c
@@ -294,9 +294,18 @@ void tx_menu(GtkWidget *parent) {
     }
 
     // If the combo box shows no device, take the first one
+    // AND set the mic.name to that device name.
+    // This situation occurs if the local microphone device in the props
+    // file is no longer present
+
     i=gtk_combo_box_get_active(GTK_COMBO_BOX(input));
     if (i < 0) {
       gtk_combo_box_set_active(GTK_COMBO_BOX(input),0);
+      if(transmitter->microphone_name!=NULL) {
+        g_free(transmitter->microphone_name);
+      }
+      transmitter->microphone_name=g_new(gchar,strlen(input_devices[0].name)+1);
+      strcpy(transmitter->microphone_name,input_devices[0].name);
     }
 
     gtk_grid_attach(GTK_GRID(grid),input,col,row,3,1);