MIDI set_sync_client fix, cleanups, compilation fixes for gcc 2.95 - Alex
authorterminatorX <>
Sun, 17 Aug 2003 15:11:32 +0000 (15:11 +0000)
committerterminatorX <>
Sun, 17 Aug 2003 15:11:32 +0000 (15:11 +0000)
12 files changed:
ChangeLog
src/main.cc
src/tX_audiofile.cc
src/tX_capabilities.cc
src/tX_dialog.cc
src/tX_engine.cc
src/tX_ladspa.cc
src/tX_mastergui.cc
src/tX_midiin.cc
src/tX_seqpar.cc
src/tX_seqpar.h
src/tX_vtt.cc

index 0f287051ff5c5931be964bbc74c5e7d75dfc7633..a7f4bb9c5bb1a991c55856441189ff0546f69f54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ This is not a GNU-style ChangeLog but you sort of get the idea what was
 changed.
 
 [v3.81]
+- fixed a bug that caused enabling sync-client setting via MIDI to fail.
 - when compiled with rt-scheduling suppport terminatorX will now display the 
   resulting scheduling policy in the about dialog.
 - if terminatorX was setup to use realtime priority for the audio engine thread
index db92f11e9342ebc450a4c39a8dd4f019dc6c9198..a5f3fc25d576369952dc74033a10a69d9d753fad 100644 (file)
@@ -58,6 +58,7 @@
 #include "tX_dialog.h"
 #include <gtk/gtk.h>
 #include <glib.h>
+#include <string.h>
 
 #include "tX_ladspa.h"
 #include "tX_ladspa_class.h"
@@ -176,7 +177,11 @@ void checkenv(const char *name) {
        
        value=getenv(name);
        if (value) {
-               length=strnlen(value, PATH_MAX+1);
+               length=strlen(value);
+               /*
+                strnlen requires extra macros...
+                length=strnlen(value, PATH_MAX+1);
+               */
                
                if (length>=PATH_MAX) {
                        tX_error("Your \"%s\" environment variable seems malicious (%i chars).", name, length);
index 9edfa3b2641af7772bf776e99815680f83cf4513..5960a6bb634ff1073adbc01681745b60f6aa8f0f 100644 (file)
@@ -69,6 +69,8 @@
 #      include <audiofile.h>
 #endif
 
+#define min(a,b) ((a) < (b) ? (a) : (b))
+
 tx_audiofile :: tx_audiofile()
 {
        mem_type=TX_AUDIO_UNDEFINED;
@@ -272,7 +274,6 @@ tX_audio_error tx_audiofile :: load_ogg123() {
 #endif
 
 #ifdef USE_BUILTIN_WAV
-#define min(a,b) ((a) < (b) ? (a) : (b))
 tX_audio_error tx_audiofile :: load_wav() {
        tX_debug("tx_audiofile::load_wav()");
        
index 5642ccc988db28d7611b6c968a7e8ca07781fc15..ad314e7002d102cf215f61c8ba0ea6bec7c23bc2 100644 (file)
@@ -32,7 +32,6 @@ bool have_nice_capability()
 {
        cap_t caps;
        cap_flag_value_t cap;
-       pid_t pid;
 
        caps=cap_get_proc();
        
index f6d9f01c3f62be24820a9320e08b63ec418cac63..5a370894633c274190dc834636da1a5287324ef3 100644 (file)
@@ -575,54 +575,123 @@ void show_about(int nag)
                
                sep=gtk_hseparator_new();
                add_about_wid_fix(sep);
-               char about_prefix_umlaut[]="\nThis is "PACKAGE" Release "VERSION" - Copyright (C) 1999-2003 by Alexander K\xC3\xB6nig";
-               char about_rest[]="\n\nSend comments, patches and scratches to: alex@lisas.de\n"
-               "terminatorX-homepage: http://www.terminatorX.cx\n\nThis binary has been compiled with the following flags: "
-               "Sox support: "
+               
+               label=gtk_label_new("This is "PACKAGE" release "VERSION" - Copyright (C) 1999-2003 by Alexander K\xC3\xB6nig"
+               "\nSend comments, patches and scratches to: alex@lisas.de\nterminatorX-homepage: http://www.terminatorX.cx");
+
+               gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
+               add_about_wid_fix(label);
+
+               sep=gtk_hseparator_new();
+               add_about_wid_fix(sep);
+               
+               label=gtk_label_new(
+               "Compilation flags: "
+               "sox: "
 #ifdef USE_SOX_INPUT
                "ON"
 #else
                "OFF"
 #endif         
-               " - mpg123 support: "
+               " - mpg123: "
 #ifdef USE_MPG123_INPUT
                "ON"
 #else
                "OFF"
 #endif
-               " - \nogg123 support: "
+               " - ogg123: "
 #ifdef USE_OGG123_INPUT
                "ON"
 #else
                "OFF"
 #endif
+               " - libmad: "
+#ifdef USE_MAD_INPUT
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - libvorbis: "
+#ifdef USE_VORBIS_INPUT
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - libaudiofile: "
+#ifdef USE_AUDIOFILE_INPUT
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - MIDI: "
+#ifdef USE_ALSA_MIDI_IN
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - OSS: "
+#ifdef USE_OSS
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - ALSA: "
+#ifdef USE_ALSA
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - JACK: "
+#ifdef USE_JACK
+               "ON"
+#else
+               "OFF"
+#endif
 
-               " - enhanced scheduling: "
+               " - liblrdf: "
+#ifdef USE_LRDF
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - rt scheduling: "
 #ifdef USE_SCHEDULER
                "ON"
 #else
                "OFF"
 #endif
-               " - for a "
+
+               " - capabilities: "
+#ifdef USE_CAPABILITIES
+               "ON"
+#else
+               "OFF"
+#endif
+
+               " - "
 #ifdef WORDS_BIGENDIAN
                "big"
-               
 #else
                "little"
 #endif
-               " endian machine.\n";
-               
-               char buffer[4096];
-               
-               strcpy(buffer, about_prefix_umlaut);
-               strcat(buffer, about_rest);
-               
-               label=gtk_label_new(buffer);
-
+               " endian.");
+       
+               gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
                gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
                add_about_wid_fix(label);
-               
+
 #ifdef         USE_SCHEDULER
+               sep=gtk_hseparator_new();
+               add_about_wid_fix(sep);
+
+               char buffer[4096];
                int prio=sched_getscheduler(tX_engine::get_instance()->get_pid());
                char prio_str[32]="";
                
index 440da02052fc93a45a5318a55e42c569d3fbb726..9d6a7b56b1ff0236645bb4dc5a01f119592b3955 100644 (file)
@@ -56,9 +56,9 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-tX_engine *tX_engine :: engine=NULL;
+tX_engine *tX_engine::engine=NULL;
 
-tX_engine *tX_engine :: get_instance() {
+tX_engine *tX_engine::get_instance() {
        if (!engine) {
                engine=new tX_engine();
        }
@@ -66,18 +66,18 @@ tX_engine *tX_engine :: get_instance() {
        return engine;
 }
 
-void tX_engine :: set_grab_request() {
+void tX_engine::set_grab_request() {
        grab_request=true;
 }
 
-int16_t* tX_engine :: render_cycle() {
+int16_t* tX_engine::render_cycle() {
        /* Checking whether to grab or not  */
        if (grab_request!=grab_active) {
                if (grab_request) {
                        /* Activating grab... */
                        int result=mouse->grab(); 
                        if (result!=0) {
-                               tX_error("tX_engine::loop(): failed to grab mouse - error %i", result);
+                               tX_error("tX_engine::render_cycle(): failed to grab mouse - error %i", result);
                                grab_active=false;
                                /* Reseting grab_request, too - doesn't help keeping it, does it ? ;) */
                                grab_request=false;
@@ -114,7 +114,7 @@ int16_t* tX_engine :: render_cycle() {
        return  data;
 }
 
-void tX_engine :: loop() {
+void tX_engine::loop() {
        while (!thread_terminate) {
                /* Waiting for the trigger */
                pthread_mutex_lock(&start);
@@ -156,10 +156,9 @@ void *engine_thread_entry(void *engine_void) {
                }
        }
 
+#ifdef USE_SCHEDULER
        pid_t pid=getpid();
-       tX_engine::get_instance()->set_pid(pid);
 
-#ifdef USE_SCHEDULER
 #ifdef USE_CAPABILITIES
        if (have_nice_capability()) {
                if (globals.use_realtime) {
@@ -175,6 +174,7 @@ void *engine_thread_entry(void *engine_void) {
                tX_warning("engine_thread_entry(): can't set SCHED_FIFO -> lacking capabilities.");
        }
 #endif //USE_CAPABILITIES
+       engine->set_pid(pid);
        
        if (sched_getscheduler(pid)!=SCHED_FIFO) {
                tX_warning("engine_thread_entry() - engine has no realtime priority scheduling.");
@@ -199,7 +199,9 @@ tX_engine :: tX_engine() {
        pthread_mutex_init(&start, NULL);
        pthread_mutex_lock(&start);
        thread_terminate=false;
-       pid=0;
+#ifdef USE_SCHEDULER
+       pid=-1;
+#endif 
        
        /* Creating the actual engine thread.. */
 #ifdef USE_SCHEDULER   
index 09c08c04b64b342698c433995547dee3fe224cac..cccefb1839b166ca670d754b34ae6cdccf1e6b41 100644 (file)
@@ -183,7 +183,7 @@ LADSPA_Plugin :: LADSPA_Plugin (const LADSPA_Descriptor *ld, char *filename)
        
        plugin_list.push_back(this);
        strcpy(file, filename);
-       sprintf (info_string, "   LADSPA-Plugin: %s   \n   Label: %s   \n   File: %s   \n   Unique ID: %li   \n   Maker: %s   \n   Copyright: %s   ", ld->Name, ld->Label, file, ld->UniqueID, ld->Maker, ld->Copyright);
+       sprintf(info_string, "LADSPA-Plugin: %s\nLabel: %s\nFile: %s\nUnique ID: %li\nMaker: %s\nCopyright: %s", ld->Name, ld->Label, file, ld->UniqueID, ld->Maker, ld->Copyright);
        LADSPA_Class::add_plugin(this);
 }
 
index 6297672d77d96a2959394aa842a2cb8306ade8dc..94ba00401a66648bfce9898de349843049f37c34 100644 (file)
@@ -914,6 +914,8 @@ GCallback menu_delete_all_events(GtkWidget *, void *param)
        
        gtk_label_set_markup(GTK_LABEL(label), "Delete <b>all</b> events for <b>all</b> turntables.");
        gtk_widget_show(del_dialog);
+       
+       return NULL;
 }
 
 GCallback menu_delete_all_events_for_vtt(GtkWidget *, vtt_class *vtt)
index 5a2cb2f6208c5537f5dc03a04b31ed9aeea4ce52..ada068e7d6e1cf1ef38622a8eea533466dfad8b7 100644 (file)
@@ -430,11 +430,15 @@ gboolean tX_midiin::midi_learn_cancel(GtkWidget *widget, tX_midiin *midi)
 {
        midi->sp_to_learn=NULL;
        gtk_widget_destroy(midi->learn_dialog);
+       
+       return FALSE;
 }
 
 gboolean tX_midiin::midi_learn_destroy(GtkWidget *widget, tX_midiin *midi)
 {
        midi->cancel_midi_learn();
+       
+       return FALSE;
 }
 
 void tX_midiin::store_connections(FILE *rc, char *indent) 
index 4751b75a8a9f7e228bbb48dbccaac0b20be5b834..f2dd51ab047e5e511709708a36b45a032046b1de 100644 (file)
@@ -617,6 +617,7 @@ void tX_seqpar_vtt_loop :: do_update_graphics ()
 tX_seqpar_vtt_sync_client :: tX_seqpar_vtt_sync_client()
 {
        set_mapping_parameters(0,0,0,0);
+       is_boolean=true;
 }
 
 void tX_seqpar_vtt_sync_client :: do_exec(const float value)
@@ -1059,8 +1060,12 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
                item = gtk_menu_item_new_with_label("MIDI Learn");
                gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
                gtk_widget_show(item);
+#ifdef USE_ALSA_MIDI_IN
                g_signal_connect(item, "activate", (GCallback) tX_seqpar::learn_midi_binding, sp);              
-
+#else
+               gtk_widget_set_sensitive(item, FALSE);
+#endif
+               
                item = gtk_menu_item_new_with_label("Remove MIDI Binding");
                gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
                gtk_widget_show(item);          
@@ -1068,8 +1073,11 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
                if (sp->bound_midi_event.type==tX_midievent::NONE) {
                        gtk_widget_set_sensitive(item, FALSE);
                }
+#ifdef USE_ALSA_MIDI_IN
                g_signal_connect(item, "activate", (GCallback) tX_seqpar::remove_midi_binding, sp);             
-
+#else
+               gtk_widget_set_sensitive(item, FALSE);
+#endif
                if (!sp->is_boolean) {
                        item = gtk_menu_item_new();
                        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
@@ -1079,12 +1087,21 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
                        item = gtk_menu_item_new_with_label("Set Upper MIDI Bound");
                        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
                        gtk_widget_show(item);
+                       
+#ifdef USE_ALSA_MIDI_IN
                        g_signal_connect(item, "activate", (GCallback) tX_seqpar::set_midi_upper_bound, sp);            
+#else
+                       gtk_widget_set_sensitive(item, FALSE);
+#endif
                        
                        item = gtk_menu_item_new_with_label("Reset Upper MIDI Bound");
                        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-                       gtk_widget_show(item);                  
+                       gtk_widget_show(item);
+#ifdef USE_ALSA_MIDI_IN
                        g_signal_connect(item, "activate", (GCallback) tX_seqpar::reset_midi_upper_bound, sp);          
+#else
+                       gtk_widget_set_sensitive(item, FALSE);
+#endif
                        
                        if (!sp->midi_upper_bound_set) {
                                gtk_widget_set_sensitive(item, FALSE);                          
@@ -1093,12 +1110,20 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
                        item = gtk_menu_item_new_with_label("Set Lower MIDI Bound");
                        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
                        gtk_widget_show(item);
+#ifdef USE_ALSA_MIDI_IN
                        g_signal_connect(item, "activate", (GCallback) tX_seqpar::set_midi_lower_bound, sp);                                    
+#else
+                       gtk_widget_set_sensitive(item, FALSE);
+#endif
                        
                        item = gtk_menu_item_new_with_label("Reset Lower MIDI Bound");
                        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-                       gtk_widget_show(item);          
+                       gtk_widget_show(item);
+#ifdef USE_ALSA_MIDI_IN
                        g_signal_connect(item, "activate", (GCallback) tX_seqpar::reset_midi_lower_bound, sp);          
+#else
+                       gtk_widget_set_sensitive(item, FALSE);
+#endif
 
                        if (!sp->midi_lower_bound_set) {
                                gtk_widget_set_sensitive(item, FALSE);                          
@@ -1126,6 +1151,8 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
        return FALSE;
 }
 
+#ifdef USE_ALSA_MIDI_IN
+
 gboolean tX_seqpar::remove_midi_binding(GtkWidget *widget, gpointer data) {
        tX_seqpar *sp=(tX_seqpar *) data;
        
@@ -1171,3 +1198,5 @@ gboolean tX_seqpar::reset_midi_lower_bound(GtkWidget *widget, gpointer data) {
        
        return TRUE;
 }
+
+#endif // USE_ALSA_MIDI_IN
index 2e8d02e10123d847893ea6d4eba69501e9e3a02d..6fbb712a24cb4d817a3dc915e3994a2bfc9aff3f 100644 (file)
@@ -155,6 +155,8 @@ class tX_seqpar
        void reset_lower_midi_bound() { midi_lower_bound_set=false; }
        
        static gboolean tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gpointer data);
+       
+#ifdef USE_ALSA_MIDI_IN        
        static gboolean remove_midi_binding(GtkWidget *widget, gpointer data);
        static gboolean learn_midi_binding(GtkWidget *widget, gpointer data);   
        
@@ -163,6 +165,7 @@ class tX_seqpar
        
        static gboolean set_midi_lower_bound(GtkWidget *widget, gpointer data);
        static gboolean reset_midi_lower_bound(GtkWidget *widget, gpointer data);       
+#endif 
 };
 
 class tX_seqpar_update : public tX_seqpar
index 296f8b4f659505b72e907921ad42d2e3bc30cd9a..883320ac656d825910fb6f0d922a0e7e8ecee903 100644 (file)
@@ -1137,6 +1137,7 @@ void vtt_class :: set_sync_master(int master)
 
 void vtt_class :: set_sync_client(int slave, int cycles)
 {
+       tX_debug("vtt_class::set_sync_client() setting %i, %i.", slave, cycles);
        is_sync_client=slave;
        sync_cycles=cycles;
 //     sync_countdown=cycles;