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
29 #include "generator.h"
33 PRIVATE gboolean
output_generator(Generator
*g
, SAMPLE
*buf
, int buflen
) {
36 if (!gen_read_realtime_input(g
, 0, -1, buf
, buflen
))
39 for (i
= 0; i
< buflen
; i
++)
40 buf
[i
] = 440 * pow( 2, (buf
[i
] - 57) / 12.0);
45 PRIVATE InputSignalDescriptor input_sigs
[] = {
46 { "Input", SIG_FLAG_REALTIME
},
50 PRIVATE OutputSignalDescriptor output_sigs
[] = {
51 { "Output", SIG_FLAG_REALTIME
, { output_generator
, } },
55 PRIVATE
void setup_class(void) {
56 GeneratorClass
*k
= gen_new_generatorclass("notetofreq", FALSE
, 0, 0,
57 input_sigs
, output_sigs
, NULL
,
58 NULL
, NULL
, NULL
, NULL
);
60 gencomp_register_generatorclass(k
, FALSE
, "Levels/Note2Freq", NULL
, NULL
);
63 PUBLIC
void init_plugin(void) {