diff --git a/common.c b/common.c index 96eb10e..a599caf 100644 --- a/common.c +++ b/common.c @@ -105,7 +105,7 @@ void changeDevices() { gtk_widget_set_tooltip_text(gui.devstatusicon, "Device was opened, but doesn't support 44100 Hz"); break; case -2: - gtk_image_set_from_stock(GTK_IMAGE(gui.devstatusicon),GTK_STOCK_NO,GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_image_set_from_stock(GTK_IMAGE(gui.devstatusicon),GTK_STOCK_DIALOG_ERROR,GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_tooltip_text(gui.devstatusicon, "Failed to open device"); break; } @@ -115,3 +115,12 @@ void changeDevices() { pthread_create (&thread1, NULL, Listen, NULL); } + +// Clear received picture & metadata +void clearPix() { + gdk_pixbuf_fill (DispPixbuf, 0); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.RxImage), DispPixbuf); + gtk_label_set_markup (GTK_LABEL(gui.idlabel), ""); + gtk_label_set_markup (GTK_LABEL(gui.utclabel), ""); + gtk_label_set_markup (GTK_LABEL(gui.lastmodelabel), ""); +} diff --git a/common.h b/common.h index 49b981a..3dc88bb 100644 --- a/common.h +++ b/common.h @@ -50,6 +50,7 @@ struct _GuiObjs { GtkWidget *picdirentry; GtkWidget *browsebtn; GtkWidget *aboutdialog; + GtkWidget *btnclear; }; extern GuiObjs gui; @@ -120,5 +121,6 @@ void populateDeviceList (); void setNewRxDir (); void chooseDir (); void show_aboutdialog(); +void clearPix (); #endif diff --git a/gui.c b/gui.c index fa9765f..6dab9af 100644 --- a/gui.c +++ b/gui.c @@ -45,17 +45,19 @@ void createGUI() { gui.devstatusicon = GTK_WIDGET(gtk_builder_get_object(builder,"devstatusicon")); gui.browsebtn = GTK_WIDGET(gtk_builder_get_object(builder,"browsebtn")); gui.picdirentry = GTK_WIDGET(gtk_builder_get_object(builder,"picdirentry")); + gui.btnclear = GTK_WIDGET(gtk_builder_get_object(builder,"BtnClear")); iconview = GTK_WIDGET(gtk_builder_get_object(builder,"SavedIconView")); - g_signal_connect (quititem, "activate", G_CALLBACK(delete_event), NULL); - g_signal_connect (gui.mainwindow,"delete-event",G_CALLBACK(delete_event), NULL); - g_signal_connect (aboutitem, "activate", G_CALLBACK(show_aboutdialog), NULL); - g_signal_connect_swapped(gui.togadapt, "toggled", G_CALLBACK(GetAdaptive), NULL); - g_signal_connect (gui.btnstart, "clicked", G_CALLBACK(ManualStart), NULL); - g_signal_connect (gui.btnabort, "clicked", G_CALLBACK(AbortRx), NULL); - g_signal_connect (gui.cardcombo, "changed", G_CALLBACK(changeDevices), NULL); - g_signal_connect (gui.browsebtn, "clicked", G_CALLBACK(chooseDir), NULL); + g_signal_connect (quititem, "activate", G_CALLBACK(delete_event), NULL); + g_signal_connect (gui.mainwindow, "delete-event", G_CALLBACK(delete_event), NULL); + g_signal_connect (aboutitem, "activate", G_CALLBACK(show_aboutdialog), NULL); + g_signal_connect_swapped(gui.togadapt, "toggled", G_CALLBACK(GetAdaptive), NULL); + g_signal_connect (gui.btnstart, "clicked", G_CALLBACK(ManualStart), NULL); + g_signal_connect (gui.btnabort, "clicked", G_CALLBACK(AbortRx), NULL); + g_signal_connect (gui.cardcombo, "changed", G_CALLBACK(changeDevices), NULL); + g_signal_connect (gui.browsebtn, "clicked", G_CALLBACK(chooseDir), NULL); + g_signal_connect (gui.btnclear, "clicked", G_CALLBACK(clearPix), NULL); savedstore = GTK_LIST_STORE(gtk_icon_view_get_model(GTK_ICON_VIEW(iconview))); diff --git a/pcm.c b/pcm.c index 434ce02..d7454da 100644 --- a/pcm.c +++ b/pcm.c @@ -27,9 +27,12 @@ void readPcm(gint numsamples) { if (samplesread < numsamples) { if (samplesread == -EPIPE) printf("ALSA: buffer overrun\n"); - else if (samplesread == -EBADFD) printf("ALSA: PCM is not in the right state\n"); - else if (samplesread == -ESTRPIPE) printf("ALSA: a suspend event occurred\n"); - else if (samplesread < 0) printf("ALSA error %d\n", samplesread); + else if (samplesread < 0) { + printf("ALSA error %d (%s)\n", samplesread, snd_strerror(samplesread)); + gtk_widget_set_tooltip_text(gui.devstatusicon, "ALSA error"); + Abort = true; + pthread_exit(NULL); + } else printf("Can't read %d samples\n", numsamples); // On first appearance of error, update the status icon diff --git a/slowrx.c b/slowrx.c index befdda2..3259a6c 100644 --- a/slowrx.c +++ b/slowrx.c @@ -72,6 +72,7 @@ void *Listen() { gdk_threads_enter (); gtk_widget_set_sensitive (gui.vugrid, true); gtk_widget_set_sensitive (gui.btnabort, false); + gtk_widget_set_sensitive (gui.btnclear, true); gdk_threads_leave (); HedrShift = 0; @@ -81,12 +82,15 @@ void *Listen() { snd_pcm_start (pcm_handle); Abort = false; - // Wait for VIS - Mode = GetVIS(); + do { - if (Abort) pthread_exit(NULL); + // Wait for VIS + Mode = GetVIS(); - if (Mode == 0) exit(EXIT_FAILURE); + // Stop listening on ALSA error + if (Abort) pthread_exit(NULL); + + } while (Mode == 0); printf(" ==== %s ====\n", ModeSpec[Mode].Name); @@ -117,6 +121,7 @@ void *Listen() { gtk_widget_set_sensitive (gui.manualframe, false); gtk_widget_set_sensitive (gui.cardcombo, false); gtk_widget_set_sensitive (gui.btnabort, true); + gtk_widget_set_sensitive (gui.btnclear, false); gtk_statusbar_push (GTK_STATUSBAR(gui.statusbar), 0, "Receiving video..." ); gtk_label_set_markup (GTK_LABEL(gui.lastmodelabel), ModeSpec[Mode].Name); gtk_label_set_markup (GTK_LABEL(gui.utclabel), rctime); @@ -247,7 +252,7 @@ int main(int argc, char *argv[]) { gtk_main(); - // Save config + // Save config on exit ConfFile = fopen(confpath->str,"w"); if (ConfFile == NULL) { perror("Unable to open config file for writing"); diff --git a/slowrx.ui b/slowrx.ui index ced1ef0..fc9bf9c 100644 --- a/slowrx.ui +++ b/slowrx.ui @@ -98,470 +98,533 @@ - + True - True + False + 7 + 6 + 8 + 8 - + True - False - 10 - 10 - 10 - 10 + True - + True False - 10 - 10 + 10 + 10 + 10 + 10 - + True False - start - 0 - in + 10 + 10 - + True False start - 10 - 10 - 10 - 10 - - - True - False - vertical - - - 500 - 375 - True - False - gtk-missing-image - - - False - True - 7 - 0 - - - - - True - False - - - True - False - 0 - none - - - True - False - 10 - 10 - 10 - 10 - - - 80 - True - False - start - - - - - - - - - - True - False - Callsign - True - - - - - False - True - 7 - 0 - - - - - True - False - 0 - none - - - True - False - 12 - - - True - False - start - - - - - - - - - - - True - False - Received at - True - - - - - True - True - 7 - 1 - - - - - True - False - 0 - none - - - True - False - 12 - - - True - False - start - - - - - - - - - - - True - False - Mode - True - - - - - True - True - 7 - 2 - - - - - False - True - 1 - - - - - - - - - True - False - Last picture - True - - - - - 1 - 1 - 1 - 2 - - - - - True - False - start - start - 10 - - - True - False - start 0 in True False + start 10 10 10 10 - + True False - True + vertical - - AutoSlant - True - True - True - True - Fix slant after reception [2] - Fix slant after reception [2] - none - True - - - - 1 - 0 - 1 - 1 - - - - - AutoSave - True - True - True - True - Save received pictures [3] - Save received pictures [3] - none - True - - - - 0 - 1 - 1 - 1 - - - - - NoiseAdapt - True - True - True - True - Adaptive noise reduction [4] - Adaptive noise reduction [4] - none - True - - - - 1 - 1 - 1 - 1 - - - - - Abort - True - False - True - True - True - Stop video decoding [Esc] - Stop video decoding [Esc] - - - - 0 - 4 - 2 - 1 - - - - - AutoStart - True - True - True - True - Automatically start upon hearing a VIS code [1] - Automatically start upon hearing a VIS code [1] - none - True - - - - 0 - 0 - 1 - 1 - - - - + + 500 + 375 True False - 5 - 5 + gtk-missing-image - 0 - 3 - 2 - 1 + False + True + 7 + 0 - - FSKID + True - True - True - True - Decode digital FSK callsign [5] - Decode digital FSK callsign [5] - none - True - + False + True + + + True + False + 0 + in + + + True + False + 10 + 10 + 10 + 10 + + + 80 + True + False + start + 8 + + + + + + + + + + True + False + Callsign + True + + + + + False + True + 7 + 0 + + + + + True + False + 0 + in + + + True + False + 12 + + + True + False + start + + 5 + + + + + + + + + + True + False + Received at + True + + + + + False + True + 7 + 1 + + + + + True + False + 0 + in + + + True + False + 12 + + + True + False + start + + + + + + + + + + + True + False + Mode + True + + + + + False + True + 7 + 2 + + - 0 - 2 - 1 - 1 + False + True + 1 - - - - + True False - Rx options + Last picture True - True - True - 0 + 1 + 1 + 1 + 2 - + True False + start start - 0 - in + 10 - + True False - 10 - 10 - 10 - 10 + start + 0 + in - + True False - vertical - 6 + 10 + 10 + 10 + 10 - + True False - True - SSTV mode used when started manually - SSTV mode used when started manually - 0 - 0 - 1 - - Martin M1 - Martin M2 - Martin M3 - Martin M4 - Scottie S1 - Scottie S2 - Scottie DX - Robot 72 - Robot 36 - Robot 24 - Robot 24 B/W - Robot 12 B/W - Robot 8 B/W - PD-50 - PD-90 - PD-120 - PD-160 - PD-180 - PD-240 - PD-290 - Pasokon P3 - Pasokon P5 - Pasokon P7 - Wraase SC-2 120 - Wraase SC-2 180 - - - - False - True - 0 - - - - - True - False - 7 + True - + + AutoSlant + True + True + True + True + Fix slant after reception [2] + Fix slant after reception [2] + none + True + + + + 1 + 0 + 1 + 1 + + + + + AutoSave + True + True + True + True + Save received pictures [3] + Save received pictures [3] + none + True + + + + 0 + 1 + 1 + 1 + + + + + NoiseAdapt + True + True + True + True + Adaptive noise reduction [4] + Adaptive noise reduction [4] + none + True + + + + 1 + 1 + 1 + 1 + + + + + Abort + True + False + True + True + True + Stop video decoding [Esc] + Stop video decoding [Esc] + + + + 0 + 4 + 2 + 1 + + + + + AutoStart + True + True + True + True + Automatically start upon hearing a VIS code [1] + Automatically start upon hearing a VIS code [1] + none + True + + + + 0 + 0 + 1 + 1 + + + + True False - Shift Hz + 5 + 5 + + + 0 + 3 + 2 + 1 + + + + + FSKID + True + True + True + True + Decode digital FSK callsign [5] + Decode digital FSK callsign [5] + none + True + + + + 0 + 2 + 1 + 1 + + + + + Clear + True + False + True + True + + + 0 + 6 + 2 + 1 + + + + + True + False + 5 + 5 + + + 0 + 5 + 2 + 1 + + + + + + + + + + + + True + False + Rx control + True + + + + + True + True + 0 + + + + + True + False + False + 0 + in + + + True + False + 10 + 10 + 10 + 10 + + + Set left edge + True + True + True + + + + + + + True + False + Manual resync + True + + + + + True + True + 1 + + + + + True + False + start + 0 + in + + + True + False + 10 + 10 + 10 + 10 + + + True + False + vertical + 6 + + + True + False + True + SSTV mode used when started manually + SSTV mode used when started manually + 0 + 0 + 1 + + Martin M1 + Martin M2 + Martin M3 + Martin M4 + Scottie S1 + Scottie S2 + Scottie DX + Robot 72 + Robot 36 + Robot 24 + Robot 24 B/W + Robot 12 B/W + Robot 8 B/W + PD-50 + PD-90 + PD-120 + PD-160 + PD-180 + PD-240 + PD-290 + Pasokon P3 + Pasokon P5 + Pasokon P7 + Wraase SC-2 120 + Wraase SC-2 180 + False @@ -570,18 +633,42 @@ - + True - True - True - Number of Hertz to shift the FM window when started manually - Number of Hertz to shift the FM window when started manually - False - - True - ShiftAdj - True - True + False + 7 + + + True + False + Shift Hz + + + False + True + 0 + + + + + True + True + True + Number of Hertz to shift the FM window when started manually + Number of Hertz to shift the FM window when started manually + False + + True + ShiftAdj + True + True + + + False + True + 1 + + False @@ -589,411 +676,407 @@ 1 + + + Start + True + True + True + True + Start receiving immediately [Space] + Start receiving immediately [Space] + + + + False + True + 2 + + - - False - True - 1 - - - - - Start - True - True - True - True - Start receiving immediately [Space] - Start receiving immediately [Space] - - - - False - True - 2 - + + + True + False + Manual start + True + + + + True + True + 2 + - - + + True False - Manual start - True + 0 + in + + + True + False + 10 + 10 + 10 + 10 + + + True + False + 4 + 4 + + + True + False + Power + + + 0 + 0 + 1 + 1 + + + + + True + False + SNR + + + 0 + 1 + 1 + 1 + + + + + 100 + 20 + True + False + gtk-missing-image + + + 1 + 0 + 1 + 1 + + + + + 100 + 20 + True + False + gtk-missing-image + + + 1 + 1 + 1 + 1 + + + + + + + + + True + False + Signal level + True + + + + True + True + 3 + - True - True - 1 + 0 + 1 + 1 + 2 - + True False - 0 - in + 10 - + True False - 10 - 10 - 10 - 10 + 0 + in - + True False - 4 - 4 + 10 + 10 + 12 + 10 - + True False - Power + + + True + False + True + Sound card device used to capture from radio + Sound card device used to capture from radio + start + 0 + 0 + 1 + + + + False + True + 0 + + + + + True + False + gtk-dialog-error + + + False + True + 4 + 1 + + - - 0 - 0 - 1 - 1 - - - - - True - False - SNR - - - 0 - 1 - 1 - 1 - - - - - 100 - 20 - True - False - gtk-missing-image - - - 1 - 0 - 1 - 1 - - - - - 100 - 20 - True - False - gtk-missing-image - - - 1 - 1 - 1 - 1 - - - - - - True - False - Signal level - True - - - - - True - True - 2 - - - - - - - - 0 - 1 - 1 - 2 - - - - - True - False - 10 - - - True - False - 0 - in - - - True - False - 10 - 10 - 12 - 10 - - + + True False - - - True - False - True - Sound card device used to capture from radio - Sound card device used to capture from radio - start - 0 - 0 - 1 - - - - False - True - 0 - - - - - True - False - gtk-missing-image - - - False - True - 4 - 1 - - + Capture device + True + + False + True + 0 + - - - True - False - Capture device - True - - - - - False - True - 0 - - - - - True - False - True - 0 - in - + True False - 10 - 10 - 12 - 10 + True + 0 + in - + True False + 10 + 10 + 12 + 10 - - 300 + True - True - True - False - - True + False + + + 300 + True + True + True + False + + True + + + False + True + 0 + + + + + Browse... + False + action1 + True + True + True + True + top + + + False + False + 1 + + - - False - True - 0 - - - - - Browse... - False - action1 - True - True - True - True - top - - - False - False - 1 - + + + True + False + Saved pictures directory + True + + - - - - True - False - Saved pictures directory - True - + + False + True + 1 + - False - True - 1 + 0 + 0 + 2 + 1 - - 0 - 0 - 2 - 1 - - - - - - True - False - Rx - - - False - - - - - True - False - 10 - 10 - 10 - 10 - - + + True False - True - 0 - in + 5 + 2 + Rx + + + False + + + + + True + False + 10 + 10 + 10 + 10 - - 110 + True False - 10 - 10 - 10 - 10 + True + 0 + in - + + 110 True - True - in + False + 10 + 10 + 10 + 10 - + True True - natural - natural - none - savedstore - 0 + in - - - 0 - - - - - center + + True + True + natural + natural + none + savedstore + 0 + + + + 0 + + + + + center + + + 1 + + - - 1 - - - - - - True - False - Recent pictures - True + + + True + False + Recent pictures + True + + + + 1 + + + + + True + False + 5 + 2 + Log + + + 1 + False + + + + + + + - - 1 - - - - - True - False - Log - - - 1 - False - - - - - - - diff --git a/vis.c b/vis.c index 06679d4..f116cee 100644 --- a/vis.c +++ b/vis.c @@ -180,5 +180,3 @@ guchar GetVIS () { else printf(" No VIS found\n"); return 0; } - -