4 * Copyright (C) Robert Ham 2002, 2003 (node@users.sourceforge.net)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34 #include "control_message.h"
37 #define PROCESS_FIFO_SIZE 64
38 #define MIDI_FIFO_SIZE 256
41 ui_new (const char * client_name
, unsigned long channels
,
42 gboolean connect_inputs
, gboolean connect_outputs
)
46 ui
= g_malloc (sizeof (ui_t
));
49 ui
->state
= STATE_NORMAL
;
51 ui
->ui_to_process
= lff_new (PROCESS_FIFO_SIZE
, sizeof (ctrlmsg_t
));
52 ui
->process_to_ui
= lff_new (PROCESS_FIFO_SIZE
, sizeof (ctrlmsg_t
));
54 ui
->procinfo
= process_info_new (ui
, client_name
, channels
, connect_inputs
, connect_outputs
);
58 ui
->plugin_mgr
= plugin_mgr_new (ui
);
59 plugin_mgr_set_plugins (ui
->plugin_mgr
, channels
);
60 ui
->jack_rack
= jack_rack_new (ui
, channels
);
71 ui_set_state (ui
, STATE_QUITTING
);
72 ctrlmsg
.type
= CTRLMSG_QUIT
;
73 lff_write (ui
->ui_to_process
, &ctrlmsg
);
77 ui_destroy (ui_t
* ui
)
81 jack_rack_destroy (ui
->jack_rack
);
87 ui_set_state (ui_t
* ui
, ui_state_t state
)
93 ui_get_state (ui_t
* ui
)
99 jack_shutdown_cb (void * data
)
106 /* do the process->gui message processing */
108 ui_loop_iterate (ui_t
* ui
)
111 jack_rack_t
* jack_rack
= ui
->jack_rack
;
113 while (lff_read (ui
->process_to_ui
, &ctrlmsg
) == 0)
115 switch (ctrlmsg
.type
)
118 jack_rack_add_plugin (jack_rack
, ctrlmsg
.data
.add
.plugin
);
122 plugin_destroy (ctrlmsg
.data
.remove
.plugin
, ui
);