Things for Sonar - Alex
authorterminatorX <>
Wed, 11 Jun 2003 12:12:57 +0000 (12:12 +0000)
committerterminatorX <>
Wed, 11 Jun 2003 12:12:57 +0000 (12:12 +0000)
src/tX_audiodevice.cc
src/tX_dialog.cc
src/tX_glade_interface.cc
src/tX_global.c
src/tX_global.h
src/tX_vttgui.cc
terminatorX.glade

index c29871e9373d23e15b0c04b1755eed3252fe0531..45807fcf2cf611228bf4cc6f15344342f84c7f60 100644 (file)
@@ -303,7 +303,10 @@ int tX_audiodevice_alsa :: open()
                return -1;
        }
        
-       //snd_pcm_hw_params_free (hw_params);
+       if (globals.alsa_free_hwstats) {
+               snd_pcm_hw_params_free (hw_params);
+       }
+       
        return 0; //snd_pcm_prepare(pcm_handle);
 }
 
index 1dc4b1748472ff0cce882dd92fc938df9c0d4007..261c6e85e4b0ded89b18de20407b06ce027cb370 100644 (file)
@@ -75,6 +75,7 @@ void apply_options(GtkWidget *dialog) {
        globals.alsa_period_time=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "alsa_period_time")));
        globals.alsa_period_time*=1000;
        globals.alsa_samplerate=atoi(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_samplerate"))->entry)));        
+       globals.alsa_free_hwstats=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_free_hwstats")));
        
        /* TODO: JACK
        */
@@ -89,6 +90,7 @@ void apply_options(GtkWidget *dialog) {
        /* User Interface */ 
        globals.show_nag=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")))==TRUE);
        globals.tooltips=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")))==TRUE);
+       globals.filename_length=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(dialog, "filename_length")));
        if (globals.tooltips) gtk_tooltips_enable(gui_tooltips);
        else gtk_tooltips_disable(gui_tooltips);
 
@@ -152,7 +154,7 @@ void apply_options(GtkWidget *dialog) {
        add_widget_dyn(label);
 
 #ifdef USE_ALSA
-static GList *alsa_devices;
+static GList *alsa_devices=NULL;
 
 GList *get_alsa_device_list() {
        if (alsa_devices) {
@@ -161,6 +163,7 @@ GList *get_alsa_device_list() {
        
        FILE *file;
        char buffer[PATH_MAX+1];
+       alsa_devices=NULL;
        
        if ((file = fopen("/proc/asound/pcm", "r"))) {
                while(fgets(buffer, PATH_MAX, file)) {
@@ -198,6 +201,8 @@ GList *get_oss_device_list() {
     int n,i;
     n = scandir("/dev", &namelist, oss_select_dsp_only, alphasort);
     
+       oss_devices=NULL;
+       
     if (n>0) {
        for (i=0; i<n; i++) {
                        char buffer[256];
@@ -312,6 +317,7 @@ void init_tx_options(GtkWidget *dialog) {
        sprintf(tmp, "%i", globals.alsa_samplerate);
        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_samplerate"))->entry), tmp);
        
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_free_hwstats")), globals.alsa_free_hwstats);
        
        /* TODO: Samplerate!
                ALSA
@@ -333,6 +339,7 @@ void init_tx_options(GtkWidget *dialog) {
        gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vtt_inertia")), globals.vtt_inertia);
        gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "vtt_inertia"),"This value defines how fast the turntables will adapt to the speed input - the higher this value, the longer it will take the turntable to actually reach the target speed.", NULL);       
 
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "filename_length")), globals.filename_length);
        /* User Interface */ 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")), globals.show_nag);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")), globals.tooltips);
index a4953ce1a12bbf46d69c48023c7ed9335015eb55..cf4d6dca21a7e518f1a27ec05c6548ff7b12043a 100644 (file)
@@ -176,6 +176,8 @@ create_tx_options (void)
   GtkWidget *alsa_period_time;
   GtkWidget *label32;
   GtkWidget *alsa_buffer_time;
+  GtkWidget *label39;
+  GtkWidget *alsa_free_hwstats;
   GtkWidget *label16;
   GtkWidget *table1;
   GtkWidget *label5;
@@ -207,6 +209,9 @@ create_tx_options (void)
   GSList *buttons_text_and_icon_group = NULL;
   GtkWidget *buttons_icon_only;
   GtkWidget *buttons_text_only;
+  GtkWidget *label38;
+  GtkObject *filename_length_adj;
+  GtkWidget *filename_length;
   GtkWidget *label2;
   GtkWidget *table3;
   GtkWidget *label13;
@@ -367,7 +372,7 @@ create_tx_options (void)
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label15);
   gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_LEFT);
 
-  table6 = gtk_table_new (4, 2, FALSE);
+  table6 = gtk_table_new (5, 2, FALSE);
   gtk_widget_show (table6);
   gtk_container_add (GTK_CONTAINER (notebook1), table6);
   gtk_container_set_border_width (GTK_CONTAINER (table6), 4);
@@ -442,6 +447,21 @@ create_tx_options (void)
                     (GtkAttachOptions) (GTK_FILL), 0, 0);
   gtk_scale_set_digits (GTK_SCALE (alsa_buffer_time), 0);
 
+  label39 = gtk_label_new ("Free HWstats:");
+  gtk_widget_show (label39);
+  gtk_table_attach (GTK_TABLE (table6), label39, 0, 1, 4, 5,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_label_set_justify (GTK_LABEL (label39), GTK_JUSTIFY_LEFT);
+  gtk_misc_set_alignment (GTK_MISC (label39), 0, 0.5);
+
+  alsa_free_hwstats = gtk_check_button_new_with_mnemonic ("Enabled");
+  gtk_widget_show (alsa_free_hwstats);
+  gtk_table_attach (GTK_TABLE (table6), alsa_free_hwstats, 1, 2, 4, 5,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alsa_free_hwstats), TRUE);
+
   label16 = gtk_label_new ("Audio: ALSA");
   gtk_widget_show (label16);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label16);
@@ -537,7 +557,7 @@ create_tx_options (void)
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label4);
   gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
 
-  table2 = gtk_table_new (6, 2, FALSE);
+  table2 = gtk_table_new (7, 2, FALSE);
   gtk_widget_show (table2);
   gtk_container_add (GTK_CONTAINER (notebook1), table2);
   gtk_container_set_border_width (GTK_CONTAINER (table2), 4);
@@ -650,6 +670,21 @@ create_tx_options (void)
   gtk_radio_button_set_group (GTK_RADIO_BUTTON (buttons_text_only), buttons_text_and_icon_group);
   buttons_text_and_icon_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (buttons_text_only));
 
+  label38 = gtk_label_new ("Filename Length:");
+  gtk_widget_show (label38);
+  gtk_table_attach (GTK_TABLE (table2), label38, 0, 1, 6, 7,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_label_set_justify (GTK_LABEL (label38), GTK_JUSTIFY_LEFT);
+  gtk_misc_set_alignment (GTK_MISC (label38), 0, 0.5);
+
+  filename_length_adj = gtk_adjustment_new (8, 3, 255, 1, 10, 10);
+  filename_length = gtk_spin_button_new (GTK_ADJUSTMENT (filename_length_adj), 1, 0);
+  gtk_widget_show (filename_length);
+  gtk_table_attach (GTK_TABLE (table2), filename_length, 1, 2, 6, 7,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
   label2 = gtk_label_new ("User Interface");
   gtk_widget_show (label2);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 4), label2);
@@ -802,6 +837,8 @@ create_tx_options (void)
   GLADE_HOOKUP_OBJECT (tx_options, alsa_period_time, "alsa_period_time");
   GLADE_HOOKUP_OBJECT (tx_options, label32, "label32");
   GLADE_HOOKUP_OBJECT (tx_options, alsa_buffer_time, "alsa_buffer_time");
+  GLADE_HOOKUP_OBJECT (tx_options, label39, "label39");
+  GLADE_HOOKUP_OBJECT (tx_options, alsa_free_hwstats, "alsa_free_hwstats");
   GLADE_HOOKUP_OBJECT (tx_options, label16, "label16");
   GLADE_HOOKUP_OBJECT (tx_options, table1, "table1");
   GLADE_HOOKUP_OBJECT (tx_options, label5, "label5");
@@ -832,6 +869,8 @@ create_tx_options (void)
   GLADE_HOOKUP_OBJECT (tx_options, buttons_text_and_icon, "buttons_text_and_icon");
   GLADE_HOOKUP_OBJECT (tx_options, buttons_icon_only, "buttons_icon_only");
   GLADE_HOOKUP_OBJECT (tx_options, buttons_text_only, "buttons_text_only");
+  GLADE_HOOKUP_OBJECT (tx_options, label38, "label38");
+  GLADE_HOOKUP_OBJECT (tx_options, filename_length, "filename_length");
   GLADE_HOOKUP_OBJECT (tx_options, label2, "label2");
   GLADE_HOOKUP_OBJECT (tx_options, table3, "table3");
   GLADE_HOOKUP_OBJECT (tx_options, label13, "label13");
index 23b96c2ecf74c4022936cc363334e279276ced5f..9f0c71cc3e4e3b9bad7f1ec8bff6872d33f0b3e3 100644 (file)
@@ -135,6 +135,9 @@ void set_global_defaults() {
        globals.compress_set_files=0;
        
        globals.vtt_inertia=10.0;
+       
+       globals.alsa_free_hwstats=1;
+       globals.filename_length=20;
 }
 
 int load_globals_xml() {
@@ -186,7 +189,8 @@ int load_globals_xml() {
                        restore_int("alsa_buffer_time", globals.alsa_buffer_time);
                        restore_int("alsa_period_time", globals.alsa_period_time);
                        restore_int("alsa_samplerate", globals.alsa_samplerate);
-
+                       restore_int("alsa_free_hwstats", globals.alsa_free_hwstats);
+                       
                        restore_string("xinput_device", globals.xinput_device);
                        restore_int("xinput_enable", globals.xinput_enable);
                        restore_int("update_idle", globals.update_idle);
@@ -195,6 +199,7 @@ int load_globals_xml() {
                        restore_float("mouse_speed", globals.mouse_speed);
                        restore_int("width", globals.width);
                        restore_int("height", globals.height);
+                       restore_int("filename_length", globals.filename_length);
                        restore_int("tooltips", globals.tooltips);
                        restore_int("use_stdout", globals.use_stdout);
                        restore_int("show_nag", globals.show_nag);
@@ -273,6 +278,7 @@ void store_globals() {
                store_int("alsa_buffer_time", globals.alsa_buffer_time);
                store_int("alsa_period_time", globals.alsa_period_time);
                store_int("alsa_samplerate", globals.alsa_samplerate);          
+               store_int("alsa_free_hwstats", globals.alsa_free_hwstats);
                
                store_string("xinput_device", globals.xinput_device);
                store_int("xinput_enable", globals.xinput_enable);
@@ -282,6 +288,7 @@ void store_globals() {
                store_float("mouse_speed", globals.mouse_speed);
                store_int("width", globals.width);
                store_int("height", globals.height);
+               store_int("filename_length", globals.filename_length);
                store_int("tooltips", globals.tooltips);
                store_int("use_stdout", globals.use_stdout);
                // globals.use_stdout_from_conf_file=0; What the heck is this?
index 4d61fbcefe545d96bb61e557ef10d7d437c78aee..788d261ade7cac45b81bace41891dbf3caaa3f7f 100644 (file)
@@ -142,6 +142,9 @@ typedef struct {
        
        double vtt_inertia;
        
+       int alsa_free_hwstats;
+       int filename_length;
+       
 } tx_global;
 
 extern tx_global globals;
index 8102e13beee5ae76fe79a9c5468b6e2d9425e7de..2318006d96428cff76839889799525cdaec6ae5f 100644 (file)
@@ -62,8 +62,6 @@
 #define WID_DYN TRUE, TRUE, 0
 #define WID_FIX FALSE, FALSE, 0
 
-#define FILENAME_BUTTON_MAX 20
-
 void nicer_filename(char *dest, char *source)
 {
                char *fn;
@@ -78,12 +76,12 @@ void nicer_filename(char *dest, char *source)
                fn=strrchr(temp, '.');
                if (fn) *fn=0;
                
-               if (strlen(temp) > FILENAME_BUTTON_MAX)
+               if (strlen(temp) > globals.filename_length)
                {
-                       temp[FILENAME_BUTTON_MAX-3]='.';
-                       temp[FILENAME_BUTTON_MAX-2]='.';
-                       temp[FILENAME_BUTTON_MAX-1]='.';
-                       temp[FILENAME_BUTTON_MAX]=0;
+                       temp[globals.filename_length-3]='.';
+                       temp[globals.filename_length-2]='.';
+                       temp[globals.filename_length-1]='.';
+                       temp[globals.filename_length]=0;
                } 
                strcpy (dest, temp);
 }
@@ -779,7 +777,7 @@ void build_vtt_gui(vtt_class *vtt)
        GtkWidget *tempbox2;
        GtkWidget *tempbox3;
        GtkWidget *dummy;
-       char nice_name[FILENAME_BUTTON_MAX];
+       char nice_name[256];
        
        vtt_gui *g;
        
@@ -820,13 +818,13 @@ void build_vtt_gui(vtt_class *vtt)
        gui_set_tooltip(g->file, "Click to Load/Edit/Reload a sample for this turntable. To load you can also drag a file and drop it over this button or the sound data display below.");
        gtk_box_pack_start(GTK_BOX(tempbox), g->file, WID_DYN);
 
-       g->mouse_mapping=gtk_button_new_with_label("Mouse Mapping");
+       g->mouse_mapping=gtk_button_new_with_label("Mouse");
        gtk_widget_show(g->mouse_mapping);
        gui_set_tooltip(g->mouse_mapping, "Determines what parameters should be affected on mouse moition in mouse grab mode.");
        gtk_box_pack_start(GTK_BOX(tempbox2), g->mouse_mapping, WID_FIX);
 
 #ifdef USE_ALSA_MIDI_IN
-       g->midi_mapping=gtk_button_new_with_label("MIDI Mapping");
+       g->midi_mapping=gtk_button_new_with_label("MIDI");
        gtk_widget_show(g->midi_mapping);
        gui_set_tooltip(g->midi_mapping, "Determines what parameters should be bound to what MIDI events.");
        gtk_box_pack_start(GTK_BOX(tempbox2), g->midi_mapping, WID_FIX);
index 74144ec60dc819ff9f1311f5f5b270d61382f4e6..fbf2f6d0b4d3dd79b4c9286d53a7813776dc7421 100644 (file)
            <widget class="GtkTable" id="table6">
              <property name="border_width">4</property>
              <property name="visible">True</property>
-             <property name="n_rows">4</property>
+             <property name="n_rows">5</property>
              <property name="n_columns">2</property>
              <property name="homogeneous">False</property>
              <property name="row_spacing">2</property>
                  <property name="y_options">fill</property>
                </packing>
              </child>
+
+             <child>
+               <widget class="GtkLabel" id="label39">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Free HWstats:</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="left_attach">0</property>
+                 <property name="right_attach">1</property>
+                 <property name="top_attach">4</property>
+                 <property name="bottom_attach">5</property>
+                 <property name="x_options">fill</property>
+                 <property name="y_options"></property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkCheckButton" id="alsa_free_hwstats">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">Enabled</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="active">True</property>
+                 <property name="inconsistent">False</property>
+                 <property name="draw_indicator">True</property>
+               </widget>
+               <packing>
+                 <property name="left_attach">1</property>
+                 <property name="right_attach">2</property>
+                 <property name="top_attach">4</property>
+                 <property name="bottom_attach">5</property>
+                 <property name="x_options">fill</property>
+                 <property name="y_options"></property>
+               </packing>
+             </child>
            </widget>
            <packing>
              <property name="tab_expand">False</property>
            <widget class="GtkTable" id="table2">
              <property name="border_width">4</property>
              <property name="visible">True</property>
-             <property name="n_rows">6</property>
+             <property name="n_rows">7</property>
              <property name="n_columns">2</property>
              <property name="homogeneous">False</property>
              <property name="row_spacing">2</property>
                  <property name="y_options">fill</property>
                </packing>
              </child>
+
+             <child>
+               <widget class="GtkLabel" id="label38">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Filename Length:</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="left_attach">0</property>
+                 <property name="right_attach">1</property>
+                 <property name="top_attach">6</property>
+                 <property name="bottom_attach">7</property>
+                 <property name="x_options">fill</property>
+                 <property name="y_options"></property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkSpinButton" id="filename_length">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="climb_rate">1</property>
+                 <property name="digits">0</property>
+                 <property name="numeric">False</property>
+                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                 <property name="snap_to_ticks">False</property>
+                 <property name="wrap">False</property>
+                 <property name="adjustment">8 3 255 1 10 10</property>
+               </widget>
+               <packing>
+                 <property name="left_attach">1</property>
+                 <property name="right_attach">2</property>
+                 <property name="top_attach">6</property>
+                 <property name="bottom_attach">7</property>
+                 <property name="y_options"></property>
+               </packing>
+             </child>
            </widget>
            <packing>
              <property name="tab_expand">False</property>