XML for set files - Alex
authorterminatorX <>
Thu, 10 Oct 2002 23:21:21 +0000 (23:21 +0000)
committerterminatorX <>
Thu, 10 Oct 2002 23:21:21 +0000 (23:21 +0000)
22 files changed:
ChangeLog
acconfig.h
configure.in
src/Makefile.am
src/tX_audiofile.cc
src/tX_event.cc
src/tX_event.h
src/tX_global.c
src/tX_global.h
src/tX_legacy_global.c [new file with mode: 0644]
src/tX_legacy_vtt.cc [new file with mode: 0644]
src/tX_mastergui.cc
src/tX_seqpar.h
src/tX_sequencer.cc
src/tX_sequencer.h
src/tX_vtt.cc
src/tX_vtt.h
src/tX_vttfx.cc
src/tX_vttfx.h
src/tX_vttgui.cc
src/tX_widget.c
src/tX_widget.h

index b0b6000f2a1bda040a235fad11a565943077ec5f..aea7ce291687d5f84c7820e8fc11dc5612d56f39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@ This is not a GNU-style ChangeLog but you sort of get the idea what was
 changed.
 
 [v3.74]
+- Enhanced audio data display - you can now zoom into the audio signal, which
+  should allow much more precise scratching with larger audio files (ie 
+  complete tracks). On playback terminatorX will scroll the displayed area
+  to ensure you always see the area of the sample in which you currently
+  scratch.
 - fixed a gcc 3.2 compilation bug - thanks to 
   Adam Duck <duck@informatik.uni-frankfurt.de>
 
index 8e95b84360c9d79ff266e9b89ad63d3c526d7348..479dd9aa6e34cabc554ac74355562169243d65b8 100644 (file)
@@ -62,3 +62,6 @@
 
 /* use the newer gtk+ toolkit */
 #undef USE_GTK2
+
+/* Define for supporting old binary tX set files */
+#undef ENABLE_TX_LEGACY
index 19da98cc8faf6ed43c126a09539d9f6418cb6a04..f73888eaf23f0448164d40a4d5e4e870ca064f2a 100644 (file)
@@ -25,6 +25,7 @@ AC_ARG_ENABLE(libxml2,            [  --disable-libxml2       use libxml even if verion
 AC_ARG_ENABLE(mad,             [  --disable-mad           disable mad for mp3 support (default=auto) ])
 AC_ARG_ENABLE(vorbis,  [  --disable-vorbis        disable libvorbis support (default=auto) ])
 AC_ARG_ENABLE(audiofile,       [  --disable-audiofile     disable audiofile support (default=auto) ])
+AC_ARG_ENABLE(legacy,          [  --disable-legacy        disable support for old terminatorX files (default=on) ])
 
 dnl Checks for programs.
 AC_PROG_AWK
@@ -382,6 +383,10 @@ if test "$enable_bigdial" = yes; then
        AC_DEFINE(USE_BIG_BUTTONS)
 fi
 
+if test "$enable_legacy" != no; then
+       AC_DEFINE(ENABLE_TX_LEGACY)
+fi
+
 if test "$enable_dga2" = yes; then
        AC_DEFINE(USE_DGA2)
 fi
index 4ded990b215d2f33c7c15a3f5f76f51bdb98d83c..c8fef9e8f6df97e5155fe6288f60498bd0bc094e 100644 (file)
@@ -29,4 +29,5 @@ terminatorX_SOURCES = tX_endian.c tX_dialog.cc tX_widget.c wav_write.c \
                        tX_event.h tX_event.cc tX_sequencer.h tX_sequencer.cc \
                        tX_knobloader.h tX_knobloader.c tX_dial.c tX_dial.h \
                        tX_extdial.h tX_extdial.cc tX_panel.h tX_panel.cc \
-                       tX_ladspa.h tX_ladspa.cc tX_vttfx.h tX_vttfx.cc
+                       tX_ladspa.h tX_ladspa.cc tX_vttfx.h tX_vttfx.cc \
+                       tX_legacy_vtt.cc tX_legacy_global.c
index 91b29ee8de0ff619e2f29b8b93eb7ff2e19339e8..19c86841ae275cbca9a55ba42d062ae019c2ffca 100644 (file)
@@ -168,6 +168,7 @@ tx_audiofile :: ~tx_audiofile() {
                        free(mem);
                        break;
                }
+               case TX_AUDIO_UNDEFINED: break;
        }       
 
        if (file) {
index 19e42698f3820b37c3277fafceeaa49a258bdfd9..cdd9f01f465e463dc451b8f70eda24fd3fff1c69 100644 (file)
 */ 
 
 #include <tX_event.h>
+#include <tX_global.h>
 
-tX_event :: tX_event (FILE *input)
-{
-       unsigned int sp_persistence_id;
-
-       fread((void *) &sp_persistence_id, sizeof(sp_persistence_id), 1, input);
-       fread((void *) &timestamp, sizeof(timestamp), 1, input);
-       fread((void *) &value, sizeof(value), 1, input);
-
-       sp=tX_seqpar::get_sp_by_persistence_id(sp_persistence_id);
-       if (!sp)
-       {
-               fprintf(stderr, "oops: couldn't resolve sp by persistence id %i.\n", sp_persistence_id);
-       }
+void tX_event :: store (FILE *output, char *indent) {
+       fprintf(output, "%s<event pid=\"%i\" value=\"%lf\" time=\"%i\"/>\n", indent, sp->get_persistence_id(), value, timestamp);
 }
 
-void tX_event :: store (FILE *output)
-{
-       int res=0;
-       unsigned int persistence_id;
+tX_event :: tX_event (xmlDocPtr doc, xmlNodePtr node) {
+       unsigned int sp_persistence_id;
+       char *buffer;
        
-       persistence_id=sp->get_persistence_id();
+       buffer=(char *) xmlGetProp(node, (xmlChar *) "pid");
+       if (buffer) sscanf(buffer, "%i", &sp_persistence_id);
+       
+       buffer=(char *) xmlGetProp(node, (xmlChar *) "value");
+       if (buffer) sscanf(buffer, "%f", &value);
+       
+       buffer=(char *) xmlGetProp(node, (xmlChar *) "time");
+       if (buffer) sscanf(buffer, "%i", &timestamp);
 
-       res+=fwrite((void *) &persistence_id, sizeof(persistence_id), 1, output)-1;     
-       res+=fwrite((void *) &timestamp, sizeof(timestamp), 1, output)-1;
-       res+=fwrite((void *) &value, sizeof(value), 1, output)-1;
+       sp=tX_seqpar::get_sp_by_persistence_id(sp_persistence_id);
+       
+       if (!sp) {
+               tX_error("fatal: couldn't resolve seq. parameter for event at %i.", timestamp);
+       }
 }
index bd5ff02a88e65abfa6f78f454e450631adb44ee1..934859c06e2c3b197e002b5a1275378d5b5a63de 100644 (file)
@@ -30,6 +30,9 @@
 #include <glib.h>
 #include "tX_types.h"
 
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+
 class tX_event
 {
        private:
@@ -44,8 +47,11 @@ class tX_event
                        value=val;
                        sp=sp_in;
                }
+#ifdef ENABLE_TX_LEGACY                
        tX_event(FILE *input);
-       void store(FILE *output);
+#endif         
+       tX_event(xmlDocPtr, xmlNodePtr);
+       void store(FILE *output, char *indent);
 
        tX_seqpar *get_sp() { return sp; }
        guint32 get_timestamp() { return timestamp; }
index 6215ff8ddcec907efd5a7face9c95b243051bb81..2e69bab9b8ee2e0e338320d43c70c4d89758a10b 100644 (file)
 
 tx_global globals;
 
-void get_rc_name_old(char *buffer)
-{
-       strcpy(buffer,"");
-
-       if (getenv("HOME"))
-       {
-               strcpy(buffer, getenv("HOME"));
-               if (buffer[strlen(buffer)-1]!='/')
-               strcat(buffer, "/");
-       }
-       
-       strcat(buffer, ".terminatorX3rc.bin");
-}
-
 void get_rc_name(char *buffer)
 {
        strcpy(buffer,"");
@@ -142,39 +128,6 @@ void set_global_defaults() {
 
 }
 
-void load_globals_old()
-{      
-       char rc_name[PATH_MAX]="";      
-       FILE *rc;
-       get_rc_name_old(rc_name);
-       
-       rc=fopen(rc_name, "r");
-       if (rc)
-       {
-               fread(&globals, sizeof(tx_global), 1, rc);
-               fclose(rc);
-       }
-       else
-       {
-               fprintf(stderr, "tX: .rc-file '%s' doesn't exist, reverting to defaults\n", rc_name);
-               set_global_defaults();
-       }
-
-       /* i'll have to keep these as they're in the code
-          everywhere but I think it doesn't make sense resetting
-         to old values on startup....
-       */
-       globals.use_stdout_cmdline=0;
-       globals.current_path = NULL;
-       globals.pitch=1.0;
-       globals.volume=1.0;     
-       if (!globals.true_block_size) globals.true_block_size=1<globals.buff_size;
-}
-
-#define restore_int(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) { sscanf(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%i", &i); }}
-#define restore_float(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if  (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {sscanf(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &dvalue); i=dvalue;}}
-#define restore_string(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {strcpy(i, xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); }}
-
 int load_globals_xml() {
        char rc_name[PATH_MAX]="";      
        xmlDocPtr doc;
@@ -182,7 +135,6 @@ int load_globals_xml() {
        int elementFound;
        double dvalue;
 
-       set_global_defaults();
        get_rc_name(rc_name);
        
        doc = xmlParseFile(rc_name);
@@ -241,16 +193,15 @@ int load_globals_xml() {
                        }
                }
        }
+
+       xmlFreeDoc(doc);
        
        return 0;
 }
 
-#define store_int(s, i); fprintf(rc, "\t<%s>%i</%s>\n", s,(int) i, s);
-#define store_float(s, i); fprintf(rc, "\t<%s>%lf</%s>\n", s,(double) i, s);
-#define store_string(s, i); fprintf(rc, "\t<%s>%s</%s>\n", s, i, s);
-
 void store_globals() {
        char rc_name[PATH_MAX]="";
+       char indent[]="\t";
        FILE *rc;
        
        get_rc_name(rc_name);
@@ -293,9 +244,17 @@ void store_globals() {
        }
 }
 
+#ifdef ENABLE_TX_LEGACY
+extern void load_globals_old();
+#endif
+
 void load_globals() {
+       set_global_defaults();
+
        if (load_globals_xml()!=0) {
                fprintf(stderr, "tX: Failed loading terminatorXrc - trying to load old binary rc.\n");
+#ifdef ENABLE_TX_LEGACY                
                load_globals_old();
+#endif         
        }
 }
index 7b088421234da7c953b6ab2bb43f14c281960923..b43446e1d7e040347d94fadb3c0918e3f0eaba3d 100644 (file)
@@ -137,6 +137,34 @@ extern tx_global globals;
 extern void load_globals();
 extern void store_globals();
 
+#define nop
+
+/* some ugly XML macros... */
+#define restore_int(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) { sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%i", &i); }}
+#define restore_float(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if  (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &dvalue); i=dvalue;}}
+#define restore_string(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {strcpy(i, (const char *)  xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); }}
+#define restore_bool(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {if (xmlStrcmp(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1),  (const xmlChar *) "true")==0) i=true; else i=false; }}
+#define restore_id(s, sp); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; pid_attr=(char* ) xmlGetProp(cur, (xmlChar *) "id"); if (pid_attr) { sscanf(pid_attr, "%i",  &pid); sp.set_persistence_id(pid); }}
+
+#define restore_int_ac(s, i, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) { sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%i", &i); init; }}
+#define restore_float_ac(s, i, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if  (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &dvalue); i=dvalue; init; }}
+#define restore_string_ac(s, i, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {strcpy(i, (const char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); init; }}
+#define restore_bool_ac(s, i, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {if (xmlStrcmp(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), (const xmlChar *) "true")==0) i=true; else i=false; init; }}
+
+#define restore_int_id(s, i, sp, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) { sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%i", &i); pid_attr=(char* ) xmlGetProp(cur, (xmlChar *) "id"); if (pid_attr) { sscanf(pid_attr, "%i",  &pid); sp.set_persistence_id(pid); } init; }}
+#define restore_float_id(s, i, sp, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if  (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &dvalue); i=dvalue; pid_attr=(char* ) xmlGetProp(cur, (xmlChar *) "id"); if (pid_attr) { sscanf(pid_attr, "%i",  &pid); sp.set_persistence_id(pid); } init; }}
+#define restore_bool_id(s, i, sp, init); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {if (xmlStrcmp(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1),  (const xmlChar *) "true")==0) i=true; else i=false; pid_attr=(char* ) xmlGetProp(cur,  (xmlChar *)"id"); if (pid_attr) { sscanf(pid_attr, "%i",  &pid); sp.set_persistence_id(pid); } init; }}
+
+#define store_int(s, i); fprintf(rc, "%s<%s>%i</%s>\n", indent, s,(int) i, s);
+#define store_float(s, i); fprintf(rc, "%s<%s>%lf</%s>\n", indent, s,(double) i, s);
+#define store_string(s, i); fprintf(rc, "%s<%s>%s</%s>\n", indent, s, i, s);
+#define store_bool(s, i); fprintf(rc, "%s<%s>%s</%s>\n", indent, s, i ? "true" : "false", s);
+
+#define store_id(s, id); fprintf(rc, "%s<%s id=\"%i\"/>\n", indent, s, id);
+#define store_int_id(s, i, id); fprintf(rc, "%s<%s id=\"%i\">%i</%s>\n", indent, s, id, (int) i, s);
+#define store_float_id(s, i, id); fprintf(rc, "%s<%s id=\"%i\">%lf</%s>\n", indent, s, id, (double) i, s);
+#define store_bool_id(s, i, id); fprintf(rc, "%s<%s id=\"%i\">%s</%s>\n", indent, s, id, i ? "true" : "false", s);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/src/tX_legacy_global.c b/src/tX_legacy_global.c
new file mode 100644 (file)
index 0000000..52a00ba
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+    terminatorX - realtime audio scratching software
+    Copyright (C) 1999-2002  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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    File: tX_legacy_global.cc
+*/    
+
+#include <config.h>
+
+#ifdef ENABLE_TX_LEGACY
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "tX_global.h"
+
+void get_rc_name_old(char *buffer)
+{
+       strcpy(buffer,"");
+
+       if (getenv("HOME"))
+       {
+               strcpy(buffer, getenv("HOME"));
+               if (buffer[strlen(buffer)-1]!='/')
+               strcat(buffer, "/");
+       }
+       
+       strcat(buffer, ".terminatorX3rc.bin");
+}
+
+void load_globals_old() {      
+       char rc_name[PATH_MAX]="";      
+       FILE *rc;
+       get_rc_name_old(rc_name);
+       
+       rc=fopen(rc_name, "r");
+       if (rc)
+       {
+               fread(&globals, sizeof(tx_global), 1, rc);
+               fclose(rc);
+       }
+       else
+       {
+               fprintf(stderr, "tX: .rc-file '%s' doesn't exist, reverting to defaults\n", rc_name);
+       }
+
+       /* i'll have to keep these as they're in the code
+          everywhere but I think it doesn't make sense resetting
+         to old values on startup....
+       */
+       globals.use_stdout_cmdline=0;
+       globals.current_path = NULL;
+       globals.pitch=1.0;
+       globals.volume=1.0;     
+       if (!globals.true_block_size) globals.true_block_size=1<globals.buff_size;
+}
+
+#endif
diff --git a/src/tX_legacy_vtt.cc b/src/tX_legacy_vtt.cc
new file mode 100644 (file)
index 0000000..4015e8f
--- /dev/null
@@ -0,0 +1,944 @@
+/*
+    terminatorX - realtime audio scratching software
+    Copyright (C) 1999-2002  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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    File: tX_legacy_vtt.cc
+*/    
+
+#include <config.h>
+
+#ifdef ENABLE_TX_LEGACY
+
+#include <stdio.h>
+#include "tX_vtt.h"
+#include "tX_global.h"
+#include "tX_loaddlg.h"
+#include "tX_mastergui.h"
+#include "tX_sequencer.h"
+#include <string.h>
+
+#define atload(data); if (fread((void *) &data, sizeof(data), 1, input)!=1) res+=1;
+
+int vtt_class :: load_10(FILE * input)
+{
+       int res=0;
+       int obsolete_int;
+       
+       atload(name);
+       atload(filename);
+       atload(is_sync_master);
+       atload(is_sync_client);
+       atload(sync_cycles);
+       atload(rel_volume);
+       recalc_volume();
+       atload(rel_pitch);
+       recalc_pitch();
+       
+       atload(autotrigger);
+       atload(loop);
+       
+       atload(mute);
+       atload(obsolete_int); //x_control
+       atload(obsolete_int); //y_control
+       
+       atload(lp_enable);
+       atload(lp_gain);
+       atload(lp_reso);
+       atload(lp_freq);
+       lp_setup(lp_gain, lp_reso, lp_freq);
+       
+       atload(ec_enable);
+       atload(ec_length);
+       ec_set_length(ec_length);
+       atload(ec_feedback);
+       ec_set_feedback(ec_feedback);
+       
+       return(res);
+}
+
+
+int vtt_class :: load_11(FILE * input)
+{
+       int res=0;
+       guint32 pid;
+       int32_t gui_page;
+       int obsolete_int;
+       
+       atload(name);
+       atload(filename);
+       atload(is_sync_master);
+       atload(is_sync_client);
+       atload(sync_cycles);
+       atload(rel_volume);
+       recalc_volume();
+       atload(rel_pitch);
+       recalc_pitch();
+       
+       atload(autotrigger);
+       atload(loop);
+       
+       atload(mute);
+       atload(obsolete_int); //x_control
+       atload(obsolete_int); //y_control
+       
+       atload(lp_enable);
+       atload(lp_gain);
+       atload(lp_reso);
+       atload(lp_freq);
+       lp_setup(lp_gain, lp_reso, lp_freq);
+       
+       atload(ec_enable);
+       atload(ec_length);
+       ec_set_length(ec_length);
+       atload(ec_feedback);
+       ec_set_feedback(ec_feedback);
+
+       atload(pid);
+       sp_speed.set_persistence_id(pid);
+       atload(pid);
+       sp_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_pitch.set_persistence_id(pid);
+       atload(pid);
+       sp_trigger.set_persistence_id(pid);
+       atload(pid);
+       sp_loop.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_client.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_cycles.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_gain.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_reso.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_freq.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_length.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_feedback.set_persistence_id(pid);
+       atload(pid);
+       sp_mute.set_persistence_id(pid);
+       atload(pid);
+       sp_spin.set_persistence_id(pid);
+       
+       atload(gui_page);
+       
+       return(res);
+}
+
+int vtt_class :: load_12(FILE * input)
+{
+       int res=0;
+       guint32 pid;
+       int32_t counter;
+       int32_t type;
+       long id;
+       int i;
+       unsigned int t;
+       LADSPA_Plugin *plugin;
+       char buffer[256];
+       vtt_fx_ladspa *ladspa_effect;
+       guint8 hidden;
+       
+       atload(buffer);
+       this->set_name(buffer);
+       atload(filename);
+       atload(is_sync_master);
+       atload(is_sync_client);
+       atload(sync_cycles);
+       atload(rel_volume);
+       recalc_volume();
+       atload(rel_pitch);
+       recalc_pitch();
+       
+       atload(autotrigger);
+       atload(loop);
+       
+       atload(mute);
+       
+       atload(lp_enable);
+       atload(lp_gain);
+       atload(lp_reso);
+       atload(lp_freq);
+       lp_setup(lp_gain, lp_reso, lp_freq);
+       
+       atload(ec_enable);
+       atload(ec_length);
+       ec_set_length(ec_length);
+       atload(ec_feedback);
+       ec_set_feedback(ec_feedback);
+
+       atload(pid);
+       sp_speed.set_persistence_id(pid);
+       atload(pid);
+       sp_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_pitch.set_persistence_id(pid);
+       atload(pid);
+       sp_trigger.set_persistence_id(pid);
+       atload(pid);
+       sp_loop.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_client.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_cycles.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_gain.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_reso.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_freq.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_length.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_feedback.set_persistence_id(pid);
+       atload(pid);
+       sp_mute.set_persistence_id(pid);
+       atload(pid);
+       sp_spin.set_persistence_id(pid);
+               
+       atload(counter);
+       
+       for (i=0; i<counter; i++)
+       {
+               atload(type);
+               switch(type)
+               {
+                       case TX_FX_BUILTINCUTOFF:
+                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
+                       break;
+                       
+                       case TX_FX_BUILTINECHO:
+                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
+                       break;
+                       
+                       case TX_FX_LADSPA:
+                               atload(id);
+                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
+                               if (plugin)
+                               {
+                                       ladspa_effect=add_effect(plugin);
+                                       ladspa_effect->load(input);
+                               }
+                               else
+                               {
+                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+                                       tx_note(buffer, true);
+                                       res++;
+                               }
+                       break;
+                       
+                       default:
+                               tx_note("Fatal error loading set: unknown effect type!", true);
+                               res++;
+               }               
+       }
+
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_x_input_parameter(NULL);
+       
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_y_input_parameter(NULL);
+
+       atload(hidden);
+       gui.main_panel->hide(hidden);
+
+       atload(hidden);
+       gui.trigger_panel->hide(hidden);
+
+       atload(hidden);
+       gui.lp_panel->hide(hidden);
+
+       atload(hidden);
+       gui.ec_panel->hide(hidden);
+       
+       return(res);
+}
+
+int vtt_class :: load_13(FILE * input)
+{
+       int res=0;
+       guint32 pid;
+       int32_t counter;
+       int32_t type;
+       long id;
+       int i;
+       unsigned int t;
+       LADSPA_Plugin *plugin;
+       char buffer[256];
+       vtt_fx_ladspa *ladspa_effect;
+       guint8 hidden;
+       
+       atload(buffer);
+       this->set_name(buffer);
+       atload(filename);
+       atload(is_sync_master);
+       atload(is_sync_client);
+       atload(sync_cycles);
+       atload(rel_volume);
+       atload(rel_pitch);
+       recalc_pitch();
+       
+       atload(autotrigger);
+       atload(loop);
+       
+       atload(mute);
+       atload(pan);
+       
+       atload(lp_enable);
+       atload(lp_gain);
+       atload(lp_reso);
+       atload(lp_freq);
+       lp_setup(lp_gain, lp_reso, lp_freq);
+       
+       atload(ec_enable);
+       atload(ec_length);
+       ec_set_length(ec_length);
+       atload(ec_feedback);
+       ec_set_feedback(ec_feedback);
+       atload(ec_pan);
+       ec_set_pan(ec_pan);
+       atload(ec_volume);
+       ec_set_volume(ec_volume);
+
+       recalc_volume();
+
+       atload(pid);
+       sp_speed.set_persistence_id(pid);
+       atload(pid);
+       sp_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_pitch.set_persistence_id(pid);
+       atload(pid);
+       sp_trigger.set_persistence_id(pid);
+       atload(pid);
+       sp_loop.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_client.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_cycles.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_gain.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_reso.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_freq.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_length.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_feedback.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_pan.set_persistence_id(pid);
+       atload(pid);
+       sp_mute.set_persistence_id(pid);
+       atload(pid);
+       sp_spin.set_persistence_id(pid);
+       atload(pid);
+       sp_pan.set_persistence_id(pid);
+               
+       atload(counter);
+       
+       for (i=0; i<counter; i++)
+       {
+               atload(type);
+               switch(type)
+               {
+                       case TX_FX_BUILTINCUTOFF:
+                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
+                       break;
+                       
+                       case TX_FX_BUILTINECHO:
+                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
+                       break;
+                       
+                       case TX_FX_LADSPA:
+                               atload(id);
+                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
+                               if (plugin)
+                               {
+                                       ladspa_effect=add_effect(plugin);
+                                       ladspa_effect->load(input);
+                               }
+                               else
+                               {
+                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+                                       tx_note(buffer, true);
+                                       res++;
+                               }
+                       break;
+                       
+                       default:
+                               tx_note("Fatal error loading set: unknown effect type!", true);
+                               res++;
+               }               
+       }
+
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_x_input_parameter(NULL);
+       
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_y_input_parameter(NULL);
+
+       atload(hidden);
+       gui.main_panel->hide(hidden);
+
+       atload(hidden);
+       gui.trigger_panel->hide(hidden);
+
+       atload(hidden);
+       gui.lp_panel->hide(hidden);
+
+       atload(hidden);
+       gui.ec_panel->hide(hidden);
+       
+       return(res);
+}
+
+int vtt_class :: load_14(FILE * input)
+{
+       int res=0;
+       guint32 pid;
+       int32_t counter;
+       int32_t type;
+       long id;
+       int i;
+       unsigned int t;
+       LADSPA_Plugin *plugin;
+       char buffer[256];
+       vtt_fx_ladspa *ladspa_effect;
+       guint8 hidden;
+       
+       atload(buffer);
+       this->set_name(buffer);
+       atload(filename);
+       atload(is_sync_master);
+       atload(is_sync_client);
+       atload(sync_cycles);
+       atload(rel_volume);
+       atload(rel_pitch);
+       recalc_pitch();
+       
+       atload(autotrigger);
+       atload(loop);
+       
+       atload(mute);
+       atload(pan);
+       
+       atload(lp_enable);
+       atload(lp_gain);
+       atload(lp_reso);
+       atload(lp_freq);
+       lp_setup(lp_gain, lp_reso, lp_freq);
+       
+       atload(ec_enable);
+       atload(ec_length);
+       ec_set_length(ec_length);
+       atload(ec_feedback);
+       ec_set_feedback(ec_feedback);
+       atload(ec_pan);
+       ec_set_pan(ec_pan);
+       atload(ec_volume);
+       ec_set_volume(ec_volume);
+
+       atload(audio_hidden);
+       atload(control_hidden);
+       
+       recalc_volume();
+
+       atload(pid);
+       sp_speed.set_persistence_id(pid);
+       atload(pid);
+       sp_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_pitch.set_persistence_id(pid);
+       atload(pid);
+       sp_trigger.set_persistence_id(pid);
+       atload(pid);
+       sp_loop.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_client.set_persistence_id(pid);
+       atload(pid);
+       sp_sync_cycles.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_gain.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_reso.set_persistence_id(pid);
+       atload(pid);
+       sp_lp_freq.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_enable.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_length.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_feedback.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_ec_pan.set_persistence_id(pid);
+       atload(pid);
+       sp_mute.set_persistence_id(pid);
+       atload(pid);
+       sp_spin.set_persistence_id(pid);
+       atload(pid);
+       sp_pan.set_persistence_id(pid);
+               
+       atload(counter);
+       
+       for (i=0; i<counter; i++)
+       {
+               atload(type);
+               switch(type)
+               {
+                       case TX_FX_BUILTINCUTOFF:
+                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
+                       break;
+                       
+                       case TX_FX_BUILTINECHO:
+                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
+                       break;
+                       
+                       case TX_FX_LADSPA:
+                               atload(id);
+                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
+                               if (plugin)
+                               {
+                                       ladspa_effect=add_effect(plugin);
+                                       ladspa_effect->load(input);
+                               }
+                               else
+                               {
+                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+                                       tx_note(buffer, true);
+                                       res++;
+                               }
+                       break;
+                       
+                       default:
+                               tx_note("Fatal error loading set: unknown effect type!", true);
+                               res++;
+               }               
+       }
+
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_x_input_parameter(NULL);
+       
+       atload(pid);
+       
+       if (pid)
+       {
+               atload(pid);
+               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       }
+       else set_y_input_parameter(NULL);
+
+       atload(hidden);
+       gui.main_panel->hide(hidden);
+
+       atload(hidden);
+       gui.trigger_panel->hide(hidden);
+
+       atload(hidden);
+       gui.lp_panel->hide(hidden);
+
+       atload(hidden);
+       gui.ec_panel->hide(hidden);
+       
+       return(res);
+}
+
+int  vtt_class :: load_all_10(FILE* input, char *fname)
+{
+       int res=0, restmp=0;
+       unsigned int i, max;
+       vtt_class *newvtt;
+       char ftmp[PATH_MAX];
+       
+       while (main_list.size())
+       {
+               delete((*main_list.begin()));
+       }
+               
+       atload(max);
+       atload(master_volume);
+       set_master_volume(master_volume);
+       globals.volume=master_volume;
+       atload(globals.pitch);  
+       set_master_pitch(globals.pitch);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       ld_set_setname(fname);
+
+       for (i=0; i<max; i++)
+       {
+               newvtt=new vtt_class(1);
+               res+=newvtt->load_10(input);
+               
+               if (strlen(newvtt->filename))
+               {
+                       /* ftmp IS NECESSARY !!! */
+                       strcpy(ftmp, newvtt->filename);
+                       ld_set_filename(ftmp);
+                       
+                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
+                       restmp=(int) newvtt->load_file(ftmp);
+                       res+=restmp;
+               }
+               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
+               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+       }
+       
+       sequencer.clear();
+       
+       ld_destroy();
+       
+       return(res);
+}
+
+
+int  vtt_class :: load_all_11(FILE* input, char *fname)
+{
+       int res=0, restmp=0;
+       unsigned int i, max;
+       vtt_class *newvtt;
+       char ftmp[PATH_MAX];
+       guint32 pid;
+       
+       while (main_list.size())
+       {
+               delete((*main_list.begin()));
+       }
+               
+       atload(max);
+       atload(master_volume);
+       set_master_volume(master_volume);
+       globals.volume=master_volume;
+       atload(globals.pitch);  
+       set_master_pitch(globals.pitch);
+       atload(pid);
+       sp_master_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_master_pitch.set_persistence_id(pid);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       ld_set_setname(fname);
+
+       for (i=0; i<max; i++)
+       {
+               newvtt=new vtt_class(1);
+               res+=newvtt->load_11(input);
+               
+               if (strlen(newvtt->filename))
+               {
+                       /* ftmp IS NECESSARY !!! */
+                       strcpy(ftmp, newvtt->filename);
+                       ld_set_filename(ftmp);
+                       
+                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
+                       restmp=(int) newvtt->load_file(ftmp);
+                       res+=restmp;
+               }
+               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
+               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+               
+       }
+       
+       sequencer.load(input);
+       
+       ld_destroy();
+       
+       return(res);
+}
+
+
+int  vtt_class :: load_all_12(FILE* input, char *fname)
+{
+       int res=0, restmp=0;
+       unsigned int i, max;
+       vtt_class *newvtt;
+       char ftmp[PATH_MAX];
+       guint32 pid;
+       
+       while (main_list.size())
+       {
+               delete((*main_list.begin()));
+       }
+               
+       atload(max);
+       atload(master_volume);
+       set_master_volume(master_volume);
+       globals.volume=master_volume;
+       atload(globals.pitch);  
+       set_master_pitch(globals.pitch);
+       atload(pid);
+       sp_master_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_master_pitch.set_persistence_id(pid);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       ld_set_setname(fname);
+
+       for (i=0; i<max; i++)
+       {
+               newvtt=new vtt_class(1);
+               res+=newvtt->load_12(input);
+               
+               if (strlen(newvtt->filename))
+               {
+                       /* ftmp IS NECESSARY !!! */
+                       strcpy(ftmp, newvtt->filename);
+                       ld_set_filename(ftmp);
+                       
+                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
+                       restmp=(int) newvtt->load_file(ftmp);
+                       res+=restmp;
+               }
+               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
+               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+               
+       }
+       
+       sequencer.load(input);
+       
+       ld_destroy();
+       
+       return(res);
+}
+
+int  vtt_class :: load_all_13(FILE* input, char *fname)
+{
+       int res=0, restmp=0;
+       unsigned int i, max;
+       vtt_class *newvtt;
+       char ftmp[PATH_MAX];
+       guint32 pid;
+       
+       while (main_list.size())
+       {
+               delete((*main_list.begin()));
+       }
+               
+       atload(max);
+       atload(master_volume);
+       set_master_volume(master_volume);
+       globals.volume=master_volume;
+       atload(globals.pitch);  
+       set_master_pitch(globals.pitch);
+       atload(pid);
+       sp_master_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_master_pitch.set_persistence_id(pid);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       ld_set_setname(fname);
+
+       for (i=0; i<max; i++)
+       {
+               newvtt=new vtt_class(1);
+               res+=newvtt->load_13(input);
+               
+               if (strlen(newvtt->filename))
+               {
+                       /* ftmp IS NECESSARY !!! */
+                       strcpy(ftmp, newvtt->filename);
+                       ld_set_filename(ftmp);
+                       
+                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
+                       restmp=(int) newvtt->load_file(ftmp);
+                       res+=restmp;
+               }
+               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
+               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+               
+       }
+       
+       sequencer.load(input);
+       
+       ld_destroy();
+       
+       return(res);
+}
+
+int  vtt_class :: load_all_14(FILE* input, char *fname)
+{
+       int res=0, restmp=0;
+       unsigned int i, max;
+       vtt_class *newvtt;
+       char ftmp[PATH_MAX];
+       guint32 pid;
+       
+       while (main_list.size())
+       {
+               delete((*main_list.begin()));
+       }
+               
+       atload(max);
+       atload(master_volume);
+       set_master_volume(master_volume);
+       globals.volume=master_volume;
+       atload(globals.pitch);  
+       set_master_pitch(globals.pitch);
+       atload(pid);
+       sp_master_volume.set_persistence_id(pid);
+       atload(pid);
+       sp_master_pitch.set_persistence_id(pid);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       ld_set_setname(fname);
+
+       for (i=0; i<max; i++)
+       {
+               newvtt=new vtt_class(1);
+               res+=newvtt->load_14(input);
+               
+               if (strlen(newvtt->filename))
+               {
+                       /* ftmp IS NECESSARY !!! */
+                       strcpy(ftmp, newvtt->filename);
+                       ld_set_filename(ftmp);
+                       
+                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
+                       restmp=(int) newvtt->load_file(ftmp);
+                       res+=restmp;
+               }
+               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
+               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+           if (newvtt->audio_hidden) newvtt->hide_audio(newvtt->audio_hidden);
+           if (newvtt->control_hidden) newvtt->hide_control(newvtt->control_hidden);\r
+       }
+       
+       sequencer.load(input);
+       
+       ld_destroy();
+       
+       return(res);
+}
+
+void vtt_fx_ladspa :: load (FILE *input)
+{
+       guint32 count;
+       unsigned int i;
+       list <tX_seqpar_vttfx *> :: iterator sp;
+       guint32 pid;
+       guint8 hidden;
+       float value;
+       
+       fread((void *) &count, sizeof(count), 1, input);
+       
+       if (count!=controls.size())
+       {
+               fprintf(stderr, "tX: Ouch! Plugin %li has less/more controls than saved!\n", plugin->getUniqueID());
+       }
+       
+       for (i=0, sp=controls.begin(); (i<count) && (sp!=controls.end()); i++, sp++) {
+               fread((void *) &pid, sizeof(pid), 1, input);
+               (*sp)->set_persistence_id(pid);
+               fread((void *) &value, sizeof(value), 1, input);
+               (*sp)->do_exec(value);
+               (*sp)->do_update_graphics();
+       } 
+       
+       fread((void *) &hidden, sizeof(hidden), 1, input);
+       panel->hide(hidden);
+}
+
+void tX_sequencer :: load(FILE *in)
+{
+       guint32 event_count=0;
+       guint32 i;
+       tX_event *new_event=NULL;
+       
+       clear();
+       
+       fread ((void *) &event_count, sizeof(event_count), 1, in);
+       
+       max_timestamp=0;
+       
+       for (i=0; i<event_count; i++)
+       {
+               new_event=new tX_event(in);
+               song_list.push_back(new_event);
+       }
+       
+       start_timestamp=0;
+       current_timestamp=0;
+       
+       if (new_event) max_timestamp=new_event->get_timestamp();
+}
+
+tX_event :: tX_event (FILE *input)
+{
+       unsigned int sp_persistence_id;
+
+       fread((void *) &sp_persistence_id, sizeof(sp_persistence_id), 1, input);
+       fread((void *) &timestamp, sizeof(timestamp), 1, input);
+       fread((void *) &value, sizeof(value), 1, input);
+
+       sp=tX_seqpar::get_sp_by_persistence_id(sp_persistence_id);
+       if (!sp)
+       {
+               fprintf(stderr, "oops: couldn't resolve sp by persistence id %i.\n", sp_persistence_id);
+       }
+}
+
+#endif
index e7584e21934af81c597170e0411fa1132043bd10..33aa7b0b67c0aa99864f33d9d977f830558719c3 100644 (file)
@@ -286,59 +286,67 @@ void load_tt_part(char * buffer)
        FILE *in;
        char idbuff[256];
        char wbuf[PATH_MAX];
-
+       xmlDocPtr doc;
+       
        turn_audio_off();
        
        strcpy(globals.tables_filename, buffer);
-
-       in=fopen(buffer, "r");  
        
-       if (in)
-       {
-               fread(idbuff, strlen(TX_SET_ID_10), 1, in);
-               if (strncmp(idbuff, TX_SET_ID_10, strlen(TX_SET_ID_10))==0)
-               {
-                       if (vtt_class::load_all_10(in, buffer)) tx_note("Error while reading set.", true);
-               }
-               else if (strncmp(idbuff, TX_SET_ID_11, strlen(TX_SET_ID_11))==0)
-               {
-                       if (vtt_class::load_all_11(in, buffer)) tx_note("Error while reading set.", true);                      
-               }
-               else if (strncmp(idbuff, TX_SET_ID_12, strlen(TX_SET_ID_12))==0)
-               {
-                       if (vtt_class::load_all_12(in, buffer)) tx_note("Error while reading set.", true);                      
-               }
-               else if (strncmp(idbuff, TX_SET_ID_13, strlen(TX_SET_ID_13))==0)
-               {
-                       if (vtt_class::load_all_13(in, buffer)) tx_note("Error while reading set.", true);                      
-               }
-               else if (strncmp(idbuff, TX_SET_ID_14, strlen(TX_SET_ID_14))==0)
-               {
-                       if (vtt_class::load_all_14(in, buffer)) tx_note("Error while reading set.", true);                      
-               }
-               else
-               {
-                       tx_note("This file is not a terminatorX set-file.", true);
-                       fclose(in);
+       doc = xmlParseFile(buffer);
+       if (doc) {
+               vtt_class::load_all(doc, buffer);
+               xmlFreeDoc(doc);
+       } 
+       
+#ifdef ENABLE_TX_LEGACY
+       else {  
+               in=fopen(buffer, "r");  
+       
+               if (in) {
+                       fread(idbuff, strlen(TX_SET_ID_10), 1, in);
+                       if (strncmp(idbuff, TX_SET_ID_10, strlen(TX_SET_ID_10))==0) {
+                               if (vtt_class::load_all_10(in, buffer)) tx_note("Error while reading set.", true);
+                       } else if (strncmp(idbuff, TX_SET_ID_11, strlen(TX_SET_ID_11))==0)      {
+                               if (vtt_class::load_all_11(in, buffer)) tx_note("Error while reading set.", true);                      
+                       } else if (strncmp(idbuff, TX_SET_ID_12, strlen(TX_SET_ID_12))==0) {
+                               if (vtt_class::load_all_12(in, buffer)) tx_note("Error while reading set.", true);                      
+                       } else if (strncmp(idbuff, TX_SET_ID_13, strlen(TX_SET_ID_13))==0) {
+                               if (vtt_class::load_all_13(in, buffer)) tx_note("Error while reading set.", true);                      
+                       } else if (strncmp(idbuff, TX_SET_ID_14, strlen(TX_SET_ID_14))==0) {
+                               if (vtt_class::load_all_14(in, buffer)) tx_note("Error while reading set.", true);                      
+                       }       else {
+                               tx_note("This file is not a terminatorX set-file.", true);
+                               fclose(in);
+                               return;
+                       }
+                       fclose(in);     
+               } else {
+                       strcpy(idbuff, "Failed to access file: \"");    // I'm stealing the unrelated sting for a temp :)
+                       strcat(idbuff, globals.tables_filename);
+                       strcat(idbuff, "\"");
+                       tx_note(idbuff, true);
+                       
                        return;
                }
-               fclose(in);
-               
-               tX_seqpar :: init_all_graphics();
-               vg_init_all_non_seqpars();
-               
-               gtk_adjustment_set_value(volume_adj, 2.0-globals.volume);
-               gtk_adjustment_set_value(pitch_adj, globals.pitch);
-               sprintf(wbuf,"terminatorX - %s", strip_path(buffer));
-               gtk_window_set_title(GTK_WINDOW(main_window), wbuf);            
        }
-       else
-       {
+#else
+       else {
                strcpy(idbuff, "Failed to access file: \"");    // I'm stealing the unrelated sting for a temp :)
                strcat(idbuff, globals.tables_filename);
                strcat(idbuff, "\"");
                tx_note(idbuff, true);
+               
+               return;
        }
+#endif 
+       
+       tX_seqpar :: init_all_graphics();
+       vg_init_all_non_seqpars();
+               
+       gtk_adjustment_set_value(volume_adj, 2.0-globals.volume);
+       gtk_adjustment_set_value(pitch_adj, globals.pitch);
+       sprintf(wbuf,"terminatorX - %s", strip_path(buffer));
+       gtk_window_set_title(GTK_WINDOW(main_window), wbuf);            
 }
 
 void do_load_tables(GtkWidget *wid)
@@ -423,7 +431,6 @@ void do_save_tables(GtkWidget *wid)
        char buffer[PATH_MAX];
        char wbuf[PATH_MAX];
        char *ext;
-       char idbuffer[256];
        
        strcpy(buffer, gtk_file_selection_get_filename(GTK_FILE_SELECTION(save_dialog)));
        strcpy(globals.tables_filename, buffer);
@@ -448,8 +455,6 @@ void do_save_tables(GtkWidget *wid)
        
        if (out)
        {
-               strcpy(idbuffer, TX_SET_ID_14);
-               fwrite(idbuffer, strlen(idbuffer), 1, out);
                if (vtt_class::save_all(out)) tx_note("Error while saving set.", true);
                fclose(out);
                sprintf(wbuf,"terminatorX - %s", strip_path(buffer));
@@ -715,6 +720,8 @@ GtkSignalFunc seq_stop(GtkWidget *w, void *)
        gtk_widget_set_sensitive(seq_slider, 1);        
        gtk_widget_set_sensitive(engine_btn, 1);
        gtk_widget_set_sensitive(seq_rec_btn, 1);
+
+       return NULL;
 }
 
 GtkSignalFunc seq_rec(GtkWidget *w, void *)
@@ -727,6 +734,8 @@ GtkSignalFunc seq_rec(GtkWidget *w, void *)
        gtk_widget_set_sensitive(engine_btn, 0);
        gtk_widget_set_sensitive(seq_rec_btn, 0);
        sequencer.trig_rec();
+       
+       return NULL;
 }
 
 void seq_update_entry(const guint32 timestamp)
@@ -1139,7 +1148,7 @@ void tx_note(const char *message, bool isError)
        GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(main_window),
                GTK_DIALOG_DESTROY_WITH_PARENT,
                isError ? GTK_MESSAGE_ERROR : GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, message);
-       int result=gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);     
 #else  
        
@@ -1193,7 +1202,7 @@ void tx_l_note(const char *message)
        
        GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(main_window),
                GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, message);
-       int result=gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);     
 #else          
        char buffer[4096]="\n   Plugin Info:  \n   ------------  \n\n";
index f6fd67e4fea6494050b7642e27b2be5a0c51ad90..9f34193a8a25e44090d274431f8daf6399c8241d 100644 (file)
@@ -108,9 +108,9 @@ class tX_seqpar
        /* Make it so ;) */
        static void materialize_forward_values();
 
-        /* info functions for the editor */
-        char *get_vtt_name();
-        virtual const char *get_name(); 
+       /* info functions for the editor */
+       char *get_vtt_name();
+       virtual const char *get_name(); 
        
        /* For Mouse and MIDI Mapping */
        protected:
@@ -384,7 +384,9 @@ class tX_seqpar_vttfx : public tX_seqpar_update
        
        private:
        virtual void create_widget();
-        virtual const char *get_name();        
+       
+       public:
+       virtual const char *get_name();         
 };
 
 class tX_seqpar_vttfx_float : public tX_seqpar_vttfx
index 3c0f3d7582e0211fd10fd9e7e181b9db179c64a4..685a8318635147090e60e54e2c6aca0f59d5e1fd 100644 (file)
@@ -230,45 +230,24 @@ void tX_sequencer :: delete_all_events_for_sp(tX_seqpar *sp)
 #endif                         
 }
 
-void tX_sequencer :: save(FILE *out)
-{
+void tX_sequencer :: save(FILE *rc, char *indent) {
        guint32 event_count;
        list <tX_event *> :: iterator song_event;
        
        event_count=song_list.size();
-       
-       fwrite((void *) &event_count,  sizeof(event_count), 1, out);
-       
-       for (song_event=song_list.begin(); song_event!=song_list.end(); song_event++)
-       {
-               (*song_event)->store(out);
-       }
-}
 
-void tX_sequencer :: load(FILE *in)
-{
-       guint32 event_count=0;
-       guint32 i;
-       tX_event *new_event=NULL;
-       
-       clear();
+       fprintf(rc, "%s<sequencer>\n", indent);
+       strcat(indent, "\t");
        
-       fread ((void *) &event_count, sizeof(event_count), 1, in);
-       
-       max_timestamp=0;
-       
-       for (i=0; i<event_count; i++)
-       {
-               new_event=new tX_event(in);
-               song_list.push_back(new_event);
+       for (song_event=song_list.begin(); song_event!=song_list.end(); song_event++) {
+               (*song_event)->store(rc, indent);
        }
        
-       start_timestamp=0;
-       current_timestamp=0;
-       
-       if (new_event) max_timestamp=new_event->get_timestamp();
+       indent[strlen(indent)-1]=0;
+       fprintf(rc, "%s</sequencer>\n", indent);
 }
 
+
 void tX_sequencer :: clear()
 {
        if (song_list.size()==0) return;
@@ -335,3 +314,22 @@ 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) {
+       tX_event *ev=NULL;
+       
+       max_timestamp=0;
+       
+       for (xmlNodePtr cur=node->xmlChildrenNode; cur!=NULL; cur=cur->next) {
+               if (cur->type == XML_ELEMENT_NODE) {
+                       if (xmlStrcmp(cur->name, (xmlChar *) "event")==0) {
+                               ev=new tX_event(doc, cur);
+                               song_list.push_back(ev);
+                       } else {
+                               tX_warning("unhandled sequencer element %s.", cur->name);
+                       }
+               }
+       }
+       
+       start_timestamp=0;
+       current_timestamp=0;
+}
index 34be046c34a4d2c41767739efc24dd56c8dd711c..ab33406969c5ff5cb3268030433a463a7ba052ef 100644 (file)
@@ -34,6 +34,9 @@
 #define TX_SEQMODE_PLAYONLY 1
 #define TX_SEQMODE_PLAYREC  0
 
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+
 class tX_sequencer
 {
        private:
@@ -78,8 +81,11 @@ class tX_sequencer
        
        void delete_all_events_for_sp(tX_seqpar *sp);
        
-       void save(FILE *);
+       void save(FILE *, char *indent);
+#ifdef ENABLE_TX_LEGACY        
        void load(FILE *);
+#endif 
+       void load(xmlDocPtr, xmlNodePtr);
        void clear();
        
        guint32 set_start_timestamp(float pos);
index f345454c8693355a4e93cdf4b082bd72c3fa98b2..ae1a703f549e002118aa12b03504b5bd290d3db4 100644 (file)
@@ -25,7 +25,7 @@
                 
     08 Dec 1999 - Switched to the new audiofile class           
 */    
-   
+
 #include "tX_vtt.h"
 #include "tX_global.h"
 #include <stdio.h>
@@ -43,7 +43,6 @@
 #include "3dnow.h"
 #endif
 
-
 #ifdef DEBUG
 #define tX_freemem(ptr, varname, comment); fprintf(stderr, "** free() [%s] at %08x. %s.\n", varname, ptr, comment); free(ptr);
 #define tX_malloc(ptr, varname, comment, size, type); fprintf(stderr, "**[1/2] malloc() [%s]. Size: %i. %s.\n", varname, size, comment); ptr=type malloc(size); fprintf(stderr, "**[2/2] malloc() [%s]. ptr: %08x.\n", varname, ptr);
@@ -72,6 +71,9 @@ extern void gui_update_display(vtt_class *vtt);
 extern void gui_clear_master_button(vtt_class *vtt);
 extern void cleanup_vtt(vtt_class *vtt);
 extern int vg_get_current_page(vtt_class *vtt);
+extern f_prec gui_get_audio_x_zoom(vtt_class *vtt);
+extern void gui_set_audio_x_zoom(vtt_class *vtt, f_prec);
+
 
 int vtt_class::vtt_amount=0;
 list <vtt_class *> vtt_class::main_list;
@@ -335,7 +337,6 @@ void vtt_class :: set_pan(f_prec newpan)
 void vtt_class :: set_pitch(f_prec newpitch)
 {
        rel_pitch=newpitch;
-//     res_pitch=fabs(globals.pitch)*rel_pitch;
        res_pitch=globals.pitch*rel_pitch;
        speed=res_pitch;
        ec_set_length(ec_length);
@@ -343,7 +344,6 @@ void vtt_class :: set_pitch(f_prec newpitch)
 
 void vtt_class :: recalc_pitch()
 {
-//     res_pitch=fabs(globals.pitch)*rel_pitch;
        res_pitch=globals.pitch*rel_pitch;
        res_pitch*=audiofile_pitch_correction;
        speed=res_pitch;
@@ -1548,1002 +1548,328 @@ void vtt_class :: xy_input(f_prec x_value, f_prec y_value)
 
 #define store(data); if (fwrite((void *) &data, sizeof(data), 1, output)!=1) res+=1;
 
-int  vtt_class :: save(FILE * output)
-{
+int  vtt_class :: save(FILE *rc, char *indent) {
        list <vtt_fx *> :: iterator effect;
 
        int res=0;
-       guint32 pid;
-       int32_t counter;
-       guint8 hidden;
-       
-       store(name);
-       store(filename);
-       store(is_sync_master);
-       store(is_sync_client);
-       store(sync_cycles);
-       store(rel_volume);
-       store(rel_pitch);
-       
-       store(autotrigger);
-       store(loop);
-       
-       store(mute);
-       store(pan);
-       
-       store(lp_enable);
-       store(lp_gain);
-       store(lp_reso);
-       store(lp_freq);
-       
-       store(ec_enable);
-       store(ec_length);
-       store(ec_feedback);
-       store(ec_pan);
-       store(ec_volume);
-       
-       store(audio_hidden);
-       store(control_hidden);
-
-       pid=sp_speed.get_persistence_id();
-       store(pid);
-       pid=sp_volume.get_persistence_id();
-       store(pid);
-       pid=sp_pitch.get_persistence_id();
-       store(pid);
-       pid=sp_trigger.get_persistence_id();
-       store(pid);
-       pid=sp_loop.get_persistence_id();
-       store(pid);
-       pid=sp_sync_client.get_persistence_id();
-       store(pid);
-       pid=sp_sync_cycles.get_persistence_id();
-       store(pid);
-       pid=sp_lp_enable.get_persistence_id();
-       store(pid);
-       pid=sp_lp_gain.get_persistence_id();
-       store(pid);
-       pid=sp_lp_reso.get_persistence_id();
-       store(pid);
-       pid=sp_lp_freq.get_persistence_id();
-       store(pid);
-       pid=sp_ec_enable.get_persistence_id();
-       store(pid);
-       pid=sp_ec_length.get_persistence_id();
-       store(pid);
-       pid=sp_ec_feedback.get_persistence_id();
-       store(pid);
-       pid=sp_ec_volume.get_persistence_id();
-       store(pid);
-       pid=sp_ec_pan.get_persistence_id();
-       store(pid);
-       pid=sp_mute.get_persistence_id();
-       store(pid);
-       pid=sp_spin.get_persistence_id();
-       store(pid);
-       pid=sp_pan.get_persistence_id();
-       store(pid);
-               
-       counter=fx_list.size();
-       store(counter);
 
-       for (effect=fx_list.begin(); effect!=fx_list.end(); effect++)
-       {
-               (*effect)->save(output);
-       }
+       fprintf(rc, "%s<turntable>\n", indent);
+       strcat(indent, "\t");
        
-       if (x_par)
-       {
-               pid=1;
-               store(pid);
-               pid=x_par->get_persistence_id();
-               store(pid);
-       }
-       else
-       {
-               pid=0;
-               store(pid);
-       }
-
-       if (y_par)
-       {
-               pid=1;
-               store(pid);
-               pid=y_par->get_persistence_id();
-               store(pid);
+       store_string("name", name);
+       if (buffer) {
+               store_string("audiofile", filename);
+       } else {
+               store_string("audiofile", "");
        }
-       else
-       {
-               pid=0;
-               store(pid);
-       }
-               
-       hidden=gui.main_panel->is_hidden();
-       store(hidden);
+       store_bool("sync_master", is_sync_master);
+       store_bool("autotrigger", autotrigger);
+       store_bool_id("loop", loop, sp_loop.get_persistence_id());
 
-       hidden=gui.trigger_panel->is_hidden();
-       store(hidden);
+       store_bool_id("sync_client", is_sync_client, sp_sync_client.get_persistence_id());
+       store_int_id("sync_cycles", sync_cycles, sp_sync_cycles.get_persistence_id());
 
-       hidden=gui.lp_panel->is_hidden();
-       store(hidden);
-
-       hidden=gui.ec_panel->is_hidden();
-       store(hidden);
+       store_float_id("volume", rel_volume, sp_volume.get_persistence_id());
+       store_float_id("pitch", rel_pitch, sp_pitch.get_persistence_id());      
+       store_bool_id("mute", mute, sp_mute.get_persistence_id());
+       store_float_id("pan", pan, sp_pan.get_persistence_id());
        
-       return(res);
-}
+       store_bool_id("lowpass_enable", lp_enable, sp_lp_enable.get_persistence_id());
+       store_float_id("lowpass_gain", lp_gain, sp_lp_gain.get_persistence_id());
+       store_float_id("lowpass_reso", lp_reso, sp_lp_reso.get_persistence_id());
+       store_float_id("lowpass_freq", lp_freq, sp_lp_freq.get_persistence_id());
 
-#define atload(data); if (fread((void *) &data, sizeof(data), 1, input)!=1) res+=1;
-
-int vtt_class :: load_10(FILE * input)
-{
-       int res=0;
-       int obsolete_int;
-       
-       atload(name);
-       atload(filename);
-       atload(is_sync_master);
-       atload(is_sync_client);
-       atload(sync_cycles);
-       atload(rel_volume);
-       recalc_volume();
-       atload(rel_pitch);
-       recalc_pitch();
-       
-       atload(autotrigger);
-       atload(loop);
-       
-       atload(mute);
-       atload(obsolete_int); //x_control
-       atload(obsolete_int); //y_control
+       store_bool_id("echo_enable", ec_enable, sp_ec_enable.get_persistence_id());
+       store_float_id("echo_length", ec_length, sp_ec_length.get_persistence_id());
+       store_float_id("echo_feedback", ec_feedback, sp_ec_feedback.get_persistence_id());
+       store_float_id("echo_pan", ec_pan, sp_ec_pan.get_persistence_id());
+       store_float_id("echo_volume", ec_volume, sp_ec_volume.get_persistence_id());
        
-       atload(lp_enable);
-       atload(lp_gain);
-       atload(lp_reso);
-       atload(lp_freq);
-       lp_setup(lp_gain, lp_reso, lp_freq);
+       store_id("speed", sp_speed.get_persistence_id());
+       store_id("trigger", sp_trigger.get_persistence_id());
+       store_id("spin", sp_spin.get_persistence_id());
+
        
-       atload(ec_enable);
-       atload(ec_length);
-       ec_set_length(ec_length);
-       atload(ec_feedback);
-       ec_set_feedback(ec_feedback);
+       if (x_par) {
+               store_int("x_axis_mapping", x_par->get_persistence_id());
+       }
        
-       return(res);
-}
+       if (y_par) {
+               store_int("y_axis_mapping", y_par->get_persistence_id());
+       }
 
+       store_bool("audio_panel_hidden", audio_hidden);
+       store_bool("control_panel_hidden", control_hidden);
+       store_bool("main_panel_hidden", gui.main_panel->is_hidden());
+       store_bool("trigger_panel_hidden", gui.trigger_panel->is_hidden());
+       store_bool("lowpass_panel_hidden", gui.lp_panel->is_hidden());
+       store_bool("echo_panel_hidden", gui.ec_panel->is_hidden());
 
-int vtt_class :: load_11(FILE * input)
-{
-       int res=0;
-       guint32 pid;
-       int32_t gui_page;
-       int obsolete_int;
-       
-       atload(name);
-       atload(filename);
-       atload(is_sync_master);
-       atload(is_sync_client);
-       atload(sync_cycles);
-       atload(rel_volume);
-       recalc_volume();
-       atload(rel_pitch);
-       recalc_pitch();
+       store_float("audio_x_zoom", gui_get_audio_x_zoom(this));
        
-       atload(autotrigger);
-       atload(loop);
+       fprintf(rc, "%s<fx>\n", indent);
+       strcat(indent, "\t");
        
-       atload(mute);
-       atload(obsolete_int); //x_control
-       atload(obsolete_int); //y_control
+       for (effect=fx_list.begin(); effect!=fx_list.end(); effect++) {
+               (*effect)->save(rc, indent);
+       }
+       indent[strlen(indent)-1]=0;
+       fprintf(rc, "%s</fx>\n", indent);
        
-       atload(lp_enable);
-       atload(lp_gain);
-       atload(lp_reso);
-       atload(lp_freq);
-       lp_setup(lp_gain, lp_reso, lp_freq);
-       
-       atload(ec_enable);
-       atload(ec_length);
-       ec_set_length(ec_length);
-       atload(ec_feedback);
-       ec_set_feedback(ec_feedback);
-
-       atload(pid);
-       sp_speed.set_persistence_id(pid);
-       atload(pid);
-       sp_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_pitch.set_persistence_id(pid);
-       atload(pid);
-       sp_trigger.set_persistence_id(pid);
-       atload(pid);
-       sp_loop.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_client.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_cycles.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_gain.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_reso.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_freq.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_length.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_feedback.set_persistence_id(pid);
-       atload(pid);
-       sp_mute.set_persistence_id(pid);
-       atload(pid);
-       sp_spin.set_persistence_id(pid);
-       
-       atload(gui_page);
+       indent[strlen(indent)-1]=0;
+       fprintf(rc, "%s</turntable>\n", indent);
        
        return(res);
 }
 
-int vtt_class :: load_12(FILE * input)
-{
-       int res=0;
-       guint32 pid;
-       int32_t counter;
-       int32_t type;
-       long id;
-       int i;
-       unsigned int t;
-       LADSPA_Plugin *plugin;
-       char buffer[256];
-       vtt_fx_ladspa *ladspa_effect;
-       guint8 hidden;
-       
-       atload(buffer);
-       this->set_name(buffer);
-       atload(filename);
-       atload(is_sync_master);
-       atload(is_sync_client);
-       atload(sync_cycles);
-       atload(rel_volume);
-       recalc_volume();
-       atload(rel_pitch);
-       recalc_pitch();
-       
-       atload(autotrigger);
-       atload(loop);
-       
-       atload(mute);
-       
-       atload(lp_enable);
-       atload(lp_gain);
-       atload(lp_reso);
-       atload(lp_freq);
-       lp_setup(lp_gain, lp_reso, lp_freq);
-       
-       atload(ec_enable);
-       atload(ec_length);
-       ec_set_length(ec_length);
-       atload(ec_feedback);
-       ec_set_feedback(ec_feedback);
-
-       atload(pid);
-       sp_speed.set_persistence_id(pid);
-       atload(pid);
-       sp_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_pitch.set_persistence_id(pid);
-       atload(pid);
-       sp_trigger.set_persistence_id(pid);
-       atload(pid);
-       sp_loop.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_client.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_cycles.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_gain.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_reso.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_freq.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_length.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_feedback.set_persistence_id(pid);
-       atload(pid);
-       sp_mute.set_persistence_id(pid);
-       atload(pid);
-       sp_spin.set_persistence_id(pid);
-               
-       atload(counter);
-       
-       for (i=0; i<counter; i++)
-       {
-               atload(type);
-               switch(type)
-               {
-                       case TX_FX_BUILTINCUTOFF:
-                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
-                       break;
-                       
-                       case TX_FX_BUILTINECHO:
-                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
-                       break;
-                       
-                       case TX_FX_LADSPA:
-                               atload(id);
-                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
-                               if (plugin)
-                               {
-                                       ladspa_effect=add_effect(plugin);
-                                       ladspa_effect->load(input);
-                               }
-                               else
-                               {
-                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
-                                       tx_note(buffer, true);
-                                       res++;
-                               }
-                       break;
-                       
-                       default:
-                               tx_note("Fatal error loading set: unknown effect type!", true);
-                               res++;
-               }               
-       }
+#define TX_XML_SETFILE_VERSION "1.0"
 
-       atload(pid);
-       
-       if (pid)
-       {
-               atload(pid);
-               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
-       }
-       else set_x_input_parameter(NULL);
-       
-       atload(pid);
-       
-       if (pid)
-       {
-               atload(pid);
-               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
-       }
-       else set_y_input_parameter(NULL);
-
-       atload(hidden);
-       gui.main_panel->hide(hidden);
-
-       atload(hidden);
-       gui.trigger_panel->hide(hidden);
-
-       atload(hidden);
-       gui.lp_panel->hide(hidden);
-
-       atload(hidden);
-       gui.ec_panel->hide(hidden);
+int  vtt_class :: save_all(FILE* rc) {
+       int res=0;
+       list <vtt_class *> :: iterator vtt;
+       char indent[256];
        
-       return(res);
-}
+       tX_seqpar :: create_persistence_ids();
 
-int vtt_class :: load_13(FILE * input)
-{
-       int res=0;
-       guint32 pid;
-       int32_t counter;
-       int32_t type;
-       long id;
-       int i;
-       unsigned int t;
-       LADSPA_Plugin *plugin;
-       char buffer[256];
-       vtt_fx_ladspa *ladspa_effect;
-       guint8 hidden;
-       
-       atload(buffer);
-       this->set_name(buffer);
-       atload(filename);
-       atload(is_sync_master);
-       atload(is_sync_client);
-       atload(sync_cycles);
-       atload(rel_volume);
-       atload(rel_pitch);
-       recalc_pitch();
-       
-       atload(autotrigger);
-       atload(loop);
-       
-       atload(mute);
-       atload(pan);
-       
-       atload(lp_enable);
-       atload(lp_gain);
-       atload(lp_reso);
-       atload(lp_freq);
-       lp_setup(lp_gain, lp_reso, lp_freq);
+       fprintf(rc, "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>\n\n");
+       fprintf(rc, "<terminatorXset version=\"%s\">\n", TX_XML_SETFILE_VERSION);
        
-       atload(ec_enable);
-       atload(ec_length);
-       ec_set_length(ec_length);
-       atload(ec_feedback);
-       ec_set_feedback(ec_feedback);
-       atload(ec_pan);
-       ec_set_pan(ec_pan);
-       atload(ec_volume);
-       ec_set_volume(ec_volume);
+       strcpy(indent, "\t");
 
-       recalc_volume();
+       //store_int(vtt_amount); obsolete
 
-       atload(pid);
-       sp_speed.set_persistence_id(pid);
-       atload(pid);
-       sp_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_pitch.set_persistence_id(pid);
-       atload(pid);
-       sp_trigger.set_persistence_id(pid);
-       atload(pid);
-       sp_loop.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_client.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_cycles.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_gain.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_reso.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_freq.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_length.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_feedback.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_pan.set_persistence_id(pid);
-       atload(pid);
-       sp_mute.set_persistence_id(pid);
-       atload(pid);
-       sp_spin.set_persistence_id(pid);
-       atload(pid);
-       sp_pan.set_persistence_id(pid);
-               
-       atload(counter);
-       
-       for (i=0; i<counter; i++)
-       {
-               atload(type);
-               switch(type)
-               {
-                       case TX_FX_BUILTINCUTOFF:
-                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
-                       break;
-                       
-                       case TX_FX_BUILTINECHO:
-                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
-                       break;
-                       
-                       case TX_FX_LADSPA:
-                               atload(id);
-                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
-                               if (plugin)
-                               {
-                                       ladspa_effect=add_effect(plugin);
-                                       ladspa_effect->load(input);
-                               }
-                               else
-                               {
-                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
-                                       tx_note(buffer, true);
-                                       res++;
-                               }
-                       break;
-                       
-                       default:
-                               tx_note("Fatal error loading set: unknown effect type!", true);
-                               res++;
-               }               
-       }
+       store_float_id("master_volume", master_volume, sp_master_volume.get_persistence_id());
+       store_float_id("master_pitch", globals.pitch, sp_master_pitch.get_persistence_id());
 
-       atload(pid);
-       
-       if (pid)
-       {
-               atload(pid);
-               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       for (vtt=main_list.begin(); vtt!=main_list.end(); vtt++) {
+               res+=(*vtt)->save(rc, indent);
        }
-       else set_x_input_parameter(NULL);
        
-       atload(pid);
+       sequencer.save(rc, indent);
        
-       if (pid)
-       {
-               atload(pid);
-               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
-       }
-       else set_y_input_parameter(NULL);
-
-       atload(hidden);
-       gui.main_panel->hide(hidden);
-
-       atload(hidden);
-       gui.trigger_panel->hide(hidden);
-
-       atload(hidden);
-       gui.lp_panel->hide(hidden);
-
-       atload(hidden);
-       gui.ec_panel->hide(hidden);
+       fprintf(rc, "</terminatorXset>\n");
        
        return(res);
 }
 
-int vtt_class :: load_14(FILE * input)
-{
-       int res=0;
-       guint32 pid;
-       int32_t counter;
-       int32_t type;
-       long id;
-       int i;
-       unsigned int t;
-       LADSPA_Plugin *plugin;
-       char buffer[256];
-       vtt_fx_ladspa *ladspa_effect;
-       guint8 hidden;
-       
-       atload(buffer);
-       this->set_name(buffer);
-       atload(filename);
-       atload(is_sync_master);
-       atload(is_sync_client);
-       atload(sync_cycles);
-       atload(rel_volume);
-       atload(rel_pitch);
-       recalc_pitch();
-       
-       atload(autotrigger);
-       atload(loop);
-       
-       atload(mute);
-       atload(pan);
-       
-       atload(lp_enable);
-       atload(lp_gain);
-       atload(lp_reso);
-       atload(lp_freq);
-       lp_setup(lp_gain, lp_reso, lp_freq);
-       
-       atload(ec_enable);
-       atload(ec_length);
-       ec_set_length(ec_length);
-       atload(ec_feedback);
-       ec_set_feedback(ec_feedback);
-       atload(ec_pan);
-       ec_set_pan(ec_pan);
-       atload(ec_volume);
-       ec_set_volume(ec_volume);
-
-       atload(audio_hidden);
-       atload(control_hidden);
-       
-       recalc_volume();
-
-       atload(pid);
-       sp_speed.set_persistence_id(pid);
-       atload(pid);
-       sp_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_pitch.set_persistence_id(pid);
-       atload(pid);
-       sp_trigger.set_persistence_id(pid);
-       atload(pid);
-       sp_loop.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_client.set_persistence_id(pid);
-       atload(pid);
-       sp_sync_cycles.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_gain.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_reso.set_persistence_id(pid);
-       atload(pid);
-       sp_lp_freq.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_enable.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_length.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_feedback.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_ec_pan.set_persistence_id(pid);
-       atload(pid);
-       sp_mute.set_persistence_id(pid);
-       atload(pid);
-       sp_spin.set_persistence_id(pid);
-       atload(pid);
-       sp_pan.set_persistence_id(pid);
-               
-       atload(counter);
-       
-       for (i=0; i<counter; i++)
-       {
-               atload(type);
-               switch(type)
-               {
-                       case TX_FX_BUILTINCUTOFF:
-                               for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
-                       break;
+int vtt_class :: load(xmlDocPtr doc, xmlNodePtr node) {
+       char buffer[1024];
+       bool hidden;
+       int xpar_id=-1;
+       int ypar_id=-1;
+       int elementFound;
+       char *pid_attr;
+       int pid;
+       double dvalue;
+       double tmp;
+       
+       for (xmlNodePtr cur=node->xmlChildrenNode; cur != NULL; cur = cur->next) {
+               if (cur->type == XML_ELEMENT_NODE) {
+                       elementFound=0;
                        
-                       case TX_FX_BUILTINECHO:
-                               for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
-                       break;
+                       restore_string_ac("name", buffer, set_name(buffer));
+                       restore_string("audiofile", filename);
+                       restore_bool("sync_master", is_sync_master);
+                       restore_bool("autotrigger", autotrigger);
+                       restore_bool_id("loop", loop, sp_loop, nop);
+                       restore_bool_id("sync_client", is_sync_client, sp_sync_client, set_sync_client(is_sync_client, sync_cycles));
+                       restore_int_id("sync_cycles", sync_cycles, sp_sync_cycles, set_sync_client(is_sync_client, sync_cycles));
+                       restore_float_id("volume", rel_volume, sp_volume, recalc_volume());
+                       restore_float_id("pitch", rel_pitch, sp_pitch, recalc_pitch());
+                       restore_bool_id("mute", mute, sp_mute, set_mute(mute));
+                       restore_float_id("pan", pan, sp_pan, set_pan(pan));
+       
+                       restore_bool_id("lowpass_enable", lp_enable, sp_lp_enable, lp_set_enable(lp_enable));
+                       restore_float_id("lowpass_gain", lp_gain, sp_lp_gain, lp_set_gain(lp_gain)); 
+                       restore_float_id("lowpass_reso", lp_reso, sp_lp_reso, lp_set_reso(lp_reso));
+                       restore_float_id("lowpass_freq", lp_freq, sp_lp_freq, lp_set_freq(lp_freq));
+       
+                       restore_bool_id("echo_enable", ec_enable, sp_ec_enable, ec_set_enable(ec_enable));      
+                       restore_float_id("echo_length", ec_length, sp_ec_length, ec_set_length(ec_length));
+                       restore_float_id("echo_feedback", ec_feedback, sp_ec_feedback, ec_set_feedback(ec_feedback));
+                       restore_float_id("echo_pan", ec_pan, sp_ec_pan, ec_set_pan(ec_pan));
+                       restore_float_id("echo_volume", ec_volume, sp_ec_volume, ec_set_volume(ec_volume));             
+               
+                       restore_id("speed", sp_speed);  
+                       restore_id("trigger", sp_trigger);
+                       restore_id("spin", sp_spin);
+       
+                       restore_int("x_axis_mapping", xpar_id);
+                       restore_int("y_axis_mapping", ypar_id);
+       
+                       restore_bool("audio_panel_hidden", audio_hidden);
+                       restore_bool("control_panel_hidden", control_hidden);
+                       restore_bool_ac("main_panel_hidden", hidden, gui.main_panel->hide(hidden));
+                       restore_bool_ac("trigger_panel_hidden", hidden, gui.trigger_panel->hide(hidden));
+                       restore_bool_ac("lowpass_panel_hidden", hidden, gui.lp_panel->hide(hidden));                    
+                       restore_bool_ac("echo_panel_hidden", hidden, gui.ec_panel->hide(hidden));
+                       restore_float_ac("audio_x_zoom", tmp, gui_set_audio_x_zoom(this,tmp));
                        
-                       case TX_FX_LADSPA:
-                               atload(id);
-                               plugin=LADSPA_Plugin::getPluginByUniqueID(id);
-                               if (plugin)
-                               {
-                                       ladspa_effect=add_effect(plugin);
-                                       ladspa_effect->load(input);
-                               }
-                               else
-                               {
-                                       sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
-                                       tx_note(buffer, true);
-                                       res++;
+                       if (xmlStrcmp(cur->name, (xmlChar *) "fx")==0) {
+                               xmlNodePtr fx=cur;
+                               elementFound=1;
+                               
+                               for (xmlNodePtr cur=fx->xmlChildrenNode; cur != NULL; cur = cur->next) {
+                                       if (cur->type == XML_ELEMENT_NODE) {
+                                               int elementFound=0;
+                                               
+                                               if (xmlStrcmp(cur->name, (xmlChar *) "cutoff")==0) {
+                                                       for (unsigned int t=0; t<fx_list.size(); t++) effect_down(lp_fx);
+                                                       elementFound=1;
+                                               } else if (xmlStrcmp(cur->name, (xmlChar *) "lowpass")==0) {
+                                                       for (unsigned int t=0; t<fx_list.size(); t++) effect_down(ec_fx);
+                                                       elementFound=1;                                                         
+                                               } else if (xmlStrcmp(cur->name, (xmlChar *) "ladspa_plugin")==0) {
+                                                       xmlNodePtr pluginNode=cur;
+                                                       int ladspa_id=-1;
+                                                       elementFound=1;
+                                                       
+                                                       for (xmlNodePtr cur=pluginNode->xmlChildrenNode; cur!=NULL; cur = cur->next) {
+                                                               int elementFound;
+                                                               if (cur->type == XML_ELEMENT_NODE) {
+                                                                       elementFound=0;
+
+                                                                       restore_int("ladspa_id", ladspa_id);
+                                                                       if (elementFound) break;
+                                                               }
+                                                       }
+                                                       
+                                                       if (ladspa_id!=-1) {
+                                                               LADSPA_Plugin *plugin=LADSPA_Plugin::getPluginByUniqueID(ladspa_id);
+                                                               if (plugin) {
+                                                                       vtt_fx_ladspa *ladspa_effect=add_effect(plugin);
+                                                                       ladspa_effect->load(doc, pluginNode);
+                                                               } else {
+                                                                       sprintf(buffer,"The terminatorX set file you are loading makes use of a LADSPA plugin that is not installed on this machine. The plugin's ID is [%i].", ladspa_id);
+                                                                       tx_note(buffer, true);                                                  
+                                                               }
+                                                       } else {
+                                                               tX_warning("ladspa_plugin section without a ladspa_id element.");
+                                                       }
+                                                       
+                                               } else {
+                                                       tX_warning("unhandled element %s in fx section.", cur->name);
+                                               }
+                                       }
                                }
-                       break;
+                       }
                        
-                       default:
-                               tx_note("Fatal error loading set: unknown effect type!", true);
-                               res++;
-               }               
+                       if(!elementFound) {
+                               tX_warning("unhandled element %s in turntable secion.", cur->name);
+                       }
+               }
        }
 
-       atload(pid);
-       
-       if (pid)
-       {
-               atload(pid);
-               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       recalc_volume();
+
+       if (xpar_id>=0) {
+               set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(xpar_id));
        }
        else set_x_input_parameter(NULL);
        
-       atload(pid);
-       
-       if (pid)
-       {
-               atload(pid);
-               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
+       if (ypar_id) {
+               set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(ypar_id));
        }
        else set_y_input_parameter(NULL);
-
-       atload(hidden);
-       gui.main_panel->hide(hidden);
-
-       atload(hidden);
-       gui.trigger_panel->hide(hidden);
-
-       atload(hidden);
-       gui.lp_panel->hide(hidden);
-
-       atload(hidden);
-       gui.ec_panel->hide(hidden);
-       
-       return(res);
+               
+       return 0;
 }
 
 
-int  vtt_class :: save_all(FILE* output)
-{
+int vtt_class :: load_all(xmlDocPtr doc, char *fname) {
+       xmlNodePtr root=xmlDocGetRootElement(doc);
+       int elementFound=0;
+       char fn_buff[4096];
+       double dvalue;
        int res=0;
-       list <vtt_class *> :: iterator vtt;
-       guint32 pid;
-       
-       tX_seqpar :: create_persistence_ids();
-       
-       store(vtt_amount);
-       store(master_volume);
-       store(globals.pitch);
-       pid=sp_master_volume.get_persistence_id();
-       store(pid);
-       pid=sp_master_pitch.get_persistence_id();
-       store(pid);
-
-       for (vtt=main_list.begin(); vtt!=main_list.end(); vtt++)
-       {
-               res+=(*vtt)->save(output);
-       }
-       
-       sequencer.save(output);
-       
-       return(res);
-}
+       int restmp=0;
+       char *pid_attr;
+       int pid;
 
-int  vtt_class :: load_all_10(FILE* input, char *fname)
-{
-       int res=0, restmp=0;
-       unsigned int i, max;
-       vtt_class *newvtt;
-       char ftmp[PATH_MAX];
        
-       while (main_list.size())
-       {
-               delete((*main_list.begin()));
-       }
-               
-       atload(max);
-       atload(master_volume);
-       set_master_volume(master_volume);
-       globals.volume=master_volume;
-       atload(globals.pitch);  
-       set_master_pitch(globals.pitch);
-
-       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
-       ld_set_setname(fname);
-
-       for (i=0; i<max; i++)
-       {
-               newvtt=new vtt_class(1);
-               res+=newvtt->load_10(input);
-               
-               if (strlen(newvtt->filename))
-               {
-                       /* ftmp IS NECESSARY !!! */
-                       strcpy(ftmp, newvtt->filename);
-                       ld_set_filename(ftmp);
-                       
-                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
-                       restmp=(int) newvtt->load_file(ftmp);
-                       res+=restmp;
-               }
-               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
-               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
+       if (!root) {
+               tX_error("no root element? What kind of XML document is this?");
+               return 1;
        }
        
-       sequencer.clear();
-       
-       ld_destroy();
-       
-       return(res);
-}
-
-
-int  vtt_class :: load_all_11(FILE* input, char *fname)
-{
-       int res=0, restmp=0;
-       unsigned int i, max;
-       vtt_class *newvtt;
-       char ftmp[PATH_MAX];
-       guint32 pid;
-       
-       while (main_list.size())
-       {
-               delete((*main_list.begin()));
-       }
-               
-       atload(max);
-       atload(master_volume);
-       set_master_volume(master_volume);
-       globals.volume=master_volume;
-       atload(globals.pitch);  
-       set_master_pitch(globals.pitch);
-       atload(pid);
-       sp_master_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_master_pitch.set_persistence_id(pid);
-
-       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
-       ld_set_setname(fname);
-
-       for (i=0; i<max; i++)
-       {
-               newvtt=new vtt_class(1);
-               res+=newvtt->load_11(input);
-               
-               if (strlen(newvtt->filename))
-               {
-                       /* ftmp IS NECESSARY !!! */
-                       strcpy(ftmp, newvtt->filename);
-                       ld_set_filename(ftmp);
-                       
-                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
-                       restmp=(int) newvtt->load_file(ftmp);
-                       res+=restmp;
-               }
-               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
-               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
-               
+       if (xmlStrcmp(root->name, (const xmlChar *) "terminatorXset")) {
+               tX_error("this is not a terminatorXset file.")
+               return 2;
        }
        
-       sequencer.load(input);
-       
-       ld_destroy();
+       if (xmlGetProp(root,(xmlChar *) "version")==NULL) {
+               tX_error("the set file lacks a version attribute.");
+               return 3;
+       }
        
-       return(res);
-}
-
-
-int  vtt_class :: load_all_12(FILE* input, char *fname)
-{
-       int res=0, restmp=0;
-       unsigned int i, max;
-       vtt_class *newvtt;
-       char ftmp[PATH_MAX];
-       guint32 pid;
+       if (xmlStrcmp(xmlGetProp(root, (xmlChar *) "version"), (xmlChar *) TX_XML_SETFILE_VERSION)) {
+               tX_warning("this set file is version %s - while this releases uses version %s - trying to load anyway.", xmlGetProp(root, (xmlChar *) "version"), TX_XML_SETFILE_VERSION);
+       }
        
-       while (main_list.size())
-       {
+       /* delete current tables... */
+       while (main_list.size()) {
                delete((*main_list.begin()));
        }
-               
-       atload(max);
-       atload(master_volume);
-       set_master_volume(master_volume);
-       globals.volume=master_volume;
-       atload(globals.pitch);  
-       set_master_pitch(globals.pitch);
-       atload(pid);
-       sp_master_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_master_pitch.set_persistence_id(pid);
-
-       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
-       ld_set_setname(fname);
 
-       for (i=0; i<max; i++)
-       {
-               newvtt=new vtt_class(1);
-               res+=newvtt->load_12(input);
-               
-               if (strlen(newvtt->filename))
-               {
-                       /* ftmp IS NECESSARY !!! */
-                       strcpy(ftmp, newvtt->filename);
-                       ld_set_filename(ftmp);
-                       
-                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
-                       restmp=(int) newvtt->load_file(ftmp);
-                       res+=restmp;
+       int table_ctr=0;
+       
+       /* counting turntables.. */
+       for (xmlNodePtr cur=root->xmlChildrenNode; cur != NULL; cur = cur->next) {
+               if (cur->type == XML_ELEMENT_NODE) {    
+                       if (xmlStrcmp(cur->name, (xmlChar *) "turntable")==0) {
+                               table_ctr++;
+                       }
                }
-               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
-               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
-               
        }
-       
-       sequencer.load(input);
-       
-       ld_destroy();
-       
-       return(res);
-}
 
-int  vtt_class :: load_all_13(FILE* input, char *fname)
-{
-       int res=0, restmp=0;
-       unsigned int i, max;
-       vtt_class *newvtt;
-       char ftmp[PATH_MAX];
-       guint32 pid;
-       
-       while (main_list.size())
-       {
-               delete((*main_list.begin()));
-       }
-               
-       atload(max);
-       atload(master_volume);
-       set_master_volume(master_volume);
-       globals.volume=master_volume;
-       atload(globals.pitch);  
-       set_master_pitch(globals.pitch);
-       atload(pid);
-       sp_master_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_master_pitch.set_persistence_id(pid);
-
-       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
+       tX_debug("Found %i turntables in set.",  table_ctr);
+
+       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, table_ctr);
        ld_set_setname(fname);
 
-       for (i=0; i<max; i++)
-       {
-               newvtt=new vtt_class(1);
-               res+=newvtt->load_13(input);
+       /* parsing all */
+       for (xmlNodePtr cur=root->xmlChildrenNode; cur != NULL; cur = cur->next) {
+               if (cur->type == XML_ELEMENT_NODE) {                    
+                       elementFound=0;
                
-               if (strlen(newvtt->filename))
-               {
-                       /* ftmp IS NECESSARY !!! */
-                       strcpy(ftmp, newvtt->filename);
-                       ld_set_filename(ftmp);
+                       restore_float_id("master_volume", master_volume, sp_master_volume, set_master_volume(master_volume));
+                       restore_float_id("master_pitch", globals.pitch, sp_master_pitch, set_master_pitch(globals.pitch));
                        
-                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
-                       restmp=(int) newvtt->load_file(ftmp);
-                       res+=restmp;
-               }
-               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
-               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
-               
-       }
-       
-       sequencer.load(input);
-       
-       ld_destroy();
-       
-       return(res);
-}
+                       if ((!elementFound) && (xmlStrcmp(cur->name, (xmlChar *) "turntable")==0)) {
+                               elementFound=1;
+                               vtt_class *vtt=new vtt_class(1);
+                               vtt->load(doc, cur);
+                               
+                               tX_debug("loading a turntable..");
 
-int  vtt_class :: load_all_14(FILE* input, char *fname)
-{
-       int res=0, restmp=0;
-       unsigned int i, max;
-       vtt_class *newvtt;
-       char ftmp[PATH_MAX];
-       guint32 pid;
+                               if (strlen(vtt->filename)) {
+                                       strcpy(fn_buff, vtt->filename);
+                                       ld_set_filename(fn_buff);
+                               
+                                       restmp=(int) vtt->load_file(fn_buff);
+                                       res+=restmp;
+                               }
        
-       while (main_list.size())
-       {
-               delete((*main_list.begin()));
-       }
-               
-       atload(max);
-       atload(master_volume);
-       set_master_volume(master_volume);
-       globals.volume=master_volume;
-       atload(globals.pitch);  
-       set_master_pitch(globals.pitch);
-       atload(pid);
-       sp_master_volume.set_persistence_id(pid);
-       atload(pid);
-       sp_master_pitch.set_persistence_id(pid);
-
-       ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
-       ld_set_setname(fname);
-
-       for (i=0; i<max; i++)
-       {
-               newvtt=new vtt_class(1);
-               res+=newvtt->load_14(input);
-               
-               if (strlen(newvtt->filename))
-               {
-                       /* ftmp IS NECESSARY !!! */
-                       strcpy(ftmp, newvtt->filename);
-                       ld_set_filename(ftmp);
-                       
-                       //restmp=load_wav(newvtt->filename, &newbuffer, &size);
-                       restmp=(int) newvtt->load_file(ftmp);
-                       res+=restmp;
+                               gtk_box_pack_start(GTK_BOX(control_parent), vtt->gui.control_box, TRUE, TRUE, 0);
+                               gtk_box_pack_start(GTK_BOX(audio_parent), vtt->gui.audio_box, TRUE, TRUE, 0);
+                               if (vtt->audio_hidden) vtt->hide_audio(vtt->audio_hidden);
+                               if (vtt->control_hidden) vtt->hide_control(vtt->control_hidden);\r
+                       }
+                       if ((!elementFound) && (xmlStrcmp(cur->name, (xmlChar *) "sequencer")==0)) {
+                               elementFound=1;
+                               sequencer.load(doc, cur);
+                       }
+                       if (!elementFound) {
+                               tX_warning("unhandled element %s in setfile %s", cur->name, fname);
+                       }
                }
-               gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
-               gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
-           if (newvtt->audio_hidden) newvtt->hide_audio(newvtt->audio_hidden);
-           if (newvtt->control_hidden) newvtt->hide_control(newvtt->control_hidden);\r
        }
        
-       sequencer.load(input);
-       
        ld_destroy();
        
        return(res);
 }
 
-
 void add_vtt(GtkWidget *ctrl, GtkWidget *audio, char *fn)
 {
        vtt_class *hmmpg;
index fe98a5890d1da2a3f8a8ca482c076dbdf1f3dd84..239d8c651b9148fc2420f9cc69f7d2c05af5f53d 100644 (file)
@@ -57,6 +57,8 @@
 #define SAMPLE_MAX    32760.0
 #define SAMPLE_BORDER 30000.0
 
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
 
 class vtt_class
 {
@@ -90,18 +92,18 @@ class vtt_class
        
        /* the gui */
        vtt_gui gui;
-       int have_gui;
+       bool have_gui;
        
        /* main object vars */
        char name[256]; // Turntable's name
        char filename[PATH_MAX]; // The corresponding audiofile
        
        int is_playing;
-       int is_sync_master;
-       int is_sync_client;
+       bool is_sync_master;
+       bool is_sync_client;
        int sync_cycles;
        int sync_countdown;
-       int want_stop;
+       bool want_stop;
        int sense_cycles;
        
        bool control_hidden;
@@ -148,18 +150,18 @@ class vtt_class
        d_prec speed_last;
        int fade_in;
        int fade_out;
-       int do_mute;
+       bool do_mute;
                
        d_prec pos_f;
        unsigned int pos_i;
        d_prec maxpos;
        
-       int mute;
-       int res_mute;
-       int res_mute_old;
+       bool mute;
+       bool res_mute;
+       bool res_mute_old;
        
-       int mix_mute;
-       int mix_solo;
+       bool mix_mute;
+       bool mix_solo;
        int fade;
        
        /* seq par mapping for x/y axis */
@@ -287,7 +289,12 @@ class vtt_class
        int stop();
        int stop_nolock();
        
-       int save(FILE *);
+       int save(FILE *, char *indent);
+       static int save_all(FILE *);
+       int load(xmlDocPtr, xmlNodePtr);
+       static int load_all(xmlDocPtr doc, char *fname);
+
+#ifdef ENABLE_TX_LEGACY
        int load_10(FILE *);
        int load_11(FILE *);
        int load_12(FILE *);
@@ -299,7 +306,8 @@ class vtt_class
        static int load_all_12(FILE *, char *fname); /* fname is for display only*/
        static int load_all_13(FILE *, char *fname); /* fname is for display only*/
        static int load_all_14(FILE *, char *fname); /* fname is for display only*/
-       static int save_all(FILE *);
+#endif 
+       
        tX_audio_error load_file(char *name);   
 
        void render_scratch();
index e5e92ed3d97c362dd3cab65bc36d2b1423546ce6..5351783ed2f2459159759ac4207433f10b19cb7f 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib.h>
 #include "tX_vtt.h"
 #define myvtt ((vtt_class *) vtt)
+#include "tX_global.h"
 
 float ladspa_dummy_output_port;
 
@@ -45,8 +46,7 @@ void vtt_fx :: run ()
        fprintf(stderr, "tX: Oops: run() abstract vtt_fx?");
 }
 
-void vtt_fx :: save (FILE *output)
-{
+void vtt_fx :: save (FILE *output, char *indent) {
        fprintf(stderr, "tX: Oops: run() abstract vtt_fx?");
 }
 
@@ -74,10 +74,9 @@ void vtt_fx_lp :: activate() { myvtt->lp_reset(); }
 void vtt_fx_lp :: deactivate() { /* NOP */ }
 void vtt_fx_lp :: run() { myvtt->render_lp(); }
 int vtt_fx_lp :: isEnabled() { return myvtt->lp_enable; }
-void vtt_fx_lp :: save (FILE *output)
-{ 
-       guint32 type=TX_FX_BUILTINCUTOFF;
-       fwrite((void *) &type, sizeof(type), 1, output);
+
+void vtt_fx_lp :: save (FILE *output, char *indent) { 
+       fprintf(output, "%s<cutoff/>\n", indent);
 }
 
 const char *vtt_fx_lp :: get_info_string()
@@ -91,10 +90,9 @@ void vtt_fx_ec :: activate() { /* NOP */ }
 void vtt_fx_ec :: deactivate() { myvtt->ec_clear_buffer(); }
 void vtt_fx_ec :: run() { myvtt->render_ec(); }
 int vtt_fx_ec :: isEnabled() { return myvtt->ec_enable; }
-void vtt_fx_ec :: save (FILE *output)
-{ 
-       guint32 type=TX_FX_BUILTINECHO;
-       fwrite((void *) &type, sizeof(type), 1, output);
+
+void vtt_fx_ec :: save (FILE *output, char *indent) { 
+       fprintf(output, "%s<lowpass/>\n", indent);      
 }
 
 const char *vtt_fx_ec :: get_info_string()
@@ -283,59 +281,64 @@ vtt_fx_ladspa :: ~vtt_fx_ladspa()
 }
 
 
-void vtt_fx_ladspa :: save (FILE *output)
-{
+void vtt_fx_ladspa :: save (FILE *rc, char *indent) {
        long ID=plugin->getUniqueID();
        list <tX_seqpar_vttfx *> :: iterator sp;
-       guint32 pid;
-       guint32 type=TX_FX_LADSPA;
-       guint32 count;
-       guint8 hidden;
-       float value;
-       
-       fwrite((void *) &type, sizeof(type), 1, output);
        
-       fwrite((void *) &ID, sizeof(ID), 1, output);
+       fprintf(rc, "%s<ladspa_plugin>\n", indent);
+       strcat (indent, "\t");
        
-       count=controls.size();
-       fwrite((void *) &count, sizeof(count), 1, output);
+       store_int("ladspa_id", ID);
        
-       for (sp=controls.begin(); sp!=controls.end(); sp++)
-       {
-               pid=(*sp)->get_persistence_id();
-               fwrite((void *) &pid, sizeof(pid), 1, output);
-               value=(*sp)->get_value();
-               fwrite((void *) &value, sizeof(value), 1, output);
+       for (sp=controls.begin(); sp!=controls.end(); sp++) {
+               store_float_id("param", (*sp)->get_value(), (*sp)->get_persistence_id());
        }
        
-       hidden=panel->is_hidden();
-       fwrite((void *) &hidden, sizeof(hidden), 1, output);
+       store_bool("panel_hidden", panel->is_hidden());
+       
+       indent[strlen(indent)-1]=0;
+       fprintf(rc, "%s</ladspa_plugin>\n", indent);
 }
 
-void vtt_fx_ladspa :: load (FILE *input)
-{
-       guint32 count;
-       unsigned int i;
-       list <tX_seqpar_vttfx *> :: iterator sp;
-       guint32 pid;
-       guint8 hidden;
-       float value;
-       
-       fread((void *) &count, sizeof(count), 1, input);
+void vtt_fx_ladspa :: load(xmlDocPtr doc, xmlNodePtr node) {
+       int dummy;
+       bool hidden;
+       list <tX_seqpar_vttfx *> :: iterator sp=controls.begin();
+       int elementFound;
+       guint32 pid=0;
+       double val;
        
-       if (count!=controls.size())
-       {
-               fprintf(stderr, "tX: Ouch! Plugin %li has less/more controls than saved!\n", plugin->getUniqueID());
+       for (xmlNodePtr cur=node->xmlChildrenNode; cur!=NULL; cur=cur->next) {
+               if (cur->type == XML_ELEMENT_NODE) {
+                       elementFound=0;
+                       
+                       restore_int("ladspa_id", dummy);
+                       restore_bool("hidden", hidden);
+                       if ((!elementFound) && (xmlStrcmp(cur->name, (xmlChar *) "param")==0)) {
+                               val=0;
+                               elementFound=1;
+                       
+                               if (sp==controls.end()) {
+                                       tX_warning("found unexpected parameters for ladspa plugin [%i].", dummy);
+                               } else {                        
+                                       char *buff=(char *) xmlGetProp(cur, (xmlChar *) "id");
+                                       sscanf(buff, "%i", &pid);
+                       
+                                       if  (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {
+                                               sscanf((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &val); 
+                                       }
+                                       (*sp)->set_persistence_id(pid);
+                                       (*sp)->do_exec(val);
+                                       (*sp)->do_update_graphics();
+                                       sp++;
+                               }
+                       }
+                       
+                       if (!elementFound) {
+                               tX_warning("unhandled ladspa_plugin element %s.", cur->name);
+                       }
+               }
        }
        
-       for (i=0, sp=controls.begin(); (i<count) && (sp!=controls.end()); i++, sp++) {
-               fread((void *) &pid, sizeof(pid), 1, input);
-               (*sp)->set_persistence_id(pid);
-               fread((void *) &value, sizeof(value), 1, input);
-               (*sp)->do_exec(value);
-               (*sp)->do_update_graphics();
-       } 
-       
-       fread((void *) &hidden, sizeof(hidden), 1, input);
        panel->hide(hidden);
 }
index 9c4f491ec42bbabc065ed2998c151a584bd40999..2f833028517d623bd7300a72e7e4cc85eda34045 100644 (file)
@@ -38,6 +38,9 @@
 #define TX_FX_BUILTINECHO 2
 #define TX_FX_LADSPA 3
 
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+
 /* abstract super class vtt_fx */
 
 class vtt_fx
@@ -61,7 +64,7 @@ class vtt_fx
        
        virtual const char *get_info_string();
        
-       virtual void save(FILE *output);
+       virtual void save(FILE *output, char *indent);
        
        GtkWidget* get_panel_widget() { return panel_widget; }
        void set_panel_widget(GtkWidget *widget) { panel_widget=widget; }
@@ -82,7 +85,7 @@ class vtt_fx_lp : public vtt_fx
        virtual void run();     
        virtual int isEnabled();
 
-       virtual void save(FILE *output);
+       virtual void save(FILE *output, char *indent);
        virtual const char *get_info_string();
 };
 
@@ -95,7 +98,7 @@ class vtt_fx_ec : public vtt_fx
        virtual void run();     
        virtual int isEnabled();
 
-       virtual void save(FILE *output);
+       virtual void save(FILE *output, char *indent);
        virtual const char *get_info_string();  
 };
 
@@ -123,8 +126,11 @@ class vtt_fx_ladspa : public vtt_fx
        virtual int isEnabled();
        virtual void reconnect_buffer();
        virtual const char *get_info_string();  
-       virtual void save(FILE *output);
-       virtual void load(FILE *input);
+       virtual void save(FILE *output, char *indent);
+#ifdef ENABLE_TX_LEGACY        
+       virtual void load(FILE *);
+#endif 
+       virtual void load(xmlDocPtr, xmlNodePtr);
 };
 
 #endif
index 693016afb01d0f32e9d84cfc148af4a4aa70ccdb..7bb927ca609b98d811ff047c019ab19255816d30 100644 (file)
@@ -1361,3 +1361,9 @@ void vg_init_all_non_seqpars()
        }       
 }
 
+f_prec gui_get_audio_x_zoom(vtt_class *vtt) {
+       return gtk_tx_get_zoom(GTK_TX(vtt->gui.display));
+}
+extern void gui_set_audio_x_zoom(vtt_class *vtt, f_prec value) {
+       gtk_tx_set_zoom(GTK_TX(vtt->gui.display), value);
+}
index 755f4e3fe8f1013cde865b016720a8bc1cd25a55..beb363891402a4d82a2f6441ee97dd523792d8d9 100644 (file)
@@ -141,7 +141,6 @@ GtkWidget *gtk_tx_new(int16_t * wavdata, int wavsamples) {
        tx->data = wavdata;
        tx->samples = wavsamples;
        tx->zoom=0;
-       tx->zoom_scale=1;
        tx->display_x_offset=0;
        
        return GTK_WIDGET(tx);
@@ -209,12 +208,10 @@ static void gtk_tx_size_request(GtkWidget * widget, GtkRequisition * requisition
 
 static void gtk_tx_prepare(GtkWidget * widget) {
        int x, sample;
-       f_prec temp;
        int16_t *ptr;
        f_prec value;
        GtkTx *tx;
        int avg_pos;
-       double scale;
        
        g_return_if_fail(widget != NULL);
        g_return_if_fail(GTK_IS_TX(widget));
@@ -313,7 +310,7 @@ static void gtk_tx_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
 
 static gint gtk_tx_expose(GtkWidget * widget, GdkEventExpose * event) {
        GtkTx *tx;
-       gint x, pos;
+       gint x;
        GdkRectangle *area;
        
        g_return_val_if_fail(widget != NULL, FALSE);
@@ -379,7 +376,7 @@ void gtk_tx_update_pos_display(GtkTx * tx, int sample, int mute) {
        GdkWindow *window;
        GdkGC *gc;
 
-       int current_x, x, y, yc, ymax, tmp;
+       int x, y, yc, ymax, tmp;
        int current_pos, current_pos_x, x_offset;
        int force_draw=0;
 
@@ -469,7 +466,7 @@ void gtk_tx_cleanup_pos_display(GtkTx * tx) {
        GtkWidget *widget;
        GdkWindow *window;
        GdkGC *gc;
-       int x, y, ymax, yc;
+       int ymax, yc;
 
        widget = GTK_WIDGET(tx);
        window = widget->window;
@@ -497,3 +494,7 @@ void gtk_tx_show_frame(GtkTx *tx, int show) {
        
        gtk_widget_queue_draw(GTK_WIDGET(tx));  
 }
+
+f_prec gtk_tx_get_zoom(GtkTx *tx) {
+       return tx->zoom;
+}
index 20b4ff940afde824b25e6e100a41d799aa0de3a2..0ba8a670826dfb1147ce495df2dd4d55ecf1c731 100644 (file)
@@ -74,7 +74,6 @@ struct _GtkTx {
        GtkWidget *peer_scale;
        
        f_prec zoom;
-       f_prec zoom_scale;
                
        int cursor_pos;
        int cursor_x_pos;
@@ -99,6 +98,7 @@ void gtk_tx_cleanup_pos_display (GtkTx *tx);
 void   gtk_tx_update_pos_display  (GtkTx *tx, int sample, int mute);
 void gtk_tx_show_frame(GtkTx *tx, int show);
 void gtk_tx_set_zoom(GtkTx *tx, f_prec zoom);
+f_prec gtk_tx_get_zoom(GtkTx *tx);
 
 #ifdef __cplusplus
 }