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