Add support for the in-progress ALC_EXT_thread_local_context extension
[openal-soft.git] / include / AL / alc.h
blobdac94615194c0f5e12c78c1b123380bd4af41db0
1 #ifndef AL_ALC_H
2 #define AL_ALC_H
4 #if defined(__cplusplus)
5 extern "C" {
6 #endif
8 #if defined(_WIN32) && !defined(_XBOX)
9 /* _OPENAL32LIB is deprecated */
10 #if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
11 #define ALC_API __declspec(dllexport)
12 #else
13 #define ALC_API __declspec(dllimport)
14 #endif
15 #else
16 #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
17 #define ALC_API __attribute__((visibility("default")))
18 #else
19 #define ALC_API extern
20 #endif
21 #endif
23 #if defined(_WIN32)
24 #define ALC_APIENTRY __cdecl
25 #else
26 #define ALC_APIENTRY
27 #endif
29 #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
30 #pragma export on
31 #endif
34 * The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are
35 * included for applications porting code from AL 1.0
37 #define ALCAPI ALC_API
38 #define ALCAPIENTRY ALC_APIENTRY
39 #define ALC_INVALID 0
42 #define ALC_VERSION_0_1 1
44 typedef struct ALCdevice_struct ALCdevice;
45 typedef struct ALCcontext_struct ALCcontext;
48 /** 8-bit boolean */
49 typedef char ALCboolean;
51 /** character */
52 typedef char ALCchar;
54 /** signed 8-bit 2's complement integer */
55 typedef char ALCbyte;
57 /** unsigned 8-bit integer */
58 typedef unsigned char ALCubyte;
60 /** signed 16-bit 2's complement integer */
61 typedef short ALCshort;
63 /** unsigned 16-bit integer */
64 typedef unsigned short ALCushort;
66 /** signed 32-bit 2's complement integer */
67 typedef int ALCint;
69 /** unsigned 32-bit integer */
70 typedef unsigned int ALCuint;
72 /** non-negative 32-bit binary integer size */
73 typedef int ALCsizei;
75 /** enumerated 32-bit value */
76 typedef int ALCenum;
78 /** 32-bit IEEE754 floating-point */
79 typedef float ALCfloat;
81 /** 64-bit IEEE754 floating-point */
82 typedef double ALCdouble;
84 /** void type (for opaque pointers only) */
85 typedef void ALCvoid;
88 /* Enumerant values begin at column 50. No tabs. */
90 /* Boolean False. */
91 #define ALC_FALSE 0
93 /* Boolean True. */
94 #define ALC_TRUE 1
96 /**
97 * followed by <int> Hz
99 #define ALC_FREQUENCY 0x1007
102 * followed by <int> Hz
104 #define ALC_REFRESH 0x1008
107 * followed by AL_TRUE, AL_FALSE
109 #define ALC_SYNC 0x1009
112 * followed by <int> Num of requested Mono (3D) Sources
114 #define ALC_MONO_SOURCES 0x1010
117 * followed by <int> Num of requested Stereo Sources
119 #define ALC_STEREO_SOURCES 0x1011
122 * errors
126 * No error
128 #define ALC_NO_ERROR ALC_FALSE
131 * No device
133 #define ALC_INVALID_DEVICE 0xA001
136 * invalid context ID
138 #define ALC_INVALID_CONTEXT 0xA002
141 * bad enum
143 #define ALC_INVALID_ENUM 0xA003
146 * bad value
148 #define ALC_INVALID_VALUE 0xA004
151 * Out of memory.
153 #define ALC_OUT_OF_MEMORY 0xA005
157 * The Specifier string for default device
159 #define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
160 #define ALC_DEVICE_SPECIFIER 0x1005
161 #define ALC_EXTENSIONS 0x1006
163 #define ALC_MAJOR_VERSION 0x1000
164 #define ALC_MINOR_VERSION 0x1001
166 #define ALC_ATTRIBUTES_SIZE 0x1002
167 #define ALC_ALL_ATTRIBUTES 0x1003
171 * Capture extension
173 #define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
174 #define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
175 #define ALC_CAPTURE_SAMPLES 0x312
179 * Context Management
181 ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
183 ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
185 ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
187 ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
189 ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
191 ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
193 ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
197 * Device Management
199 ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
201 ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
205 * Error support.
206 * Obtain the most recent Context error
208 ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
212 * Extension support.
213 * Query for the presence of an extension, and obtain any appropriate
214 * function pointers and enum values.
216 ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
218 ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
220 ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
224 * Query functions
226 ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
228 ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
232 * Capture functions
234 ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
236 ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
238 ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
240 ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
242 ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
245 * Pointer-to-function types, useful for dynamically getting ALC entry points.
247 typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
248 typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
249 typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
250 typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
251 typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
252 typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
253 typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
254 typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
255 typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
256 typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
257 typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
258 typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
259 typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
260 typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
261 typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
262 typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
263 typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
264 typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
265 typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
266 typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
268 #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
269 #pragma export off
270 #endif
272 #if defined(__cplusplus)
274 #endif
276 #endif /* AL_ALC_H */