2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2002 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: This implements the gtk+ GUI for the virtual turntable
22 class implemented in tX_vtt.cc. This code is not in tX_vtt.cc
23 for mainly to keep the GUI code divided from the audio-rendering
24 code and as gtk+ callback to C++ method call wrapper.
28 before 11-26-2001: too many changes.
30 11-26-2001: applied Adrian's solo/mute patch - Alex
32 11-27-2001: modified solo/mute to use the set_mix_mute/solo function
33 of the vtts. The previous approach messed up the sequencer
34 and more. Removed some old unnecessary code, too.
39 #include "tX_vttgui.h"
41 #include "tX_widget.h"
42 #include "tX_mastergui.h"
43 #include "tX_loaddlg.h"
44 #include "tX_prelis.h"
45 #include "tX_pbutton.h"
46 #include "tX_global.h"
47 #include "tX_extdial.h"
49 #include "tX_ladspa.h"
60 #define WID_DYN TRUE, TRUE, 0
61 #define WID_FIX FALSE, FALSE, 0
63 #define FILENAME_BUTTON_MAX 20
65 void nicer_filename(char *dest, char *source)
70 fn=strrchr(source, '/');
76 fn=strrchr(temp, '.');
79 if (strlen(temp) > FILENAME_BUTTON_MAX)
81 temp[FILENAME_BUTTON_MAX-3]='.';
82 temp[FILENAME_BUTTON_MAX-2]='.';
83 temp[FILENAME_BUTTON_MAX-1]='.';
84 temp[FILENAME_BUTTON_MAX]=0;
89 void name_changed(GtkWidget *wid, vtt_class *vtt)
91 vtt->set_name((char *) gtk_entry_get_text(GTK_ENTRY(wid)));
94 void volume_changed(GtkWidget *wid, vtt_class *vtt)
96 vtt->sp_volume.receive_gui_value(2.0-GTK_ADJUSTMENT(wid)->value);
99 void pan_changed(GtkWidget *wid, vtt_class *vtt)
101 vtt->sp_pan.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
104 void pitch_changed(GtkWidget *wid, vtt_class *vtt)
106 vtt->sp_pitch.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
109 GtkSignalFunc trigger_prelis(GtkWidget *w)
111 GtkFileSelection *fs;
113 fs=GTK_FILE_SELECTION(gtk_widget_get_toplevel(w));
115 prelis_start((char *) gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
119 void cancel_load_file(GtkWidget *wid, vtt_class *vtt)
123 vtt->gui.file_dialog=NULL;
124 if (vtt->gui.fs) gtk_widget_destroy(GTK_WIDGET(vtt->gui.fs));
127 int quit_load_file(GtkWidget *wid, vtt_class *vtt)
132 char global_filename_buffer[PATH_MAX];
134 void load_part(char *newfile, vtt_class *vtt)
136 tX_audio_error ret=TX_AUDIO_SUCCESS;
138 ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
139 ld_set_filename(newfile);
141 ret = vtt->load_file(newfile);
148 case TX_AUDIO_ERR_ALLOC:
149 tx_note("Failed to load audiofile - there's not enough memory available.", true);
151 case TX_AUDIO_ERR_PIPE_READ:
152 tx_note("An error occured on reading from the piped process - probably the file format of the audiofile is not supported by this configuration - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.", true);
154 case TX_AUDIO_ERR_SOX:
155 tx_note("Failed to run sox - to load the given audiofile please ensure that sox is installed correctly.", true);
157 case TX_AUDIO_ERR_MPG123:
158 tx_note("Failed to run mpg123 - to load the given mp3 file please ensure that mpg123 (or mpg321) is installed correctly.", true);
160 case TX_AUDIO_ERR_WAV_NOTFOUND:
161 tx_note("Couldn't acces the audiofile - file not found.", true);
163 case TX_AUDIO_ERR_NOT_16BIT:
164 tx_note("The wav file doesn't use 16 bit wide samples - please compile terminatorX with libaudiofile support to enable loading of such files.", true);
166 case TX_AUDIO_ERR_NOT_MONO:
167 tx_note("The wav file is not mono - please compile terminatorX with libaudiofile support to enable loading of such files.", true);
169 case TX_AUDIO_ERR_WAV_READ:
170 tx_note("The wav file seems to be corrupt.", true);
172 case TX_AUDIO_ERR_NOT_SUPPORTED:
173 tx_note("The file format of the audiofile is not supported - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.", true);
175 case TX_AUDIO_ERR_MAD_OPEN:
176 tx_note("Failed to open this mp3 file - please ensure that the file exists and is readable.", true);
178 case TX_AUDIO_ERR_MAD_STAT:
179 tx_note("Failed to 'stat' this mp3 file - please ensure that the file exists and is readable.", true);
181 case TX_AUDIO_ERR_MAD_DECODE:
182 tx_note("Failed to decode the mp3 stream - file is corrupt.", true);
184 case TX_AUDIO_ERR_MAD_MMAP:
185 tx_note("Failed to map the audiofile to memory - please ensure the file is readable.", true);
187 case TX_AUDIO_ERR_MAD_MUNMAP:
188 tx_note("Failed to unmap audiofile.", true);
190 case TX_AUDIO_ERR_VORBIS_OPEN:
191 tx_note("Failed to open ogg file - please ensure the file is an ogg stream and that it is readable.", true);
193 case TX_AUDIO_ERR_VORBIS_NODATA:
194 tx_note("The vorbis codec failed to decode any data - possibly this ogg stream is corrupt.", true);
196 case TX_AUDIO_ERR_AF_OPEN:
197 tx_note("Failed to open this file with libaudiofile - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.",true);
199 case TX_AUDIO_ERR_AF_NODATA:
200 tx_note("libaudiofile failed to decode any data - possilby the audiofile is corrupt.", true);
203 tx_note("An unknown error occured - if this bug is reproducible please report it, thanks.", true);
208 nicer_filename(global_filename_buffer, newfile);
210 gtk_button_set_label(GTK_BUTTON(vtt->gui.file), global_filename_buffer);
212 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), global_filename_buffer);
217 void do_load_file(GtkWidget *wid, vtt_class *vtt)
219 char newfile[PATH_MAX];
223 strcpy(newfile, gtk_file_selection_get_filename(GTK_FILE_SELECTION(vtt->gui.fs)));
224 gtk_widget_destroy(GTK_WIDGET(vtt->gui.fs));
226 load_part(newfile, vtt);
228 if (!globals.current_path)
230 free(globals.current_path);
231 globals.current_path = NULL;
234 globals.current_path = strdup(newfile);
236 vtt->gui.file_dialog=NULL;
239 void drop_file(GtkWidget *widget, GdkDragContext *context,
240 gint x, gint y, GtkSelectionData *selection_data,
241 guint info, guint time, vtt_class *vtt)
243 char filename[PATH_MAX];
246 strncpy(filename, (char *) selection_data->data, (size_t) selection_data->length);
247 gtk_drag_finish(context, TRUE, FALSE, time);
248 filename[selection_data->length]=0;
250 fn = strchr (filename, '\r');
257 realfn=g_filename_from_uri(filename, &host, NULL);
262 fn = strchr (filename, ':');
263 if (fn) fn++; else fn=(char *) selection_data->data;
268 load_part(realfn, vtt);
271 if (realfn) g_free(realfn);
272 if (host) g_free(host);
277 GtkSignalFunc load_file(GtkWidget *wid, vtt_class *vtt)
281 if (vtt->gui.file_dialog)
283 gdk_window_raise(vtt->gui.file_dialog);
287 sprintf(buffer, "Select Audio File for %s", vtt->name);
288 vtt->gui.fs=gtk_file_selection_new(buffer);
290 if (strlen(vtt->filename) > 0)
292 gtk_file_selection_set_filename(GTK_FILE_SELECTION(vtt->gui.fs), vtt->filename);
295 gtk_widget_show(GTK_WIDGET(vtt->gui.fs));
297 vtt->gui.file_dialog=vtt->gui.fs->window;
299 if (globals.current_path)
301 gtk_file_selection_set_filename(GTK_FILE_SELECTION(vtt->gui.fs),globals.current_path);
303 gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_load_file), vtt);
304 gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_load_file), vtt);
305 gtk_signal_connect (GTK_OBJECT(vtt->gui.fs), "delete-event", GTK_SIGNAL_FUNC(quit_load_file), vtt);
307 gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "cursor_changed", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
309 gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "select_row", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
314 void delete_vtt(GtkWidget *wid, vtt_class *vtt)
316 if (audioon) tx_note("Sorry, you'll have to stop playback first.");
321 void edit_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
323 char command[2*PATH_MAX];
325 if (vtt->samples_in_buffer == 0)
327 tx_note("No audiofile loaded - so there's nothing to edit.", true);
330 if (strlen(globals.file_editor)>0)
332 sprintf(command, "%s \"%s\" &", globals.file_editor, vtt->filename);
333 system(command); /*) tx_note("Failed to run the soundfile editor."); */
337 tx_note("No soundfile editor has been configured - to do so enter the soundfile editor of your choice in the options dialog.", true);
341 void reload_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
343 char reload_buffer[PATH_MAX];
345 while (gtk_events_pending()) gtk_main_iteration();
347 if (vtt->samples_in_buffer > 0)
349 strcpy(reload_buffer, vtt->filename);
350 load_part(reload_buffer, vtt);
352 else tx_note("No audiofile loaded - so there's nothing to reload.", true);
355 void clone_vtt(GtkWidget *wid, vtt_class *vtt)
360 void trigger_vtt(GtkWidget *wid, vtt_class *vtt)
362 vtt->sp_trigger.receive_gui_value((float) 1.0);
365 void stop_vtt(GtkWidget *wid, vtt_class *vtt)
367 vtt->sp_trigger.receive_gui_value((float) 0.0);
370 void autotrigger_toggled(GtkWidget *wid, vtt_class *vtt)
372 vtt->set_autotrigger(GTK_TOGGLE_BUTTON(wid)->active);
375 void loop_toggled(GtkWidget *wid, vtt_class *vtt)
377 vtt->sp_loop.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
380 void lp_enabled(GtkWidget *wid, vtt_class *vtt)
382 vtt->sp_lp_enable.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
385 void lp_gain_changed(GtkWidget *wid, vtt_class *vtt)
387 vtt->sp_lp_gain.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
390 void lp_reso_changed(GtkWidget *wid, vtt_class *vtt)
392 vtt->sp_lp_reso.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
395 void lp_freq_changed(GtkWidget *wid, vtt_class *vtt)
397 vtt->sp_lp_freq.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
400 void ec_enabled(GtkWidget *wid, vtt_class *vtt)
402 vtt->sp_ec_enable.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
405 void ec_length_changed(GtkWidget *wid, vtt_class *vtt)
407 vtt->sp_ec_length.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
410 void ec_feedback_changed(GtkWidget *wid, vtt_class *vtt)
412 vtt->sp_ec_feedback.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
415 void ec_pan_changed(GtkWidget *wid, vtt_class *vtt)
417 vtt->sp_ec_pan.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
420 void ec_volume_changed(GtkWidget *wid, vtt_class *vtt)
422 vtt->sp_ec_volume.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
425 void master_setup(GtkWidget *wid, vtt_class *vtt)
427 vtt->set_sync_master(GTK_TOGGLE_BUTTON(wid)->active);
430 void client_setup(GtkWidget *wid, vtt_class *vtt)
434 client=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vtt->gui.sync_client));
435 vtt->sp_sync_client.receive_gui_value(client);
438 void client_setup_number(GtkWidget *wid, vtt_class *vtt)
442 cycles=(int) GTK_ADJUSTMENT(vtt->gui.cycles)->value;
444 vtt->sp_sync_cycles.receive_gui_value(cycles);
447 void mute_volume(GtkWidget *widget, vtt_class *vtt)
449 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
451 vtt->set_mix_mute(1);
455 vtt->set_mix_mute(0);
459 void solo_vtt(GtkWidget *widget, vtt_class *vtt)
461 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
463 vtt->set_mix_solo(1);
467 vtt->set_mix_solo(0);
471 void minimize_control_panel(GtkWidget *wid, vtt_class *vtt)
473 vtt->hide_control(true);
476 void unminimize_control_panel(GtkWidget *wid, vtt_class *vtt)
478 vtt->hide_control(false);
481 void minimize_audio_panel(GtkWidget *wid, vtt_class *vtt)
483 vtt->hide_audio(true);
486 void unminimize_audio_panel(GtkWidget *wid, vtt_class *vtt)
488 vtt->hide_audio(false);
491 void vg_xcontrol_dis(GtkWidget *wid, vtt_class *vtt)
493 vtt->set_x_input_parameter(NULL);
496 void vg_ycontrol_dis(GtkWidget *wid, vtt_class *vtt)
498 vtt->set_y_input_parameter(NULL);
501 void vg_xcontrol_set(GtkWidget *wid, tX_seqpar *sp)
503 vtt_class *vtt=(vtt_class *) sp->vtt;
504 vtt->set_x_input_parameter(sp);
507 void vg_ycontrol_set(GtkWidget *wid, tX_seqpar *sp)
509 vtt_class *vtt=(vtt_class *) sp->vtt;
510 vtt->set_y_input_parameter(sp);
513 void vg_mouse_mapping_pressed(GtkWidget *wid, vtt_class *vtt) {
514 if (vtt->gui.mouse_mapping_menu) {
515 gtk_widget_destroy(vtt->gui.mouse_mapping_menu);
516 vtt->gui.mouse_mapping_menu=NULL;
518 /* gtk+ seems to cleanup the submenus automatically */
520 vtt->gui.mouse_mapping_menu=gtk_menu_new();
524 x_item=gtk_menu_item_new_with_label("X-axis (Left <-> Right)");
525 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu), x_item);
526 gtk_widget_show(x_item);
528 y_item=gtk_menu_item_new_with_label("Y-axis (Up <-> Down)");
529 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu), y_item);
530 gtk_widget_show(y_item);
532 vtt->gui.mouse_mapping_menu_x=gtk_menu_new();
533 vtt->gui.mouse_mapping_menu_y=gtk_menu_new();
536 GtkWidget *item_to_activate=NULL;
538 /* Filling the X menu */
539 item = gtk_check_menu_item_new_with_label("Disable");
540 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu_x), item);
541 gtk_widget_show(item);
542 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_xcontrol_dis), vtt);
543 if (vtt->x_par==NULL) item_to_activate=item;
545 list <tX_seqpar *> :: iterator sp;
547 for (sp=tX_seqpar::all.begin(); sp!=tX_seqpar::all.end(); sp++) {
548 if (((*sp)->is_mappable) && ((*sp)->vtt) == (void*) vtt) {
549 item=gtk_check_menu_item_new_with_label((*sp)->get_name());
550 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu_x), item);
551 gtk_widget_show(item);
552 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_xcontrol_set), (void*) (*sp));
554 if (vtt->x_par==(*sp)) item_to_activate=item;
558 if (item_to_activate) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_to_activate), TRUE);
560 /* Filling the Y menu */
561 item_to_activate=NULL;
563 item = gtk_check_menu_item_new_with_label("Disable");
564 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu_y), item);
565 gtk_widget_show(item);
566 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_ycontrol_dis), vtt);
567 if (vtt->y_par==NULL) item_to_activate=item;
569 for (sp=tX_seqpar::all.begin(); sp!=tX_seqpar::all.end(); sp++) {
570 if (((*sp)->is_mappable) && ((*sp)->vtt) == (void*) vtt) {
571 item=gtk_check_menu_item_new_with_label((*sp)->get_name());
572 gtk_menu_append(GTK_MENU(vtt->gui.mouse_mapping_menu_y), item);
573 gtk_widget_show(item);
574 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_ycontrol_set), (void*) (*sp));
576 if (vtt->y_par==(*sp)) item_to_activate=item;
580 if (item_to_activate) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_to_activate), TRUE);
582 gtk_menu_item_set_submenu(GTK_MENU_ITEM(x_item), vtt->gui.mouse_mapping_menu_x);
583 gtk_menu_item_set_submenu(GTK_MENU_ITEM(y_item), vtt->gui.mouse_mapping_menu_y);
585 gtk_menu_popup (GTK_MENU(vtt->gui.mouse_mapping_menu), NULL, NULL, NULL, NULL, 0, 0);
588 /* gtk+ is really waiting for this.. */
589 gtk_signal_emit_by_name(GTK_OBJECT(wid), "released", vtt);
593 void vg_file_button_pressed(GtkWidget *wid, vtt_class *vtt) {
594 if (vtt->gui.file_menu==NULL) {
597 vtt->gui.file_menu=gtk_menu_new();
598 item=gtk_menu_item_new_with_label("Load audio file");
599 gtk_menu_append(GTK_MENU(vtt->gui.file_menu), item);
600 gtk_widget_show(item);
602 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(load_file), vtt);
604 item=gtk_menu_item_new_with_label("Edit audio file");
605 gtk_menu_append(GTK_MENU(vtt->gui.file_menu), item);
606 gtk_widget_show(item);
608 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(edit_vtt_buffer), vtt);
610 item=gtk_menu_item_new_with_label("Reload current audio file");
611 gtk_menu_append(GTK_MENU(vtt->gui.file_menu), item);
612 gtk_widget_show(item);
614 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(reload_vtt_buffer), vtt);
617 gtk_menu_popup(GTK_MENU(vtt->gui.file_menu), NULL, NULL, NULL, NULL, 0,0);
620 /* gtk+ is really waiting for this.. */
621 gtk_signal_emit_by_name(GTK_OBJECT(wid), "released", vtt);
626 static vtt_class * fx_vtt;
628 void new_effect(GtkWidget *wid, LADSPA_Plugin *plugin)
630 fx_vtt->add_effect(plugin);
633 void fx_button_pressed(GtkWidget *wid, vtt_class *vtt)
635 vtt_gui *g=&vtt->gui;
638 LADSPA_Plugin *plugin;
640 char oldfile[1024]="";
641 GtkWidget *submenu=NULL;
643 fx_vtt=vtt; /* AAAAARGH - Long live ugly code */
645 if (g->ladspa_menu) gtk_object_destroy(GTK_OBJECT(g->ladspa_menu));
646 g->ladspa_menu=gtk_menu_new();
648 for (i=0; i<LADSPA_Plugin::getPluginCount(); i++)
650 plugin=LADSPA_Plugin::getPluginByIndex(i);
651 if (strcmp(plugin->get_file_name(), oldfile))
653 strcpy(oldfile, plugin->get_file_name());
654 item = gtk_menu_item_new_with_label(oldfile);
655 submenu=gtk_menu_new();
656 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
657 gtk_menu_append(GTK_MENU(g->ladspa_menu), item);
658 gtk_widget_show(item);
660 sprintf(buffer, "%s - [%li, %s]", plugin->getName(), plugin->getUniqueID(), plugin->getLabel());
661 item=gtk_menu_item_new_with_label(buffer);
662 gtk_menu_append(GTK_MENU(submenu), item);
663 gtk_widget_show(item);
664 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(new_effect), plugin);
667 gtk_menu_popup (GTK_MENU(g->ladspa_menu), NULL, NULL, NULL, NULL, 0, 0);
670 /* gtk+ is really waiting for this.. */
671 gtk_signal_emit_by_name(GTK_OBJECT(wid), "released", vtt);
675 #define connect_entry(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "activate", (GtkSignalFunc) func, (void *) vtt);
676 #define connect_adj(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "value_changed", (GtkSignalFunc) func, (void *) vtt);
677 #define connect_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "clicked", (GtkSignalFunc) func, (void *) vtt);
680 #define connect_press_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "pressed", (GtkSignalFunc) func, (void *) vtt);
682 /* "pressed" then pop-up doesn't work with gtk 1.2
683 and the well-known gdk hack doesn't support an additional vtt pointer..
685 #define connect_press_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "clicked", (GtkSignalFunc) func, (void *) vtt);
688 #define connect_rel_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "released", (GtkSignalFunc) func, (void *) vtt);
690 GtkWidget *vg_create_fx_bar(vtt_class *vtt, vtt_fx *effect, int showdel);
692 void gui_connect_signals(vtt_class *vtt)
694 vtt_gui *g=&vtt->gui;
696 connect_entry(name, name_changed);
697 connect_adj(volume, volume_changed);
698 connect_adj(pitch, pitch_changed);
699 connect_adj(pan, pan_changed);
700 connect_press_button(file, vg_file_button_pressed);
702 connect_button(del, delete_vtt);
703 connect_button(trigger, trigger_vtt);
704 connect_button(stop, stop_vtt);
705 connect_button(autotrigger, autotrigger_toggled);
706 connect_button(loop, loop_toggled);
707 connect_button(sync_master, master_setup);
708 connect_button(sync_client, client_setup);
709 connect_adj(cycles, client_setup_number);
710 connect_press_button(fx_button, fx_button_pressed);
712 connect_button(lp_enable, lp_enabled);
713 connect_adj(lp_gain, lp_gain_changed);
714 connect_adj(lp_reso, lp_reso_changed);
715 connect_adj(lp_freq, lp_freq_changed);
717 connect_button(ec_enable, ec_enabled);
718 connect_adj(ec_length, ec_length_changed);
719 connect_adj(ec_feedback, ec_feedback_changed);
720 connect_adj(ec_pan, ec_pan_changed);
721 connect_adj(ec_volume, ec_volume_changed);
722 connect_press_button(mouse_mapping, vg_mouse_mapping_pressed);
723 connect_button(control_minimize, minimize_control_panel);
724 connect_button(audio_minimize, minimize_audio_panel);
726 static GtkTargetEntry drop_types [] = {
727 { "text/uri-list", 0, 0}
729 static gint n_drop_types = sizeof (drop_types) / sizeof(drop_types[0]);
731 gtk_drag_dest_set (GTK_WIDGET (g->file), (GtkDestDefaults) (GTK_DEST_DEFAULT_MOTION |GTK_DEST_DEFAULT_HIGHLIGHT |GTK_DEST_DEFAULT_DROP),
732 drop_types, n_drop_types,
735 gtk_signal_connect (GTK_OBJECT (g->file), "drag_data_received",
736 GTK_SIGNAL_FUNC(drop_file), (void *) vtt);
738 gtk_drag_dest_set (GTK_WIDGET (g->display), (GtkDestDefaults) (GTK_DEST_DEFAULT_MOTION |GTK_DEST_DEFAULT_HIGHLIGHT |GTK_DEST_DEFAULT_DROP),
739 drop_types, n_drop_types,
742 gtk_signal_connect (GTK_OBJECT (g->display), "drag_data_received",
743 GTK_SIGNAL_FUNC(drop_file), (void *) vtt);
747 void build_vtt_gui(vtt_class *vtt)
753 char nice_name[FILENAME_BUTTON_MAX];
762 /* Building Audio Box */
763 g->audio_box=gtk_vbox_new(FALSE,2);
764 gtk_widget_show(g->audio_box);
766 tempbox2=gtk_hbox_new(FALSE,2);
767 gtk_widget_show(tempbox2);
768 gtk_box_pack_start(GTK_BOX(g->audio_box), tempbox2, WID_FIX);
770 tempbox=gtk_hbox_new(TRUE,2);
771 gtk_widget_show(tempbox);
772 gtk_box_pack_start(GTK_BOX(tempbox2), tempbox, WID_DYN);
775 g->audio_minimize=gtk_button_new();
776 pixmap=tx_pixmap_widget(TX_ICON_MINIMIZE_PANEL);
777 gtk_container_add (GTK_CONTAINER (g->audio_minimize), pixmap);
778 gtk_box_pack_end(GTK_BOX(tempbox2), g->audio_minimize, WID_FIX);
779 gtk_widget_show(pixmap);
780 gtk_widget_show(g->audio_minimize);
783 g->audio_label=gtk_label_new(vtt->name);
784 gtk_misc_set_alignment(GTK_MISC(g->audio_label), 0.025, 0.5);
785 gtk_widget_show(g->audio_label);
786 gtk_box_pack_start(GTK_BOX(tempbox), g->audio_label, WID_DYN);
788 nicer_filename(nice_name, vtt->filename);
789 g->file = gtk_button_new_with_label(nice_name);
790 gtk_widget_show(g->file);
791 gui_set_tooltip(g->file, "Click to Load/Edit/Reload a sample for this turntable. To load you can also drag a file and drop it over this button or the sound data display below.");
792 gtk_box_pack_start(GTK_BOX(tempbox), g->file, WID_DYN);
794 g->mouse_mapping=gtk_button_new_with_label("Mouse Mapping");
795 gtk_widget_show(g->mouse_mapping);
796 gui_set_tooltip(g->mouse_mapping, "Determines what parameters should be affected on mouse moition in mouse grab mode.");
798 gtk_box_pack_start(GTK_BOX(tempbox), g->mouse_mapping, WID_DYN);
800 g->display=gtk_tx_new(vtt->buffer, vtt->samples_in_buffer);
801 gtk_box_pack_start(GTK_BOX(g->audio_box), g->display, WID_DYN);
802 gtk_widget_show(g->display);
804 /* Building Control Box */
806 g->control_box=gtk_vbox_new(FALSE,2);
807 gtk_widget_show(g->control_box);
809 tempbox2=gtk_hbox_new(FALSE, 2);
810 gtk_widget_show(tempbox2);
811 gtk_box_pack_start(GTK_BOX(g->control_box), tempbox2, WID_FIX);
813 g->control_label=gtk_label_new(vtt->name);
814 gtk_widget_show(g->control_label);
815 gtk_box_pack_start(GTK_BOX(tempbox2), g->control_label, WID_DYN);
817 g->control_minimize=gtk_button_new();
818 pixmap=tx_pixmap_widget(TX_ICON_MINIMIZE_PANEL);
819 gtk_container_add (GTK_CONTAINER (g->control_minimize), pixmap);
820 gtk_box_pack_end(GTK_BOX(tempbox2), g->control_minimize, WID_FIX);
821 gtk_widget_show(pixmap);
822 gtk_widget_show(g->control_minimize);
824 g->scrolled_win=gtk_scrolled_window_new (NULL, NULL);
825 gtk_container_set_border_width (GTK_CONTAINER (g->scrolled_win), 0);
826 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (g->scrolled_win),
827 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
828 gtk_widget_show(g->scrolled_win);
829 gtk_box_pack_start(GTK_BOX(g->control_box), g->scrolled_win, WID_DYN);
831 g->control_subbox=gtk_vbox_new(FALSE,0);
832 gtk_scrolled_window_add_with_viewport (
833 GTK_SCROLLED_WINDOW (g->scrolled_win), g->control_subbox);
834 gtk_widget_show(g->control_subbox);
839 tX_panel *p=new tX_panel("Main", g->control_subbox);
842 g->name = gtk_entry_new_with_max_length(256);
843 gtk_entry_set_text(GTK_ENTRY(g->name), vtt->name);
844 p->add_client_widget(g->name);
845 gui_set_tooltip(g->name, "Enter the turntable's name here.");
846 gtk_widget_set_usize(g->name, 40, g->name->requisition.height);
848 g->del=gtk_button_new_with_label("Delete");
849 gui_set_tooltip(g->del, "Click here to annihilate this turntable. All events recorded for this turntable will be erased, too.");
850 p->add_client_widget(g->del);
852 gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
854 p=new tX_panel("Trigger", g->control_subbox);
857 g->trigger=gtk_button_new_with_label("Trigger!");
858 gui_set_tooltip(g->trigger, "Click here to trigger this turntable right now. If the audio engine is disabled this turntable will be triggerd as soon as the engine is turned on.");
859 p->add_client_widget(g->trigger);
861 g->stop=gtk_button_new_with_label("Stop.");
862 gui_set_tooltip(g->stop, "Stop this turntable's playback.");
863 p->add_client_widget(g->stop);
865 g->autotrigger=gtk_check_button_new_with_label("Auto");
866 p->add_client_widget(g->autotrigger);
867 gui_set_tooltip(g->autotrigger, "If turned on, this turntable will be automagically triggered whenever the audio engine is turned on.");
868 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autotrigger), vtt->autotrigger);
870 g->loop=gtk_check_button_new_with_label("Loop");
871 p->add_client_widget(g->loop);
872 gui_set_tooltip(g->loop, "Enable this option to make the turntable loop the audio data.");
873 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->loop), vtt->loop);
875 g->sync_master=gtk_check_button_new_with_label("Master");
876 p->add_client_widget(g->sync_master);
877 gui_set_tooltip(g->sync_master, "Click here to make this turntable the sync-master. All turntables marked as sync-clients will be (re-)triggered in relation to the sync-master. Note that only *one* turntable can be the sync-master.");
878 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->sync_master), vtt->is_sync_master);
880 g->sync_client=gtk_check_button_new_with_label("Client");
881 p->add_client_widget(g->sync_client);
882 gui_set_tooltip(g->sync_client, "If enabled this turntable will be (re-)triggerd in relation to the sync-master turntable.");
883 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->sync_client), vtt->is_sync_client);
885 g->cycles=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->sync_cycles, 0, 10.0, 1,1,1));
886 dummy=gtk_spin_button_new(g->cycles, 1.0, 0);
887 p->add_client_widget(dummy);
888 gui_set_tooltip(dummy, "Determines how often a sync-client turntable gets triggered. 0 -> this turntable will be triggered with every trigger of the sync-master table, 1 -> the table will be triggered every 2nd master trigger and so on.");
890 gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
892 dummy=gtk_button_new_with_label("FX");
893 gtk_widget_show(dummy);
895 gui_set_tooltip(g->fx_button, "Click here to load a LADSPA plugin. You will get a menu from which you can choose which plugin to load.");
896 gtk_box_pack_start(GTK_BOX(g->control_subbox), dummy, WID_FIX);
900 p=new tX_panel("Lowpass", g->control_subbox);
903 g->lp_enable=gtk_check_button_new_with_label("Enable");
904 gui_set_tooltip(g->lp_enable, "Click here to enable the built-in lowpass effect.");
905 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->lp_enable), vtt->lp_enable);
906 p->add_client_widget(vg_create_fx_bar(vtt, vtt->lp_fx, 0));
908 p->add_client_widget(g->lp_enable);
910 g->lp_gain=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_gain, 0, 2, 0.1, 0.01, 0.01));
911 g->lp_reso=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_reso, 0, 0.99, 0.1, 0.01, 0.01));
912 g->lp_freq=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_freq, 0, 1, 0.1, 0.01, 0.01));
914 g->lp_gaind=new tX_extdial("Input Gain", g->lp_gain);
915 p->add_client_widget(g->lp_gaind->get_widget());
916 gui_set_tooltip(g->lp_gaind->get_entry(), "Adjust the input gain. with this parameter you can either amplify or damp the input-signal for the lowpass effect.");
918 g->lp_freqd=new tX_extdial("Frequency", g->lp_freq);
919 p->add_client_widget(g->lp_freqd->get_widget());
920 gui_set_tooltip(g->lp_freqd->get_entry(), "Adjust the cutoff frequency of the lowpass filter. 0 is 0 Hz, 1 is 22.1 kHz.");
922 g->lp_resod=new tX_extdial("Resonance", g->lp_reso);
923 p->add_client_widget(g->lp_resod->get_widget());
924 gui_set_tooltip(g->lp_resod->get_entry(), "Adjust the resonance of the lowpass filter. This value determines how much the signal at the cutoff frequency will be amplified.");
926 gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
930 p=new tX_panel("Echo", g->control_subbox);
933 p->add_client_widget(vg_create_fx_bar(vtt, vtt->ec_fx, 0));
935 g->ec_enable=gtk_check_button_new_with_label("Enable");
936 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->ec_enable), vtt->ec_enable);
937 p->add_client_widget(g->ec_enable);
938 gui_set_tooltip(g->ec_enable, "Enable the built-in echo effect.");
940 g->ec_length=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_length, 0, 1, 0.1, 0.01, 0.001));
941 g->ec_feedback=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_feedback, 0, 1, 0.1, 0.01, 0.001));
942 g->ec_pan=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_pan, -1.0, 1, 0.1, 0.01, 0.001));
943 g->ec_volume=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_volume, 0.0, 3.0, 0.1, 0.01, 0.001));
945 g->ec_lengthd=new tX_extdial("Duration", g->ec_length);
946 p->add_client_widget(g->ec_lengthd->get_widget());
947 gui_set_tooltip(g->ec_lengthd->get_entry(), "Adjust the length of the echo buffer.");
949 g->ec_feedbackd=new tX_extdial("Feedback", g->ec_feedback);
950 p->add_client_widget(g->ec_feedbackd->get_widget());
951 gui_set_tooltip(g->ec_feedbackd->get_entry(), "Adjust the feedback of the echo effect. Note that a value of 1 will result in a constant signal.");
953 g->ec_volumed=new tX_extdial("Volume", g->ec_volume);
954 p->add_client_widget(g->ec_volumed->get_widget());
955 gui_set_tooltip(g->ec_volumed->get_entry(), "Adjust the volume of the echo effect.");
957 g->ec_pand=new tX_extdial("Pan", g->ec_pan);
958 p->add_client_widget(g->ec_pand->get_widget());
959 gui_set_tooltip(g->ec_pand->get_entry(), "Adjust the panning of the echo effect.");
961 gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
965 tempbox=gtk_hbox_new(FALSE,2);
966 gtk_widget_show(tempbox);
967 gtk_box_pack_end(GTK_BOX(g->control_box), tempbox, WID_FIX);
969 tempbox2=gtk_vbox_new(FALSE,0);
970 gtk_widget_show(tempbox2);
971 gtk_box_pack_start(GTK_BOX(tempbox), tempbox2, WID_FIX);
973 g->pitch=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->rel_pitch, -3, +3, 0.1, 0.01, 0.001));
974 g->pan=GTK_ADJUSTMENT(gtk_adjustment_new(0, -1, 1, 0.1, 0.01, 0.001));
976 g->pitchd=new tX_extdial("Pitch", g->pitch);
977 gui_set_tooltip(g->pitchd->get_entry(), "Adjust this turntable's pitch.");
979 gtk_box_pack_start(GTK_BOX(tempbox2), g->pitchd->get_widget(), WID_FIX);
981 g->pand=new tX_extdial("Pan", g->pan);
982 gtk_box_pack_start(GTK_BOX(tempbox2), g->pand->get_widget(), WID_FIX);
983 gui_set_tooltip(g->pand->get_entry(), "Specifies the position of this turntable within the stereo spectrum: -1 -> left, 0-> center, 1->right.");
985 tempbox3=gtk_hbox_new(FALSE,2);
986 gtk_widget_show(tempbox3);
988 g->mute=gtk_check_button_new_with_label("M");
989 gtk_box_pack_start(GTK_BOX(tempbox3), g->mute, WID_FIX);
990 gtk_signal_connect(GTK_OBJECT(g->mute),"clicked", (GtkSignalFunc) mute_volume, vtt);
991 gtk_widget_show(g->mute);
992 gui_set_tooltip(g->mute, "Mute this turntable's mixer output.");
994 g->solo=gtk_check_button_new_with_label("S");
995 gtk_box_pack_start(GTK_BOX(tempbox3), g->solo, WID_FIX);
996 gtk_signal_connect(GTK_OBJECT(g->solo),"clicked", (GtkSignalFunc) solo_vtt, vtt);
997 gtk_widget_show(g->solo);
998 gui_set_tooltip(g->mute, "Allow only this and other solo-switched turntabels' signal to be routed to the mixer.");
1000 gtk_box_pack_start(GTK_BOX(tempbox2), tempbox3, WID_FIX);
1002 tempbox2=gtk_hbox_new(FALSE,0);
1003 gtk_widget_show(tempbox2);
1004 gtk_box_pack_start(GTK_BOX(tempbox), tempbox2, WID_FIX);
1006 g->volume=GTK_ADJUSTMENT(gtk_adjustment_new(2.0-vtt->rel_volume, 0, 2, 0.01, 0.01, 0.01));
1007 dummy=gtk_vscale_new(GTK_ADJUSTMENT(g->volume));
1008 gtk_scale_set_draw_value(GTK_SCALE(dummy), False);
1009 gui_set_tooltip(dummy, "Adjust this turntable's volume.");
1011 gtk_box_pack_start(GTK_BOX(tempbox2), dummy, WID_FIX);
1012 gtk_widget_show(dummy);
1014 g->flash=gtk_tx_flash_new();
1015 gtk_box_pack_start(GTK_BOX(tempbox2), g->flash, WID_FIX);
1016 gtk_widget_show(g->flash);
1018 g->file_dialog=NULL;
1020 gui_connect_signals(vtt);
1022 g->audio_minimized_panel_bar_button=NULL;
1023 g->control_minimized_panel_bar_button=NULL;
1025 g->mouse_mapping_menu=NULL;
1026 g->mouse_mapping_menu_x=NULL;
1027 g->mouse_mapping_menu_y=NULL;
1030 void fx_up(GtkWidget *wid, vtt_fx *effect)
1034 vtt=(vtt_class*)effect->get_vtt();
1035 vtt->effect_up(effect);
1038 void fx_down(GtkWidget *wid, vtt_fx *effect)
1042 vtt=(vtt_class*)effect->get_vtt();
1043 vtt->effect_down(effect);
1046 void fx_kill(GtkWidget *wid, vtt_fx_ladspa *effect)
1050 vtt=(vtt_class*)effect->get_vtt();
1051 vtt->effect_remove(effect);
1054 GtkWidget *vg_create_fx_bar(vtt_class *vtt, vtt_fx *effect, int showdel)
1060 box=gtk_hbox_new(FALSE,0);
1064 button=gtk_button_new();
1065 pixmap=tx_pixmap_widget(TX_ICON_FX_CLOSE);
1066 gtk_container_add (GTK_CONTAINER (button), pixmap);
1067 gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
1068 gtk_widget_show(pixmap);
1069 gtk_widget_show(button);
1070 gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_kill, (void *) effect);
1073 button=gtk_button_new();
1074 pixmap=tx_pixmap_widget(TX_ICON_FX_DOWN);
1075 gtk_container_add (GTK_CONTAINER (button), pixmap);
1076 gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
1077 gtk_widget_show(pixmap);
1078 gtk_widget_show(button);
1079 gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_down, (void *) effect);
1081 button=gtk_button_new();
1082 pixmap=tx_pixmap_widget(TX_ICON_FX_UP);
1083 gtk_container_add (GTK_CONTAINER (button), pixmap);
1084 gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
1085 gtk_widget_show(pixmap);
1086 gtk_widget_show(button);
1087 gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_up, (void *) effect);
1089 gtk_widget_show(box);
1095 int gtk_box_get_widget_pos(GtkBox *box, GtkWidget *child)
1100 list = box->children;
1103 GtkBoxChild *child_info;
1104 child_info = (GtkBoxChild *) list->data;
1105 if (child_info->widget == child)
1107 list = list->next; i++;
1112 void vg_move_fx_panel_up(GtkWidget *wid, vtt_class *vtt)
1114 int pos=gtk_box_get_widget_pos(GTK_BOX(vtt->gui.control_subbox), wid);
1115 gtk_box_reorder_child(GTK_BOX(vtt->gui.control_subbox), wid, pos-1);
1118 void vg_move_fx_panel_down(GtkWidget *wid, vtt_class *vtt)
1120 int pos=gtk_box_get_widget_pos(GTK_BOX(vtt->gui.control_subbox), wid);
1121 gtk_box_reorder_child(GTK_BOX(vtt->gui.control_subbox), wid, pos+1);
1124 void vg_show_fx_info(GtkWidget *wid, vtt_fx *effect)
1126 tx_l_note(effect->get_info_string());
1129 void vg_create_fx_gui(vtt_class *vtt, vtt_fx_ladspa *effect, LADSPA_Plugin *plugin)
1136 list <tX_seqpar_vttfx *> :: iterator sp;
1138 strcpy(buffer, plugin->getLabel());
1139 if (strlen(buffer) > 6)
1147 p=new tX_panel(buffer, g->control_subbox);
1149 p->add_client_widget(vg_create_fx_bar(vtt, effect, 1));
1151 for (sp = effect->controls.begin(); sp != effect->controls.end(); sp++)
1153 p->add_client_widget((*sp)->get_widget());
1156 gtk_signal_connect(GTK_OBJECT(p->get_labelbutton()), "clicked", (GtkSignalFunc) vg_show_fx_info, (void *) effect);
1157 gui_set_tooltip(p->get_labelbutton(), "Click here to learn more about this plugin.");
1158 effect->set_panel_widget(p->get_widget());
1159 effect->set_panel(p);
1161 gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
1164 void gui_set_name(vtt_class *vtt, char *newname)
1166 gtk_label_set_text(GTK_LABEL(vtt->gui.audio_label), newname);
1167 gtk_label_set_text(GTK_LABEL(vtt->gui.control_label), newname);
1168 gtk_entry_set_text(GTK_ENTRY(vtt->gui.name), newname);
1170 if (vtt->gui.audio_minimized_panel_bar_button!=NULL) {
1171 gtk_label_set_text(GTK_LABEL(vtt->gui.audio_minimized_panel_bar_label), newname);
1174 if (vtt->gui.control_minimized_panel_bar_button!=NULL) {
1175 gtk_label_set_text(GTK_LABEL(vtt->gui.control_minimized_panel_bar_label), newname);
1179 void gui_set_filename (vtt_class *vtt, char *newname)
1182 gtk_button_set_label(GTK_BUTTON(vtt->gui.file), newname);
1184 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), newname);
1188 void gui_update_display(vtt_class *vtt)
1190 nicer_filename(global_filename_buffer, vtt->filename);
1192 gtk_button_set_label(GTK_BUTTON(vtt->gui.file), global_filename_buffer);
1194 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), global_filename_buffer);
1196 gtk_tx_set_data(GTK_TX(vtt->gui.display), vtt->buffer, vtt->samples_in_buffer);
1199 void gui_hide_control_panel(vtt_class *vtt, bool hide) {
1201 gtk_widget_hide(vtt->gui.control_box);
1202 vtt->gui.control_minimized_panel_bar_button=tx_xpm_button_new(TX_ICON_MIN_CONTROL, vtt->name, 0, &vtt->gui.control_minimized_panel_bar_label);
1203 gtk_signal_connect(GTK_OBJECT(vtt->gui.control_minimized_panel_bar_button), "clicked", (GtkSignalFunc) unminimize_control_panel, vtt);
1204 gtk_widget_show(vtt->gui.control_minimized_panel_bar_button);
1205 add_to_panel_bar(vtt->gui.control_minimized_panel_bar_button);
1207 gtk_widget_show(vtt->gui.control_box);
1208 remove_from_panel_bar(vtt->gui.control_minimized_panel_bar_button);
1209 gtk_widget_destroy(vtt->gui.control_minimized_panel_bar_button);
1210 vtt->gui.control_minimized_panel_bar_button=NULL;
1214 void gui_hide_audio_panel(vtt_class *vtt, bool hide) {
1216 gtk_widget_hide(vtt->gui.audio_box);
1217 vtt->gui.audio_minimized_panel_bar_button=tx_xpm_button_new(TX_ICON_MIN_AUDIO, vtt->name, 0, &vtt->gui.audio_minimized_panel_bar_label);
1218 gtk_signal_connect(GTK_OBJECT(vtt->gui.audio_minimized_panel_bar_button), "clicked", (GtkSignalFunc) unminimize_audio_panel, vtt);
1219 gtk_widget_show(vtt->gui.audio_minimized_panel_bar_button);
1220 add_to_panel_bar(vtt->gui.audio_minimized_panel_bar_button);
1222 gtk_widget_show(vtt->gui.audio_box);
1223 remove_from_panel_bar(vtt->gui.audio_minimized_panel_bar_button);
1224 gtk_widget_destroy(vtt->gui.audio_minimized_panel_bar_button);
1225 vtt->gui.audio_minimized_panel_bar_button=NULL;
1229 void delete_gui(vtt_class *vtt)
1231 if (vtt->gui.control_minimized_panel_bar_button!=NULL) gui_hide_control_panel(vtt, false);
1232 if (vtt->gui.audio_minimized_panel_bar_button!=NULL) gui_hide_audio_panel(vtt, false);
1234 delete vtt->gui.main_panel;
1235 delete vtt->gui.trigger_panel;
1237 delete vtt->gui.pitchd;
1238 delete vtt->gui.pand;
1240 delete vtt->gui.lp_gaind;
1241 delete vtt->gui.lp_resod;
1242 delete vtt->gui.lp_freqd;
1243 delete vtt->gui.lp_panel;
1245 delete vtt->gui.ec_lengthd;
1246 delete vtt->gui.ec_feedbackd;
1247 delete vtt->gui.ec_volumed;
1248 delete vtt->gui.ec_pand;
1249 delete vtt->gui.ec_panel;
1251 gtk_widget_destroy(vtt->gui.control_box);
1252 gtk_widget_destroy(vtt->gui.audio_box);
1253 if (vtt->gui.file_menu) gtk_widget_destroy(vtt->gui.file_menu);
1254 if (vtt->gui.mouse_mapping_menu) gtk_widget_destroy(vtt->gui.mouse_mapping_menu);
1255 if (vtt->gui.ladspa_menu) gtk_widget_destroy(vtt->gui.ladspa_menu);
1258 void update_all_vtts()
1260 list <vtt_class *> :: iterator vtt;
1263 for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1265 if ((*vtt)->is_playing)
1267 gtk_tx_update_pos_display(GTK_TX((*vtt)->gui.display), (*vtt)->pos_i, (*vtt)->mute);
1269 temp=(*vtt)->max_value*(*vtt)->res_volume*vtt_class::vol_channel_adjust;
1270 (*vtt)->max_value=0;
1271 gtk_tx_flash_set_level((*vtt)->gui.flash, temp);
1277 void cleanup_vtt(vtt_class *vtt)
1279 gtk_tx_cleanup_pos_display(GTK_TX(vtt->gui.display));
1281 gtk_tx_flash_set_level(vtt->gui.flash, 0.0);
1282 gtk_tx_flash_clear(vtt->gui.flash);
1286 void cleanup_all_vtts()
1288 list <vtt_class *> :: iterator vtt;
1290 for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1292 if ((*vtt)->buffer) gtk_tx_cleanup_pos_display(GTK_TX((*vtt)->gui.display));
1294 gtk_tx_flash_set_level((*vtt)->gui.flash, 0.0);
1295 gtk_tx_flash_clear((*vtt)->gui.flash);
1300 void gui_clear_master_button(vtt_class *vtt)
1302 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vtt->gui.sync_master), 0);
1305 void gui_show_frame(vtt_class *vtt, int show)
1307 gtk_tx_show_frame(GTK_TX(vtt->gui.display), show);
1310 #define vgui (*vtt)->gui
1313 void vg_enable_critical_buttons(int enable)
1315 list <vtt_class *> :: iterator vtt;
1316 for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1318 gtk_widget_set_sensitive(vgui.del, enable);
1319 gtk_widget_set_sensitive(vgui.sync_master, enable);
1324 void vg_init_all_non_seqpars()
1326 list <vtt_class *> :: iterator vtt;
1328 for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1330 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((*vtt)->gui.autotrigger), (*vtt)->autotrigger);
1331 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((*vtt)->gui.sync_master), (*vtt)->is_sync_master);