Volumes in instruments are really applied (Closes: #1050).
[ahxm.git] / ss_gen.h
blob1c98b461a5db0633072208f764fdbd148ba8946e
1 /*
3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003/2005 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
24 #ifndef SS_GEN_NUM
25 #define SS_GEN_NUM 256
26 #endif
28 struct ss_gen
30 int note_id; /* note ID */
32 struct ss_wave w; /* the wave data */
33 float vol; /* volume */
35 double cursor; /* offset to next sample */
36 double inc; /* increment (frequency) */
38 int sustain; /* number of frames to play after release */
39 float dvol; /* volume decrement in sustain */
41 double portamento; /* portamento sum to inc */
43 double vibrato; /* vibrato oscillator */
44 double vib_depth; /* vibrato depth */
45 double vib_inc; /* increment for vibrato oscillator */
47 struct ss_gen * next;
48 struct ss_gen * prev;
52 struct ss_gen * ss_gen_alloc(struct ss_gen ** q);
53 void ss_gen_free(struct ss_gen ** q, struct ss_gen * g);
55 void ss_gen_sustain(struct ss_gen * g, double sustain);
56 void ss_gen_vibrato(struct ss_gen * g, double depth, double freq);
57 int ss_gen_portamento(struct ss_gen * g, int portamento, double dest_inc);
59 void ss_gen_play(struct ss_gen * g, double freq, float vol, int note_id,
60 struct ss_wave * w);
62 void ss_gen_release(struct ss_gen * g);
64 int ss_gen_frame(struct ss_gen * g, int n_channels, float frame[]);