From: c vw Date: Wed, 9 Sep 2020 15:58:40 +0000 (+0200) Subject: Corrections that become important if sound devices named in the props file X-Git-Url: https://git.rkrishnan.org/simplejson/components/-?a=commitdiff_plain;h=5bcbc75fb1db6020d67ab77fa62b6eadefd5e48b;p=pihpsdr.git Corrections that become important if sound devices named in the props file are no longer present. --- diff --git a/radio.c b/radio.c index 4a04e69..12ed146 100644 --- a/radio.c +++ b/radio.c @@ -2551,7 +2551,7 @@ int remote_start(void *data) { for(int i=0;ilocal_audio) { - audio_open_output(receiver[i]); + if (audio_open_output(receiver[i]) < 0) receiver[i].local_audio=0; } } reconfigure_radio(); diff --git a/receiver.c b/receiver.c index a097579..a13493d 100644 --- a/receiver.c +++ b/receiver.c @@ -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; diff --git a/rx_menu.c b/rx_menu.c index 3fff413..b47ef25 100644 --- 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); diff --git a/tx_menu.c b/tx_menu.c index 1bdb866..af4c608 100644 --- 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);