More gtk+2 fixes, new sequencer dialog, mpg321 pre-listen suport - Alex
authorterminatorX <>
Wed, 31 Jul 2002 23:42:25 +0000 (23:42 +0000)
committerterminatorX <>
Wed, 31 Jul 2002 23:42:25 +0000 (23:42 +0000)
ChangeLog
src/tX_mastergui.cc
src/tX_prelis.cc
src/tX_sequencer.h
src/tX_vttgui.cc

index 35dee74e2a3a81b32daf31a49279b41037018574..a9e3c80e9ac9442e00a213435b2678a84143fd67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,11 @@ changed.
 - This release should compile and run on FreeBSD systems and possibly
   OpenBSD, too. Thanks for help and testing this goes to 
   Tilman Linneweh <tilman@arved.de>.
+- Sequencer now refuses to play when no events available - and displays
+  a dialog that suggests running the audio engine.
+- De-uglified the terminatorX note dialog.
+- Fixed gtk+2 signals for load file dialog
+- Pre-listen support for mpg321
 
 [v3.72]
 - Applied a patch from Matthew Evans <activesx@hotmail.com> that introduces 
index a64339beadfe78cf6026b6fb85dd94580684a8c6..598374490ef39e031fc20846d30a7b022553d083 100644 (file)
 #include "tX_mastergui.h"
 #include "tX_knobloader.h"
 
-/* I don't know a display that can handle that, but
-   just to be on the safe side...
-*/
-#define MAX_ROWS 25
-
 #ifdef USE_SCHEDULER
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -689,19 +684,27 @@ void quit()
 }
 
 void mplcfitx()
-/* Most Probably Least Called Function In Terminator X :) */
+/* Most Probably Least Called Function In terminatorX :) */
 {
        show_about(0);
 }
 
 GtkSignalFunc seq_play(GtkWidget *w, void *)
 {
-       if (seq_stop_override) return NULL;
-       seq_adj_care=0;
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), 1);
-       sequencer.trig_play();
-       
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 1);
+       if (sequencer.is_empty()) {
+               if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
+                       tx_note("Sequencer playback triggered - but no events\nrecorded yet - nothing to playback!\n\nTo perform live with terminatorX just activate the\naudio engine with the \"Power\" button.");
+                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), 0);
+               }
+       } else {
+               if (seq_stop_override) return NULL;
+                       
+               seq_adj_care=0;
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), 1);
+               sequencer.trig_play();
+       
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 1);
+       }
 }
 
 GtkSignalFunc seq_stop(GtkWidget *w, void *)
@@ -1128,25 +1131,39 @@ void note_destroy(GtkWidget *widget, GtkWidget *mbox)
 
 void tx_note(const char *message)
 {
-       char buffer[4096]="\n     [ terminatorX Message: ]     \n\n";
+       char buffer[4096]="\nterminatorX Note:\n\n";
        
        GtkWidget *mbox;
        GtkWidget *label;
        GtkWidget *btn;
+       GtkWidget *sp;
        GtkWindow *win;
        
        mbox=gtk_dialog_new();
        win=&(GTK_DIALOG(mbox)->window);
-       strcat(buffer, "   ");  
+
+       gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(mbox)->vbox), 2);
+       gtk_container_set_border_width(GTK_CONTAINER(mbox), 10);
+       
+       label=gtk_label_new("terminatorX Note");
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
+       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), label, TRUE, TRUE, 0);
+       gtk_widget_show(label);
+
+       sp=gtk_hseparator_new();
+       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), sp, TRUE, TRUE, 0);
+       gtk_widget_show(sp);
+
+       strcpy(buffer, "\n");
        strcat(buffer, message);
-       strcat(buffer, "   ");
+       strcat(buffer, "\n");
        label=gtk_label_new(buffer);
        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), label, TRUE, TRUE, 0);
-       gtk_widget_show(label);
-       
+       gtk_widget_show(label); 
+
        btn = gtk_button_new_with_label("Ok");
        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->action_area), btn, TRUE, TRUE, 0);
-       
+
        gtk_signal_connect(GTK_OBJECT(btn), "clicked", GtkSignalFunc(note_destroy), mbox);
 
        gtk_window_set_default_size(win, 200, 100);
@@ -1176,7 +1193,7 @@ void tx_l_note(const char *message)
        gtk_label_set_justify (GTK_LABEL(label),  GTK_JUSTIFY_LEFT);
        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), label, TRUE, TRUE, 0);
        gtk_widget_show(label);
-       
+
        btn = gtk_button_new_with_label("Ok");
        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->action_area), btn, TRUE, TRUE, 0);
        gtk_widget_show(btn);
index 93d945859dca3d8b6463c8b0278063201b4e3d31..be727a24b67ee4647f4c9e6dca09dcb7679c2896 100644 (file)
@@ -40,20 +40,12 @@ extern "C" {
 #include <config.h>
 #endif
 
-#define PL_SOX_STR "sox \"%s\" -t ossdsp -w -s \"%s\""
-#define PL_MPG123_STR "mpg123 -a \"%s\" \"%s\""
-#define PL_OGG123_STR "ogg123 -d oss \"%s\" -o \"dsp:%s\""
-
-//FILE *player_handle=NULL;
 pid_t player_pid=0;
 
 void prelis_stop()
 {
-/*     if  (player_handle) pclose(player_handle);
-       player_handle=NULL;*/
        int status;
        
-//     printf("killing %i\n", player_pid);
        if (player_pid)
        {
                kill(player_pid, SIGTERM);
@@ -88,18 +80,15 @@ void prelis_start(char *name)
 #ifdef USE_OGG123_INPUT
                        strcpy(ogg123_dev, "dev:");
                        if (!strncasecmp("ogg", ext, 2))
-//          sprintf(buffer, PL_OGG123_STR, name, globals.audio_device);
                        useogg123=1;
                        else
 #endif
 #ifdef USE_MPG123_INPUT                        
                        if (!strncasecmp("mp", ext, 2))                 
-//                     sprintf(buffer, PL_MPG123_STR, name, globals.audio_device);
                        usempg123=1;
                        else
 #endif
 #ifdef USE_SOX_INPUT                   
-//                     sprintf(buffer, PL_SOX_STR, name, globals.audio_device);
                        usempg123=0;
 #else
                        return;
@@ -126,7 +115,7 @@ void prelis_start(char *name)
 #endif
 #ifdef USE_MPG123_INPUT
                if (usempg123)
-                       res=execlp("mpg123", "mpg123", "-q", "-a", dev, nm, NULL);
+                       res=execlp("mpg123", "mpg123", "-q", "-o","oss","-a", dev, nm, NULL);
                else
 #endif
 #ifdef USE_SOX_INPUT           
index c04a2909329ea0488aee1534bb1fbc4f68a0b0a0..34be046c34a4d2c41767739efc24dd56c8dd711c 100644 (file)
@@ -84,6 +84,7 @@ class tX_sequencer
        
        guint32 set_start_timestamp(float pos);
        void forward_to_start_timestamp(int dont_fake);
+       bool is_empty() { return song_list.empty(); }
 };
 
 extern tX_sequencer sequencer;
index 0485289e7689e2d52fce8b073c10d18cded50be5..0b36f66169bf9ac31b355f9501c1f92e5f91e513 100644 (file)
@@ -110,7 +110,7 @@ void pitch_changed(GtkWidget *wid, vtt_class *vtt)
 GtkSignalFunc trigger_prelis(GtkWidget *w)
 {
        GtkFileSelection *fs;
-       
+
        fs=GTK_FILE_SELECTION(gtk_widget_get_toplevel(w));
        
        prelis_start((char *) gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
@@ -270,7 +270,11 @@ GtkSignalFunc load_file(GtkWidget *wid, vtt_class *vtt)
        gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_load_file), vtt);
        gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_load_file), vtt);    
        gtk_signal_connect (GTK_OBJECT(vtt->gui.fs), "delete-event", GTK_SIGNAL_FUNC(quit_load_file), vtt);     
+#ifdef USE_GTK2
+       gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "cursor_changed", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);            
+#else
        gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "select_row", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
+#endif         
 }
 
 void delete_vtt(GtkWidget *wid, vtt_class *vtt)