]> git.jsancho.org Git - lugaru.git/blob - Source/openal_wrapper.h
Removed FMod from the source.
[lugaru.git] / Source / openal_wrapper.h
1 #ifndef OPENAL_WRAPPER_H
2 #define OPENAL_WRAPPER_H
3
4 #include "AL/al.h"
5 #include "AL/alc.h"
6
7 #include "ogg/ogg.h"
8 #include "vorbis/vorbisfile.h"
9
10 #include "MacCompatibility.h"
11
12 #if 0 /* this should only be enable if OPENAL doesn't provide AL_API on all platforms */
13 #if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32))
14 #ifndef __cdecl
15 #define __cdecl
16 #endif
17 #ifndef __stdcall
18 #define __stdcall
19 #endif
20 #endif
21
22 #if defined(_WIN32_WCE)
23 #define AL_API _cdecl
24 #define F_CALLBACKAPI _cdecl
25 #else
26 #define AL_API __stdcall
27 #define F_CALLBACKAPI __stdcall
28 #endif
29
30 #ifdef DLL_EXPORTS
31 #define DLL_API __declspec(dllexport)
32 #else
33 #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__)
34 #define DLL_API AL_API
35 #else
36 #define DLL_API
37 #endif /* __LCC__ ||  __MINGW32__ || __CYGWIN32__ */
38 #endif /* DLL_EXPORTS */
39 #endif /* if 0 */
40
41
42 typedef struct OPENAL_SAMPLE    OPENAL_SAMPLE;
43 typedef struct OPENAL_STREAM    OPENAL_STREAM;
44 typedef struct OPENAL_DSPUNIT   OPENAL_DSPUNIT;
45
46 enum OPENAL_OUTPUTTYPES
47 {
48         OPENAL_OUTPUT_NOSOUND,    /* NoSound driver, all calls to this succeed but do nothing. */
49         OPENAL_OUTPUT_OSS,        /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */
50         OPENAL_OUTPUT_ALSA,       /* Linux Alsa driver. */
51 };
52
53 #define OPENAL_LOOP_OFF      0x00000001  /* For non looping samples. */
54 #define OPENAL_LOOP_NORMAL   0x00000002  /* For forward looping samples. */
55 #define OPENAL_HW3D          0x00001000  /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
56 #define OPENAL_2D            0x00002000  /* Tells software (not hardware) based sample not to be included in 3d processing. */
57 #define OPENAL_FREE             -1      /* value to play on any free channel, or to allocate a sample in a free sample slot. */
58 #define OPENAL_ALL              -3      /* for a channel index , this flag will affect ALL channels available!  Not supported by every function. */
59
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63
64 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);
65 AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel);
66 AL_API void OPENAL_3D_SetDopplerFactor(float scale);
67 AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
68 AL_API void OPENAL_Close();
69 AL_API OPENAL_SAMPLE *OPENAL_GetCurrentSample(int channel);
70 AL_API signed char OPENAL_GetPaused(int channel);
71 AL_API unsigned int OPENAL_GetLoopMode(int channel);
72 AL_API signed char OPENAL_IsPlaying(int channel);
73 AL_API int OPENAL_PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
74 AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
75 AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
76 AL_API signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode);
77 AL_API signed char OPENAL_Sample_SetMinMaxDistance(OPENAL_SAMPLE *sptr, float mindist, float maxdist);
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 OPENAL_STREAM *OPENAL_Stream_Open(const char *name_or_data, unsigned int mode, int offset, int length);
84 AL_API signed char OPENAL_Stream_Close(OPENAL_STREAM *stream);
85 AL_API OPENAL_SAMPLE *OPENAL_Stream_GetSample(OPENAL_STREAM *stream);
86 AL_API int OPENAL_Stream_PlayEx(int channel, OPENAL_STREAM *stream, OPENAL_DSPUNIT *dsp, signed char startpaused);
87 AL_API signed char OPENAL_Stream_Stop(OPENAL_STREAM *stream);
88 AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
89 AL_API void OPENAL_Update();
90 AL_API signed char OPENAL_SetOutput(int outputtype);
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #if USE_OPENAL
97 #  define OPENAL_Sample_LoadEx(a, b, c, d, e) OPENAL_Sample_Load( a, ConvertFileName( b), c, d, e)
98 #  define OPENAL_Stream_OpenEx(a, b, c, d) OPENAL_Stream_Open(ConvertFileName(a), b, c, d)
99 #elif !PLATFORM_MACOSX
100 #  define OPENAL_Sample_LoadEx(a, b, c, d, e) FSOUND_Sample_Load( a, ConvertFileName( b), c, d, e)
101 #  define OPENAL_Stream_OpenEx(a, b, c, d) FSOUND_Stream_Open(ConvertFileName(a), b, c, d)
102 #endif
103
104 #endif