msado15: Implement Dispatch functions in _Connection.
[wine.git] / dlls / openal32 / openal.c
blob5a4e1e71e36479848e0dc0511ea967805a8358b8
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 if (reserved) break;
111 DeleteCriticalSection(&openal_cs);
114 return TRUE;
118 static void LoadProcs(void)
120 #define LOADFUNC(x) x = alGetProcAddress(#x)
121 LOADFUNC(alBufferDataStatic);
122 LOADFUNC(alGenFilters);
123 LOADFUNC(alDeleteFilters);
124 LOADFUNC(alIsFilter);
125 LOADFUNC(alFilterf);
126 LOADFUNC(alFilterfv);
127 LOADFUNC(alFilteri);
128 LOADFUNC(alFilteriv);
129 LOADFUNC(alGetFilterf);
130 LOADFUNC(alGetFilterfv);
131 LOADFUNC(alGetFilteri);
132 LOADFUNC(alGetFilteriv);
133 LOADFUNC(alGenEffects);
134 LOADFUNC(alDeleteEffects);
135 LOADFUNC(alIsEffect);
136 LOADFUNC(alEffectf);
137 LOADFUNC(alEffectfv);
138 LOADFUNC(alEffecti);
139 LOADFUNC(alEffectiv);
140 LOADFUNC(alGetEffectf);
141 LOADFUNC(alGetEffectfv);
142 LOADFUNC(alGetEffecti);
143 LOADFUNC(alGetEffectiv);
144 LOADFUNC(alGenAuxiliaryEffectSlots);
145 LOADFUNC(alDeleteAuxiliaryEffectSlots);
146 LOADFUNC(alIsAuxiliaryEffectSlot);
147 LOADFUNC(alAuxiliaryEffectSlotf);
148 LOADFUNC(alAuxiliaryEffectSlotfv);
149 LOADFUNC(alAuxiliaryEffectSloti);
150 LOADFUNC(alAuxiliaryEffectSlotiv);
151 LOADFUNC(alGetAuxiliaryEffectSlotf);
152 LOADFUNC(alGetAuxiliaryEffectSlotfv);
153 LOADFUNC(alGetAuxiliaryEffectSloti);
154 LOADFUNC(alGetAuxiliaryEffectSlotiv);
155 #undef LOADFUNC
158 /***********************************************************************
159 * OpenAL thunk routines
162 /* OpenAL ALC 1.0 functions */
163 ALCcontext* CDECL wine_alcCreateContext(ALCdevice *device, const ALCint* attrlist)
165 return alcCreateContext(device, attrlist);
168 ALCboolean CDECL wine_alcMakeContextCurrent(ALCcontext *context)
170 EnterCriticalSection(&openal_cs);
171 if(alcMakeContextCurrent(context) == ALC_FALSE)
173 WARN("Failed to make context %p current\n", context);
174 LeaveCriticalSection(&openal_cs);
175 return ALC_FALSE;
178 if(context && !loaded_procs)
180 loaded_procs = AL_TRUE;
181 LoadProcs();
183 LeaveCriticalSection(&openal_cs);
185 return ALC_TRUE;
188 ALvoid CDECL wine_alcProcessContext(ALCcontext *context)
190 alcProcessContext(context);
193 ALvoid CDECL wine_alcSuspendContext(ALCcontext *context)
195 alcSuspendContext(context);
198 ALvoid CDECL wine_alcDestroyContext(ALCcontext *context)
200 alcDestroyContext(context);
203 ALCcontext* CDECL wine_alcGetCurrentContext(ALCvoid)
205 return alcGetCurrentContext();
208 ALCdevice* CDECL wine_alcGetContextsDevice(ALCcontext *context)
210 return alcGetContextsDevice(context);
213 ALCdevice* CDECL wine_alcOpenDevice(const ALCchar *devicename)
215 if(devicename != NULL && (strcmp(devicename, "DirectSound3D") == 0 ||
216 strcmp(devicename, "DirectSound") == 0 ||
217 strcmp(devicename, "Generic Hardware") == 0 ||
218 strcmp(devicename, "Generic Software") == 0)) {
219 devicename = NULL;
221 return alcOpenDevice(devicename);
224 ALCboolean CDECL wine_alcCloseDevice(ALCdevice *device)
226 return alcCloseDevice(device);
229 ALCenum CDECL wine_alcGetError(ALCdevice *device)
231 return alcGetError(device);
234 ALCboolean CDECL wine_alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname)
236 return alcIsExtensionPresent(device, extname);
239 ALCenum CDECL wine_alcGetEnumValue(ALCdevice *device, const ALCchar *enumname)
241 return alcGetEnumValue(device, enumname);
244 const ALCchar* CDECL wine_alcGetString(ALCdevice *device, ALCenum param)
246 return alcGetString(device, param);
249 ALvoid CDECL wine_alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest)
251 alcGetIntegerv(device, param, size, dest);
255 /* OpenAL 1.0 functions */
256 ALvoid CDECL wine_alEnable(ALenum capability)
258 alEnable(capability);
261 ALvoid CDECL wine_alDisable(ALenum capability)
263 alDisable(capability);
266 ALboolean CDECL wine_alIsEnabled(ALenum capability)
268 return alIsEnabled(capability);
271 const ALchar* CDECL wine_alGetString(ALenum param)
273 return alGetString(param);
276 ALvoid CDECL wine_alGetBooleanv(ALenum param, ALboolean* data)
278 alGetBooleanv(param, data);
281 ALvoid CDECL wine_alGetIntegerv(ALenum param, ALint* data)
283 alGetIntegerv(param, data);
286 ALvoid CDECL wine_alGetFloatv(ALenum param, ALfloat* data)
288 alGetFloatv(param, data);
291 ALvoid CDECL wine_alGetDoublev(ALenum param, ALdouble* data)
293 alGetDoublev(param, data);
296 ALboolean CDECL wine_alGetBoolean(ALenum param)
298 return alGetBoolean(param);
301 ALint CDECL wine_alGetInteger(ALenum param)
303 return alGetInteger(param);
306 ALfloat CDECL wine_alGetFloat(ALenum param)
308 return alGetFloat(param);
311 ALdouble CDECL wine_alGetDouble(ALenum param)
313 return alGetDouble(param);
316 ALenum CDECL wine_alGetError(ALvoid)
318 return alGetError();
321 ALboolean CDECL wine_alIsExtensionPresent(const ALchar* extname)
323 return alIsExtensionPresent(extname);
326 ALenum CDECL wine_alGetEnumValue(const ALchar* ename)
328 return alGetEnumValue(ename);
331 ALvoid CDECL wine_alListenerf(ALenum param, ALfloat value)
333 alListenerf(param, value);
336 ALvoid CDECL wine_alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
338 alListener3f(param, value1, value2, value3);
341 ALvoid CDECL wine_alListenerfv(ALenum param, const ALfloat* values)
343 alListenerfv(param, values);
346 ALvoid CDECL wine_alListeneri(ALenum param, ALint value)
348 alListeneri(param, value);
351 ALvoid CDECL wine_alGetListenerf(ALenum param, ALfloat* value)
353 alGetListenerf(param, value);
356 ALvoid CDECL wine_alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)
358 alGetListener3f(param, value1, value2, value3);
361 ALvoid CDECL wine_alGetListenerfv(ALenum param, ALfloat* values)
363 alGetListenerfv(param, values);
366 ALvoid CDECL wine_alGetListeneri(ALenum param, ALint* value)
368 alGetListeneri(param, value);
371 ALvoid CDECL wine_alGetListeneriv(ALenum param, ALint* values)
373 alGetListeneriv(param, values);
376 ALvoid CDECL wine_alGenSources(ALsizei n, ALuint* sources)
378 alGenSources(n, sources);
381 ALvoid CDECL wine_alDeleteSources(ALsizei n, const ALuint* sources)
383 alDeleteSources(n, sources);
386 ALboolean CDECL wine_alIsSource(ALuint sid)
388 return alIsSource(sid);
391 ALvoid CDECL wine_alSourcef(ALuint sid, ALenum param, ALfloat value)
393 alSourcef(sid, param, value);
396 ALvoid CDECL wine_alSource3f(ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
398 alSource3f(sid, param, value1, value2, value3);
401 ALvoid CDECL wine_alSourcefv(ALuint sid, ALenum param, const ALfloat* values)
403 alSourcefv(sid, param, values);
406 ALvoid CDECL wine_alSourcei(ALuint sid, ALenum param, ALint value)
408 alSourcei(sid, param, value);
411 ALvoid CDECL wine_alGetSourcef(ALuint sid, ALenum param, ALfloat* value)
413 alGetSourcef(sid, param, value);
416 ALvoid CDECL wine_alGetSource3f(ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
418 alGetSource3f(sid, param, value1, value2, value3);
421 ALvoid CDECL wine_alGetSourcefv(ALuint sid, ALenum param, ALfloat* values)
423 alGetSourcefv(sid, param, values);
426 ALvoid CDECL wine_alGetSourcei(ALuint sid, ALenum param, ALint* value)
428 alGetSourcei(sid, param, value);
431 ALvoid CDECL wine_alGetSourceiv(ALuint sid, ALenum param, ALint* values)
433 alGetSourceiv(sid, param, values);
436 ALvoid CDECL wine_alSourcePlayv(ALsizei ns, const ALuint *sids)
438 alSourcePlayv(ns, sids);
441 ALvoid CDECL wine_alSourceStopv(ALsizei ns, const ALuint *sids)
443 alSourceStopv(ns, sids);
446 ALvoid CDECL wine_alSourceRewindv(ALsizei ns, const ALuint *sids)
448 alSourceRewindv(ns, sids);
451 ALvoid CDECL wine_alSourcePausev(ALsizei ns, const ALuint *sids)
453 alSourcePausev(ns, sids);
456 ALvoid CDECL wine_alSourcePlay(ALuint sid)
458 alSourcePlay(sid);
461 ALvoid CDECL wine_alSourceStop(ALuint sid)
463 alSourceStop(sid);
466 ALvoid CDECL wine_alSourceRewind(ALuint sid)
468 alSourceRewind(sid);
471 ALvoid CDECL wine_alSourcePause(ALuint sid)
473 alSourcePause(sid);
476 ALvoid CDECL wine_alSourceQueueBuffers(ALuint sid, ALsizei numEntries, const ALuint *bids)
478 alSourceQueueBuffers(sid, numEntries, bids);
481 ALvoid CDECL wine_alSourceUnqueueBuffers(ALuint sid, ALsizei numEntries, ALuint *bids)
483 alSourceUnqueueBuffers(sid, numEntries, bids);
486 ALvoid CDECL wine_alGenBuffers(ALsizei n, ALuint* buffers)
488 alGenBuffers(n, buffers);
491 ALvoid CDECL wine_alDeleteBuffers(ALsizei n, const ALuint* buffers)
493 alDeleteBuffers(n, buffers);
496 ALboolean CDECL wine_alIsBuffer(ALuint bid)
498 return alIsBuffer(bid);
501 ALvoid CDECL wine_alBufferData(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
503 alBufferData(bid, format, data, size, freq);
506 static ALvoid CDECL wine_alBufferDataStatic(const ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
508 alBufferDataStatic(bid, format, data, size, freq);
511 ALvoid CDECL wine_alGetBufferf(ALuint bid, ALenum param, ALfloat* value)
513 alGetBufferf(bid, param, value);
516 ALvoid CDECL wine_alGetBufferfv(ALuint bid, ALenum param, ALfloat* values)
518 alGetBufferfv(bid, param, values);
521 ALvoid CDECL wine_alGetBufferi(ALuint bid, ALenum param, ALint* value)
523 alGetBufferi(bid, param, value);
526 ALvoid CDECL wine_alGetBufferiv(ALuint bid, ALenum param, ALint* values)
528 alGetBufferiv(bid, param, values);
531 ALvoid CDECL wine_alDopplerFactor(ALfloat value)
533 alDopplerFactor(value);
536 ALvoid CDECL wine_alDopplerVelocity(ALfloat value)
538 alDopplerVelocity(value);
541 ALvoid CDECL wine_alDistanceModel(ALenum distanceModel)
543 alDistanceModel(distanceModel);
547 /* OpenAL ALC 1.1 functions */
548 ALCdevice* CDECL wine_alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize)
550 return alcCaptureOpenDevice(devicename, frequency, format, buffersize);
553 ALCboolean CDECL wine_alcCaptureCloseDevice(ALCdevice *device)
555 return alcCaptureCloseDevice(device);
558 ALCvoid CDECL wine_alcCaptureStart(ALCdevice *device)
560 alcCaptureStart(device);
563 ALCvoid CDECL wine_alcCaptureStop(ALCdevice *device)
565 alcCaptureStop(device);
568 ALCvoid CDECL wine_alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
570 alcCaptureSamples(device, buffer, samples);
573 /* OpenAL 1.1 functions */
574 ALvoid CDECL wine_alListener3i(ALenum param, ALint value1, ALint value2, ALint value3)
576 alListener3i(param, value1, value2, value3);
579 ALvoid CDECL wine_alListeneriv(ALenum param, const ALint* values)
581 alListeneriv(param, values);
584 ALvoid CDECL wine_alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3)
586 alGetListener3i(param, value1, value2, value3);
589 ALvoid CDECL wine_alSource3i(ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3)
591 alSource3i(sid, param, value1, value2, value3);
594 ALvoid CDECL wine_alSourceiv(ALuint sid, ALenum param, const ALint* values)
596 alSourceiv(sid, param, values);
599 ALvoid CDECL wine_alGetSource3i(ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
601 alGetSource3i(sid, param, value1, value2, value3);
604 ALvoid CDECL wine_alBufferf(ALuint bid, ALenum param, ALfloat value)
606 alBufferf(bid, param, value);
609 ALvoid CDECL wine_alBuffer3f(ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
611 alBuffer3f(bid, param, value1, value2, value3);
614 ALvoid CDECL wine_alBufferfv(ALuint bid, ALenum param, const ALfloat* values)
616 alBufferfv(bid, param, values);
619 ALvoid CDECL wine_alBufferi(ALuint bid, ALenum param, ALint value)
621 alBufferi(bid, param, value);
624 ALvoid CDECL wine_alBuffer3i(ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3)
626 alBuffer3i(bid, param, value1, value2, value3);
629 ALvoid CDECL wine_alBufferiv(ALuint bid, ALenum param, const ALint* values)
631 alBufferiv(bid, param, values);
634 ALvoid CDECL wine_alGetBuffer3f(ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
636 alGetBuffer3f(bid, param, value1, value2, value3);
639 ALvoid CDECL wine_alGetBuffer3i(ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
641 alGetBuffer3i(bid, param, value1, value2, value3);
644 ALvoid CDECL wine_alSpeedOfSound(ALfloat value)
646 alSpeedOfSound(value);
649 /* OpenAL EFX extension functions */
650 static ALvoid CDECL wine_alGenFilters(ALsizei n, ALuint* filters)
652 alGenFilters(n, filters);
655 static ALvoid CDECL wine_alDeleteFilters(ALsizei n, const ALuint* filters)
657 alDeleteFilters(n, filters);
660 static ALboolean CDECL wine_alIsFilter(ALuint fid)
662 return alIsFilter(fid);
665 static ALvoid CDECL wine_alFilterf(ALuint fid, ALenum param, ALfloat value)
667 alFilterf(fid, param, value);
670 static ALvoid CDECL wine_alFilterfv(ALuint fid, ALenum param, const ALfloat* values)
672 alFilterfv(fid, param, values);
675 static ALvoid CDECL wine_alFilteri(ALuint fid, ALenum param, ALint value)
677 alFilteri(fid, param, value);
680 static ALvoid CDECL wine_alFilteriv(ALuint fid, ALenum param, const ALint* values)
682 alFilteriv(fid, param, values);
685 static ALvoid CDECL wine_alGetFilterf(ALuint fid, ALenum param, ALfloat* value)
687 alGetFilterf(fid, param, value);
690 static ALvoid CDECL wine_alGetFilterfv(ALuint fid, ALenum param, ALfloat* values)
692 alGetFilterfv(fid, param, values);
695 static ALvoid CDECL wine_alGetFilteri(ALuint fid, ALenum param, ALint* value)
697 alGetFilteri(fid, param, value);
700 static ALvoid CDECL wine_alGetFilteriv(ALuint fid, ALenum param, ALint* values)
702 alGetFilteriv(fid, param, values);
706 static ALvoid CDECL wine_alGenEffects(ALsizei n, ALuint* effects)
708 alGenEffects(n, effects);
711 static ALvoid CDECL wine_alDeleteEffects(ALsizei n, const ALuint* effects)
713 alDeleteEffects(n, effects);
716 static ALboolean CDECL wine_alIsEffect(ALuint eid)
718 return alIsEffect(eid);
721 static ALvoid CDECL wine_alEffectf(ALuint eid, ALenum param, ALfloat value)
723 alEffectf(eid, param, value);
726 static ALvoid CDECL wine_alEffectfv(ALuint eid, ALenum param, const ALfloat* values)
728 alEffectfv(eid, param, values);
731 static ALvoid CDECL wine_alEffecti(ALuint eid, ALenum param, ALint value)
733 alEffecti(eid, param, value);
736 static ALvoid CDECL wine_alEffectiv(ALuint eid, ALenum param, const ALint* values)
738 alEffectiv(eid, param, values);
741 static ALvoid CDECL wine_alGetEffectf(ALuint eid, ALenum param, ALfloat* value)
743 alGetEffectf(eid, param, value);
746 static ALvoid CDECL wine_alGetEffectfv(ALuint eid, ALenum param, ALfloat* values)
748 alGetEffectfv(eid, param, values);
751 static ALvoid CDECL wine_alGetEffecti(ALuint eid, ALenum param, ALint* value)
753 alGetEffecti(eid, param, value);
756 static ALvoid CDECL wine_alGetEffectiv(ALuint eid, ALenum param, ALint* values)
758 alGetEffectiv(eid, param, values);
762 static ALvoid CDECL wine_alGenAuxiliaryEffectSlots(ALsizei n, ALuint* slots)
764 alGenAuxiliaryEffectSlots(n, slots);
767 static ALvoid CDECL wine_alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint* slots)
769 alDeleteAuxiliaryEffectSlots(n, slots);
772 static ALboolean CDECL wine_alIsAuxiliaryEffectSlot(ALuint sid)
774 return alIsAuxiliaryEffectSlot(sid);
777 static ALvoid CDECL wine_alAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat value)
779 alAuxiliaryEffectSlotf(sid, param, value);
782 static ALvoid CDECL wine_alAuxiliaryEffectSlotfv(ALuint sid, ALenum param, const ALfloat* values)
784 alAuxiliaryEffectSlotfv(sid, param, values);
787 static ALvoid CDECL wine_alAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint value)
789 alAuxiliaryEffectSloti(sid, param, value);
792 static ALvoid CDECL wine_alAuxiliaryEffectSlotiv(ALuint sid, ALenum param, const ALint* values)
794 alAuxiliaryEffectSlotiv(sid, param, values);
797 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat* value)
799 alGetAuxiliaryEffectSlotf(sid, param, value);
802 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotfv(ALuint sid, ALenum param, ALfloat* values)
804 alGetAuxiliaryEffectSlotfv(sid, param, values);
807 static ALvoid CDECL wine_alGetAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint* value)
809 alGetAuxiliaryEffectSloti(sid, param, value);
812 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotiv(ALuint sid, ALenum param, ALint* values)
814 alGetAuxiliaryEffectSlotiv(sid, param, values);
818 /* Thread-local context functions */
819 static ALCboolean CDECL wine_alcSetThreadContext(ALCcontext *context)
821 EnterCriticalSection(&openal_cs);
822 if(alcSetThreadContext(context) == ALC_FALSE)
824 WARN("Failed to make context %p current\n", context);
825 LeaveCriticalSection(&openal_cs);
826 return ALC_FALSE;
829 if(context && !loaded_procs)
831 loaded_procs = AL_TRUE;
832 LoadProcs();
834 LeaveCriticalSection(&openal_cs);
836 return ALC_TRUE;
839 static ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid)
841 return alcGetThreadContext();
844 struct FuncList {
845 const char *name;
846 void *proc;
849 static const struct FuncList ALCFuncs[] = {
850 { "alcCreateContext", wine_alcCreateContext },
851 { "alcMakeContextCurrent", wine_alcMakeContextCurrent },
852 { "alcProcessContext", wine_alcProcessContext },
853 { "alcSuspendContext", wine_alcSuspendContext },
854 { "alcDestroyContext", wine_alcDestroyContext },
855 { "alcGetCurrentContext", wine_alcGetCurrentContext },
856 { "alcGetContextsDevice", wine_alcGetContextsDevice },
857 { "alcOpenDevice", wine_alcOpenDevice },
858 { "alcCloseDevice", wine_alcCloseDevice },
859 { "alcGetError", wine_alcGetError },
860 { "alcIsExtensionPresent", wine_alcIsExtensionPresent },
861 { "alcGetProcAddress", wine_alcGetProcAddress },
862 { "alcGetEnumValue", wine_alcGetEnumValue },
863 { "alcGetString", wine_alcGetString },
864 { "alcGetIntegerv", wine_alcGetIntegerv },
865 { "alcCaptureOpenDevice", wine_alcCaptureOpenDevice },
866 { "alcCaptureCloseDevice", wine_alcCaptureCloseDevice },
867 { "alcCaptureStart", wine_alcCaptureStart },
868 { "alcCaptureStop", wine_alcCaptureStop },
869 { "alcCaptureSamples", wine_alcCaptureSamples },
870 { "alcSetThreadContext", wine_alcSetThreadContext },
871 { "alcGetThreadContext", wine_alcGetThreadContext },
872 { NULL, NULL }
874 static const struct FuncList ALFuncs[] = {
875 { "alEnable", wine_alEnable },
876 { "alDisable", wine_alDisable },
877 { "alIsEnabled", wine_alIsEnabled },
878 { "alGetString", wine_alGetString },
879 { "alGetBooleanv", wine_alGetBooleanv },
880 { "alGetIntegerv", wine_alGetIntegerv },
881 { "alGetFloatv", wine_alGetFloatv },
882 { "alGetDoublev", wine_alGetDoublev },
883 { "alGetBoolean", wine_alGetBoolean },
884 { "alGetInteger", wine_alGetInteger },
885 { "alGetFloat", wine_alGetFloat },
886 { "alGetDouble", wine_alGetDouble },
887 { "alGetError", wine_alGetError },
888 { "alIsExtensionPresent", wine_alIsExtensionPresent },
889 { "alGetProcAddress", wine_alGetProcAddress },
890 { "alGetEnumValue", wine_alGetEnumValue },
891 { "alListenerf", wine_alListenerf },
892 { "alListener3f", wine_alListener3f },
893 { "alListenerfv", wine_alListenerfv },
894 { "alListeneri", wine_alListeneri },
895 { "alListener3i", wine_alListener3i },
896 { "alListeneriv", wine_alListeneriv },
897 { "alGetListenerf", wine_alGetListenerf },
898 { "alGetListener3f", wine_alGetListener3f },
899 { "alGetListenerfv", wine_alGetListenerfv },
900 { "alGetListeneri", wine_alGetListeneri },
901 { "alGetListener3i", wine_alGetListener3i },
902 { "alGetListeneriv", wine_alGetListeneriv },
903 { "alGenSources", wine_alGenSources },
904 { "alDeleteSources", wine_alDeleteSources },
905 { "alIsSource", wine_alIsSource },
906 { "alSourcef", wine_alSourcef },
907 { "alSource3f", wine_alSource3f },
908 { "alSourcefv", wine_alSourcefv },
909 { "alSourcei", wine_alSourcei },
910 { "alSource3i", wine_alSource3i },
911 { "alSourceiv", wine_alSourceiv },
912 { "alGetSourcef", wine_alGetSourcef },
913 { "alGetSource3f", wine_alGetSource3f },
914 { "alGetSourcefv", wine_alGetSourcefv },
915 { "alGetSourcei", wine_alGetSourcei },
916 { "alGetSource3i", wine_alGetSource3i },
917 { "alGetSourceiv", wine_alGetSourceiv },
918 { "alSourcePlayv", wine_alSourcePlayv },
919 { "alSourceStopv", wine_alSourceStopv },
920 { "alSourceRewindv", wine_alSourceRewindv },
921 { "alSourcePausev", wine_alSourcePausev },
922 { "alSourcePlay", wine_alSourcePlay },
923 { "alSourceStop", wine_alSourceStop },
924 { "alSourceRewind", wine_alSourceRewind },
925 { "alSourcePause", wine_alSourcePause },
926 { "alSourceQueueBuffers", wine_alSourceQueueBuffers },
927 { "alSourceUnqueueBuffers", wine_alSourceUnqueueBuffers },
928 { "alGenBuffers", wine_alGenBuffers },
929 { "alDeleteBuffers", wine_alDeleteBuffers },
930 { "alIsBuffer", wine_alIsBuffer },
931 { "alBufferData", wine_alBufferData },
932 { "alBufferDataStatic", wine_alBufferDataStatic },
933 { "alBufferf", wine_alBufferf },
934 { "alBuffer3f", wine_alBuffer3f },
935 { "alBufferfv", wine_alBufferfv },
936 { "alBufferi", wine_alBufferi },
937 { "alBuffer3i", wine_alBuffer3i },
938 { "alBufferiv", wine_alBufferiv },
939 { "alGetBufferf", wine_alGetBufferf },
940 { "alGetBuffer3f", wine_alGetBuffer3f },
941 { "alGetBufferfv", wine_alGetBufferfv },
942 { "alGetBufferi", wine_alGetBufferi },
943 { "alGetBuffer3i", wine_alGetBuffer3i },
944 { "alGetBufferiv", wine_alGetBufferiv },
945 { "alDopplerFactor", wine_alDopplerFactor },
946 { "alDopplerVelocity", wine_alDopplerVelocity },
947 { "alSpeedOfSound", wine_alSpeedOfSound },
948 { "alDistanceModel", wine_alDistanceModel },
950 { "alGenFilters", wine_alGenFilters },
951 { "alDeleteFilters", wine_alDeleteFilters },
952 { "alIsFilter", wine_alIsFilter },
953 { "alFilterf", wine_alFilterf },
954 { "alFilterfv", wine_alFilterfv },
955 { "alFilteri", wine_alFilteri },
956 { "alFilteriv", wine_alFilteriv },
957 { "alGetFilterf", wine_alGetFilterf },
958 { "alGetFilterfv", wine_alGetFilterfv },
959 { "alGetFilteri", wine_alGetFilteri },
960 { "alGetFilteriv", wine_alGetFilteriv },
962 { "alGenEffects", wine_alGenEffects },
963 { "alDeleteEffects", wine_alDeleteEffects },
964 { "alIsEffect", wine_alIsEffect },
965 { "alEffectf", wine_alEffectf },
966 { "alEffectfv", wine_alEffectfv },
967 { "alEffecti", wine_alEffecti },
968 { "alEffectiv", wine_alEffectiv },
969 { "alGetEffectf", wine_alGetEffectf },
970 { "alGetEffectfv", wine_alGetEffectfv },
971 { "alGetEffecti", wine_alGetEffecti },
972 { "alGetEffectiv", wine_alGetEffectiv },
974 { "alGenAuxiliaryEffectSlots", wine_alGenAuxiliaryEffectSlots},
975 { "alDeleteAuxiliaryEffectSlots",wine_alDeleteAuxiliaryEffectSlots},
976 { "alIsAuxiliaryEffectSlot", wine_alIsAuxiliaryEffectSlot },
977 { "alAuxiliaryEffectSlotf", wine_alAuxiliaryEffectSlotf },
978 { "alAuxiliaryEffectSlotfv", wine_alAuxiliaryEffectSlotfv },
979 { "alAuxiliaryEffectSloti", wine_alAuxiliaryEffectSloti },
980 { "alAuxiliaryEffectSlotiv", wine_alAuxiliaryEffectSlotiv },
981 { "alGetAuxiliaryEffectSlotf", wine_alGetAuxiliaryEffectSlotf},
982 { "alGetAuxiliaryEffectSlotfv", wine_alGetAuxiliaryEffectSlotfv},
983 { "alGetAuxiliaryEffectSloti", wine_alGetAuxiliaryEffectSloti},
984 { "alGetAuxiliaryEffectSlotiv", wine_alGetAuxiliaryEffectSlotiv},
986 { NULL, NULL }
990 ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *device, const ALCchar *funcname)
992 void *proc;
993 int i;
995 /* Make sure the host implementation has the requested function */
996 proc = alcGetProcAddress(device, funcname);
997 if(!proc)
998 return NULL;
1000 for(i = 0;ALCFuncs[i].name;i++)
1002 if(strcmp(funcname, ALCFuncs[i].name) == 0)
1003 return ALCFuncs[i].proc;
1005 FIXME("Could not find function in list: %s\n", funcname);
1006 return NULL;
1010 ALvoid* CDECL wine_alGetProcAddress(const ALchar* funcname)
1012 void *proc;
1013 int i;
1015 /* Make sure the host implementation has the requested function. This will
1016 * also set the last AL error properly if the function should not be
1017 * returned (eg. no current context). */
1018 proc = alGetProcAddress(funcname);
1019 if(!proc)
1020 return NULL;
1022 for(i = 0;ALFuncs[i].name;i++)
1024 if(strcmp(funcname, ALFuncs[i].name) == 0)
1025 return ALFuncs[i].proc;
1027 FIXME("Could not find function in list: %s\n", funcname);
1028 return NULL;