Moslty cleanups and minor fixes - Alex
authorterminatorX <>
Mon, 18 Aug 2003 22:30:39 +0000 (22:30 +0000)
committerterminatorX <>
Mon, 18 Aug 2003 22:30:39 +0000 (22:30 +0000)
22 files changed:
ChangeLog
src/main.cc
src/tX_audiodevice.cc
src/tX_audiofile.cc
src/tX_capabilities.cc
src/tX_dialog.cc
src/tX_engine.cc
src/tX_extdial.cc
src/tX_glade_interface.cc
src/tX_global.c
src/tX_ladspa.cc
src/tX_ladspa_class.cc
src/tX_loaddlg.cc
src/tX_mastergui.cc
src/tX_mouse.cc
src/tX_panel.cc
src/tX_sequencer.cc
src/tX_tape.cc
src/tX_vttfx.cc
src/tX_vttgui.cc
terminatorX.glade
terminatorX.spec.in

index a7f4bb9c5bb1a991c55856441189ff0546f69f54..9540a4898614210956bfea8fafe85c1dc9d654ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,9 +6,10 @@ 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.
+  resulting scheduling policy in the "About" dialog.
 - if terminatorX was setup to use realtime priority for the audio engine thread
   but you dont want it - disable realtime scheduling in the Preferences dialog.
+  This works with capabilities _ONLY_.
 - if you don't want to confirm program termination every time you can now
   disable "Ask for Quit confirmation" in the Preferences.
 - added support for Linux' POSIX capabilities. This allows a suid-root installed
@@ -34,7 +35,7 @@ changed.
   for leak. Note: I even enabled the leak by default now.
 - fixed a bug that caused turntable 1 to get the focus on entering Mouse Grab
   mode even when it's audio panel was minimized.
-- MIDI mappings can now have "borders", meaning that the incoming MIDI signals
+- MIDI mappings can now have "bounds", meaning that the incoming MIDI signals
   can modify the parameter within the given range only.
 - introduced a new way of assigning MIDI controllers to parameters: simply 
   right-click on a parameter's control: a menu with "MIDI Learn" and 
@@ -42,11 +43,7 @@ changed.
   corresponding MIDI event.
 - fixed a bug in the MIDI callback thanks to David Hamilton 
   <daham2@student.monash.edu>
-- the realtime scheduling reproducibly stalled separate machines. Unluckily 
-  an OS-stall situation is somewhat hard to debug. Additionally the new 2.5.*
-  and the 2.4.*-ckX kernels have significantly improved scheduling that renders
-  the use of SCHED_FIFO unnecessary. 
-- running suid root was reported exploitable by Andrew Griffiths
+- running suid root (the old way) was reported exploitable by Andrew Griffiths
   <andrewg@felinemenace.org> - the described environment variable based exploit 
   was fixed - however there are possibly other ways to exploit it. So the 
   old method of running suid root has been disabled by default. On Linux 
index a5f3fc25d576369952dc74033a10a69d9d753fad..dc84c7b4d018d37b1084e49bef09d03fec90b9a0 100644 (file)
@@ -69,8 +69,6 @@
 #include "tX_vtt.h"
 #endif
 
-GTimer *my_time;
-gint idle_tag;
 #ifdef USE_JACK        
 void jack_check()
 {
@@ -80,24 +78,12 @@ void jack_check()
 }
 #endif // USE_JACK
 
-int idle()
+static bool timesup=false;
+
+gboolean timeout(void *)
 {
-       gdouble time;
-       gulong ms;
-       
-       time=g_timer_elapsed(my_time, &ms);
-       if (time > 1.5)
-       {
-               gtk_idle_remove(idle_tag);
-               g_timer_destroy(my_time);
-               destroy_about();                
-               display_mastergui();            
-#ifdef USE_JACK        
-               jack_check();
-#endif                 
-       }
-       
-       return TRUE;
+       timesup=true;
+       return FALSE;
 }
 
 void show_help()
@@ -171,7 +157,8 @@ int parse_args(int *argc, char **argv)
        return 1;
 }
 
-void checkenv(const char *name) {
+void checkenv(const char *name)
+{
        char *value;
        int length;
        
@@ -220,23 +207,33 @@ int main(int argc, char **argv)
        
        checkenv("HOME");
        checkenv("XLOCALEDIR"); 
-       
+
+#ifndef USE_CAPABILITIES
+       /* If we're not using capabilities we're still 
+          running suid-root here. So we get rid of root
+          before doing anything esle.
+       */
        tX_engine *engine=tX_engine::get_instance();
+#endif 
        
        gtk_init (&argc, &argv);
        gtk_set_locale();
        
-       parse_args(&argc, argv); 
+       parse_args(&argc, argv); // loads settings
 
        if (globals.show_nag) { 
                show_about(1);
-
-               my_time=g_timer_new();
-               g_timer_start(my_time);         
-       
-               idle_tag=gtk_idle_add((GtkFunction)idle, NULL);
+               g_timeout_add(2000, (GSourceFunc) timeout, NULL);
        }
-       
+
+#ifdef USE_CAPABILITIES
+       /* If we have capabilities it's save to
+          first read the config and then create 
+          the engine.
+       */
+       tX_engine *engine=tX_engine::get_instance();
+#endif 
+
        LADSPA_Class::init();
        LADSPA_Plugin::init();
 #ifdef USE_JACK        
@@ -244,13 +241,21 @@ int main(int argc, char **argv)
 #endif 
        
        create_mastergui(globals.width, globals.height);
-               
-       if (!globals.show_nag) {
+
+       
+       if (globals.show_nag) {
+               while (!timesup) {
+                       while (gtk_events_pending()) gtk_main_iteration(); 
+                       gdk_flush();                            
+                       usleep(250);
+               }
+               destroy_about();
+       }
+       
 #ifdef USE_JACK
-               jack_check();
+       jack_check();
 #endif
-               display_mastergui();
-       }
+       display_mastergui();
                
        if (globals.startup_set) {
                while (gtk_events_pending()) gtk_main_iteration(); gdk_flush(); 
@@ -287,15 +292,14 @@ int main(int argc, char **argv)
        double res;
        list <vtt_class *> :: iterator vtt;
        
-       for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
-       {
+       for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++) {
                if ((*vtt)->autotrigger) (*vtt)->trigger();
        }
-       sleep(3);
        
+       sleep(3);       
        g_timer_start(bench_time);
-       for (int i=0; i<BENCH_CYCLES; i++)
-       {
+       
+       for (int i=0; i<BENCH_CYCLES; i++) {
                vtt_class::render_all_turntables();
        }
        g_timer_stop(bench_time);
index 20ed4e257540f75df1b335310a444c2b863232f9..39d5503dde3137518cf74e06b434f7ad18238bec 100644 (file)
@@ -161,8 +161,7 @@ int tX_audiodevice_oss :: open()
 
 int tX_audiodevice_oss :: close()
 {
-       if (!fd)
-       {       
+       if (!fd) {      
                return(1);              
        }
        is_open=false;
index 5960a6bb634ff1073adbc01681745b60f6aa8f0f..fe38aab59bec75a3b3c92c3faa4016c1dc04b5e7 100644 (file)
@@ -88,10 +88,8 @@ void tx_audiofile :: figure_file_type()
        
        ext=strrchr(filename, (int) '.');
        
-       if (ext)
-       {
-               if (strlen(ext) >3)
-               {
+       if (ext) {
+               if (strlen(ext) >3) {
                        ext++;
                        if (!strcasecmp("wav", ext)) file_type=TX_FILE_WAV;
                        else if (!strncasecmp("mp", ext, 2)) file_type=TX_FILE_MPG123;
index ad314e7002d102cf215f61c8ba0ea6bec7c23bc2..62809b0397994e81a3bd859c488ccc35786a2bbf 100644 (file)
@@ -1,6 +1,6 @@
 /*
     terminatorX - realtime audio scratching software
-    Copyright (C) 1999-2003  Alexander König
+    Copyright (C) 1999-2003  Alexander König
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
index b9b547de4aabffb9e3e73bd6ddf36af1158258b3..defcd52d1f5b8164a89b5b28cf08401d935d5091 100644 (file)
@@ -351,6 +351,12 @@ void init_tx_options(GtkWidget *dialog) {
        }
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "use_realtime")), globals.use_realtime);
+
+#ifndef USE_CAPABILITIES
+       /* rt's not configurable without capabilities. */
+       gtk_widget_hide(lookup_widget(dialog, "use_realtime"));
+       gtk_widget_hide(lookup_widget(dialog, "use_realtime_label"));   
+#endif
        
 #ifndef USE_OSS
        gtk_widget_set_sensitive(lookup_widget(dialog, "oss_driver"), 0);
index 9d6a7b56b1ff0236645bb4dc5a01f119592b3955..f2f403d5ddbd525ca1d26b47c4798df265586f19 100644 (file)
@@ -168,6 +168,8 @@ void *engine_thread_entry(void *engine_void) {
                        parm.sched_priority=sched_get_priority_max(SCHED_FIFO);
                        if (sched_setscheduler(pid, SCHED_FIFO, &parm)) {
                                tX_error("engine_thread_entry(): failed to set realtime priority.");
+                       } else {
+                               tX_debug("engine_thread_entry(): set SCHED_FIFO via capabilities.");
                        }
                }
        } else {
index 2a24cb8235a0c76c02e222d3d0f56c32db3621aa..3c9fa73dc1e0baaf5a61e9980a0f4dcd7f373282 100644 (file)
@@ -7,7 +7,6 @@
 
 GtkSignalFunc tX_extdial :: f_entry(GtkWidget *w, tX_extdial *ed)
 {
-
        strcpy(ed->sval, gtk_entry_get_text(GTK_ENTRY(ed->entry)));
        ed->s2f();
        gtk_adjustment_set_value(ed->adj, ed->fval);
index 8a62ce54b2e8b7daf0fcdb9497c6c5d7815a3c0f..0462b7a19a1870eab455b4726ccfd9593457ede1 100644 (file)
@@ -151,7 +151,7 @@ create_tx_options (void)
   GSList *oss_driver_group = NULL;
   GtkWidget *alsa_driver;
   GtkWidget *jack_driver;
-  GtkWidget *label58;
+  GtkWidget *use_realtime_label;
   GtkWidget *use_realtime;
   GtkWidget *label1;
   GtkWidget *table5;
@@ -314,13 +314,13 @@ create_tx_options (void)
   gtk_radio_button_set_group (GTK_RADIO_BUTTON (jack_driver), oss_driver_group);
   oss_driver_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (jack_driver));
 
-  label58 = gtk_label_new ("Use realtime scheduling\nwhere available:");
-  gtk_widget_show (label58);
-  gtk_table_attach (GTK_TABLE (table4), label58, 0, 1, 1, 2,
+  use_realtime_label = gtk_label_new ("Use realtime scheduling\nwhere available:");
+  gtk_widget_show (use_realtime_label);
+  gtk_table_attach (GTK_TABLE (table4), use_realtime_label, 0, 1, 1, 2,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
-  gtk_label_set_justify (GTK_LABEL (label58), GTK_JUSTIFY_LEFT);
-  gtk_misc_set_alignment (GTK_MISC (label58), 0, 0.5);
+  gtk_label_set_justify (GTK_LABEL (use_realtime_label), GTK_JUSTIFY_LEFT);
+  gtk_misc_set_alignment (GTK_MISC (use_realtime_label), 0, 0.5);
 
   use_realtime = gtk_check_button_new_with_mnemonic ("Enabled");
   gtk_widget_show (use_realtime);
@@ -1078,7 +1078,7 @@ create_tx_options (void)
   GLADE_HOOKUP_OBJECT (tx_options, oss_driver, "oss_driver");
   GLADE_HOOKUP_OBJECT (tx_options, alsa_driver, "alsa_driver");
   GLADE_HOOKUP_OBJECT (tx_options, jack_driver, "jack_driver");
-  GLADE_HOOKUP_OBJECT (tx_options, label58, "label58");
+  GLADE_HOOKUP_OBJECT (tx_options, use_realtime_label, "use_realtime_label");
   GLADE_HOOKUP_OBJECT (tx_options, use_realtime, "use_realtime");
   GLADE_HOOKUP_OBJECT (tx_options, label1, "label1");
   GLADE_HOOKUP_OBJECT (tx_options, table5, "table5");
index 42daf288be7bd3c0f13867defc758f25980e6525..575d02e872bef8b4d965f5f4fb9e766c9f1cda57 100644 (file)
@@ -53,14 +53,10 @@ extern void tX_midiin_restore_connections(xmlNodePtr node);
 void get_rc_name(char *buffer)
 {
        strcpy(buffer,"");
-       if (globals.alternate_rc)
-       {
+       if (globals.alternate_rc) {
                strcpy(buffer, globals.alternate_rc);
-       }
-       else 
-       {
-               if (getenv("HOME"))
-               {
+       } else {
+               if (getenv("HOME")) {
                        strcpy(buffer, getenv("HOME"));
                        if (buffer[strlen(buffer)-1]!='/')
                        strcat(buffer, "/");
@@ -303,7 +299,6 @@ void store_globals() {
                case OSS:
                default:
                        strcpy(device_type, "oss");
-               
        }
        
        if (rc) {               
index cccefb1839b166ca670d754b34ae6cdccf1e6b41..8c17c9732e2c36ae712c54703cf5cb14409486a8 100644 (file)
@@ -80,25 +80,19 @@ void LADSPA_Plugin :: handlelib(void *lib, LADSPA_Descriptor_Function desc_func,
        const LADSPA_Descriptor *descriptor;
        int in_audio, out_audio, in_ctrl;       
        
-       for (i=0; (descriptor = desc_func(i)) != NULL; i++)
-       {               
+       for (i=0; (descriptor = desc_func(i)) != NULL; i++) {           
                if (LADSPA_IS_INPLACE_BROKEN(descriptor->Properties)) {
                        tX_warning("Plugin \"%s\" disabled. No in-place processing support.", descriptor->Name);
-               }
-               else
-               {               
+               } else {                
                        in_audio=0; out_audio=0; in_ctrl=0;
                
-                       for (port = 0; port<descriptor->PortCount; port++)
-                       {                       
-                               if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[port]))
-                               {
+                       for (port = 0; port<descriptor->PortCount; port++) {                    
+                               if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[port])) {
                                        if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[port])) in_audio++;
                                        else
                                        if (LADSPA_IS_PORT_OUTPUT(descriptor->PortDescriptors[port])) out_audio++;
-                               }
-                               else 
-                               if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[port]) && LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[port])) in_ctrl++;                    
+                               } else 
+                                       if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[port]) && LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[port])) in_ctrl++;                    
                        }
                        
                        if ((in_audio == 1) && (out_audio == 1)) {
@@ -127,10 +121,8 @@ void LADSPA_Plugin :: scandir(char *dirname)
        
        if (!dir) { tX_error("tX: Error: couldn't access directory \"%s\".", dirname); return; };
        
-       while (1)
-       {
-               entry=readdir(dir);
-               
+       while (1) {
+               entry=readdir(dir);             
                if (!entry) { closedir(dir); return; }
                
                filename = (char *) malloc (dirlen + strlen(entry->d_name) + 1 + needslash);
@@ -141,8 +133,7 @@ void LADSPA_Plugin :: scandir(char *dirname)
                
                handle = dlopen(filename, RTLD_LAZY);
                
-               if (handle)
-               {
+               if (handle) {
                        /* clear dlerror */
                        dlerror();
                        
@@ -171,8 +162,7 @@ void LADSPA_Plugin :: debug_display()
 {
        std::list <LADSPA_Plugin *> :: iterator plugin;
        
-       for (plugin=plugin_list.begin(); plugin != plugin_list.end(); plugin++)
-       {
+       for (plugin=plugin_list.begin(); plugin != plugin_list.end(); plugin++) {
                printf("plugin: %60s | id: %5li | ports: %2li\n", (*plugin)->getName(), (*plugin)->getUniqueID(), (*plugin)->getPortCount());
        }
 }
@@ -204,8 +194,7 @@ LADSPA_Plugin * LADSPA_Plugin :: getPluginByUniqueID(long ID)
 {
        std::list <LADSPA_Plugin *> :: iterator plugin;
        
-       for (plugin=plugin_list.begin(); plugin != plugin_list.end(); plugin++)
-       {
+       for (plugin=plugin_list.begin(); plugin != plugin_list.end(); plugin++) {
                if ((*plugin)->getUniqueID()==ID) return (*plugin);
        }
 
index 30376f2b37592d6faea0fabf89f2fc036c4d59d7..5cfe6a9ce98f9f8012fc2c6201313cd00ce03fff 100644 (file)
@@ -38,7 +38,8 @@ vtt_class *LADSPA_Class::current_vtt;
 bool LADSPA_Class::liblrdf_error=false;
 
 /* Why do have to code this myself? */
-static int compare(const char *a, const char *b) {
+static int compare(const char *a, const char *b) 
+{
        int lena, lenb, i;
 
        if (!a && !b) return 0;
@@ -129,8 +130,7 @@ void LADSPA_Class::scandir(char *dirname) {
        if (!dir) { tX_error("LADSPA_Class::scandir() couldn't access directory \"%s\"", dirname); return; };
        
        while (1) {
-               entry=readdir(dir);
-               
+               entry=readdir(dir);             
                if (!entry) { closedir(dir); return; }
                
                if ((strcmp(entry->d_name, ".")==0) ||
index d2f369aea0afbaae6e04612fd8907844004d0355..afe986f89bff710b7fe821f43515aa47e149cad5 100644 (file)
@@ -76,8 +76,7 @@ int ld_create_loaddlg(int mode, int count)
        actionarea=GTK_WIDGET(GTK_DIALOG(ld_loaddlg)->action_area);
        gtk_box_set_spacing(GTK_BOX(actionarea), 5);
        
-       if (mode==TX_LOADDLG_MODE_MULTI)
-       {
+       if (mode==TX_LOADDLG_MODE_MULTI) {
                ld_multi_l=gtk_label_new("Loading Set");
                gtk_misc_set_alignment(GTK_MISC(ld_multi_l), 0.5, 0.5);
                add_widget_fix(ld_multi_l);
@@ -115,14 +114,12 @@ char *strip_path(char *name)
        
        tmp=strrchr(name, (int) '/');
        
-       if (tmp)
-       {
-               if (strlen(tmp)>1)
-               {
+       if (tmp) {
+               if (strlen(tmp)>1) {
                        tmp++;
                }
-       }
-       else tmp=name;
+       } else 
+               tmp=name;
                
        return(tmp);
 }
@@ -147,18 +144,14 @@ void ld_set_filename(char *name)
        ld_current++;
        ld_old_prog=-1;
        filename=strip_path(name);
-       if (ld_mode==TX_LOADDLG_MODE_MULTI)
-       {
+       if (ld_mode==TX_LOADDLG_MODE_MULTI) {
                sprintf(buffer, "Loading file No. %i of %i [%s]", ld_current, ld_count, filename);
-       }
-       else
-       {
+       } else {
                sprintf(buffer, "Loading file [%s]", filename); 
        }
        gtk_label_set_text(GTK_LABEL(ld_single_l), buffer);
        
-       if (ld_mode==TX_LOADDLG_MODE_MULTI)
-       {
+       if (ld_mode==TX_LOADDLG_MODE_MULTI) {
                setprog=(((float) ld_current)/((float) ld_count));
                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ld_multi_p), setprog);
                gtk_flush();            
@@ -170,12 +163,9 @@ void ld_set_progress(gfloat progress)
 {
        progress=floor(progress*200.0)/200.0;
        if (progress>1.0) progress=1.0;
-       //printf("%f\n", progress);
        
-       if (progress!=ld_old_prog)
-       {
+       if (progress!=ld_old_prog) {
                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ld_single_p), progress);
-               
                gtk_flush();
        }
        
@@ -184,8 +174,7 @@ void ld_set_progress(gfloat progress)
 
 void ld_destroy()
 {
-       if (ld_loaddlg)
-       {
+       if (ld_loaddlg) {
                gtk_widget_hide(ld_loaddlg);
                gtk_widget_destroy(ld_loaddlg);
        }
index 94ba00401a66648bfce9898de349843049f37c34..a4c076413d5edd009a2c59024c3d5d74b2ed132a 100644 (file)
@@ -141,8 +141,7 @@ void gui_set_tooltip(GtkWidget *wid, char *tip)
 
 void turn_audio_off(void)
 {
-       if (audioon) 
-       {
+       if (audioon) {
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 0);
                while (gtk_events_pending()) gtk_main_iteration();              
        }
@@ -153,8 +152,7 @@ gint pos_update(gpointer data)
 {
        f_prec temp;
 
-       if (stop_update) 
-       {               
+       if (stop_update) {              
                cleanup_all_vtts();
                tX_seqpar :: update_all_graphics();
                if (old_focus) gui_show_frame(old_focus, 0);
@@ -164,9 +162,7 @@ gint pos_update(gpointer data)
                gdk_flush();    
                update_tag=0;
                return(FALSE);
-       }
-       else
-       {
+       } else {
                update_all_vtts();
                
                /*left vu meter */
@@ -179,25 +175,21 @@ gint pos_update(gpointer data)
                vtt_class::mix_max_r=0;
                gtk_tx_flash_set_level(main_flash_r, temp);
                
-               if (vtt_class::focused_vtt!=old_focus)
-               {
+               if (vtt_class::focused_vtt!=old_focus) {
                        if (old_focus) gui_show_frame(old_focus, 0);
                        old_focus=vtt_class::focused_vtt;
                        if (old_focus) gui_show_frame(old_focus, 1);                    
                }
-               if (grab_status!=last_grab_status)
-               {
+               if (grab_status!=last_grab_status) {
                        last_grab_status=grab_status;
-                       if (!grab_status) 
-                       {
+                       if (!grab_status) {
                                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(grab_button), 0);
                        }
                }
                gdk_flush();    
                update_delay--;
                
-               if (update_delay < 0)
-               {
+               if (update_delay < 0) {
                        seq_update();
                        tX_seqpar :: update_all_graphics();
                        update_delay=globals.update_delay;
@@ -218,13 +210,11 @@ void mg_update_status()
        mypid=getpid();
        sprintf(filename, "/proc/%i/status", mypid);
        procfs=fopen(filename, "r");
-       if (procfs)
-       {
-               while((!feof(procfs)) && !found)
-               {
+       if (procfs) {
+               while((!feof(procfs)) && !found) {
                        fgets(buffer, 256, procfs);
-                       if (strncmp("VmSize:", buffer, 7)==0)
-                       {
+                       
+                       if (strncmp("VmSize:", buffer, 7)==0) {
                                found=1;
                                sscanf(buffer, "VmSize: %i kB", &mem);
                                sprintf(buffer, "%i", mem);
@@ -242,15 +232,14 @@ GtkSignalFunc new_table(GtkWidget *, char *fn)
 {
        turn_audio_off();
                
-               if (fn) 
-               {
-                       ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
-                       ld_set_filename(fn);
-               }
-               
-               add_vtt(control_parent, audio_parent, fn);                              
-               
-               if (fn) ld_destroy();           
+       if (fn) {
+               ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
+               ld_set_filename(fn);
+       }
+       
+       add_vtt(control_parent, audio_parent, fn);                              
+       
+       if (fn) ld_destroy();           
        mg_update_status();
        return NULL;
 }
@@ -400,8 +389,7 @@ void do_load_tables(GtkWidget *wid)
 
 GtkSignalFunc load_tables()
 {
-       if (load_dialog_win) 
-       {
+       if (load_dialog_win) {
                gdk_window_raise(load_dialog_win);
                return 0;
        }
@@ -411,8 +399,7 @@ GtkSignalFunc load_tables()
        gtk_file_selection_show_fileop_buttons(GTK_FILE_SELECTION(load_dialog));
        gtk_file_selection_complete(GTK_FILE_SELECTION(load_dialog), "*.tX");
        
-       if (strlen(globals.tables_filename))
-       {
+       if (strlen(globals.tables_filename)) {
                gtk_file_selection_set_filename(GTK_FILE_SELECTION(load_dialog), globals.tables_filename);
        }
        
@@ -485,12 +472,9 @@ gboolean do_save_tables(GtkWidget *wid)
        
        ext=strrchr(buffer, '.');
        
-       if (ext)
-       {
+       if (ext) {
                if (strcmp(ext, ".tX")) strcat(buffer, ".tX");
-       }
-       else
-       {
+       } else {
                strcat(buffer, ".tX");
        }
 
@@ -507,16 +491,13 @@ gboolean do_save_tables(GtkWidget *wid)
                zout=NULL;
        }
        
-       if (out || zout)
-       {
+       if (out || zout) {
                if (vtt_class::save_all(out, zout)) tx_note("Error while saving set.", true);
                if (out) fclose(out); 
                else if (zout) gzclose(zout);
                sprintf(wbuf,"terminatorX - %s", strip_path(buffer));
                gtk_window_set_title(GTK_WINDOW(main_window), wbuf);                            
-       }
-       else
-       {
+       } else {
                tx_note("Failed to open file for write access.", true);
        }
        
@@ -593,21 +574,18 @@ GtkSignalFunc audio_on(GtkWidget *w, void *d)
 {
        tX_engine_error res;
        
-       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
-       {               
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {               
                sequencer_ready=0;
                mg_enable_critical_buttons(0);
                res=tX_engine::get_instance()->run();
 
-               if (res!=NO_ERROR)
-               {
+               if (res!=NO_ERROR) {
                        mg_enable_critical_buttons(1);
                        stop_override=true;
                        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), 0);
                        stop_override=false;                    
 
-                       switch(res)
-                       {
+                       switch(res) {
                                case ERROR_BUSY:
                                tx_note("Error starting engine: engine is already running.", true);
                                break;
@@ -629,9 +607,7 @@ GtkSignalFunc audio_on(GtkWidget *w, void *d)
                update_delay=globals.update_delay;
                update_tag=gtk_timeout_add(globals.update_idle, (GtkFunction) pos_update, NULL);
                gtk_widget_set_sensitive(grab_button, 1);
-       }
-       else
-       {       
+       } else {        
                if (stop_override) return NULL;
                if (!sequencer_ready) return NULL;
                gtk_widget_set_sensitive(grab_button, 0);
@@ -644,6 +620,7 @@ GtkSignalFunc audio_on(GtkWidget *w, void *d)
                        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(rec_menu_item), 0);
                        rec_dont_care=0;
                }
+               
                seq_stop(NULL, NULL);
                mg_enable_critical_buttons(1);
        }
@@ -666,8 +643,7 @@ void do_rec(GtkWidget *wid)
        
        strcpy(buffer, gtk_file_selection_get_filename(GTK_FILE_SELECTION(rec_dialog)));
 
-       if (strlen(buffer))
-       {
+       if (strlen(buffer)) {
                strcpy(globals.record_filename, buffer);                
                tX_engine::get_instance()->set_recording_request(true);
                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(rec_menu_item), 1);
@@ -683,16 +659,14 @@ void do_rec(GtkWidget *wid)
 
 GtkSignalFunc select_rec_file()
 {
-       if (rec_dialog_win) 
-       {
+       if (rec_dialog_win) {
                gdk_window_raise(rec_dialog_win);
                return 0;
        }
        
        rec_dialog=gtk_file_selection_new("Record To Disk");    
        
-       if (strlen(globals.record_filename))
-       {
+       if (strlen(globals.record_filename)) {
                gtk_file_selection_set_filename(GTK_FILE_SELECTION(rec_dialog), globals.record_filename);
        }
        
@@ -711,16 +685,11 @@ GtkSignalFunc tape_on(GtkWidget *w, void *d)
 {
        if (rec_dont_care) return 0;
 
-       if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
-       {       
-               {
-                       rec_dont_care=1;
-                       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), 0);
-                       select_rec_file();
-               }
-       }
-       else
-       {
+       if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {   
+               rec_dont_care=1;
+               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), 0);
+               select_rec_file();
+       } else {
                        tX_engine::get_instance()->set_recording_request(false);
        }
        
@@ -839,8 +808,7 @@ void seq_update_entry(const guint32 timestamp)
        samples=timestamp*vtt_class::get_mix_buffer_size();
        sr=vtt_class::get_last_sample_rate();
        
-       if (samples>0)
-       {
+       if (samples>0) {
                minu=samples/(sr*60);
                samples-=(sr*60)*minu;
        
@@ -848,9 +816,7 @@ void seq_update_entry(const guint32 timestamp)
                samples-=sr*sec;
        
                hun=samples/(sr/100);
-       }
-       else
-       {
+       } else {
                minu=sec=hun=0;
        }
        
@@ -878,8 +844,7 @@ void sequencer_move(GtkWidget *wid, void *d)
 {
        guint32 pos;
        
-       if (seq_adj_care)
-       {
+       if (seq_adj_care) {
                pos=sequencer.set_start_timestamp((float) GTK_ADJUSTMENT(wid)->value);
                seq_update_entry(pos);  
        }
@@ -1495,13 +1460,15 @@ void tx_l_note(const char *message)
 }
 
 
-void add_to_panel_bar(GtkWidget *button) {
+void add_to_panel_bar(GtkWidget *button) 
+{
        buttons_on_panel_bar++;
        gtk_box_pack_start(GTK_BOX(panel_bar), button, WID_DYN);
        gtk_widget_show(panel_bar);
 }
 
-void remove_from_panel_bar(GtkWidget *button) {
+void remove_from_panel_bar(GtkWidget *button) 
+{
        buttons_on_panel_bar--;
        gtk_container_remove(GTK_CONTAINER(panel_bar), button);
        if (buttons_on_panel_bar==0) gtk_widget_hide(panel_bar);
@@ -1572,7 +1539,8 @@ pid_t help_child=0;
 GTimer *help_timer=NULL;
 int help_tag=-1;
 
-int help_checker() {
+int help_checker()
+{
        gdouble time;
        gulong ms;
        int status;
@@ -1600,7 +1568,8 @@ int help_checker() {
 #define INSTALL_PREFIX "/usr/local/share"
 #endif
 
-void display_help() {  
+void display_help()
+{      
        help_child=fork();
 
        if (help_tag!=-1) {
@@ -1630,7 +1599,8 @@ pid_t browser_child=0;
 GTimer *browser_timer=NULL;
 int browser_tag=-1;
 
-int browser_checker() {
+int browser_checker()
+{
        gdouble time;
        gulong ms;
        int status;
@@ -1654,7 +1624,8 @@ int browser_checker() {
        return TRUE;    
 }
 
-void display_browser() {       
+void display_browser()
+{      
        browser_child=fork();
 
        if (browser_tag!=-1) {
index 7f980d028116415a0510559cf8d3d0fce03fd573..a98621b8ea1e3365bee8864a8eb397883f1c1ece 100644 (file)
@@ -36,7 +36,8 @@
 #define TX_MOUSE_SPEED_NORMAL 0.05
 #define TX_MOUSE_SPEED_WARP 250000
 
-tx_mouse :: tx_mouse() {
+tx_mouse :: tx_mouse()
+{
        mask=PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask;
        xmot=(XMotionEvent *) &xev;
        xkey=(XKeyEvent *) &xev;
@@ -53,7 +54,8 @@ tx_mouse :: tx_mouse() {
 }
 
 
-int tx_mouse :: grab() {       
+int tx_mouse :: grab()
+{      
 #ifdef USE_DGA2
        XDGAMode *mode;
 #endif 
@@ -63,20 +65,17 @@ int tx_mouse :: grab() {
        warp_override=false;
        
        dpy=XOpenDisplay(NULL);
-       if (!dpy)
-       {
+       if (!dpy) {
                fputs("GrabMode Error: couldn't connect to XDisplay.", stderr);
                return(ENG_ERR_XOPEN);
        }
 
-
 #ifdef USE_DGA2
        mode=XDGAQueryModes(dpy,DefaultScreen(dpy), &num);
        
        printf("Found %i DGA2-Modes:\n", num);
        
-       for(i=0; i<num; i++)
-       {
+       for(i=0; i<num; i++) {
                printf("%2i: %s\n", i, mode[i].name);
        }
        XFree(mode);
@@ -86,26 +85,22 @@ int tx_mouse :: grab() {
 
        XSetInputFocus(dpy, xwindow, None, CurrentTime);
 
-       if (globals.xinput_enable)
-       {
-               if (set_xinput())
-               {
+       if (globals.xinput_enable) {
+               if (set_xinput()) {
                        XCloseDisplay(dpy);
                        fputs("GrabMode Error: failed to setup XInput.", stderr);
                        return(ENG_ERR_XINPUT);
                }
        }
 
-        if (GrabSuccess != XGrabPointer(dpy, xwindow, False, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync,GrabModeAsync,None,None,CurrentTime))
-       {
+       if (GrabSuccess != XGrabPointer(dpy, xwindow, False, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync,GrabModeAsync,None,None,CurrentTime)) {
                reset_xinput();
                XCloseDisplay(dpy);
                fputs("GrabMode Error: XGrabPointer failed.", stderr);
                return(ENG_ERR_GRABMOUSE);
        }       
        
-        if (GrabSuccess != XGrabKeyboard(dpy, xwindow, False, GrabModeAsync,GrabModeAsync,CurrentTime))
-       {
+       if (GrabSuccess != XGrabKeyboard(dpy, xwindow, False, GrabModeAsync,GrabModeAsync,CurrentTime)) {
                XUngrabPointer (dpy, CurrentTime);
                reset_xinput();         
                XCloseDisplay(dpy);
@@ -115,11 +110,10 @@ int tx_mouse :: grab() {
        
 
 #ifdef USE_DGA2
-       if (!XDGASetMode(dpy, DefaultScreen(dpy), 1))
+       if (!XDGASetMode(dpy, DefaultScreen(dpy), 1)) {
 #else  
-       if (!XF86DGADirectVideo(dpy,DefaultScreen(dpy),XF86DGADirectMouse))
+       if (!XF86DGADirectVideo(dpy,DefaultScreen(dpy),XF86DGADirectMouse)) {
 #endif
-       {
                XUngrabKeyboard(dpy, CurrentTime);                              
                XUngrabPointer (dpy, CurrentTime);
                reset_xinput();         
@@ -148,12 +142,9 @@ int tx_mouse :: grab() {
                c++;
                //vtt_class::focus_no(0);
        }
-       
-       
+
        warp=TX_MOUSE_SPEED_NORMAL;
        
-       tX_debug("tX_mouse::grab(): this: %08x, dpy: %08x", (int) this, (int) dpy);
-       
        return(0);
 }
 
@@ -175,8 +166,7 @@ void tx_mouse :: ungrab()
        
        XCloseDisplay(dpy);
 
-       if (globals.xinput_enable)
-       {
+       if (globals.xinput_enable) {
                reset_xinput(); 
        }
 
@@ -196,15 +186,13 @@ void tx_mouse :: set_x_pointer(char *devname)
                
        pid = fork();
        
-       if (pid==-1) 
-       { 
+       if (pid==-1) { 
                /* OOPS. fork failed */
-               perror("tX: Error: Couldn't fork process!");
+               perror("tX: Error: Failed to fork a new process!");
                return; 
        }
        
-       if (pid==0) 
-       {
+       if (pid==0) {
                /* The child execlps xsetpointer */
                execlp("xsetpointer", "xsetpointer", devname, NULL);
                perror("tX: Error: Failed to execute xpointer!");
@@ -225,21 +213,16 @@ void tx_mouse :: set_x_pointer(char *devname)
        
        devlist=XListInputDevices(dpy, &listmax);
        
-       for (i=0; i<listmax; i++)
-       {
-               if(strcmp(devlist[i].name, devname)==0)
-               {
+       for (i=0; i<listmax; i++) {
+               if(strcmp(devlist[i].name, devname)==0) {
                        device=XOpenDevice(dpy, devlist[i].id);
-                       if (device)
-                       {
-                               if (XChangePointerDevice(dpy, device, 0, 1))
-                               {
+                       if (device) {
+                               if (XChangePointerDevice(dpy, device, 0, 1)) {
                                        printf("tX: Error: failed to set pointer device.");                     
                                }
+                               
                                XCloseDevice(dpy, device);
-                       }
-                       else
-                       {
+                       } else {
                                printf("tX: Error: failed to open XInput device.");
                        }               
                }
@@ -257,21 +240,17 @@ int tx_mouse :: set_xinput()
        
        OrgXPointer=0;
        
-       if (globals.xinput_enable)
-       {       
+       if (globals.xinput_enable) {    
                devlist=XListInputDevices(dpy, &listmax);
        
-               for (i=0; i<listmax; i++)
-               {
-                       if(devlist[i].use == IsXPointer)
-                       {
+               for (i=0; i<listmax; i++) {
+                       if(devlist[i].use == IsXPointer) {
                                OrgXPointer=devlist[i].id;
                                strcpy(OrgXPointerName, devlist[i].name);
                        }
                }
                
-               XFreeDeviceList(devlist);               
-               
+               XFreeDeviceList(devlist);                               
                set_x_pointer(globals.xinput_device);
        }
        
@@ -282,8 +261,7 @@ int tx_mouse :: set_xinput()
 
 void tx_mouse :: reset_xinput()
 {
-       if (globals.xinput_enable)
-       {
+       if (globals.xinput_enable) {
                if (OrgXPointer) set_x_pointer(OrgXPointerName);
        }
 }
@@ -293,14 +271,11 @@ void tx_mouse :: reset_xinput()
 
 int tx_mouse :: check_event()
 {
-       if (XCheckWindowEvent(dpy, xwindow, mask, &xev))
-       {
+       if (XCheckWindowEvent(dpy, xwindow, mask, &xev) && vtt) {
 #ifdef USE_DGA2
                puts("Got an event");
 #endif         
-               if (vtt)
-               switch(xev.type)
-               {
+               switch(xev.type) {
                        case MotionNotify:
                                
                                if (warp_override) {
@@ -312,8 +287,7 @@ int tx_mouse :: check_event()
                                break;
                        
                        case ButtonPress:
-                               switch(xbut->button)
-                               {
+                               switch(xbut->button) {
                                        case 1: if (vtt->is_playing)
                                                        vtt->set_scratch(1); 
                                                else
@@ -325,23 +299,21 @@ int tx_mouse :: check_event()
                                break;
                        
                        case ButtonRelease:
-                               switch (xbut->button)
-                               {       
+                               switch (xbut->button) { 
                                        case 1: vtt->set_scratch(0); break;
                                        case 2: vtt->sp_mute.receive_input_value(0); break;
                                }
                                break;
+
                        case KeyPress:
 #ifdef USE_DGA2
                                puts("Yeah its a key");
                                XDGAKeyEventToXKeyEvent(xdgakey, (XKeyEvent *) &xev_copy);
                                memcpy(&xev, &xev_copy, sizeof(XEvent));
 #endif                 
-                       {
                                key=XKeycodeToKeysym(dpy, xkey->keycode, 0);
                                
-                               switch(key)
-                               {
+                               switch(key) {
                                        case XK_space: vtt->set_scratch(1); break;
                                        case XK_Escape: return(1);
                                        
@@ -384,14 +356,12 @@ int tx_mouse :: check_event()
                                        case XK_F11: vtt_class::focus_no(10); break;
                                        case XK_F12: vtt_class::focus_no(11); break;
                                }
-                       } break;
+                               break;
                        
                        case KeyRelease:
-                       {
                                key=XKeycodeToKeysym (dpy, xkey->keycode, 0);
                                
-                               switch(key)
-                               {
+                               switch(key) {
                                        case XK_space: vtt->set_scratch(0); break;
                                        
                                        case XK_m:
@@ -412,9 +382,7 @@ int tx_mouse :: check_event()
                                        vtt->set_scratch(0);
                                        break;                                  
                                }
-                       }
                }
-               else {  puts("no vtt"); return(1); }
        }
-       return(0);
+       return 0;
 }
index f3d81e57d7a604aa90efb3839c95beeca9de7b6b..e30b8a3ee14ece9aa2651b41515cefe5403b97ac 100644 (file)
@@ -20,30 +20,18 @@ void tX_panel :: minimize(GtkWidget *w, tX_panel *p)
        guint padding;
        GtkPackType pack_type;
                
-       if (p->container)
-       {
-               gtk_box_query_child_packing(GTK_BOX(p->container),
-                                           p->mainbox,
-                                           &expand,
-                                           &fill,
-                                           &padding,
-                                           &pack_type);
-               gtk_box_set_child_packing(GTK_BOX(p->container),
-                                           p->mainbox,
-                                           expand,
-                                           fill,
-                                           padding,
-                                           pack_type);
+       if (p->container) {
+               gtk_box_query_child_packing(GTK_BOX(p->container), p->mainbox,
+                                                                       &expand, &fill, &padding, &pack_type);
+               gtk_box_set_child_packing(GTK_BOX(p->container), p->mainbox,
+                                                                       expand, fill, padding, pack_type);
                gtk_container_check_resize(GTK_CONTAINER(p->container));                            
-               //gtk_widget_set_usize(p->container, p->container->allocation.width, p->container->allocation.height);
        }
 }
 
 void tX_panel_make_label_bold(GtkWidget *widget) {
-       char label[128];
-       strcpy(label, "<b>");
-       strcat(label, gtk_label_get_text(GTK_LABEL(widget)));
-       strcat(label, "</b>");
+       char label[128];        
+       sprintf(label, "<b>%s</b>", gtk_label_get_text(GTK_LABEL(widget)));
        gtk_label_set_markup(GTK_LABEL (widget), label);
 }
 
@@ -92,7 +80,6 @@ void tX_panel :: add_client_widget(GtkWidget *w)
 
 tX_panel :: ~tX_panel()
 {
-       //gtk_widget_destroy(pixmap);
        gtk_widget_destroy(minbutton);
        gtk_widget_destroy(labelbutton);
        gtk_widget_destroy(clientbox);
index 8d7e4e4c304242e466d54abad31688b7099a1165..8590b0ffba23613c66865b28287d4b11d769b9b4 100644 (file)
@@ -108,8 +108,7 @@ void tX_sequencer :: trig_stop()
        
        record_stop_timestamp=current_timestamp;
        
-       if (oldmode==TX_SEQMODE_PLAYREC)
-       {
+       if (oldmode==TX_SEQMODE_PLAYREC) {
                pthread_mutex_lock(&record_lock);
 #ifdef SEQ_DEBUG               
                printf ("Recorded from %i to %i.\n", record_start_timestamp, record_stop_timestamp);
@@ -135,8 +134,7 @@ void tX_sequencer :: trig_stop()
                        while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() < record_start_timestamp))
                                song_event++;
        
-                       while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() <= record_stop_timestamp))
-                       {
+                       while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() <= record_stop_timestamp)) {
                                sp = (*song_event)->get_sp();
 #ifdef SEQ_DEBUG_MAX                   
                                printf("sp %08x (%i) touched at: %i - timestamp %i.\n", sp, sp->is_touched(), sp->get_touch_timestamp(), (*song_event)->get_timestamp());
@@ -187,8 +185,7 @@ void tX_sequencer :: trig_stop()
        
        song_event=song_list.end();
        
-       if (song_event!=song_list.begin()) 
-       {
+       if (song_event!=song_list.begin()) {
                song_event--;
                max_timestamp=(*song_event)->get_timestamp();
        }
@@ -196,8 +193,7 @@ void tX_sequencer :: trig_stop()
 #ifdef SEQ_DEBUG_MAX
        /*dump song_list */
        
-       for (song_event=song_list.begin(); song_event!=song_list.end(); song_event++)
-       {
+       for (song_event=song_list.begin(); song_event!=song_list.end(); song_event++) {
                printf ("%-15s| %-27s| %8i | %10f\n", (*song_event)->get_vtt_name(), (*song_event)->get_seqpar_name(), (*song_event)->get_timestamp(), (*song_event)->get_value());
        }
 #endif 
@@ -284,11 +280,9 @@ guint32 tX_sequencer :: set_start_timestamp(float pos)
        guint32 timestamp;
        
        if (pos>99.999) pos=99.999;
-       
        pos/=100;
        
        timestamp = (guint32) (((float) max_timestamp) * pos);
-       
        start_timestamp=timestamp;
        
        return start_timestamp;
@@ -308,16 +302,13 @@ void tX_sequencer :: forward_to_start_timestamp(int dont_fake)
        
        next_event=song_list.begin();
        
-       while (current_timestamp<start_timestamp)
-       {
+       while (current_timestamp<start_timestamp) {
                step();
-               if (dont_fake)
-               {
+               if (dont_fake) {
                        vtt_class :: forward_all_turntables();
                        
                        gui_update--;           
-                       if (gui_update < 0)
-                       {
+                       if (gui_update < 0) {
                                gui_update=gui_update_max;
                                seq_update();
                                while (gtk_events_pending()) gtk_main_iteration();
@@ -331,7 +322,8 @@ void tX_sequencer :: forward_to_start_timestamp(int dont_fake)
        while (gtk_events_pending()) gtk_main_iteration();
 }
 
-void tX_sequencer :: load(xmlDocPtr doc, xmlNodePtr node) {
+void tX_sequencer :: load(xmlDocPtr doc, xmlNodePtr node)
+{
        tX_event *ev=NULL;
        
        max_timestamp=0;
index 5dd3adba4a91b0216d1b8e376f32edb764693fdf..2188bccbda94a9f4ba4d4652cec2afa3ee6f3242 100644 (file)
@@ -48,8 +48,7 @@ int tx_tapedeck :: start_record (char *name, int bs, int samplerate)
 
        written_bytes=0;        
 
-       if (!open_wav_rec(&file)) 
-       {
+       if (!open_wav_rec(&file)) {
                return 1;
        }
        
index 70f948114755c08260186c419e741ff4df6a287f..a34f3e5c43f1dc4990d4e4f62d5619d8ed881f49 100644 (file)
@@ -168,55 +168,41 @@ vtt_fx_ladspa :: vtt_fx_ladspa(LADSPA_Plugin *p, void *v)
        sp_outgain=NULL;
        
        /* connecting ports */
-       for (port=0; port < plugin->getPortCount(); port++)
-       {
-               if (LADSPA_IS_PORT_AUDIO(cpd))
-               {
+       for (port=0; port < plugin->getPortCount(); port++) {
+               if (LADSPA_IS_PORT_AUDIO(cpd)) {
                        if (LADSPA_IS_PORT_INPUT(cpd)) input_port=port;
                        else if (LADSPA_IS_PORT_OUTPUT(cpd)) output_port=port;
-               }
-               else if ((LADSPA_IS_PORT_CONTROL(cpd)) && (LADSPA_IS_PORT_INPUT(cpd)))
-               {
+               } else if ((LADSPA_IS_PORT_CONTROL(cpd)) && (LADSPA_IS_PORT_INPUT(cpd))) {
                        min=-22100;
                        max=+22100;
                        
                        if (LADSPA_IS_HINT_BOUNDED_BELOW(cph.HintDescriptor)) min=cph.LowerBound;
                        if (LADSPA_IS_HINT_BOUNDED_ABOVE(cph.HintDescriptor)) max=cph.UpperBound;
                        
-                       if (LADSPA_IS_HINT_SAMPLE_RATE(cph.HintDescriptor)) 
-                       {
+                       if (LADSPA_IS_HINT_SAMPLE_RATE(cph.HintDescriptor)) {
                                min*=44100; max*=44100;
                        }
                        
-                       if (LADSPA_IS_HINT_TOGGLED(cph.HintDescriptor))
-                       {
+                       if (LADSPA_IS_HINT_TOGGLED(cph.HintDescriptor)) {
                                sp=new tX_seqpar_vttfx_bool();
                                sp->set_mapping_parameters(max, min, 0, 0);
-                       }
-                       else
-                       if (LADSPA_IS_HINT_INTEGER(cph.HintDescriptor))
-                       {
+                       } else if (LADSPA_IS_HINT_INTEGER(cph.HintDescriptor)) {
                                sp=new tX_seqpar_vttfx_int();
                                sp->set_mapping_parameters(max, min, 0, 0);
-                       }
-                       else
-                       {
+                       } else {
                                sp=new tX_seqpar_vttfx_float();
                                sp->set_mapping_parameters(max, min, (max-min)/100.0, 1);
                        }
                        
                        sprintf(buffer, "%s: %s", plugin->getLabel(), cpn);
                        strcpy(buffer2, cpn);
-                       
                        wrapstr(buffer2);
                        
                        sp->set_name(buffer, buffer2);
                        sp->set_vtt(vtt);
                        plugin->getDescriptor()->connect_port(instance, port, sp->get_value_ptr());
                        controls.push_back(sp);
-               }
-               else if ((LADSPA_IS_PORT_CONTROL(cpd)) && (LADSPA_IS_PORT_OUTPUT(cpd)))
-               {
+               } else if ((LADSPA_IS_PORT_CONTROL(cpd)) && (LADSPA_IS_PORT_OUTPUT(cpd))) {
                        plugin->getDescriptor()->connect_port(instance, port, &ladspa_dummy_output_port);
                }
        }
@@ -257,8 +243,7 @@ vtt_fx_ladspa :: ~vtt_fx_ladspa()
 {
        list <tX_seqpar_vttfx *> :: iterator sp;
        
-       while (controls.size())
-       {
+       while (controls.size()) {
                sp=controls.begin();
                controls.remove((*sp));
                
index d6c916f6ad57fcd54e237d81a700224f02e51a2d..8b4d1390c4b2c0d67f5840181f449f41f03691ac 100644 (file)
@@ -141,10 +141,8 @@ void load_part(char *newfile, vtt_class *vtt)
        ret = vtt->load_file(newfile);
        
        ld_destroy();
-       if (ret)
-       {
-               switch(ret)
-               {
+       if (ret) {
+               switch(ret) {
                        case TX_AUDIO_ERR_ALLOC:
                        tx_note("Failed to load audiofile - there's not enough memory available.", true);
                        break;
@@ -202,9 +200,7 @@ void load_part(char *newfile, vtt_class *vtt)
                        default:                                        
                        tx_note("An unknown error occured - if this bug is reproducible please report it, thanks.", true);      
                }
-       }
-       else
-       {
+       } else {
                nicer_filename(global_filename_buffer, newfile);
         gtk_button_set_label(GTK_BUTTON(vtt->gui.file), global_filename_buffer);
        }       
@@ -250,7 +246,7 @@ void drop_file(GtkWidget *widget, GdkDragContext *context,
        realfn=g_filename_from_uri(filename, &host, NULL);
        if (realfn) {
                fn=realfn;
-       } else  {
+       } else {
                fn = strchr (filename, ':');
                if (fn) fn++; else fn=(char *) selection_data->data;
        }
@@ -266,8 +262,7 @@ GtkSignalFunc load_file(GtkWidget *wid, vtt_class *vtt)
 {      
        char buffer[512];
        
-       if (vtt->gui.file_dialog)
-       {
+       if (vtt->gui.file_dialog) {
                gdk_window_raise(vtt->gui.file_dialog);
                return(0);
        }
@@ -281,8 +276,7 @@ GtkSignalFunc load_file(GtkWidget *wid, vtt_class *vtt)
                gtk_file_selection_set_filename(GTK_FILE_SELECTION(vtt->gui.fs),globals.current_path);
        }
        
-       gtk_widget_show(GTK_WIDGET(vtt->gui.fs));
-       
+       gtk_widget_show(GTK_WIDGET(vtt->gui.fs));       
        vtt->gui.file_dialog=vtt->gui.fs->window;
        
        g_signal_connect (G_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->ok_button), "clicked", G_CALLBACK(do_load_file), vtt);
@@ -304,18 +298,12 @@ void edit_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
 {
        char command[2*PATH_MAX];
 
-       if (vtt->samples_in_buffer == 0)
-       {
+       if (vtt->samples_in_buffer == 0) {
                tx_note("No audiofile loaded - so there's nothing to edit.", true);
-       }
-       else
-       if (strlen(globals.file_editor)>0)
-       {
+       } else if (strlen(globals.file_editor)>0) {
                sprintf(command, "%s \"%s\" &", globals.file_editor, vtt->filename);
                system(command); /*) tx_note("Failed to run the soundfile editor."); */
-       }
-       else
-       {
+       } else {
                tx_note("No soundfile editor has been configured - to do so enter the soundfile editor of your choice in the options dialog.", true);
        }
 }
@@ -326,8 +314,7 @@ void reload_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
        
        while (gtk_events_pending()) gtk_main_iteration();
        
-       if (vtt->samples_in_buffer > 0)
-       {
+       if (vtt->samples_in_buffer > 0) {
                strcpy(reload_buffer, vtt->filename);
                load_part(reload_buffer, vtt);
        }
@@ -435,24 +422,18 @@ void client_setup_number(GtkWidget *wid, vtt_class *vtt)
 
 void mute_volume(GtkWidget *widget, vtt_class *vtt)
 {
-       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-       {
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
                vtt->set_mix_mute(1);
-       }
-       else
-       {
+       } else {
                vtt->set_mix_mute(0);
        }
 }
 
 void solo_vtt(GtkWidget *widget, vtt_class *vtt)
 {
-       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) 
-       {
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
                vtt->set_mix_solo(1);
-       }
-       else
-       {
+       } else {
                vtt->set_mix_solo(0);
        }
 }      
index 309fa32f03fa55db0e2cd296d090063793139626..1e6d3eeec4469df78c70e991c7460710e43a34d7 100644 (file)
              </child>
 
              <child>
-               <widget class="GtkLabel" id="label58">
+               <widget class="GtkLabel" id="use_realtime_label">
                  <property name="visible">True</property>
                  <property name="label" translatable="yes">Use realtime scheduling
 where available:</property>
index 4babaafdaa47f4d94f75926aaf18bd7f44887c0b..0283d2354d86cc791fa4152152d9291d4065509b 100644 (file)
@@ -2,7 +2,6 @@
 %define version @VERSION@
 %define release 1
 
-
 Summary: Realtime Audio Synthesizer
 Name: %{name}
 Version: %{version}
@@ -12,8 +11,8 @@ Copyright: GPL2
 URL: http://www.terminatorX.cx
 Source: %{name}-%{version}.tar.gz
 Buildroot: %{_tmppath}/%{name}-%{version}-root
-Requires: gtk2, libvorbis, audiofile, libxml2, zlib, scrollkeeper, yelp, sox, vorbis-tools
-BuildPrereq: gtk2-devel, libvorbis-devel, audiofile-devel, libxml2-devel, scrollkeeper
+Requires: gtk2, libvorbis, audiofile, libxml2, zlib, scrollkeeper, yelp, sox, vorbis-tools, libcap
+BuildPrereq: gtk2-devel, libvorbis-devel, audiofile-devel, libxml2-devel, scrollkeeper, libcap-devel
 
 %description
 terminatorX is a realtime audio synthesizer that allows you to "scratch" on 
@@ -23,6 +22,8 @@ effects (buit-in as well as LADSPA plugin effects), a sequencer and MIDI
 interface - all accessible through an easy-to-use gtk+ GUI.
 
 %changelog
+* Mon Aug 18 2003 Alexander König <alex@lisas.de>
+ - added libcap dependency
 * Fri Apr 11 2003 Alexander König <alex@lisas.de>
  - disabled the suid root stuff
 * Fri Apr 11 2003 Alexander König <alex@lisas.de>
@@ -106,11 +107,12 @@ rm -rf $RPM_BUILD_ROOT/var
 %post
 if which scrollkeeper-update>/dev/null 2>&1; then scrollkeeper-update -q -o %{_datadir}/omf/terminatorX; fi
 
-#echo Note: Installing terminatorX \"suid root\" improves terminatorX\' performance 
-#echo for non-root users, but poses a potential security threat. See \'INSTALL\' for
-#echo details. To install terminatorX \"suid root\" run the following command:
-#echo
-#echo chmod u+s /usr/bin/terminatorX
+echo Note: Installing terminatorX \"suid root\" improves terminatorX\' performance 
+echo for non-root users, but poses a potential security threat. See \'INSTALL\' for
+echo and \"README.PERFORMANCE\" details. To install terminatorX \"suid root\" run 
+echo the following command:
+echo
+echo chmod u+s /usr/bin/terminatorX
 
 %postun
 if which scrollkeeper-update>/dev/null 2>&1; then scrollkeeper-update -q; fi