]> git.jsancho.org Git - lugaru.git/blob - Source/openal_wrapper.h
Add copyright header to source files to match license for project
[lugaru.git] / Source / openal_wrapper.h
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3
4 This file is part of Lugaru.
5
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 See the GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21
22 #ifndef OPENAL_WRAPPER_H
23 #define OPENAL_WRAPPER_H
24
25 #ifdef _WIN32
26 #include <malloc.h>
27 #endif
28
29 #include "al.h"
30 #include "alc.h"
31
32 #include "ogg/ogg.h"
33 #include "vorbis/vorbisfile.h"
34
35 #include "MacCompatibility.h"
36
37 #if 0 /* this should only be enable if OPENAL doesn't provide AL_API on all platforms */
38 #if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32))
39 #ifndef __cdecl
40 #define __cdecl
41 #endif
42 #ifndef __stdcall
43 #define __stdcall
44 #endif
45 #endif
46
47 #if defined(_WIN32_WCE)
48 #define AL_API _cdecl
49 #define F_CALLBACKAPI _cdecl
50 #else
51 #define AL_API __stdcall
52 #define F_CALLBACKAPI __stdcall
53 #endif
54
55 #ifdef DLL_EXPORTS
56 #define DLL_API __declspec(dllexport)
57 #else
58 #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__)
59 #define DLL_API AL_API
60 #else
61 #define DLL_API
62 #endif /* __LCC__ ||  __MINGW32__ || __CYGWIN32__ */
63 #endif /* DLL_EXPORTS */
64 #endif /* if 0 */
65
66
67 typedef struct OPENAL_SAMPLE    OPENAL_SAMPLE;
68 typedef OPENAL_SAMPLE    OPENAL_STREAM;
69 typedef struct OPENAL_DSPUNIT   OPENAL_DSPUNIT;
70
71 enum OPENAL_OUTPUTTYPES {
72     OPENAL_OUTPUT_NOSOUND,    /* NoSound driver, all calls to this succeed but do nothing. */
73     OPENAL_OUTPUT_OSS,        /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */
74     OPENAL_OUTPUT_ALSA,       /* Linux Alsa driver. */
75 };
76
77 #define OPENAL_LOOP_OFF      0x00000001  /* For non looping samples. */
78 #define OPENAL_LOOP_NORMAL   0x00000002  /* For forward looping samples. */
79 #define OPENAL_HW3D          0x00001000  /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
80 #define OPENAL_2D            0x00002000  /* Tells software (not hardware) based sample not to be included in 3d processing. */
81 #define OPENAL_FREE             -1      /* value to play on any free channel, or to allocate a sample in a free sample slot. */
82 #define OPENAL_ALL              -3      /* for a channel index , this flag will affect ALL channels available!  Not supported by every function. */
83
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87
88 #undef AL_API
89 #define AL_API
90
91     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);
92     AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel);
93     AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel);
94     AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
95     AL_API void OPENAL_Close();
96     AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
97     AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
98     AL_API signed char OPENAL_SetFrequency(int channel, int freq);
99     AL_API signed char OPENAL_SetVolume(int channel, int vol);
100     AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
101     AL_API void OPENAL_SetSFXMasterVolume(int volume);
102     AL_API signed char OPENAL_StopSound(int channel);
103     AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream);
104     AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
105     AL_API void OPENAL_Update();
106     AL_API signed char OPENAL_SetOutput(int outputtype);
107     void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
108     void PlayStreamEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif