3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003 Angel Ortega <angel@triptico.com>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 http://www.triptico.com
28 GEN_MODE_PLAYING - Generator is generating sound after a call
29 to generator_play(). If sound is not looped, jumps
30 to GEN_MODE_ZOMBIE when the cursor reaches loop_end.
32 GEN_MODE_RELEASED - Generator is generating the sustain of a sound
33 after a call to generator_release(). When the sustain
34 ends, jumps to GEN_MODE_FREE.
36 GEN_MODE_ZOMBIE - Generator was playing a non-looped sound and the
37 cursor got beyond loop_end. No sound is being generated.
38 Waiting for a call to generator_release() to enter
39 GEN_MODE_FREE immediately.
41 GEN_MODE_FREE - Generator is free to be used.
45 #define GEN_MODE_PLAYING 3
46 #define GEN_MODE_RELEASED 2
47 #define GEN_MODE_ZOMBIE 1
48 #define GEN_MODE_FREE 0
52 int mode
; /* GEN_MODE_* */
54 float * wave
[CHANNELS
]; /* the PCM waves */
55 float vol
[CHANNELS
]; /* the volumes */
57 double size
; /* size in samples */
58 double loop_start
; /* start of loop (-1, no loop) */
59 double loop_end
; /* end of loop */
61 double inc
; /* increment (frequency) */
62 double cursor
; /* offset to next sample */
64 int sustain
; /* number of samples to play after release */
65 float dvol
[CHANNELS
]; /* volume decrement for each sample in sustain */
67 int portamento
; /* number of samples of portamento */
68 double dest_inc
; /* final portamento inc */
69 double dinc
; /* delta of inc */
73 int generator_play(struct generator
* g
,
74 float * wave
[], float vol
[], double size
, double inc
,
75 double loop_start
, double loop_end
, int sustain
);
77 int generator_release(struct generator
* g
);
79 int generator(struct generator
* g
, float sample
[]);
81 int generator_portamento(struct generator
* g
, int portamento
,