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
27 #include "generator.h"
32 #define GENERATOR_CLASS_NAME "vca"
33 #define GENERATOR_CLASS_PATH "Levels/Envelope Gain"
35 #define SIG_ENVELOPE 0
40 PRIVATE gboolean
output_generator(Generator
*g
, SAMPLE
*buf
, int buflen
) {
41 SAMPLE tmpbuf
[MAXIMUM_REALTIME_STEP
];
44 if (!gen_read_realtime_input(g
, SIG_ENVELOPE
, -1, tmpbuf
, buflen
) ||
45 !gen_read_realtime_input(g
, SIG_INPUT
, -1, buf
, buflen
))
48 for (i
= 0; i
< buflen
; i
++)
53 PRIVATE InputSignalDescriptor input_sigs
[] = {
54 { "Envelope", SIG_FLAG_REALTIME
},
55 { "Input", SIG_FLAG_REALTIME
},
59 PRIVATE OutputSignalDescriptor output_sigs
[] = {
60 { "Output", SIG_FLAG_REALTIME
, { output_generator
, } },
64 PRIVATE
void setup_class(void) {
65 GeneratorClass
*k
= gen_new_generatorclass(GENERATOR_CLASS_NAME
, FALSE
, 0, 0,
66 input_sigs
, output_sigs
, NULL
,
67 NULL
, NULL
, NULL
, NULL
);
69 gencomp_register_generatorclass(k
, FALSE
, GENERATOR_CLASS_PATH
, NULL
, NULL
);
72 PUBLIC
void init_plugin(void) {