missing commit in generator.h
[galan.git] / plugins / libevtinteger.c
blob293bf915f758a1b55f78d5c3d363517cfeedfa8c
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 #include <stdlib.h>
20 #include <string.h>
21 #include <stdio.h>
22 #include <stddef.h>
24 #include <gdk/gdk.h>
25 #include <gtk/gtk.h>
27 #include "global.h"
28 #include "generator.h"
29 #include "comp.h"
30 #include "control.h"
31 #include "gencomp.h"
32 #include "msgbox.h"
34 #define GENERATOR_CLASS_NAME "evtinteger"
35 #define GENERATOR_CLASS_PATH "Events/Integer"
37 #define EVT_VALUE 0
38 #define EVT_OUTPUT 0
40 typedef struct Data {
41 } Data;
43 PRIVATE int init_instance(Generator *g) {
45 return 1;
48 PRIVATE void destroy_instance(Generator *g) {
52 PRIVATE void unpickle_instance(Generator *g, ObjectStoreItem *item, ObjectStore *db) {
56 PRIVATE void pickle_instance(Generator *g, ObjectStoreItem *item, ObjectStore *db) {
61 PRIVATE void evt_value_handler(Generator *g, AEvent *event) {
63 event->d.number = (double) ((int) (event->d.number));
64 gen_send_events(g, EVT_OUTPUT, -1, event);
67 PRIVATE ControlDescriptor controls[] = {
68 { CONTROL_KIND_NONE, }
73 PRIVATE void setup_class(void) {
74 GeneratorClass *k = gen_new_generatorclass(GENERATOR_CLASS_NAME, FALSE, 1, 1,
75 NULL, NULL, controls,
76 init_instance, destroy_instance,
77 unpickle_instance, pickle_instance);
79 gen_configure_event_input(k, EVT_VALUE, "Note", evt_value_handler);
80 gen_configure_event_output(k, EVT_OUTPUT, "Freq");
82 gencomp_register_generatorclass(k, FALSE, GENERATOR_CLASS_PATH, NULL, NULL);
85 PUBLIC void init_plugin(void) {
86 setup_class();