1 #ifndef OPENAL_WRAPPER_H
2 #define OPENAL_WRAPPER_H
12 #include "vorbis/vorbisfile.h"
14 #include "MacCompatibility.h"
16 #if 0 /* this should only be enable if OPENAL doesn't provide AL_API on all platforms */
17 #if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32))
26 #if defined(_WIN32_WCE)
28 #define F_CALLBACKAPI _cdecl
30 #define AL_API __stdcall
31 #define F_CALLBACKAPI __stdcall
35 #define DLL_API __declspec(dllexport)
37 #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__)
38 #define DLL_API AL_API
41 #endif /* __LCC__ || __MINGW32__ || __CYGWIN32__ */
42 #endif /* DLL_EXPORTS */
46 typedef struct OPENAL_SAMPLE OPENAL_SAMPLE;
47 typedef OPENAL_SAMPLE OPENAL_STREAM;
48 typedef struct OPENAL_DSPUNIT OPENAL_DSPUNIT;
50 enum OPENAL_OUTPUTTYPES
52 OPENAL_OUTPUT_NOSOUND, /* NoSound driver, all calls to this succeed but do nothing. */
53 OPENAL_OUTPUT_OSS, /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */
54 OPENAL_OUTPUT_ALSA, /* Linux Alsa driver. */
57 #define OPENAL_LOOP_OFF 0x00000001 /* For non looping samples. */
58 #define OPENAL_LOOP_NORMAL 0x00000002 /* For forward looping samples. */
59 #define OPENAL_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
60 #define OPENAL_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */
61 #define OPENAL_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */
62 #define OPENAL_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */
71 AL_API void OPENAL_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
72 AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel);
73 AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel);
74 AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
75 AL_API void OPENAL_Close();
76 AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
77 AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
78 AL_API signed char OPENAL_SetFrequency(int channel, int freq);
79 AL_API signed char OPENAL_SetVolume(int channel, int vol);
80 AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
81 AL_API void OPENAL_SetSFXMasterVolume(int volume);
82 AL_API signed char OPENAL_StopSound(int channel);
83 AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream);
84 AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
85 AL_API void OPENAL_Update();
86 AL_API signed char OPENAL_SetOutput(int outputtype);
87 void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);