cards: Fix description of cdtTerm.
[wine] / dlls / openal32 / openal.c
1 /*
2  * OpenAL32.dll thunk. Wraps Win32 OpenAL function calls around a native
3  * implementation.
4  *
5  * Copyright 2007 Nick Burns (adger44@hotmail.com)
6  * Copyright 2007,2009 Chris Robinson
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "config.h"
24
25 #include <stdarg.h>
26 #include <string.h>
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wine/debug.h"
31
32 #ifdef HAVE_AL_AL_H
33 #include <AL/al.h>
34 #include <AL/alc.h>
35 #elif defined(HAVE_OPENAL_AL_H)
36 #include <OpenAL/al.h>
37 #include <OpenAL/alc.h>
38 #endif
39
40 WINE_DEFAULT_DEBUG_CHANNEL(openal32);
41
42 static ALCboolean  (ALC_APIENTRY*alcSetThreadContext)(ALCcontext *context);
43 static ALCcontext* (ALC_APIENTRY*alcGetThreadContext)(ALCvoid);
44
45 static ALboolean loaded_procs;
46
47 static ALvoid (AL_APIENTRY*alBufferDataStatic)(const ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq);
48 static ALvoid (AL_APIENTRY*alGenFilters)(ALsizei n, ALuint* filters);
49 static ALvoid (AL_APIENTRY*alDeleteFilters)(ALsizei n, const ALuint* filters);
50 static ALboolean (AL_APIENTRY*alIsFilter)(ALuint fid);
51 static ALvoid (AL_APIENTRY*alFilterf)(ALuint fid, ALenum param, ALfloat value);
52 static ALvoid (AL_APIENTRY*alFilterfv)(ALuint fid, ALenum param, const ALfloat* values);
53 static ALvoid (AL_APIENTRY*alFilteri)(ALuint fid, ALenum param, ALint value);
54 static ALvoid (AL_APIENTRY*alFilteriv)(ALuint fid, ALenum param, const ALint* values);
55 static ALvoid (AL_APIENTRY*alGetFilterf)(ALuint fid, ALenum param, ALfloat* value);
56 static ALvoid (AL_APIENTRY*alGetFilterfv)(ALuint fid, ALenum param, ALfloat* values);
57 static ALvoid (AL_APIENTRY*alGetFilteri)(ALuint fid, ALenum param, ALint* value);
58 static ALvoid (AL_APIENTRY*alGetFilteriv)(ALuint fid, ALenum param, ALint* values);
59 static ALvoid (AL_APIENTRY*alGenEffects)(ALsizei n, ALuint* effects);
60 static ALvoid (AL_APIENTRY*alDeleteEffects)(ALsizei n, const ALuint* effects);
61 static ALboolean (AL_APIENTRY*alIsEffect)(ALuint eid);
62 static ALvoid (AL_APIENTRY*alEffectf)(ALuint eid, ALenum param, ALfloat value);
63 static ALvoid (AL_APIENTRY*alEffectfv)(ALuint eid, ALenum param, const ALfloat* values);
64 static ALvoid (AL_APIENTRY*alEffecti)(ALuint eid, ALenum param, ALint value);
65 static ALvoid (AL_APIENTRY*alEffectiv)(ALuint eid, ALenum param, const ALint* values);
66 static ALvoid (AL_APIENTRY*alGetEffectf)(ALuint eid, ALenum param, ALfloat* value);
67 static ALvoid (AL_APIENTRY*alGetEffectfv)(ALuint eid, ALenum param, ALfloat* values);
68 static ALvoid (AL_APIENTRY*alGetEffecti)(ALuint eid, ALenum param, ALint* value);
69 static ALvoid (AL_APIENTRY*alGetEffectiv)(ALuint eid, ALenum param, ALint* values);
70 static ALvoid (AL_APIENTRY*alGenAuxiliaryEffectSlots)(ALsizei n, ALuint* slots);
71 static ALvoid (AL_APIENTRY*alDeleteAuxiliaryEffectSlots)(ALsizei n, const ALuint* slots);
72 static ALboolean (AL_APIENTRY*alIsAuxiliaryEffectSlot)(ALuint sid);
73 static ALvoid (AL_APIENTRY*alAuxiliaryEffectSlotf)(ALuint sid, ALenum param, ALfloat value);
74 static ALvoid (AL_APIENTRY*alAuxiliaryEffectSlotfv)(ALuint sid, ALenum param, const ALfloat* values);
75 static ALvoid (AL_APIENTRY*alAuxiliaryEffectSloti)(ALuint sid, ALenum param, ALint value);
76 static ALvoid (AL_APIENTRY*alAuxiliaryEffectSlotiv)(ALuint sid, ALenum param, const ALint* values);
77 static ALvoid (AL_APIENTRY*alGetAuxiliaryEffectSlotf)(ALuint sid, ALenum param, ALfloat* value);
78 static ALvoid (AL_APIENTRY*alGetAuxiliaryEffectSlotfv)(ALuint sid, ALenum param, ALfloat* values);
79 static ALvoid (AL_APIENTRY*alGetAuxiliaryEffectSloti)(ALuint sid, ALenum param, ALint* value);
80 static ALvoid (AL_APIENTRY*alGetAuxiliaryEffectSlotiv)(ALuint sid, ALenum param, ALint* values);
81
82 struct FuncList {
83     const char *name;
84     void *proc;
85 };
86
87 static const struct FuncList ALCFuncs[];
88 static const struct FuncList ALFuncs[];
89
90 CRITICAL_SECTION openal_cs;
91 static CRITICAL_SECTION_DEBUG openal_cs_debug =
92 {
93     0, 0, &openal_cs,
94     {&openal_cs_debug.ProcessLocksList,
95     &openal_cs_debug.ProcessLocksList},
96     0, 0, {(DWORD_PTR)(__FILE__ ": openal_cs")}
97 };
98 CRITICAL_SECTION openal_cs = {&openal_cs_debug, -1, 0, 0, 0, 0};
99
100 /***********************************************************************
101  *           OpenAL initialisation routine
102  */
103 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
104 {
105     switch(reason)
106     {
107     case DLL_PROCESS_ATTACH:
108         DisableThreadLibraryCalls(hinst);
109 #define LOADFUNC(x) x = alcGetProcAddress(NULL, #x)
110         LOADFUNC(alcSetThreadContext);
111         LOADFUNC(alcGetThreadContext);
112 #undef LOADFUNC
113         break;
114     }
115
116     return TRUE;
117 }
118
119
120 static void LoadProcs(void)
121 {
122 #define LOADFUNC(x) x = alGetProcAddress(#x)
123     LOADFUNC(alBufferDataStatic);
124     LOADFUNC(alGenFilters);
125     LOADFUNC(alDeleteFilters);
126     LOADFUNC(alIsFilter);
127     LOADFUNC(alFilterf);
128     LOADFUNC(alFilterfv);
129     LOADFUNC(alFilteri);
130     LOADFUNC(alFilteriv);
131     LOADFUNC(alGetFilterf);
132     LOADFUNC(alGetFilterfv);
133     LOADFUNC(alGetFilteri);
134     LOADFUNC(alGetFilteriv);
135     LOADFUNC(alGenEffects);
136     LOADFUNC(alDeleteEffects);
137     LOADFUNC(alIsEffect);
138     LOADFUNC(alEffectf);
139     LOADFUNC(alEffectfv);
140     LOADFUNC(alEffecti);
141     LOADFUNC(alEffectiv);
142     LOADFUNC(alGetEffectf);
143     LOADFUNC(alGetEffectfv);
144     LOADFUNC(alGetEffecti);
145     LOADFUNC(alGetEffectiv);
146     LOADFUNC(alGenAuxiliaryEffectSlots);
147     LOADFUNC(alDeleteAuxiliaryEffectSlots);
148     LOADFUNC(alIsAuxiliaryEffectSlot);
149     LOADFUNC(alAuxiliaryEffectSlotf);
150     LOADFUNC(alAuxiliaryEffectSlotfv);
151     LOADFUNC(alAuxiliaryEffectSloti);
152     LOADFUNC(alAuxiliaryEffectSlotiv);
153     LOADFUNC(alGetAuxiliaryEffectSlotf);
154     LOADFUNC(alGetAuxiliaryEffectSlotfv);
155     LOADFUNC(alGetAuxiliaryEffectSloti);
156     LOADFUNC(alGetAuxiliaryEffectSlotiv);
157 #undef LOADFUNC
158 }
159
160 /***********************************************************************
161  *           OpenAL thunk routines
162  */
163
164 /* OpenAL ALC 1.0 functions */
165 ALCcontext* CDECL wine_alcCreateContext(ALCdevice *device, const ALCint* attrlist)
166 {
167     return alcCreateContext(device, attrlist);
168 }
169
170 ALCboolean CDECL wine_alcMakeContextCurrent(ALCcontext *context)
171 {
172     EnterCriticalSection(&openal_cs);
173     if(alcMakeContextCurrent(context) == ALC_FALSE)
174     {
175         WARN("Failed to make context %p current\n", context);
176         LeaveCriticalSection(&openal_cs);
177         return ALC_FALSE;
178     }
179
180     if(context && !loaded_procs)
181     {
182         loaded_procs = AL_TRUE;
183         LoadProcs();
184     }
185     LeaveCriticalSection(&openal_cs);
186
187     return ALC_TRUE;
188 }
189
190 ALvoid CDECL wine_alcProcessContext(ALCcontext *context)
191 {
192     alcProcessContext(context);
193 }
194
195 ALvoid CDECL wine_alcSuspendContext(ALCcontext *context)
196 {
197     alcSuspendContext(context);
198 }
199
200 ALvoid CDECL wine_alcDestroyContext(ALCcontext *context)
201 {
202     alcDestroyContext(context);
203 }
204
205 ALCcontext* CDECL wine_alcGetCurrentContext(ALCvoid)
206 {
207     return alcGetCurrentContext();
208 }
209
210 ALCdevice* CDECL wine_alcGetContextsDevice(ALCcontext *context)
211 {
212     return alcGetContextsDevice(context);
213 }
214
215 ALCdevice* CDECL wine_alcOpenDevice(const ALCchar *devicename)
216 {
217     if(devicename != NULL && (strcmp(devicename, "DirectSound3D") == 0 ||
218                               strcmp(devicename, "DirectSound") == 0 ||
219                               strcmp(devicename, "Generic Hardware") == 0 ||
220                               strcmp(devicename, "Generic Software") == 0)) {
221         devicename = NULL;
222     }
223     return alcOpenDevice(devicename);
224 }
225
226 ALCboolean CDECL wine_alcCloseDevice(ALCdevice *device)
227 {
228     return alcCloseDevice(device);
229 }
230
231 ALCenum CDECL wine_alcGetError(ALCdevice *device)
232 {
233     return alcGetError(device);
234 }
235
236 ALCboolean CDECL wine_alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname)
237 {
238     return alcIsExtensionPresent(device, extname);
239 }
240
241 ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *device, const ALCchar *funcname)
242 {
243     void *proc;
244     int i;
245
246     /* Make sure the host implementation has the requested function */
247     proc = alcGetProcAddress(device, funcname);
248     if(!proc)
249         return NULL;
250
251     for(i = 0;ALCFuncs[i].name;i++)
252     {
253         if(strcmp(funcname, ALCFuncs[i].name) == 0)
254             return ALCFuncs[i].proc;
255     }
256     FIXME("Could not find function in list: %s\n", funcname);
257     return NULL;
258 }
259
260 ALCenum CDECL wine_alcGetEnumValue(ALCdevice *device, const ALCchar *enumname)
261 {
262     return alcGetEnumValue(device, enumname);
263 }
264
265 const ALCchar* CDECL wine_alcGetString(ALCdevice *device, ALCenum param)
266 {
267     return alcGetString(device, param);
268 }
269
270 ALvoid CDECL wine_alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest)
271 {
272     return alcGetIntegerv(device, param, size, dest);
273 }
274
275
276 /* OpenAL 1.0 functions */
277 ALvoid CDECL wine_alEnable(ALenum capability)
278 {
279     alEnable(capability);
280 }
281
282 ALvoid CDECL wine_alDisable(ALenum capability)
283 {
284     alDisable(capability);
285 }
286
287 ALboolean CDECL wine_alIsEnabled(ALenum capability)
288 {
289     return alIsEnabled(capability);
290 }
291
292 const ALchar* CDECL wine_alGetString(ALenum param)
293 {
294     return alGetString(param);
295 }
296
297 ALvoid CDECL wine_alGetBooleanv(ALenum param, ALboolean* data)
298 {
299     alGetBooleanv(param, data);
300 }
301
302 ALvoid CDECL wine_alGetIntegerv(ALenum param, ALint* data)
303 {
304     alGetIntegerv(param, data);
305 }
306
307 ALvoid CDECL wine_alGetFloatv(ALenum param, ALfloat* data)
308 {
309     alGetFloatv(param, data);
310 }
311
312 ALvoid CDECL wine_alGetDoublev(ALenum param, ALdouble* data)
313 {
314     alGetDoublev(param, data);
315 }
316
317 ALboolean CDECL wine_alGetBoolean(ALenum param)
318 {
319     return alGetBoolean(param);
320 }
321
322 ALint CDECL wine_alGetInteger(ALenum param)
323 {
324     return alGetInteger(param);
325 }
326
327 ALfloat CDECL wine_alGetFloat(ALenum param)
328 {
329     return alGetFloat(param);
330 }
331
332 ALdouble CDECL wine_alGetDouble(ALenum param)
333 {
334     return alGetDouble(param);
335 }
336
337 ALenum CDECL wine_alGetError(ALvoid)
338 {
339     return alGetError();
340 }
341
342 ALboolean CDECL wine_alIsExtensionPresent(const ALchar* extname)
343 {
344     return alIsExtensionPresent(extname);
345 }
346
347 ALvoid* CDECL wine_alGetProcAddress(const ALchar* funcname)
348 {
349     void *proc;
350     int i;
351
352     /* Make sure the host implementation has the requested function. This will
353      * also set the last AL error properly if the function should not be
354      * returned (eg. no current context). */
355     proc = alGetProcAddress(funcname);
356     if(!proc)
357         return NULL;
358
359     for(i = 0;ALFuncs[i].name;i++)
360     {
361         if(strcmp(funcname, ALFuncs[i].name) == 0)
362             return ALFuncs[i].proc;
363     }
364     FIXME("Could not find function in list: %s\n", funcname);
365     return NULL;
366 }
367
368 ALenum CDECL wine_alGetEnumValue(const ALchar* ename)
369 {
370     return alGetEnumValue(ename);
371 }
372
373 ALvoid CDECL wine_alListenerf(ALenum param, ALfloat value)
374 {
375     alListenerf(param, value);
376 }
377
378 ALvoid CDECL wine_alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
379 {
380     alListener3f(param, value1, value2, value3);
381 }
382
383 ALvoid CDECL wine_alListenerfv(ALenum param, const ALfloat* values)
384 {
385     alListenerfv(param, values);
386 }
387
388 ALvoid CDECL wine_alListeneri(ALenum param, ALint value)
389 {
390     alListeneri(param, value);
391 }
392
393 ALvoid CDECL wine_alGetListenerf(ALenum param, ALfloat* value)
394 {
395     alGetListenerf(param, value);
396 }
397
398 ALvoid CDECL wine_alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)
399 {
400     alGetListener3f(param, value1, value2, value3);
401 }
402
403 ALvoid CDECL wine_alGetListenerfv(ALenum param, ALfloat* values)
404 {
405     alGetListenerfv(param, values);
406 }
407
408 ALvoid CDECL wine_alGetListeneri(ALenum param, ALint* value)
409 {
410     alGetListeneri(param, value);
411 }
412
413 ALvoid CDECL wine_alGetListeneriv(ALenum param, ALint* values)
414 {
415     alGetListeneriv(param, values);
416 }
417
418 ALvoid CDECL wine_alGenSources(ALsizei n, ALuint* sources)
419 {
420     alGenSources(n, sources);
421 }
422
423 ALvoid CDECL wine_alDeleteSources(ALsizei n, const ALuint* sources)
424 {
425     alDeleteSources(n, sources);
426 }
427
428 ALboolean CDECL wine_alIsSource(ALuint sid)
429 {
430     return alIsSource(sid);
431 }
432
433 ALvoid CDECL wine_alSourcef(ALuint sid, ALenum param, ALfloat value)
434 {
435     alSourcef(sid, param, value);
436 }
437
438 ALvoid CDECL wine_alSource3f(ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
439 {
440     alSource3f(sid, param, value1, value2, value3);
441 }
442
443 ALvoid CDECL wine_alSourcefv(ALuint sid, ALenum param, const ALfloat* values)
444 {
445     alSourcefv(sid, param, values);
446 }
447
448 ALvoid CDECL wine_alSourcei(ALuint sid, ALenum param, ALint value)
449 {
450     alSourcei(sid, param, value);
451 }
452
453 ALvoid CDECL wine_alGetSourcef(ALuint sid, ALenum param, ALfloat* value)
454 {
455     alGetSourcef(sid, param, value);
456 }
457
458 ALvoid CDECL wine_alGetSource3f(ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
459 {
460     alGetSource3f(sid, param, value1, value2, value3);
461 }
462
463 ALvoid CDECL wine_alGetSourcefv(ALuint sid, ALenum param, ALfloat* values)
464 {
465     alGetSourcefv(sid, param, values);
466 }
467
468 ALvoid CDECL wine_alGetSourcei(ALuint sid, ALenum param, ALint* value)
469 {
470     alGetSourcei(sid, param, value);
471 }
472
473 ALvoid CDECL wine_alGetSourceiv(ALuint sid, ALenum param, ALint* values)
474 {
475     alGetSourceiv(sid, param, values);
476 }
477
478 ALvoid CDECL wine_alSourcePlayv(ALsizei ns, const ALuint *sids)
479 {
480     alSourcePlayv(ns, sids);
481 }
482
483 ALvoid CDECL wine_alSourceStopv(ALsizei ns, const ALuint *sids)
484 {
485     alSourceStopv(ns, sids);
486 }
487
488 ALvoid CDECL wine_alSourceRewindv(ALsizei ns, const ALuint *sids)
489 {
490     alSourceRewindv(ns, sids);
491 }
492
493 ALvoid CDECL wine_alSourcePausev(ALsizei ns, const ALuint *sids)
494 {
495     alSourcePausev(ns, sids);
496 }
497
498 ALvoid CDECL wine_alSourcePlay(ALuint sid)
499 {
500     alSourcePlay(sid);
501 }
502
503 ALvoid CDECL wine_alSourceStop(ALuint sid)
504 {
505     alSourceStop(sid);
506 }
507
508 ALvoid CDECL wine_alSourceRewind(ALuint sid)
509 {
510     alSourceRewind(sid);
511 }
512
513 ALvoid CDECL wine_alSourcePause(ALuint sid)
514 {
515     alSourcePause(sid);
516 }
517
518 ALvoid CDECL wine_alSourceQueueBuffers(ALuint sid, ALsizei numEntries, const ALuint *bids)
519 {
520     alSourceQueueBuffers(sid, numEntries, bids);
521 }
522
523 ALvoid CDECL wine_alSourceUnqueueBuffers(ALuint sid, ALsizei numEntries, ALuint *bids)
524 {
525     alSourceUnqueueBuffers(sid, numEntries, bids);
526 }
527
528 ALvoid CDECL wine_alGenBuffers(ALsizei n, ALuint* buffers)
529 {
530     alGenBuffers(n, buffers);
531 }
532
533 ALvoid CDECL wine_alDeleteBuffers(ALsizei n, const ALuint* buffers)
534 {
535     alDeleteBuffers(n, buffers);
536 }
537
538 ALboolean CDECL wine_alIsBuffer(ALuint bid)
539 {
540     return alIsBuffer(bid);
541 }
542
543 ALvoid CDECL wine_alBufferData(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
544 {
545     alBufferData(bid, format, data, size, freq);
546 }
547
548 ALvoid CDECL wine_alBufferDataStatic(const ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
549 {
550     alBufferDataStatic(bid, format, data, size, freq);
551 }
552
553 ALvoid CDECL wine_alGetBufferf(ALuint bid, ALenum param, ALfloat* value)
554 {
555     alGetBufferf(bid, param, value);
556 }
557
558 ALvoid CDECL wine_alGetBufferfv(ALuint bid, ALenum param, ALfloat* values)
559 {
560     alGetBufferfv(bid, param, values);
561 }
562
563 ALvoid CDECL wine_alGetBufferi(ALuint bid, ALenum param, ALint* value)
564 {
565     alGetBufferi(bid, param, value);
566 }
567
568 ALvoid CDECL wine_alGetBufferiv(ALuint bid, ALenum param, ALint* values)
569 {
570     alGetBufferiv(bid, param, values);
571 }
572
573 ALvoid CDECL wine_alDopplerFactor(ALfloat value)
574 {
575     alDopplerFactor(value);
576 }
577
578 ALvoid CDECL wine_alDopplerVelocity(ALfloat value)
579 {
580     alDopplerVelocity(value);
581 }
582
583 ALvoid CDECL wine_alDistanceModel(ALenum distanceModel)
584 {
585     alDistanceModel(distanceModel);
586 }
587
588
589 /* OpenAL ALC 1.1 functions */
590 ALCdevice* CDECL wine_alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize)
591 {
592      return alcCaptureOpenDevice(devicename, frequency, format, buffersize);
593 }
594
595 ALCboolean CDECL wine_alcCaptureCloseDevice(ALCdevice *device)
596 {
597     return alcCaptureCloseDevice(device);
598 }
599
600 ALCvoid CDECL wine_alcCaptureStart(ALCdevice *device)
601 {
602     alcCaptureStart(device);
603 }
604
605 ALCvoid CDECL wine_alcCaptureStop(ALCdevice *device)
606 {
607     alcCaptureStop(device);
608 }
609
610 ALCvoid CDECL wine_alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
611 {
612     alcCaptureSamples(device, buffer, samples);
613 }
614
615 /* OpenAL 1.1 functions */
616 ALvoid CDECL wine_alListener3i(ALenum param, ALint value1, ALint value2, ALint value3)
617 {
618     alListener3i(param, value1, value2, value3);
619 }
620
621 ALvoid CDECL wine_alListeneriv(ALenum param, const ALint* values)
622 {
623     alListeneriv(param, values);
624 }
625
626 ALvoid CDECL wine_alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3)
627 {
628     alGetListener3i(param, value1, value2, value3);
629 }
630
631 ALvoid CDECL wine_alSource3i(ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3)
632 {
633     alSource3i(sid, param, value1, value2, value3);
634 }
635
636 ALvoid CDECL wine_alSourceiv(ALuint sid, ALenum param, const ALint* values)
637 {
638     alSourceiv(sid, param, values);
639 }
640
641 ALvoid CDECL wine_alGetSource3i(ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
642 {
643     alGetSource3i(sid, param, value1, value2, value3);
644 }
645
646 ALvoid CDECL wine_alBufferf(ALuint bid, ALenum param, ALfloat value)
647 {
648     alBufferf(bid, param, value);
649 }
650
651 ALvoid CDECL wine_alBuffer3f(ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
652 {
653     alBuffer3f(bid, param, value1, value2, value3);
654 }
655
656 ALvoid CDECL wine_alBufferfv(ALuint bid, ALenum param, const ALfloat* values)
657 {
658     alBufferfv(bid, param, values);
659 }
660
661 ALvoid CDECL wine_alBufferi(ALuint bid, ALenum param, ALint value)
662 {
663     alBufferi(bid, param, value);
664 }
665
666 ALvoid CDECL wine_alBuffer3i(ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3)
667 {
668     alBuffer3i(bid, param, value1, value2, value3);
669 }
670
671 ALvoid CDECL wine_alBufferiv(ALuint bid, ALenum param, const ALint* values)
672 {
673     alBufferiv(bid, param, values);
674 }
675
676 ALvoid CDECL wine_alGetBuffer3f(ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
677 {
678     alGetBuffer3f(bid, param, value1, value2, value3);
679 }
680
681 ALvoid CDECL wine_alGetBuffer3i(ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
682 {
683     alGetBuffer3i(bid, param, value1, value2, value3);
684 }
685
686 ALvoid CDECL wine_alSpeedOfSound(ALfloat value)
687 {
688     alSpeedOfSound(value);
689 }
690
691 /* OpenAL EFX extension functions */
692 ALvoid CDECL wine_alGenFilters(ALsizei n, ALuint* filters)
693 {
694     alGenFilters(n, filters);
695 }
696
697 ALvoid CDECL wine_alDeleteFilters(ALsizei n, const ALuint* filters)
698 {
699     alDeleteFilters(n, filters);
700 }
701
702 ALboolean CDECL wine_alIsFilter(ALuint fid)
703 {
704     return alIsFilter(fid);
705 }
706
707 ALvoid CDECL wine_alFilterf(ALuint fid, ALenum param, ALfloat value)
708 {
709     alFilterf(fid, param, value);
710 }
711
712 ALvoid CDECL wine_alFilterfv(ALuint fid, ALenum param, const ALfloat* values)
713 {
714     alFilterfv(fid, param, values);
715 }
716
717 ALvoid CDECL wine_alFilteri(ALuint fid, ALenum param, ALint value)
718 {
719     alFilteri(fid, param, value);
720 }
721
722 ALvoid CDECL wine_alFilteriv(ALuint fid, ALenum param, const ALint* values)
723 {
724     alFilteriv(fid, param, values);
725 }
726
727 ALvoid CDECL wine_alGetFilterf(ALuint fid, ALenum param, ALfloat* value)
728 {
729     alGetFilterf(fid, param, value);
730 }
731
732 ALvoid CDECL wine_alGetFilterfv(ALuint fid, ALenum param, ALfloat* values)
733 {
734     alGetFilterfv(fid, param, values);
735 }
736
737 ALvoid CDECL wine_alGetFilteri(ALuint fid, ALenum param, ALint* value)
738 {
739     alGetFilteri(fid, param, value);
740 }
741
742 ALvoid CDECL wine_alGetFilteriv(ALuint fid, ALenum param, ALint* values)
743 {
744     alGetFilteriv(fid, param, values);
745 }
746
747
748 ALvoid CDECL wine_alGenEffects(ALsizei n, ALuint* effects)
749 {
750     alGenEffects(n, effects);
751 }
752
753 ALvoid CDECL wine_alDeleteEffects(ALsizei n, const ALuint* effects)
754 {
755     alDeleteEffects(n, effects);
756 }
757
758 ALboolean CDECL wine_alIsEffect(ALuint eid)
759 {
760     return alIsEffect(eid);
761 }
762
763 ALvoid CDECL wine_alEffectf(ALuint eid, ALenum param, ALfloat value)
764 {
765     alEffectf(eid, param, value);
766 }
767
768 ALvoid CDECL wine_alEffectfv(ALuint eid, ALenum param, const ALfloat* values)
769 {
770     alEffectfv(eid, param, values);
771 }
772
773 ALvoid CDECL wine_alEffecti(ALuint eid, ALenum param, ALint value)
774 {
775     alEffecti(eid, param, value);
776 }
777
778 ALvoid CDECL wine_alEffectiv(ALuint eid, ALenum param, const ALint* values)
779 {
780     alEffectiv(eid, param, values);
781 }
782
783 ALvoid CDECL wine_alGetEffectf(ALuint eid, ALenum param, ALfloat* value)
784 {
785     alGetEffectf(eid, param, value);
786 }
787
788 ALvoid CDECL wine_alGetEffectfv(ALuint eid, ALenum param, ALfloat* values)
789 {
790     alGetEffectfv(eid, param, values);
791 }
792
793 ALvoid CDECL wine_alGetEffecti(ALuint eid, ALenum param, ALint* value)
794 {
795     alGetEffecti(eid, param, value);
796 }
797
798 ALvoid CDECL wine_alGetEffectiv(ALuint eid, ALenum param, ALint* values)
799 {
800     alGetEffectiv(eid, param, values);
801 }
802
803
804 ALvoid CDECL wine_alGenAuxiliaryEffectSlots(ALsizei n, ALuint* slots)
805 {
806     alGenAuxiliaryEffectSlots(n, slots);
807 }
808
809 ALvoid CDECL wine_alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint* slots)
810 {
811     alDeleteAuxiliaryEffectSlots(n, slots);
812 }
813
814 ALboolean CDECL wine_alIsAuxiliaryEffectSlot(ALuint sid)
815 {
816     return alIsAuxiliaryEffectSlot(sid);
817 }
818
819 ALvoid CDECL wine_alAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat value)
820 {
821     alAuxiliaryEffectSlotf(sid, param, value);
822 }
823
824 ALvoid CDECL wine_alAuxiliaryEffectSlotfv(ALuint sid, ALenum param, const ALfloat* values)
825 {
826     alAuxiliaryEffectSlotfv(sid, param, values);
827 }
828
829 ALvoid CDECL wine_alAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint value)
830 {
831     alAuxiliaryEffectSloti(sid, param, value);
832 }
833
834 ALvoid CDECL wine_alAuxiliaryEffectSlotiv(ALuint sid, ALenum param, const ALint* values)
835 {
836     alAuxiliaryEffectSlotiv(sid, param, values);
837 }
838
839 ALvoid CDECL wine_alGetAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat* value)
840 {
841     alGetAuxiliaryEffectSlotf(sid, param, value);
842 }
843
844 ALvoid CDECL wine_alGetAuxiliaryEffectSlotfv(ALuint sid, ALenum param, ALfloat* values)
845 {
846     alGetAuxiliaryEffectSlotfv(sid, param, values);
847 }
848
849 ALvoid CDECL wine_alGetAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint* value)
850 {
851     alGetAuxiliaryEffectSloti(sid, param, value);
852 }
853
854 ALvoid CDECL wine_alGetAuxiliaryEffectSlotiv(ALuint sid, ALenum param, ALint* values)
855 {
856     alGetAuxiliaryEffectSlotiv(sid, param, values);
857 }
858
859
860 /* Thread-local context functions */
861 ALCboolean CDECL wine_alcSetThreadContext(ALCcontext *context)
862 {
863     EnterCriticalSection(&openal_cs);
864     if(alcSetThreadContext(context) == ALC_FALSE)
865     {
866         WARN("Failed to make context %p current\n", context);
867         LeaveCriticalSection(&openal_cs);
868         return ALC_FALSE;
869     }
870
871     if(context && !loaded_procs)
872     {
873         loaded_procs = AL_TRUE;
874         LoadProcs();
875     }
876     LeaveCriticalSection(&openal_cs);
877
878     return ALC_TRUE;
879 }
880
881 ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid)
882 {
883     return alcGetThreadContext();
884 }
885
886
887 static const struct FuncList ALCFuncs[] = {
888     { "alcCreateContext",           wine_alcCreateContext        },
889     { "alcMakeContextCurrent",      wine_alcMakeContextCurrent   },
890     { "alcProcessContext",          wine_alcProcessContext       },
891     { "alcSuspendContext",          wine_alcSuspendContext       },
892     { "alcDestroyContext",          wine_alcDestroyContext       },
893     { "alcGetCurrentContext",       wine_alcGetCurrentContext    },
894     { "alcGetContextsDevice",       wine_alcGetContextsDevice    },
895     { "alcOpenDevice",              wine_alcOpenDevice           },
896     { "alcCloseDevice",             wine_alcCloseDevice          },
897     { "alcGetError",                wine_alcGetError             },
898     { "alcIsExtensionPresent",      wine_alcIsExtensionPresent   },
899     { "alcGetProcAddress",          wine_alcGetProcAddress       },
900     { "alcGetEnumValue",            wine_alcGetEnumValue         },
901     { "alcGetString",               wine_alcGetString            },
902     { "alcGetIntegerv",             wine_alcGetIntegerv          },
903     { "alcCaptureOpenDevice",       wine_alcCaptureOpenDevice    },
904     { "alcCaptureCloseDevice",      wine_alcCaptureCloseDevice   },
905     { "alcCaptureStart",            wine_alcCaptureStart         },
906     { "alcCaptureStop",             wine_alcCaptureStop          },
907     { "alcCaptureSamples",          wine_alcCaptureSamples       },
908     { "alcSetThreadContext",        wine_alcSetThreadContext     },
909     { "alcGetThreadContext",        wine_alcGetThreadContext     },
910     { NULL,                         NULL                         }
911 };
912 static const struct FuncList ALFuncs[] = {
913     { "alEnable",                   wine_alEnable                },
914     { "alDisable",                  wine_alDisable               },
915     { "alIsEnabled",                wine_alIsEnabled             },
916     { "alGetString",                wine_alGetString             },
917     { "alGetBooleanv",              wine_alGetBooleanv           },
918     { "alGetIntegerv",              wine_alGetIntegerv           },
919     { "alGetFloatv",                wine_alGetFloatv             },
920     { "alGetDoublev",               wine_alGetDoublev            },
921     { "alGetBoolean",               wine_alGetBoolean            },
922     { "alGetInteger",               wine_alGetInteger            },
923     { "alGetFloat",                 wine_alGetFloat              },
924     { "alGetDouble",                wine_alGetDouble             },
925     { "alGetError",                 wine_alGetError              },
926     { "alIsExtensionPresent",       wine_alIsExtensionPresent    },
927     { "alGetProcAddress",           wine_alGetProcAddress        },
928     { "alGetEnumValue",             wine_alGetEnumValue          },
929     { "alListenerf",                wine_alListenerf             },
930     { "alListener3f",               wine_alListener3f            },
931     { "alListenerfv",               wine_alListenerfv            },
932     { "alListeneri",                wine_alListeneri             },
933     { "alListener3i",               wine_alListener3i            },
934     { "alListeneriv",               wine_alListeneriv            },
935     { "alGetListenerf",             wine_alGetListenerf          },
936     { "alGetListener3f",            wine_alGetListener3f         },
937     { "alGetListenerfv",            wine_alGetListenerfv         },
938     { "alGetListeneri",             wine_alGetListeneri          },
939     { "alGetListener3i",            wine_alGetListener3i         },
940     { "alGetListeneriv",            wine_alGetListeneriv         },
941     { "alGenSources",               wine_alGenSources            },
942     { "alDeleteSources",            wine_alDeleteSources         },
943     { "alIsSource",                 wine_alIsSource              },
944     { "alSourcef",                  wine_alSourcef               },
945     { "alSource3f",                 wine_alSource3f              },
946     { "alSourcefv",                 wine_alSourcefv              },
947     { "alSourcei",                  wine_alSourcei               },
948     { "alSource3i",                 wine_alSource3i              },
949     { "alSourceiv",                 wine_alSourceiv              },
950     { "alGetSourcef",               wine_alGetSourcef            },
951     { "alGetSource3f",              wine_alGetSource3f           },
952     { "alGetSourcefv",              wine_alGetSourcefv           },
953     { "alGetSourcei",               wine_alGetSourcei            },
954     { "alGetSource3i",              wine_alGetSource3i           },
955     { "alGetSourceiv",              wine_alGetSourceiv           },
956     { "alSourcePlayv",              wine_alSourcePlayv           },
957     { "alSourceStopv",              wine_alSourceStopv           },
958     { "alSourceRewindv",            wine_alSourceRewindv         },
959     { "alSourcePausev",             wine_alSourcePausev          },
960     { "alSourcePlay",               wine_alSourcePlay            },
961     { "alSourceStop",               wine_alSourceStop            },
962     { "alSourceRewind",             wine_alSourceRewind          },
963     { "alSourcePause",              wine_alSourcePause           },
964     { "alSourceQueueBuffers",       wine_alSourceQueueBuffers    },
965     { "alSourceUnqueueBuffers",     wine_alSourceUnqueueBuffers  },
966     { "alGenBuffers",               wine_alGenBuffers            },
967     { "alDeleteBuffers",            wine_alDeleteBuffers         },
968     { "alIsBuffer",                 wine_alIsBuffer              },
969     { "alBufferData",               wine_alBufferData            },
970     { "alBufferDataStatic",         wine_alBufferDataStatic      },
971     { "alBufferf",                  wine_alBufferf               },
972     { "alBuffer3f",                 wine_alBuffer3f              },
973     { "alBufferfv",                 wine_alBufferfv              },
974     { "alBufferi",                  wine_alBufferi               },
975     { "alBuffer3i",                 wine_alBuffer3i              },
976     { "alBufferiv",                 wine_alBufferiv              },
977     { "alGetBufferf",               wine_alGetBufferf            },
978     { "alGetBuffer3f",              wine_alGetBuffer3f           },
979     { "alGetBufferfv",              wine_alGetBufferfv           },
980     { "alGetBufferi",               wine_alGetBufferi            },
981     { "alGetBuffer3i",              wine_alGetBuffer3i           },
982     { "alGetBufferiv",              wine_alGetBufferiv           },
983     { "alDopplerFactor",            wine_alDopplerFactor         },
984     { "alDopplerVelocity",          wine_alDopplerVelocity       },
985     { "alSpeedOfSound",             wine_alSpeedOfSound          },
986     { "alDistanceModel",            wine_alDistanceModel         },
987
988     { "alGenFilters",               wine_alGenFilters            },
989     { "alDeleteFilters",            wine_alDeleteFilters         },
990     { "alIsFilter",                 wine_alIsFilter              },
991     { "alFilterf",                  wine_alFilterf               },
992     { "alFilterfv",                 wine_alFilterfv              },
993     { "alFilteri",                  wine_alFilteri               },
994     { "alFilteriv",                 wine_alFilteriv              },
995     { "alGetFilterf",               wine_alGetFilterf            },
996     { "alGetFilterfv",              wine_alGetFilterfv           },
997     { "alGetFilteri",               wine_alGetFilteri            },
998     { "alGetFilteriv",              wine_alGetFilteriv           },
999
1000     { "alGenEffects",               wine_alGenEffects            },
1001     { "alDeleteEffects",            wine_alDeleteEffects         },
1002     { "alIsEffect",                 wine_alIsEffect              },
1003     { "alEffectf",                  wine_alEffectf               },
1004     { "alEffectfv",                 wine_alEffectfv              },
1005     { "alEffecti",                  wine_alEffecti               },
1006     { "alEffectiv",                 wine_alEffectiv              },
1007     { "alGetEffectf",               wine_alGetEffectf            },
1008     { "alGetEffectfv",              wine_alGetEffectfv           },
1009     { "alGetEffecti",               wine_alGetEffecti            },
1010     { "alGetEffectiv",              wine_alGetEffectiv           },
1011
1012     { "alGenAuxiliaryEffectSlots",  wine_alGenAuxiliaryEffectSlots},
1013     { "alDeleteAuxiliaryEffectSlots",wine_alDeleteAuxiliaryEffectSlots},
1014     { "alIsAuxiliaryEffectSlot",    wine_alIsAuxiliaryEffectSlot },
1015     { "alAuxiliaryEffectSlotf",     wine_alAuxiliaryEffectSlotf  },
1016     { "alAuxiliaryEffectSlotfv",    wine_alAuxiliaryEffectSlotfv },
1017     { "alAuxiliaryEffectSloti",     wine_alAuxiliaryEffectSloti  },
1018     { "alAuxiliaryEffectSlotiv",    wine_alAuxiliaryEffectSlotiv },
1019     { "alGetAuxiliaryEffectSlotf",  wine_alGetAuxiliaryEffectSlotf},
1020     { "alGetAuxiliaryEffectSlotfv", wine_alGetAuxiliaryEffectSlotfv},
1021     { "alGetAuxiliaryEffectSloti",  wine_alGetAuxiliaryEffectSloti},
1022     { "alGetAuxiliaryEffectSlotiv", wine_alGetAuxiliaryEffectSlotiv},
1023
1024     { NULL,                         NULL                         }
1025 };