2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Gamesnd/EventMusic.h $
15 * Header file for high-level control of event driven music
18 * Revision 1.3 2003/05/25 02:30:42 taylor
21 * Revision 1.2 2002/06/09 04:41:13 relnev
22 * added copyright header
24 * Revision 1.1.1.1 2002/05/03 03:28:12 root
28 * 5 8/11/99 5:33p Jefff
29 * added 3rd debrief music track
31 * 4 6/20/99 12:06a Alanl
32 * new event music changes
34 * 3 11/20/98 4:08p Dave
35 * Fixed flak effect in multiplayer.
37 * 2 10/07/98 10:52a Dave
40 * 1 10/07/98 10:48a Dave
42 * 27 9/18/98 1:22p Dave
43 * Added new event music stuff defines.
45 * 26 5/18/98 5:22p Lawrance
46 * Support new briefing music
48 * 25 5/03/98 1:54a Lawrance
49 * Fix event music problems related to respawning
51 * 24 12/30/97 11:46a Lawrance
52 * Support a success debriefing music.
54 * 23 12/28/97 5:52p Lawrance
55 * Add support for debriefing success/fail music.
57 * 22 12/26/97 10:01p Lawrance
58 * Add goal failure music... remove unused arrival music patterns
60 * 21 9/19/97 5:13p Lawrance
61 * add support for specifying music in the mission file
63 * 20 9/09/97 5:24p Lawrance
64 * added ability to switch soundtracks, gave soundtracks real names
66 * 19 9/06/97 2:13p Mike
67 * Replace support for TEAM_NEUTRAL
69 * 18 5/14/97 9:54a Lawrance
70 * supporting mission-specific briefing music
72 * 17 4/21/97 5:36p Lawrance
73 * add in hooks to play death music when pilot dies
75 * 16 4/17/97 3:28p Lawrance
76 * documented functions
78 * 15 4/14/97 1:52p Lawrance
79 * making transitions happen on measure boundries
81 * 14 4/07/97 1:39p Lawrance
82 * added event_music_first_pattern();
84 * 13 4/03/97 4:26p Lawrance
85 * getting digital event music working
87 * 12 3/07/97 8:53a Lawrance
88 * Read event at time 0 when music first starts
90 * 11 2/25/97 11:10a Lawrance
91 * using text of the mission name to match up which midi file gets played
94 * 10 2/18/97 9:43a Lawrance
95 * make BTTL_2 play after 2 enemy arrivals in battle mode. Then switch
96 * back to default BTTL_1 until 2 more.
98 * 9 2/14/97 11:50a Lawrance
101 * 8 2/11/97 4:22p Lawrance
102 * adding song switching request to the event music level
104 * 7 2/11/97 9:15a Lawrance
105 * taking out BTTL_2 and BTTL_3
107 * 6 2/10/97 9:26a Lawrance
109 * 5 2/05/97 3:12p Lawrance
110 * supporting changes in MIDI system that remove any high-level
113 * 4 2/04/97 11:58p Lawrance
114 * volume change code, and fixing some bugs
116 * 3 2/04/97 12:02p Lawrance
117 * fixed temp bug, integrating music.tbl
119 * 2 2/03/97 6:49p Lawrance
120 * Event Music interface working
126 #ifndef __EVENT_MUSIC_H__
127 #define __EVENT_MUSIC_H__
131 // Identifies songs in the Soundtrack_filenames[] structure. The order matches up with
132 // what is in music.tbl. Do not modify without synching music.tbl.
134 #define SONG_NRML_1 0 // Normal Song 1
135 #define SONG_NRML_2 1 // Normal Song 2
136 #define SONG_NRML_3 2 // Normal Song 3
137 #define SONG_AARV_1 3 // Allied Arrival 1
138 #define SONG_EARV_1 4 // Enemy Arrival 1
139 #define SONG_BTTL_1 5 // Battle Song 1
140 #define SONG_BTTL_2 6 // Battle Song 2
141 #define SONG_BTTL_3 7 // Battle Song 3
142 #define SONG_AARV_2 8 // Allied Arrival 2
143 #define SONG_EARV_2 9 // Enemy Arrival 2
144 #define SONG_VICT_1 10 // Victory Song 1
145 #define SONG_VICT_2 11 // Victory Song 2
146 #define SONG_FAIL_1 12 // Goal Failed
147 #define SONG_DEAD_1 13 // Death Song 1
149 #define MAX_PATTERNS 14
151 #define SONG_NRML_1 0 // Normal Song 1
152 #define SONG_AARV_1 1 // Allied Arrival 1
153 #define SONG_EARV_1 2 // Enemy Arrival 1
154 #define SONG_BTTL_1 3 // Battle Song 1
155 #define SONG_BTTL_2 4 // Battle Song 2
156 #define SONG_BTTL_3 5 // Battle Song 3
157 #define SONG_AARV_2 6 // Allied Arrival 2
158 #define SONG_EARV_2 7 // Enemy Arrival 2
159 #define SONG_VICT_1 8 // Victory Song 1
160 #define SONG_VICT_2 9 // Victory Song 2
161 #define SONG_FAIL_1 10 // Goal Failed
162 #define SONG_DEAD_1 11 // Death Song 1
164 #define MAX_PATTERNS 12
167 // if player targets a hostile ship at less than this range, switch to battle track
168 #define BATTLE_START_MIN_TARGET_DIST 500
170 extern int Event_Music_battle_started; // flag that will tell us if we've started a battle in the current mission
171 extern int Event_music_enabled;
172 extern float Master_event_music_volume; // range is 0->1
175 /////////////////////////////////////////////////////////////////////////////
176 // Used to track what briefing and debriefing music is played for the mission
177 /////////////////////////////////////////////////////////////////////////////
179 #define SCORE_BRIEFING 0
180 #define SCORE_DEBRIEF_SUCCESS 1
181 #define SCORE_DEBRIEF_AVERAGE 2
182 #define SCORE_DEBRIEF_FAIL 3
183 extern int Mission_music[NUM_SCORES]; // indicies into Spooled_music[]
184 /////////////////////////////////////////////////////////////////////////////
186 extern int Current_soundtrack_num; // index into Soundtracks[]
188 // menu music storage
189 typedef struct menu_music {
190 char name[NAME_LENGTH]; // name music is known by
191 char filename[MAX_FILENAME_LEN]; // name music is stored on disk as
194 #define MAX_SPOOLED_MUSIC 20
196 extern menu_music Spooled_music[MAX_SPOOLED_MUSIC];
197 extern int Num_music_files;
199 // event music soundtrack storage
200 typedef struct tagSOUNDTRACK_INFO {
202 char name[NAME_LENGTH];
203 char pattern_fnames[MAX_PATTERNS][MAX_FILENAME_LEN];
206 #define MAX_SOUNDTRACKS 10
208 extern SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS];
209 extern int Num_soundtracks;
211 void event_music_init();
212 void event_music_close();
213 void event_music_level_init(int force_soundtrack = -1);
214 void event_music_level_close();
215 void event_music_do_frame();
216 void event_music_disable();
217 void event_music_enable();
218 void event_music_pause();
219 void event_music_unpause();
220 void event_music_set_volume_all(float volume);
221 void event_music_parse_musictbl();
222 void event_music_change_pattern(int new_pattern);
223 int event_music_return_current_pattern();
224 void event_music_first_pattern();
225 int event_music_battle_start();
226 int event_music_enemy_arrival();
227 int event_music_friendly_arrival();
228 void event_music_arrival(int team);
229 int event_music_primary_goals_met();
230 int event_music_primary_goal_failed();
231 int event_music_player_death();
232 void event_music_start_default();
233 void event_music_get_info(char *outbuf);
234 void event_music_get_soundtrack_name(char *outbuf);
235 int event_music_next_soundtrack(int delta);
236 void event_music_set_soundtrack(char *name);
237 void event_music_set_score(int score_index, char *name);
238 int event_music_get_spooled_music_index(char *name);
239 void event_music_reset_choices();
240 int event_music_player_respawn();
241 int event_music_player_respawn_as_observer();
242 void event_music_hostile_ship_destroyed();
244 #endif /* __EVENT_MUSIC_H__ */