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
28 #include "generator.h"
34 #define GENERATOR_CLASS_NAME "evtabs"
35 #define GENERATOR_CLASS_PATH "Events/Abs"
43 PRIVATE
int init_instance(Generator
*g
) {
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
= abs(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,
76 init_instance
, destroy_instance
,
77 unpickle_instance
, pickle_instance
);
79 gen_configure_event_input(k
, EVT_VALUE
, "Input", evt_value_handler
);
80 gen_configure_event_output(k
, EVT_OUTPUT
, "Abs");
82 gencomp_register_generatorclass(k
, FALSE
, GENERATOR_CLASS_PATH
, NULL
, NULL
);
85 PUBLIC
void init_plugin(void) {