Added a new source file, ss_song.c, to hold the old "event2" stream,
[ahxm.git] / event.h
blobcd0be2038f706541b444bf24cf4d2e0939dc431b
1 /*
3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003/2004 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 /* stage 1 events */
27 typedef enum
29 EV1_TEMPO,
30 EV1_METER,
31 EV1_MEASURE,
32 EV1_NOTE,
33 EV1_SS_NOTE,
34 EV1_SS_SUSTAIN,
35 EV1_SS_CHANNEL_MAP,
36 EV1_END
37 } ev1_type;
39 struct ev1_generic
41 ev1_type type; /* event type */
42 double time; /* event time (1: whole note) */
43 int trk_id; /* track id */
46 struct ev1_note
48 ev1_type type; /* EV1_NOTE */
49 double time;
50 int trk_id;
51 int note; /* MIDI-like note */
52 double len; /* note length (1: whole note) */
53 double vol; /* note volume (1: full volume) */
56 struct ev1_tempo
58 ev1_type type; /* EV1_TEMPO */
59 double time;
60 int trk_id; /* always -1 */
61 double tempo; /* tempo in bpm */
64 struct ev1_meter
66 ev1_type type; /* EV1_METER */
67 double time;
68 int trk_id; /* always -1 */
69 int num; /* meter numerator */
70 int den; /* meter denominator */
73 struct ev1_ss_note
75 ev1_type type; /* EV1_SS_NOTE */
76 double time;
77 int trk_id;
78 double freq; /* note frequency */
79 double len; /* note length (1: whole note) */
80 double vol; /* note volume (1: full volume) */
83 struct ev1_ss_sustain
85 ev1_type type; /* EV1_SS_SUSTAIN */
86 double time;
87 int trk_id;
88 int sustain; /* sustain time (in frames) */
91 struct ev1_ss_channel_map
93 ev1_type type; /* EV1_SS_CHANNEL_MAP */
94 double time;
95 int trk_id;
96 float vol[CHANNELS]; /* volume for each channel */
99 union event1
101 struct ev1_generic generic;
102 struct ev1_note note;
103 struct ev1_tempo tempo;
104 struct ev1_meter meter;
105 struct ev1_ss_note ss_note;
106 struct ev1_ss_sustain ss_sustain;
107 struct ev1_ss_channel_map ss_channel_map;
110 extern union event1 * _events_1;
111 extern int _n_events_1;
113 /* stage 2 events */
115 typedef enum
117 EV2_NOTE_OFF,
118 EV2_SS_SUSTAIN,
119 EV2_SS_CHANNEL_MAP,
120 EV2_NOTE_ON,
121 EV2_SS_NOTE_ON,
122 EV2_DEBUG,
123 EV2_END
124 } ev2_type;
126 struct ev2_generic
128 ev2_type type; /* event type */
129 int frame; /* frame number (time) */
130 int trk_id; /* track id */
134 struct ev2_note_off
136 ev2_type type; /* EV2_NOTE_OFF */
137 int frame;
138 int trk_id;
139 int note_id; /* note id */
142 struct ev2_note_on
144 ev2_type type; /* EV2_NOTE_ON */
145 int frame;
146 int trk_id;
147 int note_id; /* note id */
148 int note; /* MIDI-like note number */
149 double vol; /* volume */
152 struct ev2_ss_note_on
154 ev2_type type; /* EV2_SS_NOTE_ON */
155 int frame;
156 int trk_id;
157 int note_id; /* note id */
158 double freq; /* note frequency */
159 double vol; /* volume */
162 struct ev2_ss_sustain
164 ev2_type type; /* EV2_SS_SUSTAIN */
165 int frame;
166 int trk_id;
167 int sustain; /* sustain time (in frames) */
170 struct ev2_ss_channel_map
172 ev2_type type; /* EV2_SS_CHANNEL_MAP */
173 int frame;
174 int trk_id;
175 float vol[CHANNELS]; /* volumes for each channel */
179 union event2
181 struct ev2_generic generic;
182 struct ev2_note_on note_on;
183 struct ev2_note_off note_off;
184 struct ev2_ss_note_on ss_note_on;
185 struct ev2_ss_sustain ss_sustain;
186 struct ev2_ss_channel_map ss_channel_map;
189 extern union event2 * _events_2;
190 extern int _n_events_2;
193 void event1_clear(void);
194 void new_event1(union event1 * ev);
195 void event1_sort(void);
197 void event2_clear(void);
198 void new_event2(union event2 * ev);
199 void event2_sort(void);
201 void event1_to_event2(void);