]> git.jsancho.org Git - lugaru.git/blob - Source/openal_wrapper.h
a7d6af2c28438f7bc9ab7eecfae87d69c963065a
[lugaru.git] / Source / openal_wrapper.h
1 #ifndef OPENAL_WRAPPER_H
2 #define OPENAL_WRAPPER_H
3
4 #ifdef _WIN32
5 #include <malloc.h>
6 #endif
7
8 #include "al.h"
9 #include "alc.h"
10
11 #include "ogg/ogg.h"
12 #include "vorbis/vorbisfile.h"
13
14 #include "MacCompatibility.h"
15
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))
18 #ifndef __cdecl
19 #define __cdecl
20 #endif
21 #ifndef __stdcall
22 #define __stdcall
23 #endif
24 #endif
25
26 #if defined(_WIN32_WCE)
27 #define AL_API _cdecl
28 #define F_CALLBACKAPI _cdecl
29 #else
30 #define AL_API __stdcall
31 #define F_CALLBACKAPI __stdcall
32 #endif
33
34 #ifdef DLL_EXPORTS
35 #define DLL_API __declspec(dllexport)
36 #else
37 #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__)
38 #define DLL_API AL_API
39 #else
40 #define DLL_API
41 #endif /* __LCC__ ||  __MINGW32__ || __CYGWIN32__ */
42 #endif /* DLL_EXPORTS */
43 #endif /* if 0 */
44
45
46 typedef struct OPENAL_SAMPLE    OPENAL_SAMPLE;
47 typedef OPENAL_SAMPLE    OPENAL_STREAM;
48 typedef struct OPENAL_DSPUNIT   OPENAL_DSPUNIT;
49
50 enum OPENAL_OUTPUTTYPES {
51     OPENAL_OUTPUT_NOSOUND,    /* NoSound driver, all calls to this succeed but do nothing. */
52     OPENAL_OUTPUT_OSS,        /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */
53     OPENAL_OUTPUT_ALSA,       /* Linux Alsa driver. */
54 };
55
56 #define OPENAL_LOOP_OFF      0x00000001  /* For non looping samples. */
57 #define OPENAL_LOOP_NORMAL   0x00000002  /* For forward looping samples. */
58 #define OPENAL_HW3D          0x00001000  /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
59 #define OPENAL_2D            0x00002000  /* Tells software (not hardware) based sample not to be included in 3d processing. */
60 #define OPENAL_FREE             -1      /* value to play on any free channel, or to allocate a sample in a free sample slot. */
61 #define OPENAL_ALL              -3      /* for a channel index , this flag will affect ALL channels available!  Not supported by every function. */
62
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66
67 #undef AL_API
68 #define AL_API
69
70     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);
71     AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel);
72     AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel);
73     AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
74     AL_API void OPENAL_Close();
75     AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
76     AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
77     AL_API signed char OPENAL_SetFrequency(int channel, int freq);
78     AL_API signed char OPENAL_SetVolume(int channel, int vol);
79     AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
80     AL_API void OPENAL_SetSFXMasterVolume(int volume);
81     AL_API signed char OPENAL_StopSound(int channel);
82     AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream);
83     AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
84     AL_API void OPENAL_Update();
85     AL_API signed char OPENAL_SetOutput(int outputtype);
86     void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
87     void PlayStreamEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif