]> git.tdb.fi Git - ext/openal.git/blob - include/AL/alc.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / include / AL / alc.h
1 #ifndef AL_ALC_H
2 #define AL_ALC_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #ifndef ALC_API
9  #if defined(AL_LIBTYPE_STATIC)
10   #define ALC_API
11  #elif defined(_WIN32)
12   #define ALC_API __declspec(dllimport)
13  #else
14   #define ALC_API extern
15  #endif
16 #endif
17
18 #ifdef _WIN32
19  #define ALC_APIENTRY __cdecl
20 #else
21  #define ALC_APIENTRY
22 #endif
23
24
25 /* Deprecated macros. */
26 #define ALCAPI                                   ALC_API
27 #define ALCAPIENTRY                              ALC_APIENTRY
28 #define ALC_INVALID                              0
29
30 /** Supported ALC version? */
31 #define ALC_VERSION_0_1                          1
32
33 /** Opaque device handle */
34 typedef struct ALCdevice ALCdevice;
35 /** Opaque context handle */
36 typedef struct ALCcontext ALCcontext;
37
38 /** 8-bit boolean */
39 typedef char ALCboolean;
40
41 /** character */
42 typedef char ALCchar;
43
44 /** signed 8-bit integer */
45 typedef signed char ALCbyte;
46
47 /** unsigned 8-bit integer */
48 typedef unsigned char ALCubyte;
49
50 /** signed 16-bit integer */
51 typedef short ALCshort;
52
53 /** unsigned 16-bit integer */
54 typedef unsigned short ALCushort;
55
56 /** signed 32-bit integer */
57 typedef int ALCint;
58
59 /** unsigned 32-bit integer */
60 typedef unsigned int ALCuint;
61
62 /** non-negative 32-bit integer size */
63 typedef int ALCsizei;
64
65 /** 32-bit enumeration value */
66 typedef int ALCenum;
67
68 /** 32-bit IEEE-754 floating-point */
69 typedef float ALCfloat;
70
71 /** 64-bit IEEE-754 floating-point */
72 typedef double ALCdouble;
73
74 /** void type (for opaque pointers only) */
75 typedef void ALCvoid;
76
77
78 /* Enumeration values begin at column 50. Do not use tabs. */
79
80 /** Boolean False. */
81 #define ALC_FALSE                                0
82
83 /** Boolean True. */
84 #define ALC_TRUE                                 1
85
86 /** Context attribute: <int> Hz. */
87 #define ALC_FREQUENCY                            0x1007
88
89 /** Context attribute: <int> Hz. */
90 #define ALC_REFRESH                              0x1008
91
92 /** Context attribute: AL_TRUE or AL_FALSE synchronous context? */
93 #define ALC_SYNC                                 0x1009
94
95 /** Context attribute: <int> requested Mono (3D) Sources. */
96 #define ALC_MONO_SOURCES                         0x1010
97
98 /** Context attribute: <int> requested Stereo Sources. */
99 #define ALC_STEREO_SOURCES                       0x1011
100
101 /** No error. */
102 #define ALC_NO_ERROR                             0
103
104 /** Invalid device handle. */
105 #define ALC_INVALID_DEVICE                       0xA001
106
107 /** Invalid context handle. */
108 #define ALC_INVALID_CONTEXT                      0xA002
109
110 /** Invalid enumeration passed to an ALC call. */
111 #define ALC_INVALID_ENUM                         0xA003
112
113 /** Invalid value passed to an ALC call. */
114 #define ALC_INVALID_VALUE                        0xA004
115
116 /** Out of memory. */
117 #define ALC_OUT_OF_MEMORY                        0xA005
118
119
120 /** Runtime ALC major version. */
121 #define ALC_MAJOR_VERSION                        0x1000
122 /** Runtime ALC minor version. */
123 #define ALC_MINOR_VERSION                        0x1001
124
125 /** Context attribute list size. */
126 #define ALC_ATTRIBUTES_SIZE                      0x1002
127 /** Context attribute list properties. */
128 #define ALC_ALL_ATTRIBUTES                       0x1003
129
130 /** String for the default device specifier. */
131 #define ALC_DEFAULT_DEVICE_SPECIFIER             0x1004
132 /**
133  * Device specifier string.
134  *
135  * If device handle is NULL, it is instead a null-character separated list of
136  * strings of known device specifiers (list ends with an empty string).
137  */
138 #define ALC_DEVICE_SPECIFIER                     0x1005
139 /** String for space-separated list of ALC extensions. */
140 #define ALC_EXTENSIONS                           0x1006
141
142
143 /** Capture extension */
144 #define ALC_EXT_CAPTURE 1
145 /**
146  * Capture device specifier string.
147  *
148  * If device handle is NULL, it is instead a null-character separated list of
149  * strings of known capture device specifiers (list ends with an empty string).
150  */
151 #define ALC_CAPTURE_DEVICE_SPECIFIER             0x310
152 /** String for the default capture device specifier. */
153 #define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER     0x311
154 /** Number of sample frames available for capture. */
155 #define ALC_CAPTURE_SAMPLES                      0x312
156
157
158 /** Enumerate All extension */
159 #define ALC_ENUMERATE_ALL_EXT 1
160 /** String for the default extended device specifier. */
161 #define ALC_DEFAULT_ALL_DEVICES_SPECIFIER        0x1012
162 /**
163  * Device's extended specifier string.
164  *
165  * If device handle is NULL, it is instead a null-character separated list of
166  * strings of known extended device specifiers (list ends with an empty string).
167  */
168 #define ALC_ALL_DEVICES_SPECIFIER                0x1013
169
170
171 #ifndef ALC_NO_PROTOTYPES
172 /* Context management. */
173
174 /** Create and attach a context to the given device. */
175 ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrlist);
176 /**
177  * Makes the given context the active process-wide context. Passing NULL clears
178  * the active context.
179  */
180 ALC_API ALCboolean  ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
181 /** Resumes processing updates for the given context. */
182 ALC_API void        ALC_APIENTRY alcProcessContext(ALCcontext *context);
183 /** Suspends updates for the given context. */
184 ALC_API void        ALC_APIENTRY alcSuspendContext(ALCcontext *context);
185 /** Remove a context from its device and destroys it. */
186 ALC_API void        ALC_APIENTRY alcDestroyContext(ALCcontext *context);
187 /** Returns the currently active context. */
188 ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
189 /** Returns the device that a particular context is attached to. */
190 ALC_API ALCdevice*  ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
191
192 /* Device management. */
193
194 /** Opens the named playback device. */
195 ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename);
196 /** Closes the given playback device. */
197 ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
198
199 /* Error support. */
200
201 /** Obtain the most recent Device error. */
202 ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
203
204 /* Extension support. */
205
206 /**
207  * Query for the presence of an extension on the device. Pass a NULL device to
208  * query a device-inspecific extension.
209  */
210 ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
211 /**
212  * Retrieve the address of a function. Given a non-NULL device, the returned
213  * function may be device-specific.
214  */
215 ALC_API ALCvoid*   ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
216 /**
217  * Retrieve the value of an enum. Given a non-NULL device, the returned value
218  * may be device-specific.
219  */
220 ALC_API ALCenum    ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
221
222 /* Query functions. */
223
224 /** Returns information about the device, and error strings. */
225 ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param);
226 /** Returns information about the device and the version of OpenAL. */
227 ALC_API void           ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
228
229 /* Capture functions. */
230
231 /**
232  * Opens the named capture device with the given frequency, format, and buffer
233  * size.
234  */
235 ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
236 /** Closes the given capture device. */
237 ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
238 /** Starts capturing samples into the device buffer. */
239 ALC_API void       ALC_APIENTRY alcCaptureStart(ALCdevice *device);
240 /** Stops capturing samples. Samples in the device buffer remain available. */
241 ALC_API void       ALC_APIENTRY alcCaptureStop(ALCdevice *device);
242 /** Reads samples from the device buffer. */
243 ALC_API void       ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
244 #endif /* ALC_NO_PROTOTYPES */
245
246 /* Pointer-to-function types, useful for storing dynamically loaded ALC entry
247  * points.
248  */
249 typedef ALCcontext*    (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
250 typedef ALCboolean     (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
251 typedef void           (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
252 typedef void           (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context);
253 typedef void           (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context);
254 typedef ALCcontext*    (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void);
255 typedef ALCdevice*     (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
256 typedef ALCdevice*     (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename);
257 typedef ALCboolean     (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
258 typedef ALCenum        (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
259 typedef ALCboolean     (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
260 typedef ALCvoid*       (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
261 typedef ALCenum        (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
262 typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
263 typedef void           (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
264 typedef ALCdevice*     (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
265 typedef ALCboolean     (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
266 typedef void           (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device);
267 typedef void           (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
268 typedef void           (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
269
270 #ifdef __cplusplus
271 } /* extern "C" */
272 #endif
273
274 #endif /* AL_ALC_H */