wined3d: Use the bo binding in wined3d_context_gl_map_bo_address().
[wine.git] / dlls / openal32 / openal.c
blobcd49b926a83d87ed310b66e19163dd6720d9a1a3
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_WINE_PREATTACH:
103 return FALSE; /* prefer native version */
104 case DLL_PROCESS_ATTACH:
105 DisableThreadLibraryCalls(hinst);
106 #define LOADFUNC(x) x = alcGetProcAddress(NULL, #x)
107 LOADFUNC(alcSetThreadContext);
108 LOADFUNC(alcGetThreadContext);
109 #undef LOADFUNC
110 break;
111 case DLL_PROCESS_DETACH:
112 if (reserved) break;
113 DeleteCriticalSection(&openal_cs);
116 return TRUE;
120 static void LoadProcs(void)
122 #define LOADFUNC(x) x = alGetProcAddress(#x)
123 LOADFUNC(alBufferDataStatic);
124 LOADFUNC(alGenFilters);
125 LOADFUNC(alDeleteFilters);
126 LOADFUNC(alIsFilter);
127 LOADFUNC(alFilterf);
128 LOADFUNC(alFilterfv);
129 LOADFUNC(alFilteri);
130 LOADFUNC(alFilteriv);
131 LOADFUNC(alGetFilterf);
132 LOADFUNC(alGetFilterfv);
133 LOADFUNC(alGetFilteri);
134 LOADFUNC(alGetFilteriv);
135 LOADFUNC(alGenEffects);
136 LOADFUNC(alDeleteEffects);
137 LOADFUNC(alIsEffect);
138 LOADFUNC(alEffectf);
139 LOADFUNC(alEffectfv);
140 LOADFUNC(alEffecti);
141 LOADFUNC(alEffectiv);
142 LOADFUNC(alGetEffectf);
143 LOADFUNC(alGetEffectfv);
144 LOADFUNC(alGetEffecti);
145 LOADFUNC(alGetEffectiv);
146 LOADFUNC(alGenAuxiliaryEffectSlots);
147 LOADFUNC(alDeleteAuxiliaryEffectSlots);
148 LOADFUNC(alIsAuxiliaryEffectSlot);
149 LOADFUNC(alAuxiliaryEffectSlotf);
150 LOADFUNC(alAuxiliaryEffectSlotfv);
151 LOADFUNC(alAuxiliaryEffectSloti);
152 LOADFUNC(alAuxiliaryEffectSlotiv);
153 LOADFUNC(alGetAuxiliaryEffectSlotf);
154 LOADFUNC(alGetAuxiliaryEffectSlotfv);
155 LOADFUNC(alGetAuxiliaryEffectSloti);
156 LOADFUNC(alGetAuxiliaryEffectSlotiv);
157 #undef LOADFUNC
160 /***********************************************************************
161 * OpenAL thunk routines
164 /* OpenAL ALC 1.0 functions */
165 ALCcontext* CDECL wine_alcCreateContext(ALCdevice *device, const ALCint* attrlist)
167 return alcCreateContext(device, attrlist);
170 ALCboolean CDECL wine_alcMakeContextCurrent(ALCcontext *context)
172 EnterCriticalSection(&openal_cs);
173 if(alcMakeContextCurrent(context) == ALC_FALSE)
175 WARN("Failed to make context %p current\n", context);
176 LeaveCriticalSection(&openal_cs);
177 return ALC_FALSE;
180 if(context && !loaded_procs)
182 loaded_procs = AL_TRUE;
183 LoadProcs();
185 LeaveCriticalSection(&openal_cs);
187 return ALC_TRUE;
190 ALvoid CDECL wine_alcProcessContext(ALCcontext *context)
192 alcProcessContext(context);
195 ALvoid CDECL wine_alcSuspendContext(ALCcontext *context)
197 alcSuspendContext(context);
200 ALvoid CDECL wine_alcDestroyContext(ALCcontext *context)
202 alcDestroyContext(context);
205 ALCcontext* CDECL wine_alcGetCurrentContext(ALCvoid)
207 return alcGetCurrentContext();
210 ALCdevice* CDECL wine_alcGetContextsDevice(ALCcontext *context)
212 return alcGetContextsDevice(context);
215 ALCdevice* CDECL wine_alcOpenDevice(const ALCchar *devicename)
217 if(devicename != NULL && (strcmp(devicename, "DirectSound3D") == 0 ||
218 strcmp(devicename, "DirectSound") == 0 ||
219 strcmp(devicename, "Generic Hardware") == 0 ||
220 strcmp(devicename, "Generic Software") == 0)) {
221 devicename = NULL;
223 return alcOpenDevice(devicename);
226 ALCboolean CDECL wine_alcCloseDevice(ALCdevice *device)
228 return alcCloseDevice(device);
231 ALCenum CDECL wine_alcGetError(ALCdevice *device)
233 return alcGetError(device);
236 ALCboolean CDECL wine_alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname)
238 return alcIsExtensionPresent(device, extname);
241 ALCenum CDECL wine_alcGetEnumValue(ALCdevice *device, const ALCchar *enumname)
243 return alcGetEnumValue(device, enumname);
246 const ALCchar* CDECL wine_alcGetString(ALCdevice *device, ALCenum param)
248 return alcGetString(device, param);
251 ALvoid CDECL wine_alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest)
253 alcGetIntegerv(device, param, size, dest);
257 /* OpenAL 1.0 functions */
258 ALvoid CDECL wine_alEnable(ALenum capability)
260 alEnable(capability);
263 ALvoid CDECL wine_alDisable(ALenum capability)
265 alDisable(capability);
268 ALboolean CDECL wine_alIsEnabled(ALenum capability)
270 return alIsEnabled(capability);
273 const ALchar* CDECL wine_alGetString(ALenum param)
275 return alGetString(param);
278 ALvoid CDECL wine_alGetBooleanv(ALenum param, ALboolean* data)
280 alGetBooleanv(param, data);
283 ALvoid CDECL wine_alGetIntegerv(ALenum param, ALint* data)
285 alGetIntegerv(param, data);
288 ALvoid CDECL wine_alGetFloatv(ALenum param, ALfloat* data)
290 alGetFloatv(param, data);
293 ALvoid CDECL wine_alGetDoublev(ALenum param, ALdouble* data)
295 alGetDoublev(param, data);
298 ALboolean CDECL wine_alGetBoolean(ALenum param)
300 return alGetBoolean(param);
303 ALint CDECL wine_alGetInteger(ALenum param)
305 return alGetInteger(param);
308 ALfloat CDECL wine_alGetFloat(ALenum param)
310 return alGetFloat(param);
313 ALdouble CDECL wine_alGetDouble(ALenum param)
315 return alGetDouble(param);
318 ALenum CDECL wine_alGetError(ALvoid)
320 return alGetError();
323 ALboolean CDECL wine_alIsExtensionPresent(const ALchar* extname)
325 return alIsExtensionPresent(extname);
328 ALenum CDECL wine_alGetEnumValue(const ALchar* ename)
330 return alGetEnumValue(ename);
333 ALvoid CDECL wine_alListenerf(ALenum param, ALfloat value)
335 alListenerf(param, value);
338 ALvoid CDECL wine_alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
340 alListener3f(param, value1, value2, value3);
343 ALvoid CDECL wine_alListenerfv(ALenum param, const ALfloat* values)
345 alListenerfv(param, values);
348 ALvoid CDECL wine_alListeneri(ALenum param, ALint value)
350 alListeneri(param, value);
353 ALvoid CDECL wine_alGetListenerf(ALenum param, ALfloat* value)
355 alGetListenerf(param, value);
358 ALvoid CDECL wine_alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)
360 alGetListener3f(param, value1, value2, value3);
363 ALvoid CDECL wine_alGetListenerfv(ALenum param, ALfloat* values)
365 alGetListenerfv(param, values);
368 ALvoid CDECL wine_alGetListeneri(ALenum param, ALint* value)
370 alGetListeneri(param, value);
373 ALvoid CDECL wine_alGetListeneriv(ALenum param, ALint* values)
375 alGetListeneriv(param, values);
378 ALvoid CDECL wine_alGenSources(ALsizei n, ALuint* sources)
380 alGenSources(n, sources);
383 ALvoid CDECL wine_alDeleteSources(ALsizei n, const ALuint* sources)
385 alDeleteSources(n, sources);
388 ALboolean CDECL wine_alIsSource(ALuint sid)
390 return alIsSource(sid);
393 ALvoid CDECL wine_alSourcef(ALuint sid, ALenum param, ALfloat value)
395 alSourcef(sid, param, value);
398 ALvoid CDECL wine_alSource3f(ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
400 alSource3f(sid, param, value1, value2, value3);
403 ALvoid CDECL wine_alSourcefv(ALuint sid, ALenum param, const ALfloat* values)
405 alSourcefv(sid, param, values);
408 ALvoid CDECL wine_alSourcei(ALuint sid, ALenum param, ALint value)
410 alSourcei(sid, param, value);
413 ALvoid CDECL wine_alGetSourcef(ALuint sid, ALenum param, ALfloat* value)
415 alGetSourcef(sid, param, value);
418 ALvoid CDECL wine_alGetSource3f(ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
420 alGetSource3f(sid, param, value1, value2, value3);
423 ALvoid CDECL wine_alGetSourcefv(ALuint sid, ALenum param, ALfloat* values)
425 alGetSourcefv(sid, param, values);
428 ALvoid CDECL wine_alGetSourcei(ALuint sid, ALenum param, ALint* value)
430 alGetSourcei(sid, param, value);
433 ALvoid CDECL wine_alGetSourceiv(ALuint sid, ALenum param, ALint* values)
435 alGetSourceiv(sid, param, values);
438 ALvoid CDECL wine_alSourcePlayv(ALsizei ns, const ALuint *sids)
440 alSourcePlayv(ns, sids);
443 ALvoid CDECL wine_alSourceStopv(ALsizei ns, const ALuint *sids)
445 alSourceStopv(ns, sids);
448 ALvoid CDECL wine_alSourceRewindv(ALsizei ns, const ALuint *sids)
450 alSourceRewindv(ns, sids);
453 ALvoid CDECL wine_alSourcePausev(ALsizei ns, const ALuint *sids)
455 alSourcePausev(ns, sids);
458 ALvoid CDECL wine_alSourcePlay(ALuint sid)
460 alSourcePlay(sid);
463 ALvoid CDECL wine_alSourceStop(ALuint sid)
465 alSourceStop(sid);
468 ALvoid CDECL wine_alSourceRewind(ALuint sid)
470 alSourceRewind(sid);
473 ALvoid CDECL wine_alSourcePause(ALuint sid)
475 alSourcePause(sid);
478 ALvoid CDECL wine_alSourceQueueBuffers(ALuint sid, ALsizei numEntries, const ALuint *bids)
480 alSourceQueueBuffers(sid, numEntries, bids);
483 ALvoid CDECL wine_alSourceUnqueueBuffers(ALuint sid, ALsizei numEntries, ALuint *bids)
485 alSourceUnqueueBuffers(sid, numEntries, bids);
488 ALvoid CDECL wine_alGenBuffers(ALsizei n, ALuint* buffers)
490 alGenBuffers(n, buffers);
493 ALvoid CDECL wine_alDeleteBuffers(ALsizei n, const ALuint* buffers)
495 alDeleteBuffers(n, buffers);
498 ALboolean CDECL wine_alIsBuffer(ALuint bid)
500 return alIsBuffer(bid);
503 ALvoid CDECL wine_alBufferData(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
505 alBufferData(bid, format, data, size, freq);
508 static ALvoid CDECL wine_alBufferDataStatic(const ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq)
510 alBufferDataStatic(bid, format, data, size, freq);
513 ALvoid CDECL wine_alGetBufferf(ALuint bid, ALenum param, ALfloat* value)
515 alGetBufferf(bid, param, value);
518 ALvoid CDECL wine_alGetBufferfv(ALuint bid, ALenum param, ALfloat* values)
520 alGetBufferfv(bid, param, values);
523 ALvoid CDECL wine_alGetBufferi(ALuint bid, ALenum param, ALint* value)
525 alGetBufferi(bid, param, value);
528 ALvoid CDECL wine_alGetBufferiv(ALuint bid, ALenum param, ALint* values)
530 alGetBufferiv(bid, param, values);
533 ALvoid CDECL wine_alDopplerFactor(ALfloat value)
535 alDopplerFactor(value);
538 ALvoid CDECL wine_alDopplerVelocity(ALfloat value)
540 alDopplerVelocity(value);
543 ALvoid CDECL wine_alDistanceModel(ALenum distanceModel)
545 alDistanceModel(distanceModel);
549 /* OpenAL ALC 1.1 functions */
550 ALCdevice* CDECL wine_alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize)
552 return alcCaptureOpenDevice(devicename, frequency, format, buffersize);
555 ALCboolean CDECL wine_alcCaptureCloseDevice(ALCdevice *device)
557 return alcCaptureCloseDevice(device);
560 ALCvoid CDECL wine_alcCaptureStart(ALCdevice *device)
562 alcCaptureStart(device);
565 ALCvoid CDECL wine_alcCaptureStop(ALCdevice *device)
567 alcCaptureStop(device);
570 ALCvoid CDECL wine_alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
572 alcCaptureSamples(device, buffer, samples);
575 /* OpenAL 1.1 functions */
576 ALvoid CDECL wine_alListener3i(ALenum param, ALint value1, ALint value2, ALint value3)
578 alListener3i(param, value1, value2, value3);
581 ALvoid CDECL wine_alListeneriv(ALenum param, const ALint* values)
583 alListeneriv(param, values);
586 ALvoid CDECL wine_alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3)
588 alGetListener3i(param, value1, value2, value3);
591 ALvoid CDECL wine_alSource3i(ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3)
593 alSource3i(sid, param, value1, value2, value3);
596 ALvoid CDECL wine_alSourceiv(ALuint sid, ALenum param, const ALint* values)
598 alSourceiv(sid, param, values);
601 ALvoid CDECL wine_alGetSource3i(ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
603 alGetSource3i(sid, param, value1, value2, value3);
606 ALvoid CDECL wine_alBufferf(ALuint bid, ALenum param, ALfloat value)
608 alBufferf(bid, param, value);
611 ALvoid CDECL wine_alBuffer3f(ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)
613 alBuffer3f(bid, param, value1, value2, value3);
616 ALvoid CDECL wine_alBufferfv(ALuint bid, ALenum param, const ALfloat* values)
618 alBufferfv(bid, param, values);
621 ALvoid CDECL wine_alBufferi(ALuint bid, ALenum param, ALint value)
623 alBufferi(bid, param, value);
626 ALvoid CDECL wine_alBuffer3i(ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3)
628 alBuffer3i(bid, param, value1, value2, value3);
631 ALvoid CDECL wine_alBufferiv(ALuint bid, ALenum param, const ALint* values)
633 alBufferiv(bid, param, values);
636 ALvoid CDECL wine_alGetBuffer3f(ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3)
638 alGetBuffer3f(bid, param, value1, value2, value3);
641 ALvoid CDECL wine_alGetBuffer3i(ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3)
643 alGetBuffer3i(bid, param, value1, value2, value3);
646 ALvoid CDECL wine_alSpeedOfSound(ALfloat value)
648 alSpeedOfSound(value);
651 /* OpenAL EFX extension functions */
652 static ALvoid CDECL wine_alGenFilters(ALsizei n, ALuint* filters)
654 alGenFilters(n, filters);
657 static ALvoid CDECL wine_alDeleteFilters(ALsizei n, const ALuint* filters)
659 alDeleteFilters(n, filters);
662 static ALboolean CDECL wine_alIsFilter(ALuint fid)
664 return alIsFilter(fid);
667 static ALvoid CDECL wine_alFilterf(ALuint fid, ALenum param, ALfloat value)
669 alFilterf(fid, param, value);
672 static ALvoid CDECL wine_alFilterfv(ALuint fid, ALenum param, const ALfloat* values)
674 alFilterfv(fid, param, values);
677 static ALvoid CDECL wine_alFilteri(ALuint fid, ALenum param, ALint value)
679 alFilteri(fid, param, value);
682 static ALvoid CDECL wine_alFilteriv(ALuint fid, ALenum param, const ALint* values)
684 alFilteriv(fid, param, values);
687 static ALvoid CDECL wine_alGetFilterf(ALuint fid, ALenum param, ALfloat* value)
689 alGetFilterf(fid, param, value);
692 static ALvoid CDECL wine_alGetFilterfv(ALuint fid, ALenum param, ALfloat* values)
694 alGetFilterfv(fid, param, values);
697 static ALvoid CDECL wine_alGetFilteri(ALuint fid, ALenum param, ALint* value)
699 alGetFilteri(fid, param, value);
702 static ALvoid CDECL wine_alGetFilteriv(ALuint fid, ALenum param, ALint* values)
704 alGetFilteriv(fid, param, values);
708 static ALvoid CDECL wine_alGenEffects(ALsizei n, ALuint* effects)
710 alGenEffects(n, effects);
713 static ALvoid CDECL wine_alDeleteEffects(ALsizei n, const ALuint* effects)
715 alDeleteEffects(n, effects);
718 static ALboolean CDECL wine_alIsEffect(ALuint eid)
720 return alIsEffect(eid);
723 static ALvoid CDECL wine_alEffectf(ALuint eid, ALenum param, ALfloat value)
725 alEffectf(eid, param, value);
728 static ALvoid CDECL wine_alEffectfv(ALuint eid, ALenum param, const ALfloat* values)
730 alEffectfv(eid, param, values);
733 static ALvoid CDECL wine_alEffecti(ALuint eid, ALenum param, ALint value)
735 alEffecti(eid, param, value);
738 static ALvoid CDECL wine_alEffectiv(ALuint eid, ALenum param, const ALint* values)
740 alEffectiv(eid, param, values);
743 static ALvoid CDECL wine_alGetEffectf(ALuint eid, ALenum param, ALfloat* value)
745 alGetEffectf(eid, param, value);
748 static ALvoid CDECL wine_alGetEffectfv(ALuint eid, ALenum param, ALfloat* values)
750 alGetEffectfv(eid, param, values);
753 static ALvoid CDECL wine_alGetEffecti(ALuint eid, ALenum param, ALint* value)
755 alGetEffecti(eid, param, value);
758 static ALvoid CDECL wine_alGetEffectiv(ALuint eid, ALenum param, ALint* values)
760 alGetEffectiv(eid, param, values);
764 static ALvoid CDECL wine_alGenAuxiliaryEffectSlots(ALsizei n, ALuint* slots)
766 alGenAuxiliaryEffectSlots(n, slots);
769 static ALvoid CDECL wine_alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint* slots)
771 alDeleteAuxiliaryEffectSlots(n, slots);
774 static ALboolean CDECL wine_alIsAuxiliaryEffectSlot(ALuint sid)
776 return alIsAuxiliaryEffectSlot(sid);
779 static ALvoid CDECL wine_alAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat value)
781 alAuxiliaryEffectSlotf(sid, param, value);
784 static ALvoid CDECL wine_alAuxiliaryEffectSlotfv(ALuint sid, ALenum param, const ALfloat* values)
786 alAuxiliaryEffectSlotfv(sid, param, values);
789 static ALvoid CDECL wine_alAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint value)
791 alAuxiliaryEffectSloti(sid, param, value);
794 static ALvoid CDECL wine_alAuxiliaryEffectSlotiv(ALuint sid, ALenum param, const ALint* values)
796 alAuxiliaryEffectSlotiv(sid, param, values);
799 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotf(ALuint sid, ALenum param, ALfloat* value)
801 alGetAuxiliaryEffectSlotf(sid, param, value);
804 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotfv(ALuint sid, ALenum param, ALfloat* values)
806 alGetAuxiliaryEffectSlotfv(sid, param, values);
809 static ALvoid CDECL wine_alGetAuxiliaryEffectSloti(ALuint sid, ALenum param, ALint* value)
811 alGetAuxiliaryEffectSloti(sid, param, value);
814 static ALvoid CDECL wine_alGetAuxiliaryEffectSlotiv(ALuint sid, ALenum param, ALint* values)
816 alGetAuxiliaryEffectSlotiv(sid, param, values);
820 /* Thread-local context functions */
821 static ALCboolean CDECL wine_alcSetThreadContext(ALCcontext *context)
823 EnterCriticalSection(&openal_cs);
824 if(alcSetThreadContext(context) == ALC_FALSE)
826 WARN("Failed to make context %p current\n", context);
827 LeaveCriticalSection(&openal_cs);
828 return ALC_FALSE;
831 if(context && !loaded_procs)
833 loaded_procs = AL_TRUE;
834 LoadProcs();
836 LeaveCriticalSection(&openal_cs);
838 return ALC_TRUE;
841 static ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid)
843 return alcGetThreadContext();
846 struct FuncList {
847 const char *name;
848 void *proc;
851 static const struct FuncList ALCFuncs[] = {
852 { "alcCreateContext", wine_alcCreateContext },
853 { "alcMakeContextCurrent", wine_alcMakeContextCurrent },
854 { "alcProcessContext", wine_alcProcessContext },
855 { "alcSuspendContext", wine_alcSuspendContext },
856 { "alcDestroyContext", wine_alcDestroyContext },
857 { "alcGetCurrentContext", wine_alcGetCurrentContext },
858 { "alcGetContextsDevice", wine_alcGetContextsDevice },
859 { "alcOpenDevice", wine_alcOpenDevice },
860 { "alcCloseDevice", wine_alcCloseDevice },
861 { "alcGetError", wine_alcGetError },
862 { "alcIsExtensionPresent", wine_alcIsExtensionPresent },
863 { "alcGetProcAddress", wine_alcGetProcAddress },
864 { "alcGetEnumValue", wine_alcGetEnumValue },
865 { "alcGetString", wine_alcGetString },
866 { "alcGetIntegerv", wine_alcGetIntegerv },
867 { "alcCaptureOpenDevice", wine_alcCaptureOpenDevice },
868 { "alcCaptureCloseDevice", wine_alcCaptureCloseDevice },
869 { "alcCaptureStart", wine_alcCaptureStart },
870 { "alcCaptureStop", wine_alcCaptureStop },
871 { "alcCaptureSamples", wine_alcCaptureSamples },
872 { "alcSetThreadContext", wine_alcSetThreadContext },
873 { "alcGetThreadContext", wine_alcGetThreadContext },
874 { NULL, NULL }
876 static const struct FuncList ALFuncs[] = {
877 { "alEnable", wine_alEnable },
878 { "alDisable", wine_alDisable },
879 { "alIsEnabled", wine_alIsEnabled },
880 { "alGetString", wine_alGetString },
881 { "alGetBooleanv", wine_alGetBooleanv },
882 { "alGetIntegerv", wine_alGetIntegerv },
883 { "alGetFloatv", wine_alGetFloatv },
884 { "alGetDoublev", wine_alGetDoublev },
885 { "alGetBoolean", wine_alGetBoolean },
886 { "alGetInteger", wine_alGetInteger },
887 { "alGetFloat", wine_alGetFloat },
888 { "alGetDouble", wine_alGetDouble },
889 { "alGetError", wine_alGetError },
890 { "alIsExtensionPresent", wine_alIsExtensionPresent },
891 { "alGetProcAddress", wine_alGetProcAddress },
892 { "alGetEnumValue", wine_alGetEnumValue },
893 { "alListenerf", wine_alListenerf },
894 { "alListener3f", wine_alListener3f },
895 { "alListenerfv", wine_alListenerfv },
896 { "alListeneri", wine_alListeneri },
897 { "alListener3i", wine_alListener3i },
898 { "alListeneriv", wine_alListeneriv },
899 { "alGetListenerf", wine_alGetListenerf },
900 { "alGetListener3f", wine_alGetListener3f },
901 { "alGetListenerfv", wine_alGetListenerfv },
902 { "alGetListeneri", wine_alGetListeneri },
903 { "alGetListener3i", wine_alGetListener3i },
904 { "alGetListeneriv", wine_alGetListeneriv },
905 { "alGenSources", wine_alGenSources },
906 { "alDeleteSources", wine_alDeleteSources },
907 { "alIsSource", wine_alIsSource },
908 { "alSourcef", wine_alSourcef },
909 { "alSource3f", wine_alSource3f },
910 { "alSourcefv", wine_alSourcefv },
911 { "alSourcei", wine_alSourcei },
912 { "alSource3i", wine_alSource3i },
913 { "alSourceiv", wine_alSourceiv },
914 { "alGetSourcef", wine_alGetSourcef },
915 { "alGetSource3f", wine_alGetSource3f },
916 { "alGetSourcefv", wine_alGetSourcefv },
917 { "alGetSourcei", wine_alGetSourcei },
918 { "alGetSource3i", wine_alGetSource3i },
919 { "alGetSourceiv", wine_alGetSourceiv },
920 { "alSourcePlayv", wine_alSourcePlayv },
921 { "alSourceStopv", wine_alSourceStopv },
922 { "alSourceRewindv", wine_alSourceRewindv },
923 { "alSourcePausev", wine_alSourcePausev },
924 { "alSourcePlay", wine_alSourcePlay },
925 { "alSourceStop", wine_alSourceStop },
926 { "alSourceRewind", wine_alSourceRewind },
927 { "alSourcePause", wine_alSourcePause },
928 { "alSourceQueueBuffers", wine_alSourceQueueBuffers },
929 { "alSourceUnqueueBuffers", wine_alSourceUnqueueBuffers },
930 { "alGenBuffers", wine_alGenBuffers },
931 { "alDeleteBuffers", wine_alDeleteBuffers },
932 { "alIsBuffer", wine_alIsBuffer },
933 { "alBufferData", wine_alBufferData },
934 { "alBufferDataStatic", wine_alBufferDataStatic },
935 { "alBufferf", wine_alBufferf },
936 { "alBuffer3f", wine_alBuffer3f },
937 { "alBufferfv", wine_alBufferfv },
938 { "alBufferi", wine_alBufferi },
939 { "alBuffer3i", wine_alBuffer3i },
940 { "alBufferiv", wine_alBufferiv },
941 { "alGetBufferf", wine_alGetBufferf },
942 { "alGetBuffer3f", wine_alGetBuffer3f },
943 { "alGetBufferfv", wine_alGetBufferfv },
944 { "alGetBufferi", wine_alGetBufferi },
945 { "alGetBuffer3i", wine_alGetBuffer3i },
946 { "alGetBufferiv", wine_alGetBufferiv },
947 { "alDopplerFactor", wine_alDopplerFactor },
948 { "alDopplerVelocity", wine_alDopplerVelocity },
949 { "alSpeedOfSound", wine_alSpeedOfSound },
950 { "alDistanceModel", wine_alDistanceModel },
952 { "alGenFilters", wine_alGenFilters },
953 { "alDeleteFilters", wine_alDeleteFilters },
954 { "alIsFilter", wine_alIsFilter },
955 { "alFilterf", wine_alFilterf },
956 { "alFilterfv", wine_alFilterfv },
957 { "alFilteri", wine_alFilteri },
958 { "alFilteriv", wine_alFilteriv },
959 { "alGetFilterf", wine_alGetFilterf },
960 { "alGetFilterfv", wine_alGetFilterfv },
961 { "alGetFilteri", wine_alGetFilteri },
962 { "alGetFilteriv", wine_alGetFilteriv },
964 { "alGenEffects", wine_alGenEffects },
965 { "alDeleteEffects", wine_alDeleteEffects },
966 { "alIsEffect", wine_alIsEffect },
967 { "alEffectf", wine_alEffectf },
968 { "alEffectfv", wine_alEffectfv },
969 { "alEffecti", wine_alEffecti },
970 { "alEffectiv", wine_alEffectiv },
971 { "alGetEffectf", wine_alGetEffectf },
972 { "alGetEffectfv", wine_alGetEffectfv },
973 { "alGetEffecti", wine_alGetEffecti },
974 { "alGetEffectiv", wine_alGetEffectiv },
976 { "alGenAuxiliaryEffectSlots", wine_alGenAuxiliaryEffectSlots},
977 { "alDeleteAuxiliaryEffectSlots",wine_alDeleteAuxiliaryEffectSlots},
978 { "alIsAuxiliaryEffectSlot", wine_alIsAuxiliaryEffectSlot },
979 { "alAuxiliaryEffectSlotf", wine_alAuxiliaryEffectSlotf },
980 { "alAuxiliaryEffectSlotfv", wine_alAuxiliaryEffectSlotfv },
981 { "alAuxiliaryEffectSloti", wine_alAuxiliaryEffectSloti },
982 { "alAuxiliaryEffectSlotiv", wine_alAuxiliaryEffectSlotiv },
983 { "alGetAuxiliaryEffectSlotf", wine_alGetAuxiliaryEffectSlotf},
984 { "alGetAuxiliaryEffectSlotfv", wine_alGetAuxiliaryEffectSlotfv},
985 { "alGetAuxiliaryEffectSloti", wine_alGetAuxiliaryEffectSloti},
986 { "alGetAuxiliaryEffectSlotiv", wine_alGetAuxiliaryEffectSlotiv},
988 { NULL, NULL }
992 ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *device, const ALCchar *funcname)
994 void *proc;
995 int i;
997 /* Make sure the host implementation has the requested function */
998 proc = alcGetProcAddress(device, funcname);
999 if(!proc)
1000 return NULL;
1002 for(i = 0;ALCFuncs[i].name;i++)
1004 if(strcmp(funcname, ALCFuncs[i].name) == 0)
1005 return ALCFuncs[i].proc;
1007 FIXME("Could not find function in list: %s\n", funcname);
1008 return NULL;
1012 ALvoid* CDECL wine_alGetProcAddress(const ALchar* funcname)
1014 void *proc;
1015 int i;
1017 /* Make sure the host implementation has the requested function. This will
1018 * also set the last AL error properly if the function should not be
1019 * returned (eg. no current context). */
1020 proc = alGetProcAddress(funcname);
1021 if(!proc)
1022 return NULL;
1024 for(i = 0;ALFuncs[i].name;i++)
1026 if(strcmp(funcname, ALFuncs[i].name) == 0)
1027 return ALFuncs[i].proc;
1029 FIXME("Could not find function in list: %s\n", funcname);
1030 return NULL;