1 /* gAlan - Graphical Audio Language
2 * Copyright (C) 1999 Tony Garnock-Jones
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /* Template gAlan plugin file. Please distribute your plugins according to
20 the GNU General Public License! (You don't have to, but I'd prefer it.) */
32 #include "generator.h"
37 #define GENERATOR_CLASS_NAME "template"
38 #define GENERATOR_CLASS_PATH "Misc/Template Plugin"
39 #define GENERATOR_CLASS_PIXMAP "template.xpm"
45 #define NUM_EVENT_INPUTS 1
48 #define NUM_EVENT_OUTPUTS 1
54 PRIVATE
void setup_tables(void) {
55 /* Put any plugin-wide initialisation here. */
58 PRIVATE gboolean
init_instance(Generator
*g
) {
59 Data
*data
= safe_malloc(sizeof(Data
));
67 PRIVATE
void destroy_instance(Generator
*g
) {
71 PRIVATE
void unpickle_instance(Generator
*g
, ObjectStoreItem
*item
, ObjectStore
*db
) {
72 Data
*data
= safe_malloc(sizeof(Data
));
75 data
->dummy
= objectstore_item_get_integer(item
, "TEMPLATE_dummy", 123456);
78 PRIVATE
void pickle_instance(Generator
*g
, ObjectStoreItem
*item
, ObjectStore
*db
) {
80 objectstore_item_set_integer(item
, "TEMPLATE_dummy", data
->dummy
);
83 PRIVATE gboolean
output_generator(Generator
*g
, SAMPLE
*buf
, int buflen
) {
86 memset(buf
, 0, buflen
* sizeof(SAMPLE
));
90 PRIVATE
void evt_input_handler(Generator
*g
, AEvent
*event
) {
91 /* handle incoming events on queue EVT_INPUT */
94 PRIVATE InputSignalDescriptor input_sigs
[] = {
95 { "Input", SIG_FLAG_REALTIME
},
99 PRIVATE OutputSignalDescriptor output_sigs
[] = {
100 { "Output", SIG_FLAG_REALTIME
, { output_generator
, } },
104 PRIVATE ControlDescriptor controls
[] = {
105 /* { kind, name, min,max,step,page, size,editable, is_dst,queue_number,
106 init,destroy,refresh,refresh_data }, */
107 { CONTROL_KIND_NONE
, }
110 PRIVATE
void setup_class(void) {
111 GeneratorClass
*k
= gen_new_generatorclass(GENERATOR_CLASS_NAME
, FALSE
,
112 NUM_EVENT_INPUTS
, NUM_EVENT_OUTPUTS
,
113 input_sigs
, output_sigs
, controls
,
114 init_instance
, destroy_instance
,
115 unpickle_instance
, pickle_instance
);
117 gen_configure_event_input(k
, EVT_INPUT
, "Input", evt_input_handler
);
118 gen_configure_event_output(k
, EVT_OUTPUT
, "Output");
120 gencomp_register_generatorclass(k
, FALSE
, GENERATOR_CLASS_PATH
,
121 PIXMAPDIRIFY(GENERATOR_CLASS_PIXMAP
),
125 PUBLIC
void init_plugin(void) {