]> icculus.org git repositories - taylor/freespace2.git/blob - include/audiostr.h
embed standalone web in executable
[taylor/freespace2.git] / include / audiostr.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Sound/AudioStr.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Routines to stream large WAV files from disk
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:12  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:12  root
22  * Initial import.
23  *
24  * 
25  * 2     10/07/98 10:54a Dave
26  * Initial checkin.
27  * 
28  * 1     10/07/98 10:51a Dave
29  * 
30  * 9     5/24/98 4:42p Dan
31  * AL: Fix several bugs related to pausing and enabling/disabling event
32  * music
33  * 
34  * 8     3/31/98 4:50p Dan
35  * AL: Clean up all audio streams if necessary in
36  * event_music_level_close()
37  * 
38  * 7     12/10/97 10:04p Lawrance
39  * modify what happens in Audio_stream constructor
40  * 
41  * 6     12/09/97 6:14p Lawrance
42  * add -nomusic flag
43  * 
44  * 5     11/20/97 1:06a Lawrance
45  * Add Master_voice_volume, make voices play back at correctly scaled
46  * volumes
47  * 
48  * 4     10/03/97 8:24a Lawrance
49  * When unpausing, be sure to retain looping status
50  * 
51  * 3     9/18/97 10:31p Lawrance
52  * add functions to pause and unpause all audio streams
53  * 
54  * 2     6/04/97 1:19p Lawrance
55  * added function to check if system is initialized
56  * 
57  * 1     4/28/97 4:45p John
58  * Initial version of ripping sound & movie out of OsAPI.
59  * 
60  * 8     4/14/97 1:52p Lawrance
61  * making transitions happen on measure boundries
62  * 
63  * 7     4/09/97 11:14a Lawrance
64  * working on event music transitions
65  * 
66  * 6     4/07/97 3:15p Lawrance
67  * allowing event music to pause
68  * 
69  * 5     4/03/97 4:27p Lawrance
70  * expanding functionality to support event driven music
71  * 
72  * 4     4/01/97 1:31p Lawrance
73  * make music fade quickly out when stopping.  Delay onset of new music to
74  * allow old music to fade out.
75  * 
76  * 3     3/31/97 5:45p Lawrance
77  * supporting changes to allow multiple streamed audio files
78  * 
79  * 2     3/31/97 3:56p Lawrance
80  * decompress ADPCM->PCM for streaming sounds working
81  * 
82  * 1     1/22/97 10:43a John
83  *
84  * $NoKeywords: $
85  */
86
87 #ifndef _AUDIOSTR_H
88 #define _AUDIOSTR_H
89
90 // type of audio stream
91 #define ASF_SOUNDFX                     0
92 #define ASF_EVENTMUSIC          1
93 #define ASF_VOICE                               2
94 #define ASF_NONE                                3               // used to catch errors
95
96
97 // Initializes the audio streaming library.  Called
98 // automatically when the sound stuff is inited.
99 void audiostream_init();
100
101 // Closes down the audio streaming library
102 void audiostream_close();
103
104 // Opens a wave file but doesn't play it.
105 int audiostream_open( const char * filename, int type );
106
107 // Closes the opened wave file.  This doesn't have to be
108 // called between songs, because when you open the next
109 // song, it will call this internally.
110 void audiostream_close_file(int i, int fade = 1);
111
112 void audiostream_close_all(int fade);
113
114 // Plays the currently opened wave file
115 void audiostream_play(int i, float volume = -1.0f, int looping = 1);
116
117 // See if a particular stream is playing
118 bool audiostream_is_playing(int i);
119
120 // Stops the currently opened wave file
121 void audiostream_stop(int i, int rewind = 1, int paused = 0);
122
123 // set the volume for every audio stream of a particular type
124 void audiostream_set_volume_all(float volume, int type);
125
126 // set the volume for a particular audio stream
127 void audiostream_set_volume(int i, float volume);
128
129 // see if a particular stream is paused
130 bool audiostream_is_paused(int i);
131
132 // set the number of bytes that the sound should cutoff after
133 void audiostream_set_byte_cutoff(int i, unsigned int cutoff);
134
135 // return the number of bytes streamed to the Direct Sound buffer so far
136 unsigned int audiostream_get_bytes_committed(int i);
137
138 // check if the streaming has read all the bytes from disk yet
139 bool audiostream_done_reading(int i);
140
141 // return if audiostream has initialized ok
142 int audiostream_is_inited();
143
144 void audiostream_pause(int i);  // pause a particular stream
145 void audiostream_pause_all();   // pause all audio streams                                                                                      
146
147 void audiostream_unpause(int i);        // unpause a particular stream
148 void audiostream_unpause_all(); // unpause all audio streams
149
150 #endif // _AUDIOSTR_H
151