The wav driver has been simplified.
[ahxm.git] / song.h
blob08fd1f6703cfba2c40d5e9c0a276d6836d3b75aa
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
25 typedef enum
27 SONG_EV_TEMPO,
28 SONG_EV_METER,
29 SONG_EV_MEASURE,
31 SONG_EV_SS_SUSTAIN,
32 SONG_EV_SS_SET_CHANNEL,
34 SONG_EV_SS_WAV,
35 SONG_EV_SS_PAT,
37 SONG_EV_SS_EFF_DELAY,
38 SONG_EV_SS_EFF_ECHO,
39 SONG_EV_SS_EFF_COMB,
40 SONG_EV_SS_EFF_ALLPASS,
41 SONG_EV_SS_EFF_FLANGER,
42 SONG_EV_SS_EFF_WOBBLE,
43 SONG_EV_SS_EFF_SQWOBBLE,
44 SONG_EV_SS_EFF_FADER,
45 SONG_EV_SS_EFF_REVERB,
47 SONG_EV_MIDI_CHANNEL,
48 SONG_EV_MIDI_PROGRAM,
50 SONG_EV_NOTE,
51 SONG_EV_SS_NOTE_ON_BY_TIME,
53 SONG_EV_NOTE_ON,
54 SONG_EV_NOTE_OFF,
56 SONG_EV_END
58 } song_ev_type;
60 struct song_ev_generic
62 song_ev_type type; /* event type */
63 double time; /* event time (1: whole note) */
64 int trk_id; /* track id */
67 struct song_ev_note
69 song_ev_type type; /* SONG_EV_NOTE */
70 double time;
71 int trk_id;
72 int note; /* MIDI-like note */
73 double len; /* note length (1: whole note) */
74 float vol; /* note volume (1: full volume) */
77 struct song_ev_tempo
79 song_ev_type type; /* SONG_EV_TEMPO */
80 double time;
81 int trk_id; /* always -1 */
82 double tempo; /* tempo in bpm */
85 struct song_ev_meter
87 song_ev_type type; /* SONG_EV_METER */
88 double time;
89 int trk_id; /* always -1 */
90 int num; /* meter numerator */
91 int den; /* meter denominator */
94 struct song_ev_ss_note_by_time
96 song_ev_type type; /* SONG_EV_SS_NOTE_BY_TIME */
97 double time;
98 int trk_id;
99 int note; /* MIDI-like note (to find the wave) */
100 double len; /* note length (1: whole note) */
101 float vol; /* note volume (1: full volume) */
104 struct song_ev_ss_sustain
106 song_ev_type type; /* SONG_EV_SS_SUSTAIN */
107 double time;
108 int trk_id;
109 double sustain; /* sustain time (in msecs) */
112 struct song_ev_ss_set_channel
114 song_ev_type type; /* SONG_EV_SS_SET_CHANNEL */
115 double time;
116 int trk_id;
117 int channel; /* channel */
118 float vol; /* volume */
121 struct song_ev_ss_wav
123 song_ev_type type; /* SONG_EV_SS_WAV */
124 double time;
125 int trk_id;
126 char * file; /* path to .wav file */
127 int base; /* MIDI-like base note */
128 int min; /* MIDI-like minimum note */
129 int max; /* MIDI-like maximum note */
130 double loop_start; /* start of loop */
131 double loop_end; /* end of loop */
134 struct song_ev_ss_pat
136 song_ev_type type; /* SONG_EV_SS_PAT */
137 double time;
138 int trk_id;
139 char * file; /* path to .pat file */
142 struct song_ev_ss_eff
144 song_ev_type type; /* effect type */
145 double time;
146 int trk_id;
147 int channel; /* channel */
148 double size; /* size of effect */
149 float gain; /* gain */
150 double depth; /* depth */
151 double freq; /* freq */
152 double phase; /* phase */
153 float initial; /* initial vol */
154 float final; /* final vol */
157 struct song_ev_midi_channel
159 song_ev_type type; /* SONG_EV_MIDI_CHANNEL */
160 double time;
161 int trk_id;
162 int channel; /* midi channel (1-16) */
165 struct song_ev_midi_program
167 song_ev_type type; /* SONG_EV_MIDI_PROGRAM */
168 double time;
169 int trk_id;
170 int program; /* midi program (0-127) */
173 union song_ev
175 struct song_ev_generic generic;
177 struct song_ev_tempo tempo;
178 struct song_ev_meter meter;
180 struct song_ev_note note;
182 struct song_ev_ss_note_by_time ss_note_by_time;
183 struct song_ev_ss_sustain ss_sustain;
184 struct song_ev_ss_set_channel ss_set_channel;
186 struct song_ev_ss_wav ss_wav;
187 struct song_ev_ss_pat ss_pat;
189 struct song_ev_ss_eff ss_eff;
191 struct song_ev_midi_channel midi_channel;
192 struct song_ev_midi_program midi_program;
195 extern union song_ev * song;
196 extern int n_song_ev;
198 void song_clear(void);
199 void add_song_ev(union song_ev * ev);
200 void song_sort(void);