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