regedit: Merge accelerators into the main resource file.
[wine/multimedia.git] / dlls / openal32 / openal.c
blobd3ff07d68aa5c52082bd117fec0f3520f391efce
1 /*
2 * OpenAL32.dll thunk. Wraps Win32 OpenAL function calls around a native
3 * implementation.
5 * Copyright 2007 Nick Burns (adger44@hotmail.com)
6 * Copyright 2007,2009 Chris Robinson
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.
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.
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
23 #include "config.h"
25 #include <stdarg.h>
26 #include <string.h>
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
36 #include "windef.h"
37 #include "winbase.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(openal32);
42 static ALCboolean (ALC_APIENTRY*alcSetThreadContext)(ALCcontext *context);
43 static ALCcontext* (ALC_APIENTRY*alcGetThreadContext)(ALCvoid);
45 static ALboolean loaded_procs;
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);
82 extern ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *, const ALCchar *);
83 extern ALvoid* CDECL wine_alGetProcAddress(const ALchar*);
85 static CRITICAL_SECTION openal_cs;
86 static CRITICAL_SECTION_DEBUG openal_cs_debug =
88 0, 0, &openal_cs,
89 {&openal_cs_debug.ProcessLocksList,
90 &openal_cs_debug.ProcessLocksList},
91 0, 0, {(DWORD_PTR)(__FILE__ ": openal_cs")}
93 static CRITICAL_SECTION openal_cs = {&openal_cs_debug, -1, 0, 0, 0, 0};
95 /***********************************************************************
96 * OpenAL initialisation routine
98 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
100 switch(reason)
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);
113 return TRUE;
117 static void LoadProcs(void)
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
157 /***********************************************************************
158 * OpenAL thunk routines
161 /* OpenAL ALC 1.0 functions */
162 ALCcontext* CDECL wine_alcCreateContext(ALCdevice *device, const ALCint* attrlist)
164 return alcCreateContext(device, attrlist);
167 ALCboolean CDECL wine_alcMakeContextCurrent(ALCcontext *context)
169 EnterCriticalSection(&openal_cs);
170 if(alcMakeContextCurrent(context) == ALC_FALSE)
172 WARN("Failed to make context %p current\n", context);
173 LeaveCriticalSection(&openal_cs);
174 return ALC_FALSE;
177 if(context && !loaded_procs)
179 loaded_procs = AL_TRUE;
180 LoadProcs();
182 LeaveCriticalSection(&openal_cs);
184 return ALC_TRUE;
187 ALvoid CDECL wine_alcProcessContext(ALCcontext *context)
189 alcProcessContext(context);
192 ALvoid CDECL wine_alcSuspendContext(ALCcontext *context)
194 alcSuspendContext(context);
197 ALvoid CDECL wine_alcDestroyContext(ALCcontext *context)
199 alcDestroyContext(context);
202 ALCcontext* CDECL wine_alcGetCurrentContext(ALCvoid)
204 return alcGetCurrentContext();
207 ALCdevice* CDECL wine_alcGetContextsDevice(ALCcontext *context)
209 return alcGetContextsDevice(context);
212 ALCdevice* CDECL wine_alcOpenDevice(const ALCchar *devicename)
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;
220 return alcOpenDevice(devicename);
223 ALCboolean CDECL wine_alcCloseDevice(ALCdevice *device)
225 return alcCloseDevice(device);
228 ALCenum CDECL wine_alcGetError(ALCdevice *device)
230 return alcGetError(device);
233 ALCboolean CDECL wine_alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname)
235 return alcIsExtensionPresent(device, extname);
238 ALCenum CDECL wine_alcGetEnumValue(ALCdevice *device, const ALCchar *enumname)
240 return alcGetEnumValue(device, enumname);
243 const ALCchar* CDECL wine_alcGetString(ALCdevice *device, ALCenum param)
245 return alcGetString(device, param);
248 ALvoid CDECL wine_alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest)
250 alcGetIntegerv(device, param, size, dest);
254 /* OpenAL 1.0 functions */
255 ALvoid CDECL wine_alEnable(ALenum capability)
257 alEnable(capability);
260 ALvoid CDECL wine_alDisable(ALenum capability)
262 alDisable(capability);
265 ALboolean CDECL wine_alIsEnabled(ALenum capability)
267 return alIsEnabled(capability);
270 const ALchar* CDECL wine_alGetString(ALenum param)
272 return alGetString(param);
275 ALvoid CDECL wine_alGetBooleanv(ALenum param, ALboolean* data)
277 alGetBooleanv(param, data);
280 ALvoid CDECL wine_alGetIntegerv(ALenum param, ALint* data)
282 alGetIntegerv(param, data);
285 ALvoid CDECL wine_alGetFloatv(ALenum param, ALfloat* data)
287 alGetFloatv(param, data);
290 ALvoid CDECL wine_alGetDoublev(ALenum param, ALdouble* data)
292 alGetDoublev(param, data);
295 ALboolean CDECL wine_alGetBoolean(ALenum param)
297 return alGetBoolean(param);
300 ALint CDECL wine_alGetInteger(ALenum param)
302 return alGetInteger(param);
305 ALfloat CDECL wine_alGetFloat(ALenum param)
307 return alGetFloat(param);
310 ALdouble CDECL wine_alGetDouble(ALenum param)
312 return alGetDouble(param);
315 ALenum CDECL wine_alGetError(ALvoid)
317 return alGetError();
320 ALboolean CDECL wine_alIsExtensionPresent(const ALchar* extname)
322 return alIsExtensionPresent(extname);
325 ALenum CDECL wine_alGetEnumValue(const ALchar* ename)
327 return alGetEnumValue(ename);
330 ALvoid CDECL wine_alListenerf(ALenum param, ALfloat value)
332 alListenerf(param, value);
335 ALvoid CDECL wine_alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
337 alListener3f(param, value1, value2, value3);
340 ALvoid CDECL wine_alListenerfv(ALenum param, const ALfloat* values)
342 alListenerfv(param, values);
345 ALvoid CDECL wine_alListeneri(ALenum param, ALint value)
347 alListeneri(param, value);
350 ALvoid CDECL wine_alGetListenerf(ALenum param, ALfloat* value)
352 alGetListenerf(param, value);
355 ALvoid CDECL wine_alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)
357 alGetListener3f(param, value1, value2, value3);
360 ALvoid CDECL wine_alGetListenerfv(ALenum param, ALfloat* values)
362 alGetListenerfv(param, values);
365 ALvoid CDECL wine_alGetListeneri(ALenum param, ALint* value)
367 alGetListeneri(param, value);
370 ALvoid CDECL wine_alGetListeneriv(ALenum param, ALint* values)
372 alGetListeneriv(param, values);
375 ALvoid CDECL wine_alGenSources(ALsizei n, ALuint* sources)
377 alGenSources(n, sources);
380 ALvoid CDECL wine_alDeleteSources(ALsizei n, const ALuint* sources)
382 alDeleteSources(n, sources);
385 ALboolean CDECL wine_alIsSource(ALuint sid)
387 return alIsSource(sid);
390 ALvoid CDECL wine_alSourcef(ALuint sid, ALenum param, ALfloat value)
392 alSourcef(sid, param, value);
395 ALvoid CDECL wine_alSource3f(ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
397 alSource3f(sid, param, value1, value2, value3);
400 ALvoid CDECL wine_alSourcefv(ALuint sid, ALenum param, const ALfloat* values)
402 alSourcefv(sid, param, values);
405 ALvoid CDECL wine_alSourcei(ALuint sid, ALenum param, ALint value)
407 alSourcei(sid, param, value);
410 ALvoid CDECL wine_alGetSourcef(ALuint sid, ALenum param, ALfloat* value)
412 alGetSourcef(sid, param, value);
415 ALvoid CDECL wine_alGetSource3f(ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
417 alGetSource3f(sid, param, value1, value2, value3);
420 ALvoid CDECL wine_alGetSourcefv(ALuint sid, ALenum param, ALfloat* values)
422 alGetSourcefv(sid, param, values);
425 ALvoid CDECL wine_alGetSourcei(ALuint sid, ALenum param, ALint* value)
427 alGetSourcei(sid, param, value);
430 ALvoid CDECL wine_alGetSourceiv(ALuint sid, ALenum param, ALint* values)
432 alGetSourceiv(sid, param, values);
435 ALvoid CDECL wine_alSourcePlayv(ALsizei ns, const ALuint *sids)
437 alSourcePlayv(ns, sids);
440 ALvoid CDECL wine_alSourceStopv(ALsizei ns, const ALuint *sids)
442 alSourceStopv(ns, sids);
445 ALvoid CDECL wine_alSourceRewindv(ALsizei ns, const ALuint *sids)
447 alSourceRewindv(ns, sids);
450 ALvoid CDECL wine_alSourcePausev(ALsizei ns, const ALuint *sids)
452 alSourcePausev(ns, sids);
455 ALvoid CDECL wine_alSourcePlay(ALuint sid)
457 alSourcePlay(sid);
460 ALvoid CDECL wine_alSourceStop(ALuint sid)
462 alSourceStop(sid);
465 ALvoid CDECL wine_alSourceRewind(ALuint sid)
467 alSourceRewind(sid);
470 ALvoid CDECL wine_alSourcePause(ALuint sid)
472 alSourcePause(sid);
475 ALvoid CDECL wine_alSourceQueueBuffers(ALuint sid, ALsizei numEntries, const ALuint *bids)
477 alSourceQueueBuffers(sid, numEntries, bids);
480 ALvoid CDECL wine_alSourceUnqueueBuffers(ALuint sid, ALsizei numEntries, ALuint *bids)
482 alSourceUnqueueBuffers(sid, numEntries, bids);
485 ALvoid CDECL wine_alGenBuffers(ALsizei n, ALuint* buffers)
487 alGenBuffers(n, buffers);
490 ALvoid CDECL wine_alDeleteBuffers(ALsizei n, const ALuint* buffers)
492 alDeleteBuffers(n, buffers);
495 ALboolean CDECL wine_alIsBuffer(ALuint bid)
497 return alIsBuffer(bid);
500 ALvoid CDECL wine_alBufferData(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
502 alBufferData(bid, format, data, size, freq);
505 static ALvoid CDECL wine_alBufferDataStatic(const ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
507 alBufferDataStatic(bid, format, data, size, freq);
510 ALvoid CDECL wine_alGetBufferf(ALuint bid, ALenum param, ALfloat* value)
512 alGetBufferf(bid, param, value);
515 ALvoid CDECL wine_alGetBufferfv(ALuint bid, ALenum param, ALfloat* values)
517 alGetBufferfv(bid, param, values);
520 ALvoid CDECL wine_alGetBufferi(ALuint bid, ALenum param, ALint* value)
522 alGetBufferi(bid, param, value);
525 ALvoid CDECL wine_alGetBufferiv(ALuint bid, ALenum param, ALint* values)
527 alGetBufferiv(bid, param, values);
530 ALvoid CDECL wine_alDopplerFactor(ALfloat value)
532 alDopplerFactor(value);
535 ALvoid CDECL wine_alDopplerVelocity(ALfloat value)
537 alDopplerVelocity(value);
540 ALvoid CDECL wine_alDistanceModel(ALenum distanceModel)
542 alDistanceModel(distanceModel);
546 /* OpenAL ALC 1.1 functions */
547 ALCdevice* CDECL wine_alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize)
549 return alcCaptureOpenDevice(devicename, frequency, format, buffersize);
552 ALCboolean CDECL wine_alcCaptureCloseDevice(ALCdevice *device)
554 return alcCaptureCloseDevice(device);
557 ALCvoid CDECL wine_alcCaptureStart(ALCdevice *device)
559 alcCaptureStart(device);
562 ALCvoid CDECL wine_alcCaptureStop(ALCdevice *device)
564 alcCaptureStop(device);
567 ALCvoid CDECL wine_alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
569 alcCaptureSamples(device, buffer, samples);
572 /* OpenAL 1.1 functions */
573 ALvoid CDECL wine_alListener3i(ALenum param, ALint value1, ALint value2, ALint value3)
575 alListener3i(param, value1, value2, value3);
578 ALvoid CDECL wine_alListeneriv(ALenum param, const ALint* values)
580 alListeneriv(param, values);
583 ALvoid CDECL wine_alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3)
585 alGetListener3i(param, value1, value2, value3);
588 ALvoid CDECL wine_alSource3i(ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3)
590 alSource3i(sid, param, value1, value2, value3);
593 ALvoid CDECL wine_alSourceiv(ALuint sid, ALenum param, const ALint* values)
595 alSourceiv(sid, param, values);
598 ALvoid CDECL wine_alGetSource3i(ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
600 alGetSource3i(sid, param, value1, value2, value3);
603 ALvoid CDECL wine_alBufferf(ALuint bid, ALenum param, ALfloat value)
605 alBufferf(bid, param, value);
608 ALvoid CDECL wine_alBuffer3f(ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
610 alBuffer3f(bid, param, value1, value2, value3);
613 ALvoid CDECL wine_alBufferfv(ALuint bid, ALenum param, const ALfloat* values)
615 alBufferfv(bid, param, values);
618 ALvoid CDECL wine_alBufferi(ALuint bid, ALenum param, ALint value)
620 alBufferi(bid, param, value);
623 ALvoid CDECL wine_alBuffer3i(ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3)
625 alBuffer3i(bid, param, value1, value2, value3);
628 ALvoid CDECL wine_alBufferiv(ALuint bid, ALenum param, const ALint* values)
630 alBufferiv(bid, param, values);
633 ALvoid CDECL wine_alGetBuffer3f(ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
635 alGetBuffer3f(bid, param, value1, value2, value3);
638 ALvoid CDECL wine_alGetBuffer3i(ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
640 alGetBuffer3i(bid, param, value1, value2, value3);
643 ALvoid CDECL wine_alSpeedOfSound(ALfloat value)
645 alSpeedOfSound(value);
648 /* OpenAL EFX extension functions */
649 static ALvoid CDECL wine_alGenFilters(ALsizei n, ALuint* filters)
651 alGenFilters(n, filters);
654 static ALvoid CDECL wine_alDeleteFilters(ALsizei n, const ALuint* filters)
656 alDeleteFilters(n, filters);
659 static ALboolean CDECL wine_alIsFilter(ALuint fid)
661 return alIsFilter(fid);
664 static ALvoid CDECL wine_alFilterf(ALuint fid, ALenum param, ALfloat value)
666 alFilterf(fid, param, value);
669 static ALvoid CDECL wine_alFilterfv(ALuint fid, ALenum param, const ALfloat* values)
671 alFilterfv(fid, param, values);
674 static ALvoid CDECL wine_alFilteri(ALuint fid, ALenum param, ALint value)
676 alFilteri(fid, param, value);
679 static ALvoid CDECL wine_alFilteriv(ALuint fid, ALenum param, const ALint* values)
681 alFilteriv(fid, param, values);
684 static ALvoid CDECL wine_alGetFilterf(ALuint fid, ALenum param, ALfloat* value)
686 alGetFilterf(fid, param, value);
689 static ALvoid CDECL wine_alGetFilterfv(ALuint fid, ALenum param, ALfloat* values)
691 alGetFilterfv(fid, param, values);
694 static ALvoid CDECL wine_alGetFilteri(ALuint fid, ALenum param, ALint* value)
696 alGetFilteri(fid, param, value);
699 static ALvoid CDECL wine_alGetFilteriv(ALuint fid, ALenum param, ALint* values)
701 alGetFilteriv(fid, param, values);
705 static ALvoid CDECL wine_alGenEffects(ALsizei n, ALuint* effects)
707 alGenEffects(n, effects);
710 static ALvoid CDECL wine_alDeleteEffects(ALsizei n, const ALuint* effects)
712 alDeleteEffects(n, effects);
715 static ALboolean CDECL wine_alIsEffect(ALuint eid)
717 return alIsEffect(eid);
720 static ALvoid CDECL wine_alEffectf(ALuint eid, ALenum param, ALfloat value)
722 alEffectf(eid, param, value);
725 static ALvoid CDECL wine_alEffectfv(ALuint eid, ALenum param, const ALfloat* values)
727 alEffectfv(eid, param, values);
730 static ALvoid CDECL wine_alEffecti(ALuint eid, ALenum param, ALint value)
732 alEffecti(eid, param, value);
735 static ALvoid CDECL wine_alEffectiv(ALuint eid, ALenum param, const ALint* values)
737 alEffectiv(eid, param, values);
740 static ALvoid CDECL wine_alGetEffectf(ALuint eid, ALenum param, ALfloat* value)
742 alGetEffectf(eid, param, value);
745 static ALvoid CDECL wine_alGetEffectfv(ALuint eid, ALenum param, ALfloat* values)
747 alGetEffectfv(eid, param, values);
750 static ALvoid CDECL wine_alGetEffecti(ALuint eid, ALenum param, ALint* value)
752 alGetEffecti(eid, param, value);
755 static ALvoid CDECL wine_alGetEffectiv(ALuint eid, ALenum param, ALint* values)
757 alGetEffectiv(eid, param, values);
761 static ALvoid CDECL wine_alGenAuxiliaryEffectSlots(ALsizei n, ALuint* slots)
763 alGenAuxiliaryEffectSlots(n, slots);
766 static ALvoid CDECL wine_alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint* slots)
768 alDeleteAuxiliaryEffectSlots(n, slots);
771 static ALboolean CDECL wine_alIsAuxiliaryEffectSlot(ALuint sid)
773 return alIsAuxiliaryEffectSlot(sid);
776 static ALvoid CDECL wine_alAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat value)
778 alAuxiliaryEffectSlotf(sid, param, value);
781 static ALvoid CDECL wine_alAuxiliaryEffectSlotfv(ALuint sid, ALenum param, const ALfloat* values)
783 alAuxiliaryEffectSlotfv(sid, param, values);
786 static ALvoid CDECL wine_alAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint value)
788 alAuxiliaryEffectSloti(sid, param, value);
791 static ALvoid CDECL wine_alAuxiliaryEffectSlotiv(ALuint sid, ALenum param, const ALint* values)
793 alAuxiliaryEffectSlotiv(sid, param, values);
796 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat* value)
798 alGetAuxiliaryEffectSlotf(sid, param, value);
801 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotfv(ALuint sid, ALenum param, ALfloat* values)
803 alGetAuxiliaryEffectSlotfv(sid, param, values);
806 static ALvoid CDECL wine_alGetAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint* value)
808 alGetAuxiliaryEffectSloti(sid, param, value);
811 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotiv(ALuint sid, ALenum param, ALint* values)
813 alGetAuxiliaryEffectSlotiv(sid, param, values);
817 /* Thread-local context functions */
818 static ALCboolean CDECL wine_alcSetThreadContext(ALCcontext *context)
820 EnterCriticalSection(&openal_cs);
821 if(alcSetThreadContext(context) == ALC_FALSE)
823 WARN("Failed to make context %p current\n", context);
824 LeaveCriticalSection(&openal_cs);
825 return ALC_FALSE;
828 if(context && !loaded_procs)
830 loaded_procs = AL_TRUE;
831 LoadProcs();
833 LeaveCriticalSection(&openal_cs);
835 return ALC_TRUE;
838 static ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid)
840 return alcGetThreadContext();
843 struct FuncList {
844 const char *name;
845 void *proc;
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 }
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 },
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 },
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 },
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},
985 { NULL, NULL }
989 ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *device, const ALCchar *funcname)
991 void *proc;
992 int i;
994 /* Make sure the host implementation has the requested function */
995 proc = alcGetProcAddress(device, funcname);
996 if(!proc)
997 return NULL;
999 for(i = 0;ALCFuncs[i].name;i++)
1001 if(strcmp(funcname, ALCFuncs[i].name) == 0)
1002 return ALCFuncs[i].proc;
1004 FIXME("Could not find function in list: %s\n", funcname);
1005 return NULL;
1009 ALvoid* CDECL wine_alGetProcAddress(const ALchar* funcname)
1011 void *proc;
1012 int i;
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;
1021 for(i = 0;ALFuncs[i].name;i++)
1023 if(strcmp(funcname, ALFuncs[i].name) == 0)
1024 return ALFuncs[i].proc;
1026 FIXME("Could not find function in list: %s\n", funcname);
1027 return NULL;