FS2_Open
Open source remastering of the Freespace 2 engine
audiostr.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _AUDIOSTR_H
13 #define _AUDIOSTR_H
14 
15 
16 
17 // type of audio stream
18 #define ASF_SOUNDFX 0
19 #define ASF_EVENTMUSIC 1
20 #define ASF_MENUMUSIC 2
21 #define ASF_VOICE 3
22 #define ASF_NONE 4 // used to catch errors
23 // NOTE: the only difference between EVENTMUSIC and everything else is that EVENTMUSIC
24 // will always respect the file type, everything else will load first available type
25 
26 #define MAX_AUDIO_STREAMS 30
27 
28 #ifdef NEED_STRHDL
29 #ifdef _WIN32
30 #define WIN32_LEAN_AND_MEAN
31 #include <windows.h>
32 #include <mmsystem.h>
33 #endif
34 
35 #include "sound/ogg/ogg.h"
36 
37 // audio stream file handle information
38 typedef struct {
39  HMMIO cfp; // handle for mmio
40 
41  long true_offset; // true offset of file into VP
42  uint size; // total size of file being read
43 
44  // for OGGs
45  OggVorbis_File vorbis_file; // vorbis file info
46 } STRHDL;
47 #endif // NEED_STRHDL
48 
49 extern const char *audio_ext_list[];
50 extern const int NUM_AUDIO_EXT;
51 
52 // Initializes the audio streaming library. Called
53 // automatically when the sound stuff is inited.
54 void audiostream_init();
55 
56 // Closes down the audio streaming library
57 void audiostream_close();
58 
59 // Opens a wave file but doesn't play it.
60 int audiostream_open( const char * filename, int type );
61 
62 // Closes the opened wave file. This doesn't have to be
63 // called between songs, because when you open the next
64 // song, it will call this internally.
65 void audiostream_close_file(int i, int fade = 1);
66 
67 void audiostream_close_all(int fade);
68 
69 // Plays the currently opened wave file
70 void audiostream_play(int i, float volume = -1.0f, int looping = 1);
71 
72 // See if a particular stream is playing
73 int audiostream_is_playing(int i);
74 
75 // Stops the currently opened wave file
76 void audiostream_stop(int i, int rewind = 1, int paused = 0);
77 
78 // set the volume for every audio stream of a particular type
79 void audiostream_set_volume_all(float volume, int type);
80 
81 // set the volume for a particular audio stream
82 void audiostream_set_volume(int i, float volume);
83 
84 // see if a particular stream is paused
85 int audiostream_is_paused(int i);
86 
87 // set the number of samples that the sound should cutoff after
88 void audiostream_set_sample_cutoff(int i, unsigned int cutoff);
89 
90 // return the number of samples streamed to the Direct Sound buffer so far
91 unsigned int audiostream_get_samples_committed(int i);
92 
93 // check if the streaming has read all the bytes from disk yet
95 
96 // return if audiostream has initialized ok
98 
99 void audiostream_pause(int i, bool via_sexp_or_script = false); // pause a particular stream
100 void audiostream_unpause(int i, bool via_sexp_or_script = false); // unpause a particular stream
101 
102 void audiostream_pause_all(bool via_sexp_or_script = false); // pause all audio streams
103 void audiostream_unpause_all(bool via_sexp_or_script = false); // unpause all audio streams
104 
105 #endif // _AUDIOSTR_H
void audiostream_unpause(int i, bool via_sexp_or_script=false)
Definition: audiostr.cpp:1960
int i
Definition: multi_pxo.cpp:466
void audiostream_close_file(int i, int fade=1)
Definition: audiostr.cpp:1772
void audiostream_close()
Definition: audiostr.cpp:1661
void audiostream_set_volume(int i, float volume)
Definition: audiostr.cpp:1871
SDL_RWops * HMMIO
Definition: config.h:93
GLclampf f
Definition: Glext.h:7097
GLsizeiptr size
Definition: Glext.h:5496
int audiostream_is_paused(int i)
Definition: audiostr.cpp:1885
const char * audio_ext_list[]
Definition: audiostr.cpp:49
void audiostream_pause(int i, bool via_sexp_or_script=false)
Definition: audiostr.cpp:1943
GLenum type
Definition: Gl.h:1492
unsigned int uint
Definition: pstypes.h:64
char * filename
void audiostream_unpause_all(bool via_sexp_or_script=false)
Definition: audiostr.cpp:1990
cfp
Definition: cfile.cpp:1061
void audiostream_stop(int i, int rewind=1, int paused=0)
Definition: audiostr.cpp:1840
void audiostream_set_volume_all(float volume, int type)
Definition: audiostr.cpp:1857
void audiostream_play(int i, float volume=-1.0f, int looping=1)
Definition: audiostr.cpp:1803
unsigned int audiostream_get_samples_committed(int i)
Definition: audiostr.cpp:1912
int audiostream_done_reading(int i)
Definition: audiostr.cpp:1925
int audiostream_open(const char *filename, int type)
Definition: audiostr.cpp:1713
void audiostream_close_all(int fade)
Definition: audiostr.cpp:1791
const int NUM_AUDIO_EXT
Definition: audiostr.cpp:50
void audiostream_set_sample_cutoff(int i, unsigned int cutoff)
Definition: audiostr.cpp:1898
void audiostream_pause_all(bool via_sexp_or_script=false)
Definition: audiostr.cpp:1978
int audiostream_is_playing(int i)
Definition: audiostr.cpp:1827
void audiostream_init()
Definition: audiostr.cpp:1611
int audiostream_is_inited()
Definition: audiostr.cpp:1938