missing commit in generator.h
[galan.git] / plugins / libsigsignum.c
blobb23ae6d2f07e5cbc677e7165e4c5569f7f80244b
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>
26 #include <gmodule.h>
28 #include "global.h"
29 #include "generator.h"
30 #include "comp.h"
31 #include "gencomp.h"
33 PRIVATE gboolean output_generator(Generator *g, SAMPLE *buf, int buflen) {
34 int i;
36 if (!gen_read_realtime_input(g, 0, -1, buf, buflen))
37 return FALSE;
39 for (i = 0; i < buflen; i++)
40 buf[i] = buf[i] > 0.0 ? 1.0 : -1.0;
42 return TRUE;
45 PRIVATE InputSignalDescriptor input_sigs[] = {
46 { "Input", SIG_FLAG_REALTIME },
47 { NULL, }
50 PRIVATE OutputSignalDescriptor output_sigs[] = {
51 { "Output", SIG_FLAG_REALTIME, { output_generator, } },
52 { NULL, }
55 PRIVATE void setup_class(void) {
56 GeneratorClass *k = gen_new_generatorclass("sigsignum", FALSE, 0, 0,
57 input_sigs, output_sigs, NULL,
58 NULL, NULL, NULL, NULL);
60 gencomp_register_generatorclass(k, FALSE, "Levels/Signum", NULL, NULL);
63 PUBLIC void init_plugin(void) {
64 setup_class();