absence_thelab

view libs/fmod/fmod.h @ 1:4d5933c261c3

todo and .hgignore
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Oct 2014 02:18:43 +0300
parents
children
line source
1 //==========================================================================================
2 // FMOD Main header file. Copyright (c), FireLight Multimedia 1999-2000.
3 //==========================================================================================
5 #ifndef _FMOD_H_
6 #define _FMOD_H_
8 //===============================================================================================
9 // DEFINITIONS
10 //===============================================================================================
12 #if defined(__GNUC__) && defined(WIN32)
13 #define _cdecl
14 #endif /* defined(__GNUC__) && defined(WIN32) */
16 #if defined(PLATFORM_LINUX)
17 #define _cdecl
18 #define _stdcall
19 #define __cdecl
20 #define __stdcall
21 #define __declspec(x)
22 #define __PS __attribute__((packed)) /* gcc packed */
23 #else
24 #define __PS /*dummy*/
25 #endif
27 #define F_API _stdcall
29 #ifdef DLL_EXPORTS
30 #define DLL_API __declspec(dllexport)
31 #else
32 #ifdef __LCC__
33 #define DLL_API F_API
34 #else
35 #define DLL_API
36 #endif // __LCC__
37 #endif //DLL_EXPORTS
40 #define FMOD_VERSION 3.32f
43 // fmod defined types
44 typedef struct FSOUND_MATERIAL FSOUND_MATERIAL;
45 typedef struct FSOUND_GEOMLIST FSOUND_GEOMLIST;
46 typedef struct FSOUND_SAMPLE FSOUND_SAMPLE;
47 typedef struct FSOUND_STREAM FSOUND_STREAM;
48 typedef struct FSOUND_DSPUNIT FSOUND_DSPUNIT;
49 typedef struct FMUSIC_MODULE FMUSIC_MODULE;
51 // callback types
52 typedef signed char (_cdecl *FSOUND_STREAMCALLBACK) (FSOUND_STREAM *stream, void *buff, int len, int param);
53 typedef void * (_cdecl *FSOUND_DSPCALLBACK) (void *originalbuffer, void *newbuffer, int length, int param);
54 typedef void (_cdecl *FMUSIC_CALLBACK) (FMUSIC_MODULE *mod, unsigned char param);
57 /*
58 [ENUM]
59 [
60 [DESCRIPTION]
61 On failure of commands in FMOD, use FSOUND_GetError to attain what happened.
63 [SEE_ALSO]
64 FSOUND_GetError
65 ]
66 */
67 enum FMOD_ERRORS
68 {
69 FMOD_ERR_NONE, // No errors
70 FMOD_ERR_BUSY, // Cannot call this command after FSOUND_Init. Call FSOUND_Close first.
71 FMOD_ERR_UNINITIALIZED, // This command failed because FSOUND_Init or FSOUND_SetOutput was not called
72 FMOD_ERR_INIT, // Error initializing output device.
73 FMOD_ERR_ALLOCATED, // Error initializing output device, but more specifically, the output device is already in use and cannot be reused.
74 FMOD_ERR_PLAY, // Playing the sound failed.
75 FMOD_ERR_OUTPUT_FORMAT, // Soundcard does not support the features needed for this soundsystem (16bit stereo output)
76 FMOD_ERR_COOPERATIVELEVEL, // Error setting cooperative level for hardware.
77 FMOD_ERR_CREATEBUFFER, // Error creating hardware sound buffer.
78 FMOD_ERR_FILE_NOTFOUND, // File not found
79 FMOD_ERR_FILE_FORMAT, // Unknown file format
80 FMOD_ERR_FILE_BAD, // Error loading file
81 FMOD_ERR_MEMORY, // Not enough memory
82 FMOD_ERR_VERSION, // The version number of this file format is not supported
83 FMOD_ERR_INVALID_PARAM, // An invalid parameter was passed to this function
84 FMOD_ERR_NO_EAX, // Tried to use an EAX command on a non EAX enabled channel or output.
85 FMOD_ERR_NO_EAX2, // Tried to use an advanced EAX2 command on a non EAX2 enabled channel or output.
86 FMOD_ERR_CHANNEL_ALLOC, // Failed to allocate a new channel
87 FMOD_ERR_RECORD, // Recording is not supported on this machine
88 FMOD_ERR_MEDIAPLAYER, // Windows Media Player not installed so cant play wma or use internet streaming.
89 };
92 /*
93 [ENUM]
94 [
95 [DESCRIPTION]
96 These output types are used with FSOUND_SetOutput, to choose which output driver to use.
98 FSOUND_OUTPUT_A3D will cause FSOUND_Init to FAIL if you have not got a vortex
99 based A3D card. The suggestion for this is to immediately try and reinitialize FMOD with
100 FSOUND_OUTPUT_DSOUND, and if this fails, try initializing FMOD with FSOUND_OUTPUT_WAVEOUT.
102 FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver
103 does not support DirectX 6 Voice Manager Extensions.
105 [SEE_ALSO]
106 FSOUND_SetOutput
107 FSOUND_GetOutput
108 ]
109 */
110 enum FSOUND_OUTPUTTYPES
111 {
112 FSOUND_OUTPUT_NOSOUND, // NoSound driver, all calls to this succeed but do nothing.
113 FSOUND_OUTPUT_WINMM, // Windows Multimedia driver.
114 FSOUND_OUTPUT_DSOUND, // DirectSound driver. You need this to get EAX or EAX2 support.
115 FSOUND_OUTPUT_A3D, // A3D driver. You need this to get geometry support.
116 FSOUND_OUTPUT_OSS, // Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers.
117 FSOUND_OUTPUT_ESD, // Linux/Unix ESD (Enlightment Sound Daemon) driver.
118 FSOUND_OUTPUT_ALSA // Linux Alsa driver.
119 };
122 /*
123 [ENUM]
124 [
125 [DESCRIPTION]
126 These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act
127 upon for other reasons using FSOUND_GetMixer.
129 [SEE_ALSO]
130 FSOUND_SetMixer
131 FSOUND_GetMixer
132 ]
133 */
134 enum FSOUND_MIXERTYPES
135 {
136 FSOUND_MIXER_AUTODETECT, // Enables autodetection of the fastest mixer based on your cpu.
137 FSOUND_MIXER_BLENDMODE, // Enables the standard non mmx, blendmode mixer.
138 FSOUND_MIXER_MMXP5, // Enables the mmx, pentium optimized blendmode mixer.
139 FSOUND_MIXER_MMXP6, // Enables the mmx, ppro/p2/p3 optimized mixer.
141 FSOUND_MIXER_QUALITY_AUTODETECT,// Enables autodetection of the fastest quality mixer based on your cpu.
142 FSOUND_MIXER_QUALITY_FPU, // Enables the interpolating/volume ramping FPU mixer.
143 FSOUND_MIXER_QUALITY_MMXP5, // Enables the interpolating/volume ramping p5 MMX mixer.
144 FSOUND_MIXER_QUALITY_MMXP6, // Enables the interpolating/volume ramping ppro/p2/p3+ MMX mixer.
145 };
147 /*
148 [ENUM]
149 [
150 [DESCRIPTION]
151 These definitions describe the type of song being played.
153 [SEE_ALSO]
154 FMUSIC_GetType
155 ]
156 */
157 enum FMUSIC_TYPES
158 {
159 FMUSIC_TYPE_NONE,
160 FMUSIC_TYPE_MOD, // Protracker / Fasttracker
161 FMUSIC_TYPE_S3M, // ScreamTracker 3
162 FMUSIC_TYPE_XM, // FastTracker 2
163 FMUSIC_TYPE_IT, // Impulse Tracker.
164 FMUSIC_TYPE_MIDI, // MIDI file
165 };
168 /*
169 [DEFINE_START]
170 [
171 [NAME]
172 FSOUND_DSP_PRIORITIES
174 [DESCRIPTION]
175 These default priorities are
177 [SEE_ALSO]
178 FSOUND_DSP_Create
179 FSOUND_DSP_SetPriority
180 ]
181 */
182 #define FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 // DSP CLEAR unit - done first
183 #define FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 // DSP SFX unit - done second
184 #define FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 // DSP MUSIC unit - done third
185 #define FSOUND_DSP_DEFAULTPRIORITY_USER 300 // User priority, use this as reference
186 #define FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 // DSP CLIP AND COPY unit - last
187 // [DEFINE_END]
190 /*
191 [DEFINE_START]
192 [
193 [NAME]
194 FSOUND_CAPS
196 [DESCRIPTION]
197 Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated
198 has the settings you are after. The enumerated driver depends on the output mode, see
199 FSOUND_OUTPUTTYPES
201 [SEE_ALSO]
202 FSOUND_GetDriverCaps
203 FSOUND_OUTPUTTYPES
204 ]
205 */
206 #define FSOUND_CAPS_HARDWARE 0x1 // This driver supports hardware accelerated 3d sound.
207 #define FSOUND_CAPS_EAX 0x2 // This driver supports EAX reverb
208 #define FSOUND_CAPS_GEOMETRY_OCCLUSIONS 0x4 // This driver supports (A3D) geometry occlusions
209 #define FSOUND_CAPS_GEOMETRY_REFLECTIONS 0x8 // This driver supports (A3D) geometry reflections
210 #define FSOUND_CAPS_EAX2 0x10 // This driver supports EAX2/A3D3 reverb
211 // [DEFINE_END]
214 /*
215 [DEFINE_START]
216 [
217 [NAME]
218 FSOUND_MODES
220 [DESCRIPTION]
221 Sample description bitfields, OR them together for loading and describing samples.
222 ]
223 */
224 #define FSOUND_LOOP_OFF 0x00000001 // For non looping samples.
225 #define FSOUND_LOOP_NORMAL 0x00000002 // For forward looping samples.
226 #define FSOUND_LOOP_BIDI 0x00000004 // For bidirectional looping samples. (no effect if in hardware).
227 #define FSOUND_8BITS 0x00000008 // For 8 bit samples.
228 #define FSOUND_16BITS 0x00000010 // For 16 bit samples.
229 #define FSOUND_MONO 0x00000020 // For mono samples.
230 #define FSOUND_STEREO 0x00000040 // For stereo samples.
231 #define FSOUND_UNSIGNED 0x00000080 // For source data containing unsigned samples.
232 #define FSOUND_SIGNED 0x00000100 // For source data containing signed data.
233 #define FSOUND_DELTA 0x00000200 // For source data stored as delta values.
234 #define FSOUND_IT214 0x00000400 // For source data stored using IT214 compression.
235 #define FSOUND_IT215 0x00000800 // For source data stored using IT215 compression.
236 #define FSOUND_HW3D 0x00001000 // Attempts to make samples use 3d hardware acceleration. (if the card supports it)
237 #define FSOUND_2D 0x00002000 // Ignores any 3d processing. overrides FSOUND_HW3D. Located in software.
238 #define FSOUND_STREAMABLE 0x00004000 // For a streamable sound where you feed the data to it. If you dont supply this sound may come out corrupted. (only affects a3d output)
239 #define FSOUND_LOADMEMORY 0x00008000 // 'name' will be interpreted as a pointer to data for streaming and samples.
240 #define FSOUND_LOADRAW 0x00010000 // For will ignore file format and treat as raw pcm.
241 #define FSOUND_MPEGACCURATE 0x00020000 // For FSOUND_Stream_OpenFile - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUNDStream_OpenFile for inital opening time performance issues.
243 // Default sample type. Loop off, 8bit mono, signed, not hardware accelerated.
244 // Some API functions ignore 8bits and mono, as it may be an mpeg/wav/etc which has its format predetermined.
245 #define FSOUND_NORMAL (FSOUND_LOOP_OFF | FSOUND_8BITS | FSOUND_MONO)
246 // [DEFINE_END]
249 /*
250 [DEFINE_START]
251 [
252 [NAME]
253 FSOUND_CDPLAYMODES
255 [DESCRIPTION]
256 Playback method for a CD Audio track, using FSOUND_CD_Play
258 [SEE_ALSO]
259 FSOUND_CD_Play
260 ]
261 */
262 #define FSOUND_CD_PLAYCONTINUOUS 0 // Starts from the current track and plays to end of CD.
263 #define FSOUND_CD_PLAYONCE 1 // Plays the specified track then stops.
264 #define FSOUND_CD_PLAYLOOPED 2 // Plays the specified track looped, forever until stopped manually.
265 #define FSOUND_CD_PLAYRANDOM 3 // Plays tracks in random order
266 // [DEFINE_END]
269 /*
270 [DEFINE_START]
271 [
272 [NAME]
273 FSOUND_CHANNELSAMPLEMODE
275 [DESCRIPTION]
276 Miscellaneous values for FMOD functions.
278 [SEE_ALSO]
279 FSOUND_PlaySound
280 FSOUND_PlaySound3DAttrib
282 FSOUND_Sample_Alloc
283 FSOUND_Sample_Load
284 FSOUND_SetPan
285 ]
286 */
287 #define FSOUND_FREE -1 // value to play on any free channel, or to allocate a sample in a free sample slot.
288 #define FSOUND_UNMANAGED -2 // value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot.
289 #define FSOUND_ALL -3 // for a channel index , this flag will affect ALL channels available! Not supported by every function.
290 #define FSOUND_STEREOPAN -1 // value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this.
291 // [DEFINE_END]
294 /*
295 [ENUM]
296 [
297 [DESCRIPTION]
298 These are environment types defined for use with the FSOUND_Reverb API.
300 [SEE_ALSO]
301 FSOUND_Reverb_SetEnvironment
302 FSOUND_Reverb_SetEnvironmentAdvanced
303 ]
304 */
305 enum FSOUND_REVERB_ENVIRONMENTS
306 {
307 FSOUND_ENVIRONMENT_GENERIC,
308 FSOUND_ENVIRONMENT_PADDEDCELL,
309 FSOUND_ENVIRONMENT_ROOM,
310 FSOUND_ENVIRONMENT_BATHROOM,
311 FSOUND_ENVIRONMENT_LIVINGROOM,
312 FSOUND_ENVIRONMENT_STONEROOM,
313 FSOUND_ENVIRONMENT_AUDITORIUM,
314 FSOUND_ENVIRONMENT_CONCERTHALL,
315 FSOUND_ENVIRONMENT_CAVE,
316 FSOUND_ENVIRONMENT_ARENA,
317 FSOUND_ENVIRONMENT_HANGAR,
318 FSOUND_ENVIRONMENT_CARPETEDHALLWAY,
319 FSOUND_ENVIRONMENT_HALLWAY,
320 FSOUND_ENVIRONMENT_STONECORRIDOR,
321 FSOUND_ENVIRONMENT_ALLEY,
322 FSOUND_ENVIRONMENT_FOREST,
323 FSOUND_ENVIRONMENT_CITY,
324 FSOUND_ENVIRONMENT_MOUNTAINS,
325 FSOUND_ENVIRONMENT_QUARRY,
326 FSOUND_ENVIRONMENT_PLAIN,
327 FSOUND_ENVIRONMENT_PARKINGLOT,
328 FSOUND_ENVIRONMENT_SEWERPIPE,
329 FSOUND_ENVIRONMENT_UNDERWATER,
330 FSOUND_ENVIRONMENT_DRUGGED,
331 FSOUND_ENVIRONMENT_DIZZY,
332 FSOUND_ENVIRONMENT_PSYCHOTIC,
334 FSOUND_ENVIRONMENT_COUNT
335 };
337 /*
338 [DEFINE_START]
339 [
340 [NAME]
341 FSOUND_REVERBMIX_USEDISTANCE
343 [DESCRIPTION]
344 Used with FSOUND_Reverb_SetMix, this setting allows reverb to attenuate based on distance from the listener.
345 Instead of hard coding a value with FSOUND_Reverb_SetMix, this value can be used instead, for a more natural
346 reverb dropoff.
348 [SEE_ALSO]
349 FSOUND_Reverb_SetMix
350 ]
351 */
352 #define FSOUND_REVERBMIX_USEDISTANCE -1.0f // used with FSOUND_Reverb_SetMix to scale reverb by distance
353 // [DEFINE_END]
356 /*
357 [DEFINE_START]
358 [
359 [NAME]
360 FSOUND_REVERB_IGNOREPARAM
362 [DESCRIPTION]
363 Used with FSOUND_Reverb_SetEnvironment and FSOUND_Reverb_SetEnvironmentAdvanced, this can
364 be placed in the place of a specific parameter for the reverb setting. It allows you to
365 not set any parameters except the ones you are interested in .. and example would be this.
366 FSOUND_Reverb_SetEnvironment(FSOUND_REVERB_IGNOREPARAM,
367 FSOUND_REVERB_IGNOREPARAM,
368 FSOUND_REVERB_IGNOREPARAM,
369 0.0f);
370 This means env, vol and decay are left alone, but 'damp' is set to 0.
372 [SEE_ALSO]
373 FSOUND_Reverb_SetEnvironment
374 FSOUND_Reverb_SetEnvironmentAdvanced
375 ]
376 */
377 #define FSOUND_REVERB_IGNOREPARAM -9999999 // used with FSOUND_Reverb_SetEnvironmentAdvanced to ignore certain parameters by choice.
378 // [DEFINE_END]
381 /*
382 [DEFINE_START]
383 [
384 [NAME]
385 FSOUND_REVERB_PRESETS
387 [DESCRIPTION]
388 A set of predefined environment PARAMETERS, created by Creative Labs
389 These can be placed directly into the FSOUND_Reverb_SetEnvironment call
391 [SEE_ALSO]
392 FSOUND_Reverb_SetEnvironment
393 ]
394 */
395 #define FSOUND_PRESET_OFF FSOUND_ENVIRONMENT_GENERIC,0.0f,0.0f,0.0f
396 #define FSOUND_PRESET_GENERIC FSOUND_ENVIRONMENT_GENERIC,0.5f,1.493f,0.5f
397 #define FSOUND_PRESET_PADDEDCELL FSOUND_ENVIRONMENT_PADDEDCELL,0.25f,0.1f,0.0f
398 #define FSOUND_PRESET_ROOM FSOUND_ENVIRONMENT_ROOM,0.417f,0.4f,0.666f
399 #define FSOUND_PRESET_BATHROOM FSOUND_ENVIRONMENT_BATHROOM,0.653f,1.499f,0.166f
400 #define FSOUND_PRESET_LIVINGROOM FSOUND_ENVIRONMENT_LIVINGROOM,0.208f,0.478f,0.0f
401 #define FSOUND_PRESET_STONEROOM FSOUND_ENVIRONMENT_STONEROOM,0.5f,2.309f,0.888f
402 #define FSOUND_PRESET_AUDITORIUM FSOUND_ENVIRONMENT_AUDITORIUM,0.403f,4.279f,0.5f
403 #define FSOUND_PRESET_CONCERTHALL FSOUND_ENVIRONMENT_CONCERTHALL,0.5f,3.961f,0.5f
404 #define FSOUND_PRESET_CAVE FSOUND_ENVIRONMENT_CAVE,0.5f,2.886f,1.304f
405 #define FSOUND_PRESET_ARENA FSOUND_ENVIRONMENT_ARENA,0.361f,7.284f,0.332f
406 #define FSOUND_PRESET_HANGAR FSOUND_ENVIRONMENT_HANGAR,0.5f,10.0f,0.3f
407 #define FSOUND_PRESET_CARPETEDHALLWAY FSOUND_ENVIRONMENT_CARPETEDHALLWAY,0.153f,0.259f,2.0f
408 #define FSOUND_PRESET_HALLWAY FSOUND_ENVIRONMENT_HALLWAY,0.361f,1.493f,0.0f
409 #define FSOUND_PRESET_STONECORRIDOR FSOUND_ENVIRONMENT_STONECORRIDOR,0.444f,2.697f,0.638f
410 #define FSOUND_PRESET_ALLEY FSOUND_ENVIRONMENT_ALLEY,0.25f,1.752f,0.776f
411 #define FSOUND_PRESET_FOREST FSOUND_ENVIRONMENT_FOREST,0.111f,3.145f,0.472f
412 #define FSOUND_PRESET_CITY FSOUND_ENVIRONMENT_CITY,0.111f,2.767f,0.224f
413 #define FSOUND_PRESET_MOUNTAINS FSOUND_ENVIRONMENT_MOUNTAINS,0.194f,7.841f,0.472f
414 #define FSOUND_PRESET_QUARRY FSOUND_ENVIRONMENT_QUARRY,1.0f,1.499f,0.5f
415 #define FSOUND_PRESET_PLAIN FSOUND_ENVIRONMENT_PLAIN,0.097f,2.767f,0.224f
416 #define FSOUND_PRESET_PARKINGLOT FSOUND_ENVIRONMENT_PARKINGLOT,0.208f,1.652f,1.5f
417 #define FSOUND_PRESET_SEWERPIPE FSOUND_ENVIRONMENT_SEWERPIPE,0.652f,2.886f,0.25f
418 #define FSOUND_PRESET_UNDERWATER FSOUND_ENVIRONMENT_UNDERWATER,1.0f,1.499f,0.0f
419 #define FSOUND_PRESET_DRUGGED FSOUND_ENVIRONMENT_DRUGGED,0.875f, 8.392f,1.388f
420 #define FSOUND_PRESET_DIZZY FSOUND_ENVIRONMENT_DIZZY,0.139f,17.234f,0.666f
421 #define FSOUND_PRESET_PSYCHOTIC FSOUND_ENVIRONMENT_PSYCHOTIC,0.486f,7.563f,0.806f
422 // [DEFINE_END]
425 /*
426 [DEFINE_START]
427 [
428 [NAME]
429 FSOUND_GEOMETRY_MODES
431 [DESCRIPTION]
432 Geometry flags, used as the mode flag in FSOUND_Geometry_AddPolygon
434 [SEE_ALSO]
435 FSOUND_Geometry_AddPolygon
436 ]
437 */
438 #define FSOUND_GEOMETRY_NORMAL 0x0 // Default geometry type. Occluding polygon
439 #define FSOUND_GEOMETRY_REFLECTIVE 0x01 // This polygon is reflective
440 #define FSOUND_GEOMETRY_OPENING 0x02 // Overlays a transparency over the previous polygon. The 'openingfactor' value supplied is copied internally.
441 #define FSOUND_GEOMETRY_OPENING_REFERENCE 0x04 // Overlays a transparency over the previous polygon. The 'openingfactor' supplied is pointed to (for access when building a list)
442 // [DEFINE_END]
444 /*
445 [DEFINE_START]
446 [
447 [NAME]
448 FSOUND_INIT_FLAGS
450 [DESCRIPTION]
451 Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour.
453 [SEE_ALSO]
454 FSOUND_Init
455 ]
456 */
457 #define FSOUND_INIT_USEDEFAULTMIDISYNTH 0x01 // Causes MIDI playback to force software decoding.
458 #define FSOUND_INIT_GLOBALFOCUS 0x02 // For DirectSound output - sound is not muted when window is out of focus.
459 // [DEFINE_END]
464 //===============================================================================================
465 // FUNCTION PROTOTYPES
466 //===============================================================================================
468 #ifdef __cplusplus
469 extern "C" {
470 #endif
472 // ==================================
473 // Initialization / Global functions.
474 // ==================================
476 // *Pre* FSOUND_Init functions. These can't be called after FSOUND_Init is
477 // called (they will fail). They set up FMOD system functionality.
478 DLL_API signed char F_API FSOUND_SetOutput(int outputtype);
479 DLL_API signed char F_API FSOUND_SetDriver(int driver);
480 DLL_API signed char F_API FSOUND_SetMixer(int mixer);
481 DLL_API signed char F_API FSOUND_SetBufferSize(int len_ms);
482 DLL_API signed char F_API FSOUND_SetHWND(void *hwnd);
483 DLL_API signed char F_API FSOUND_SetMinHardwareChannels(int min);
484 DLL_API signed char F_API FSOUND_SetMaxHardwareChannels(int max);
486 // Main initialization / closedown functions.
487 // Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override with MIDI playback.
488 // : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter which window is in focus.
489 DLL_API signed char F_API FSOUND_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
490 DLL_API void F_API FSOUND_Close();
492 // Runtime
493 DLL_API void F_API FSOUND_SetSFXMasterVolume(int volume);
494 DLL_API void F_API FSOUND_SetPanSeperation(float pansep);
496 // System information.
497 DLL_API int F_API FSOUND_GetError();
498 DLL_API float F_API FSOUND_GetVersion();
499 DLL_API int F_API FSOUND_GetOutput();
500 DLL_API int F_API FSOUND_GetDriver();
501 DLL_API int F_API FSOUND_GetMixer();
502 DLL_API int F_API FSOUND_GetNumDrivers();
503 DLL_API signed char * F_API FSOUND_GetDriverName(int id);
504 DLL_API signed char F_API FSOUND_GetDriverCaps(int id, unsigned int *caps);
505 DLL_API int F_API FSOUND_GetOutputRate();
506 DLL_API int F_API FSOUND_GetMaxChannels();
507 DLL_API int F_API FSOUND_GetMaxSamples();
508 DLL_API int F_API FSOUND_GetSFXMasterVolume();
509 DLL_API int F_API FSOUND_GetNumHardwareChannels();
510 DLL_API int F_API FSOUND_GetChannelsPlaying();
511 DLL_API float F_API FSOUND_GetCPUUsage();
513 // ===================================
514 // Sample management / load functions.
515 // ===================================
517 // Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory.
518 // Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data.
520 // Sample creation and management functions
521 DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Load(int index, const char *name, unsigned int mode, int memlength);
522 DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Alloc(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri);
523 DLL_API void F_API FSOUND_Sample_Free(FSOUND_SAMPLE *sptr);
524 DLL_API signed char F_API FSOUND_Sample_Upload(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode);
525 DLL_API signed char F_API FSOUND_Sample_Lock(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
526 DLL_API signed char F_API FSOUND_Sample_Unlock(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
528 // Sample control functions
529 DLL_API signed char F_API FSOUND_Sample_SetLoopMode(FSOUND_SAMPLE *sptr, unsigned int loopmode);
530 DLL_API signed char F_API FSOUND_Sample_SetLoopPoints(FSOUND_SAMPLE *sptr, int loopstart, int loopend);
531 DLL_API signed char F_API FSOUND_Sample_SetDefaults(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri);
532 DLL_API signed char F_API FSOUND_Sample_SetMinMaxDistance(FSOUND_SAMPLE *sptr, float min, float max);
534 // Sample information
535 DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Get(int sampno);
536 DLL_API char * F_API FSOUND_Sample_GetName(FSOUND_SAMPLE *sptr);
537 DLL_API unsigned int F_API FSOUND_Sample_GetLength(FSOUND_SAMPLE *sptr);
538 DLL_API signed char F_API FSOUND_Sample_GetLoopPoints(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend);
539 DLL_API signed char F_API FSOUND_Sample_GetDefaults(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri);
540 DLL_API unsigned int F_API FSOUND_Sample_GetMode(FSOUND_SAMPLE *sptr);
542 // ============================
543 // Channel control functions.
544 // ============================
546 // Playing and stopping sounds.
547 DLL_API int F_API FSOUND_PlaySound(int channel, FSOUND_SAMPLE *sptr);
548 DLL_API int F_API FSOUND_PlaySound3DAttrib(int channel, FSOUND_SAMPLE *sptr, int freq, int vol, int pan, float *pos, float *vel);
549 DLL_API signed char F_API FSOUND_StopSound(int channel);
551 // Functions to control playback of a channel.
552 DLL_API signed char F_API FSOUND_SetFrequency(int channel, int freq);
553 DLL_API signed char F_API FSOUND_SetVolume(int channel, int vol);
554 DLL_API signed char F_API FSOUND_SetVolumeAbsolute(int channel, int vol);
555 DLL_API signed char F_API FSOUND_SetPan(int channel, int pan);
556 DLL_API signed char F_API FSOUND_SetSurround(int channel, signed char surround);
557 DLL_API signed char F_API FSOUND_SetMute(int channel, signed char mute);
558 DLL_API signed char F_API FSOUND_SetPriority(int channel, int priority);
559 DLL_API signed char F_API FSOUND_SetReserved(int channel, signed char reserved);
560 DLL_API signed char F_API FSOUND_SetPaused(int channel, signed char paused);
561 DLL_API signed char F_API FSOUND_SetLoopMode(int channel, unsigned int loopmode);
563 // Channel information
564 DLL_API signed char F_API FSOUND_IsPlaying(int channel);
565 DLL_API int F_API FSOUND_GetFrequency(int channel);
566 DLL_API int F_API FSOUND_GetVolume(int channel);
567 DLL_API int F_API FSOUND_GetPan(int channel);
568 DLL_API signed char F_API FSOUND_GetSurround(int channel);
569 DLL_API signed char F_API FSOUND_GetMute(int channel);
570 DLL_API int F_API FSOUND_GetPriority(int channel);
571 DLL_API signed char F_API FSOUND_GetReserved(int channel);
572 DLL_API signed char F_API FSOUND_GetPaused(int channel);
573 DLL_API unsigned int F_API FSOUND_GetCurrentPosition(int channel);
574 DLL_API FSOUND_SAMPLE * F_API FSOUND_GetCurrentSample(int channel);
575 DLL_API float F_API FSOUND_GetCurrentVU(int channel);
577 // ===================
578 // 3D sound functions.
579 // ===================
580 // see also FSOUND_PlaySound3DAttrib (above)
581 // see also FSOUND_Sample_SetMinMaxDistance (above)
582 DLL_API void F_API FSOUND_3D_Update();
583 DLL_API signed char F_API FSOUND_3D_SetAttributes(int channel, float *pos, float *vel);
584 DLL_API signed char F_API FSOUND_3D_GetAttributes(int channel, float *pos, float *vel);
585 DLL_API void F_API FSOUND_3D_Listener_SetAttributes(float *pos, float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
586 DLL_API void F_API FSOUND_3D_Listener_GetAttributes(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz);
587 DLL_API void F_API FSOUND_3D_Listener_SetDopplerFactor(float scale);
588 DLL_API void F_API FSOUND_3D_Listener_SetDistanceFactor(float scale);
589 DLL_API void F_API FSOUND_3D_Listener_SetRolloffFactor(float scale);
591 // =========================
592 // File Streaming functions.
593 // =========================
595 // Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_OpenFile to stream from memory.
596 // Use FSOUND_LOADRAW flag with FSOUND_Stream_OpenFile to treat stream as raw pcm data.
597 // Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_OpenFile to open mpegs in 'accurate mode' for seeking etc.
599 DLL_API FSOUND_STREAM * F_API FSOUND_Stream_OpenFile(const char *filename, unsigned int mode, int memlength);
600 DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Create(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, int userdata);
601 DLL_API int F_API FSOUND_Stream_Play(int channel, FSOUND_STREAM *stream);
602 DLL_API int F_API FSOUND_Stream_Play3DAttrib(int channel, FSOUND_STREAM *stream, int freq, int vol, int pan, float *pos, float *vel);
603 DLL_API signed char F_API FSOUND_Stream_Stop(FSOUND_STREAM *stream);
604 DLL_API signed char F_API FSOUND_Stream_Close(FSOUND_STREAM *stream);
605 DLL_API signed char F_API FSOUND_Stream_SetEndCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, int userdata);
606 DLL_API signed char F_API FSOUND_Stream_SetSynchCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, int userdata);
607 DLL_API FSOUND_SAMPLE * F_API FSOUND_Stream_GetSample(FSOUND_STREAM *stream);
608 DLL_API FSOUND_DSPUNIT *F_API FSOUND_Stream_CreateDSP(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, int param);
610 DLL_API signed char F_API FSOUND_Stream_SetPaused(FSOUND_STREAM *stream, signed char paused);
611 DLL_API signed char F_API FSOUND_Stream_GetPaused(FSOUND_STREAM *stream);
612 DLL_API signed char F_API FSOUND_Stream_SetPosition(FSOUND_STREAM *stream, int position);
613 DLL_API int F_API FSOUND_Stream_GetPosition(FSOUND_STREAM *stream);
614 DLL_API signed char F_API FSOUND_Stream_SetTime(FSOUND_STREAM *stream, int ms);
615 DLL_API int F_API FSOUND_Stream_GetTime(FSOUND_STREAM *stream);
616 DLL_API int F_API FSOUND_Stream_GetLength(FSOUND_STREAM *stream);
617 DLL_API int F_API FSOUND_Stream_GetLengthMs(FSOUND_STREAM *stream);
619 // ===================
620 // CD audio functions.
621 // ===================
623 DLL_API signed char F_API FSOUND_CD_Play(int track);
624 DLL_API void F_API FSOUND_CD_SetPlayMode(signed char mode);
625 DLL_API signed char F_API FSOUND_CD_Stop();
626 DLL_API signed char F_API FSOUND_CD_SetPaused(signed char paused);
627 DLL_API signed char F_API FSOUND_CD_SetVolume(int volume);
628 DLL_API signed char F_API FSOUND_CD_Eject();
630 DLL_API signed char F_API FSOUND_CD_GetPaused();
631 DLL_API int F_API FSOUND_CD_GetTrack();
632 DLL_API int F_API FSOUND_CD_GetNumTracks();
633 DLL_API int F_API FSOUND_CD_GetVolume();
634 DLL_API int F_API FSOUND_CD_GetTrackLength(int track);
635 DLL_API int F_API FSOUND_CD_GetTrackTime();
638 // ==============
639 // DSP functions.
640 // ==============
642 // DSP Unit control and information functions.
643 DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_Create(FSOUND_DSPCALLBACK callback, int priority, int param);
644 DLL_API void F_API FSOUND_DSP_Free(FSOUND_DSPUNIT *unit);
645 DLL_API void F_API FSOUND_DSP_SetPriority(FSOUND_DSPUNIT *unit, int priority);
646 DLL_API int F_API FSOUND_DSP_GetPriority(FSOUND_DSPUNIT *unit);
647 DLL_API void F_API FSOUND_DSP_SetActive(FSOUND_DSPUNIT *unit, signed char active);
648 DLL_API signed char F_API FSOUND_DSP_GetActive(FSOUND_DSPUNIT *unit);
650 // Functions to get hold of FSOUND 'system DSP unit' handles.
651 DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClearUnit();
652 DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetSFXUnit();
653 DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetMusicUnit();
654 DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClipAndCopyUnit();
656 // misc DSP functions
657 DLL_API signed char F_API FSOUND_DSP_MixBuffers(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode);
658 DLL_API void F_API FSOUND_DSP_ClearMixBuffer();
659 DLL_API int F_API FSOUND_DSP_GetBufferLength();
661 // =============================================
662 // Geometry functions. (NOT SUPPORTED IN LINUX)
663 // =============================================
665 // scene/polygon functions
666 DLL_API signed char F_API FSOUND_Geometry_AddPolygon(float *p1, float *p2, float *p3, float *p4, float *normal, unsigned int mode, float *openingfactor);
667 DLL_API int F_API FSOUND_Geometry_AddList(FSOUND_GEOMLIST *geomlist);
669 // polygon list functions
670 DLL_API FSOUND_GEOMLIST * F_API FSOUND_Geometry_List_Create(signed char boundingvolume);
671 DLL_API signed char F_API FSOUND_Geometry_List_Free(FSOUND_GEOMLIST *geomlist);
672 DLL_API signed char F_API FSOUND_Geometry_List_Begin(FSOUND_GEOMLIST *geomlist);
673 DLL_API signed char F_API FSOUND_Geometry_List_End(FSOUND_GEOMLIST *geomlist);
675 // material functions
676 DLL_API FSOUND_MATERIAL * F_API FSOUND_Geometry_Material_Create();
677 DLL_API signed char F_API FSOUND_Geometry_Material_Free(FSOUND_MATERIAL *material);
678 DLL_API signed char F_API FSOUND_Geometry_Material_SetAttributes(FSOUND_MATERIAL *material, float reflectancegain, float reflectancefreq, float transmittancegain, float transmittancefreq);
679 DLL_API signed char F_API FSOUND_Geometry_Material_GetAttributes(FSOUND_MATERIAL *material, float *reflectancegain, float *reflectancefreq, float *transmittancegain, float *transmittancefreq);
680 DLL_API signed char F_API FSOUND_Geometry_Material_Set(FSOUND_MATERIAL *material);
682 // ========================================================================
683 // Reverb functions. (eax, eax2, a3d 3.0 reverb) (NOT SUPPORTED IN LINUX)
684 // ========================================================================
686 // eax1, eax2, a3d 3.0 (use FSOUND_REVERB_PRESETS if you like), (eax2 support through emulation/parameter conversion)
687 DLL_API signed char F_API FSOUND_Reverb_SetEnvironment(int env, float vol, float decay, float damp);
688 // eax2, a3d 3.0 only, does not work on eax1
689 DLL_API signed char F_API FSOUND_Reverb_SetEnvironmentAdvanced(
690 int env,
691 int Room, // [-10000, 0] default: -10000 mB or use FSOUND_REVERB_IGNOREPARAM
692 int RoomHF, // [-10000, 0] default: 0 mB or use FSOUND_REVERB_IGNOREPARAM
693 float RoomRolloffFactor, // [0.0, 10.0] default: 0.0 or use FSOUND_REVERB_IGNOREPARAM
694 float DecayTime, // [0.1, 20.0] default: 1.0 s or use FSOUND_REVERB_IGNOREPARAM
695 float DecayHFRatio, // [0.1, 2.0] default: 0.5 or use FSOUND_REVERB_IGNOREPARAM
696 int Reflections, // [-10000, 1000] default: -10000 mB or use FSOUND_REVERB_IGNOREPARAM
697 float ReflectionsDelay, // [0.0, 0.3] default: 0.02 s or use FSOUND_REVERB_IGNOREPARAM
698 int Reverb, // [-10000, 2000] default: -10000 mB or use FSOUND_REVERB_IGNOREPARAM
699 float ReverbDelay, // [0.0, 0.1] default: 0.04 s or use FSOUND_REVERB_IGNOREPARAM
700 float EnvironmentSize, // [0.0, 100.0] default: 100.0 % or use FSOUND_REVERB_IGNOREPARAM
701 float EnvironmentDiffusion, // [0.0, 100.0] default: 100.0 % or use FSOUND_REVERB_IGNOREPARAM
702 float AirAbsorptionHF); // [20.0, 20000.0] default: 5000.0 Hz or use FSOUND_REVERB_IGNOREPARAM
704 DLL_API signed char F_API FSOUND_Reverb_SetMix(int channel, float mix);
706 // information functions
707 DLL_API signed char F_API FSOUND_Reverb_GetEnvironment(int *env, float *vol, float *decay, float *damp);
708 DLL_API signed char F_API FSOUND_Reverb_GetEnvironmentAdvanced(
709 int *env,
710 int *Room,
711 int *RoomHF,
712 float *RoomRolloffFactor,
713 float *DecayTime,
714 float *DecayHFRatio,
715 int *Reflections,
716 float *ReflectionsDelay,
717 int *Reverb,
718 float *ReverbDelay,
719 float *EnvironmentSize,
720 float *EnvironmentDiffusion,
721 float *AirAbsorptionHF);
722 DLL_API signed char F_API FSOUND_Reverb_GetMix(int channel, float *mix);
724 // =============================================
725 // Recording functions (NOT SUPPORTED IN LINUX)
726 // =============================================
728 // recording initialization functions
729 DLL_API signed char F_API FSOUND_Record_SetDriver(int outputtype);
730 DLL_API int F_API FSOUND_Record_GetNumDrivers();
731 DLL_API signed char * F_API FSOUND_Record_GetDriverName(int id);
732 DLL_API int F_API FSOUND_Record_GetDriver();
734 // recording functionality. Only one recording session will work at a time
735 DLL_API signed char F_API FSOUND_Record_StartSample(FSOUND_SAMPLE *sptr, signed char loop);// record to sample
736 DLL_API signed char F_API FSOUND_Record_Stop(); // stop recording
737 DLL_API int F_API FSOUND_Record_GetPosition(); // offset in sample, or wav file
739 // =========================
740 // File system override
741 // =========================
743 DLL_API void F_API FSOUND_File_SetCallbacks(unsigned int (_cdecl *OpenCallback)(const char *name),
744 void (_cdecl *CloseCallback)(unsigned int handle),
745 int (_cdecl *ReadCallback)(void *buffer, int size, unsigned int handle),
746 int (_cdecl *SeekCallback)(unsigned int handle, int pos, signed char mode),
747 int (_cdecl *TellCallback)(unsigned int handle));
749 // =============================================================================================
750 // FMUSIC API
751 // =============================================================================================
753 // Song management / playback functions.
754 DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSong(const char *name);
755 DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSongMemory(void *data, int length);
756 DLL_API signed char F_API FMUSIC_FreeSong(FMUSIC_MODULE *mod);
757 DLL_API signed char F_API FMUSIC_PlaySong(FMUSIC_MODULE *mod);
758 DLL_API signed char F_API FMUSIC_StopSong(FMUSIC_MODULE *mod);
759 DLL_API void F_API FMUSIC_StopAllSongs();
760 DLL_API signed char F_API FMUSIC_SetZxxCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback);
761 DLL_API signed char F_API FMUSIC_SetRowCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep);
762 DLL_API signed char F_API FMUSIC_SetOrderCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep);
763 DLL_API signed char F_API FMUSIC_SetInstCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument);
764 DLL_API signed char F_API FMUSIC_SetSample(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr);
765 DLL_API signed char F_API FMUSIC_OptimizeChannels(FMUSIC_MODULE *mod, int maxchannels, int minvolume);
767 // Runtime song functions.
768 DLL_API signed char F_API FMUSIC_SetReverb(signed char reverb); // MIDI only.
769 DLL_API signed char F_API FMUSIC_SetOrder(FMUSIC_MODULE *mod, int order);
770 DLL_API signed char F_API FMUSIC_SetPaused(FMUSIC_MODULE *mod, signed char pause);
771 DLL_API signed char F_API FMUSIC_SetMasterVolume(FMUSIC_MODULE *mod, int volume);
772 DLL_API signed char F_API FMUSIC_SetPanSeperation(FMUSIC_MODULE *mod, float pansep);
774 // Static song information functions.
775 DLL_API char * F_API FMUSIC_GetName(FMUSIC_MODULE *mod);
776 DLL_API signed char F_API FMUSIC_GetType(FMUSIC_MODULE *mod);
777 DLL_API int F_API FMUSIC_GetNumOrders(FMUSIC_MODULE *mod);
778 DLL_API int F_API FMUSIC_GetNumPatterns(FMUSIC_MODULE *mod);
779 DLL_API int F_API FMUSIC_GetNumInstruments(FMUSIC_MODULE *mod);
780 DLL_API int F_API FMUSIC_GetNumSamples(FMUSIC_MODULE *mod);
781 DLL_API int F_API FMUSIC_GetNumChannels(FMUSIC_MODULE *mod);
782 DLL_API FSOUND_SAMPLE * F_API FMUSIC_GetSample(FMUSIC_MODULE *mod, int sampno);
783 DLL_API int F_API FMUSIC_GetPatternLength(FMUSIC_MODULE *mod, int orderno);
785 // Runtime song information.
786 DLL_API signed char F_API FMUSIC_IsFinished(FMUSIC_MODULE *mod);
787 DLL_API signed char F_API FMUSIC_IsPlaying(FMUSIC_MODULE *mod);
788 DLL_API int F_API FMUSIC_GetMasterVolume(FMUSIC_MODULE *mod);
789 DLL_API int F_API FMUSIC_GetGlobalVolume(FMUSIC_MODULE *mod);
790 DLL_API int F_API FMUSIC_GetOrder(FMUSIC_MODULE *mod);
791 DLL_API int F_API FMUSIC_GetPattern(FMUSIC_MODULE *mod);
792 DLL_API int F_API FMUSIC_GetSpeed(FMUSIC_MODULE *mod);
793 DLL_API int F_API FMUSIC_GetBPM(FMUSIC_MODULE *mod);
794 DLL_API int F_API FMUSIC_GetRow(FMUSIC_MODULE *mod);
795 DLL_API signed char F_API FMUSIC_GetPaused(FMUSIC_MODULE *mod);
796 DLL_API int F_API FMUSIC_GetTime(FMUSIC_MODULE *mod);
798 #ifdef __cplusplus
799 }
800 #endif
802 #endif