2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2004 Alexander König
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 Description: Header to tX_global.c / defines the heavily used
26 21 Jul 1999: Introduced the lowpass globals.
34 #endif /* __cplusplus */
44 // JACK clips with true 16 Bit MAX...
45 #define FL_SHRT_MAX 32765.0 // 32767.0
46 #define FL_SHRT_MIN -32765.0 // -32768.0
48 #define BUTTON_TYPE_ICON 1
49 #define BUTTON_TYPE_TEXT 2
50 #define BUTTON_TYPE_BOTH 3
58 #ifdef ENABLE_DEBUG_OUTPUT
59 #define tX_debug(fmt, args...); { fprintf(stderr, "~ tX_debug: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
61 #define tX_debug(fmt, args...);
64 #define tX_error(fmt, args...); { fprintf(stderr, "* tX_error: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
65 #define tX_warning(fmt, args...); { fprintf(stderr, "+ tX_warning: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
66 #define tX_msg(fmt, args...); { fprintf(stderr, "- tX_msg: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
67 #define tX_plugin_warning(fmt, args...); { if (globals.verbose_plugin_loading) { fprintf(stderr, "+ tX_warning: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }}
70 #define tX_freemem(ptr, varname, comment); fprintf(stderr, "** free() [%s] at %08x. %s.\n", varname, ptr, comment); free(ptr);
71 #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);
73 #define tX_freemem(ptr, varname, comment); free(ptr);
74 #define tX_malloc(ptr, varname, comment, size, type); ptr=type malloc(size);
81 } tX_audiodevice_type;
85 char xinput_device[256];
87 int store_globals; // if it should store the globals vals on exit
89 char *alternate_rc; // a diferent set of stored globals to load
90 int no_gui; // run without any gui
102 char last_fn[PATH_MAX];
105 int use_stdout_cmdline;
106 int use_stdout_from_conf_file;
116 char tables_filename[PATH_MAX];
117 char record_filename[PATH_MAX];
120 float flash_response;
124 char file_editor[PATH_MAX];
128 char current_path[PATH_MAX];
130 /* new audiodevice handling
131 we have *all* variables for *all* audiodevice types -
132 even if support for them is not compiled in - to keep
133 the .terminatorX3rc.bin in sync.
136 tX_audiodevice_type audiodevice_type; // TX_AUDIODEVICE_TYPE_OSS etc.
138 /* OSS specific options */
139 char oss_device[PATH_MAX];
141 int oss_buff_size; // 2^X Bytes
144 /* ALSA specific options */
145 char alsa_device_id[PATH_MAX];
146 int alsa_buffer_time;
147 int alsa_period_time;
150 char lrdf_path[PATH_MAX];
152 int compress_set_files;
154 int fullscreen_enabled;
159 int alsa_free_hwstats;
162 int restore_midi_connections;
164 char wav_display_bg_focus[8];
165 char wav_display_bg_no_focus[8];
167 char wav_display_fg_focus[8];
168 char wav_display_fg_no_focus[8];
170 char wav_display_cursor[8];
171 char wav_display_cursor_mute[8];
174 char vu_meter_loud[8];
175 char vu_meter_normal[8];
176 double vu_meter_border_intensity;
180 int auto_assign_midi;
182 int verbose_plugin_loading;
183 int force_nonrt_plugins;
186 extern tx_global globals;
188 extern void load_globals();
189 extern void store_globals();
190 extern void set_global_defaults();
191 extern char *encode_xml(char *dest, const char *src);
192 extern char *decode_xml(char *dest, const char *src);
196 /* some ugly XML macros... */
197 #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); }}
198 #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;}}
199 #define restore_string(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {strcpy(i, decode_xml(tmp_xml_buffer, (const char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1))); }}
200 #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; }}
201 #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); }}
203 #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; }}
204 #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; }}
205 #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, decode_xml(tmp_xml_buffer, (const char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1))); init; }}
206 #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; }}
208 //#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; }}
209 //#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; }}
210 //#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; }}
212 extern int _store_compress_xml;
214 #define tX_store(fmt, args...); { _store_compress_xml ? gzprintf(rz, fmt , ## args) : fprintf(rc, fmt , ## args); }
216 #define store_int(s, i); tX_store("%s<%s>%i</%s>\n", indent, s,(int) i, s);
217 #define store_float(s, i); tX_store((sizeof(i)>4) ? "%s<%s>%lf</%s>\n" : "%s<%s>%f</%s>\n", indent, s, i, s);
218 #define store_string(s, i); tX_store("%s<%s>%s</%s>\n", indent, s, encode_xml(tmp_xml_buffer, i) , s);
219 #define store_bool(s, i); tX_store("%s<%s>%s</%s>\n", indent, s, i ? "true" : "false", s);
221 #define store_id(s, id); tX_store("%s<%s id=\"%i\"/>\n", indent, s, id);
222 #define store_int_id(s, i, id); tX_store("%s<%s id=\"%i\">%i</%s>\n", indent, s, id, (int) i, s);
223 #define store_float_id(s, i, id); tX_store((sizeof(i)>4) ? "%s<%s id=\"%i\">%lf</%s>\n" : "%s<%s id=\"%i\">%f</%s>\n", indent, s, id, i, s);
224 #define store_bool_id(s, i, id); tX_store("%s<%s id=\"%i\">%s</%s>\n", indent, s, id, i ? "true" : "false", s);
226 #define store_int_sp(name, i, sp); { tX_store("%s<%s ", indent, name); sp.store_meta(rc, rz); tX_store(">%i</%s>\n", (int) i, name); }
227 #define store_float_sp(name, i, sp); { tX_store("%s<%s ", indent, name); sp.store_meta(rc, rz); tX_store((sizeof(i)>4) ? ">%lf</%s>\n" : ">%f</%s>\n" , i, name); }
228 #define store_bool_sp(name, i, sp); { tX_store("%s<%s ", indent, name); sp.store_meta(rc, rz); tX_store(">%s</%s>\n", i ? "true" : "false", name); }
230 #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); init; } sp.restore_meta(cur); }
231 #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; init; } sp.restore_meta(cur);}
232 #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; init; } sp.restore_meta(cur);}
236 #endif /* __cplusplus */