1 
2 //          Copyright 2018 - 2021 Michael D. Parker
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.openal.binddynamic;
8 
9 version(BindOpenAL_Static) {}
10 else version = BindOpenAL_Dynamic;
11 
12 version(BindOpenAL_Dynamic):
13 
14 import bindbc.loader;
15 import bindbc.openal.types;
16 
17 extern(C) @nogc nothrow {
18     alias palEnable = void function(ALenum capability);
19     alias palDisable = void function(ALenum capability);
20     alias palIsEnabled = ALboolean function(ALenum capability);
21     alias palGetString = const(ALchar)* function(ALenum param);
22     alias palGetBooleanv = void function(ALenum param, ALboolean* values);
23     alias palGetIntegerv = void function(ALenum param, ALint* values);
24     alias palGetFloatv = void function(ALenum param, ALfloat* values);
25     alias palGetDoublev = void function(ALenum param, ALdouble* values);
26     alias palGetBoolean = ALboolean function(ALenum param);
27     alias palGetInteger = ALint function(ALenum param);
28     alias palGetFloat = ALfloat function(ALenum param);
29     alias palGetDouble = ALdouble function(ALenum param);
30     alias palGetError = ALenum function();
31     alias palIsExtensionPresent = ALboolean function(const(char)* extname);
32     alias palGetProcAddress = ALvoid* function(const(char)* fname);
33     alias palGetEnumValue = ALenum function(const(char)* ename);
34     alias palListenerf = void function(ALenum param, ALfloat value);
35     alias palListener3f = void function(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
36     alias palListenerfv = void function(ALenum param, const(ALfloat)* values);
37     alias palListeneri = void function(ALenum param, ALint value);
38     alias palListener3i = void function(ALenum param, ALint value1, ALint value2, ALint value3);
39     alias palListeneriv = void function(ALenum param, const(ALint)* values);
40     alias palGetListenerf = void function(ALenum param, ALfloat* value);
41     alias palGetListener3f = void function(ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
42     alias palGetListenerfv = void function(ALenum param, ALfloat* values);
43     alias palGetListeneri = void function(ALenum param, ALint* value);
44     alias palGetListener3i = void function(ALenum param, ALint* value1, ALint* value2, ALint* value3);
45     alias palGetListeneriv = void function(ALenum param, ALint* values);
46     alias palGenSources = void function(ALsizei n, ALuint* sources);
47     alias palDeleteSources = void function(ALsizei n, const(ALuint)* sources);
48     alias palIsSource = ALboolean function(ALuint source);
49     alias palSourcef = void function(ALuint source, ALenum param, ALfloat value);
50     alias palSource3f = void function(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
51     alias palSourcefv = void function(ALuint source, ALenum param, const(ALfloat)* values);
52     alias palSourcei = void function(ALuint source, ALenum param, ALint value);
53     alias palSource3i = void function(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
54     alias palSourceiv = void function(ALuint source, ALenum param, const(ALint)* values);
55     alias palGetSourcef = void function(ALuint source, ALenum param, ALfloat* value);
56     alias palGetSource3f = void function(ALuint source, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
57     alias palGetSourcefv = void function(ALuint source, ALenum param, ALfloat* values);
58     alias palGetSourcei = void function(ALuint source, ALenum param, ALint* value);
59     alias palGetSource3i = void function(ALuint source, ALenum param, ALint* value1, ALint* value2, ALint* value3);
60     alias palGetSourceiv = void function(ALuint source, ALenum param, ALint*);
61     alias palSourcePlayv = void function(ALsizei n, const(ALuint)* sources);
62     alias palSourceStopv = void function(ALsizei n, const(ALuint)* sources);
63     alias palSourceRewindv = void function(ALsizei n, const(ALuint)* sources);
64     alias palSourcePausev = void function(ALsizei n, const(ALuint)* sources);
65     alias palSourcePlay = void function(ALuint source);
66     alias palSourcePause = void function(ALuint source);
67     alias palSourceRewind = void function(ALuint source);
68     alias palSourceStop = void function(ALuint source);
69     alias palSourceQueueBuffers = void function(ALuint source, ALsizei nb, ALuint* buffers);
70     alias palSourceUnqueueBuffers = void function(ALuint source, ALsizei nb, ALuint* buffers);
71     alias palGenBuffers = void function(ALsizei, ALuint* buffers);
72     alias palDeleteBuffers = void function(ALsizei, const(ALuint)* buffers);
73     alias palIsBuffer = ALboolean function(ALuint buffer);
74     alias palBufferData = void function(ALuint buffers, ALenum param, const(ALvoid)* data, ALsizei size, ALsizei freq);
75     alias palBufferf = void function(ALuint buffers, ALenum param, ALfloat value);
76     alias palBuffer3f = void function(ALuint buffers, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
77     alias palBufferfv = void function(ALuint buffers, ALenum param, const(ALfloat)* values);
78     alias palBufferi = void function(ALuint buffers, ALenum param, ALint value);
79     alias palBuffer3i = void function(ALuint buffers, ALenum param, ALint value1, ALint value2, ALint value3);
80     alias palBufferiv = void function(ALuint buffers, ALenum param, const(ALint)* values);
81     alias palGetBufferf = void function(ALuint buffers, ALenum param, ALfloat* value);
82     alias palGetBuffer3f = void function(ALuint buffers, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
83     alias palGetBufferfv = void function(ALuint buffers, ALenum param, ALfloat* values);
84     alias palGetBufferi = void function(ALuint buffers, ALenum param, ALint* value);
85     alias palGetBuffer3i = void function(ALuint buffers, ALenum param, ALint* value1, ALint* value2, ALint* value3);
86     alias palGetBufferiv = void function(ALuint buffers, ALenum param, ALint* values);
87     alias palDopplerFactor = void function(ALfloat value);
88     alias palDopplerVelocity = void function(ALfloat value);
89     alias palSpeedOfSound = void function(ALfloat value);
90     alias palDistanceModel = void function(ALenum distanceModel);
91     alias palcCreateContext = ALCcontext* function(ALCdevice* device, const(ALCint)* attrlist);
92     alias palcMakeContextCurrent = ALCboolean function(ALCcontext* context);
93     alias palcProcessContext = void function(ALCcontext* context);
94     alias palcSuspendContext = void function(ALCcontext* context);
95     alias palcDestroyContext = void function(ALCcontext* context);
96     alias palcGetCurrentContext = ALCcontext* function();
97     alias palcGetContextsDevice = ALCdevice* function(ALCcontext* context);
98     alias palcOpenDevice = ALCdevice* function(const(char)* devicename);
99     alias palcCloseDevice = ALCboolean function(ALCdevice* device);
100     alias palcGetError = ALCenum function(ALCdevice* device);
101     alias palcIsExtensionPresent = ALCboolean function(ALCdevice* device, const(char)* extname);
102     alias palcGetProcAddress = void* function(ALCdevice* device, const(char)* funcname);
103     alias palcGetEnumValue = ALCenum function(ALCdevice* device, const(char)* enumname);
104     alias palcGetString = const(char)* function(ALCdevice* device, ALCenum param);
105     alias palcGetIntegerv = void function(ALCdevice* device, ALCenum param, ALCsizei size, ALCint* values);
106     alias palcCaptureOpenDevice = ALCdevice* function(const(char)* devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
107     alias palcCaptureCloseDevice = ALCboolean function(ALCdevice* device);
108     alias palcCaptureStart = void function(ALCdevice* device);
109     alias palcCaptureStop = void function(ALCdevice* device);
110     alias palcCaptureSamples = void function(ALCdevice* device, ALCvoid* buffer, ALCsizei samples);
111 
112     version(AL_EFX) {
113         //EFX Functions
114         alias palGenEffects = void function(ALsizei n, ALuint* effects);
115         alias palDeleteEffects = void function(ALsizei n, const ALuint* effects);
116         alias palIsEffect = ALboolean function(ALuint effect);
117         alias palEffecti = void function(ALuint effect, ALenum param, ALint iValue);
118         alias palEffectiv = void function(ALuint effect, ALenum param, const (ALint)* piValues);
119         alias palEffectf = void function(ALuint effect, ALenum param, ALfloat flValue);
120         alias palEffectfv = void function(ALuint effect, ALenum param, const (ALfloat)* pflValues);
121         alias palGetEffecti = void function(ALuint effect, ALenum param, ALint* piValue);
122         alias palGetEffectiv = void function(ALuint effect, ALenum param, ALint* piValues);
123         alias palGetEffectf = void function(ALuint effect, ALenum param, ALfloat* pflValue);
124         alias palGetEffectfv = void function(ALuint effect, ALenum param, ALfloat* pflValues);
125 
126         alias palGenFilters = void function(ALsizei n, ALuint* filters);
127         alias palDeleteFilters = void function(ALsizei n, const ALuint* filters);
128         alias palIsFilter = ALboolean function(ALuint filter);
129         alias palFilteri = void function(ALuint filter, ALenum param, ALint iValue);
130         alias palFilteriv = void function(ALuint filter, ALenum param, const ALint* piValues);
131         alias palFilterf = void function(ALuint filter, ALenum param, ALfloat flValue);
132         alias palFilterfv = void function(ALuint filter, ALenum param, const ALfloat* pflValues);
133         alias palGetFilteri = void function(ALuint filter, ALenum param, ALint* piValue);
134         alias palGetFilteriv = void function(ALuint filter, ALenum param, ALint* piValues);
135         alias palGetFilterf = void function(ALuint filter, ALenum param, ALfloat* pflValue);
136         alias palGetFilterfv = void function(ALuint filter, ALenum param, ALfloat* pflValues);
137 
138         alias palGenAuxiliaryEffectSlots = void function(ALsizei n, ALuint* effectslots);
139         alias palDeleteAuxiliaryEffectSlots = void function(ALsizei n, const ALuint* effectslots);
140         alias palIsAuxiliaryEffectSlot = ALboolean function(ALuint effectslot);
141         alias palAuxiliaryEffectSloti = void function(ALuint effectslot, ALenum param, ALint iValue);
142         alias palAuxiliaryEffectSlotiv = void function(ALuint effectslot, ALenum param, const ALint* piValues);
143         alias palAuxiliaryEffectSlotf = void function(ALuint effectslot, ALenum param, ALfloat flValue);
144         alias palAuxiliaryEffectSlotfv = void function(ALuint effectslot, ALenum param, const ALfloat* pflValues);
145         alias palGetAuxiliaryEffectSloti = void function(ALuint effectslot, ALenum param, ALint* piValue);
146         alias palGetAuxiliaryEffectSlotiv = void function(ALuint effectslot, ALenum param, ALint* piValues);
147         alias palGetAuxiliaryEffectSlotf = void function(ALuint effectslot, ALenum param, ALfloat* pflValue);
148         alias palGetAuxiliaryEffectSlotfv = void function(ALuint effectslot, ALenum param, ALfloat* pflValues);
149     }
150 
151 }
152 
153 __gshared {
154     palEnable alEnable;
155     palDisable alDisable;
156     palIsEnabled alIsEnabled;
157     palGetString alGetString;
158     palGetBooleanv alGetBooleanv;
159     palGetIntegerv alGetIntegerv;
160     palGetFloatv alGetFloatv;
161     palGetDoublev alGetDoublev;
162     palGetBoolean alGetBoolean;
163     palGetInteger alGetInteger;
164     palGetFloat alGetFloat;
165     palGetDouble alGetDouble;
166     palGetError alGetError;
167     palIsExtensionPresent alIsExtensionPresent;
168     palGetProcAddress alGetProcAddress;
169     palGetEnumValue alGetEnumValue;
170     palListenerf alListenerf;
171     palListener3f alListener3f;
172     palListenerfv alListenerfv;
173     palListeneri alListeneri;
174     palListener3i alListener3i;
175     palListeneriv alListeneriv;
176     palGetListenerf alGetListenerf;
177     palGetListener3f alGetListener3f;
178     palGetListenerfv alGetListenerfv;
179     palGetListeneri alGetListeneri;
180     palGetListener3i alGetListener3i;
181     palGetListeneriv alGetListeneriv;
182     palGenSources alGenSources;
183     palDeleteSources alDeleteSources;
184     palIsSource alIsSource;
185     palSourcef alSourcef;
186     palSource3f alSource3f;
187     palSourcefv alSourcefv;
188     palSourcei alSourcei;
189     palSource3i alSource3i;
190     palSourceiv alSourceiv;
191     palGetSourcef alGetSourcef;
192     palGetSource3f alGetSource3f;
193     palGetSourcefv alGetSourcefv;
194     palGetSourcei alGetSourcei;
195     palGetSource3i alGetSource3i;
196     palGetSourceiv alGetSourceiv;
197     palSourcePlayv alSourcePlayv;
198     palSourceStopv alSourceStopv;
199     palSourceRewindv alSourceRewindv;
200     palSourcePausev alSourcePausev;
201     palSourcePlay alSourcePlay;
202     palSourcePause alSourcePause;
203     palSourceRewind alSourceRewind;
204     palSourceStop alSourceStop;
205     palSourceQueueBuffers alSourceQueueBuffers;
206     palSourceUnqueueBuffers alSourceUnqueueBuffers;
207     palGenBuffers alGenBuffers;
208     palDeleteBuffers alDeleteBuffers;
209     palIsBuffer alIsBuffer;
210     palBufferData alBufferData;
211     palBufferf alBufferf;
212     palBuffer3f alBuffer3f;
213     palBufferfv alBufferfv;
214     palBufferi alBufferi;
215     palBuffer3i alBuffer3i;
216     palBufferiv alBufferiv;
217     palGetBufferf alGetBufferf;
218     palGetBuffer3f alGetBuffer3f;
219     palGetBufferfv alGetBufferfv;
220     palGetBufferi alGetBufferi;
221     palGetBuffer3i alGetBuffer3i;
222     palGetBufferiv alGetBufferiv;
223     palDopplerFactor alDopplerFactor;
224     palDopplerVelocity alDopplerVelocity;
225     palSpeedOfSound alSpeedOfSound;
226     palDistanceModel alDistanceModel;
227     palcCreateContext alcCreateContext;
228     palcMakeContextCurrent alcMakeContextCurrent;
229     palcProcessContext alcProcessContext;
230     palcSuspendContext alcSuspendContext;
231     palcDestroyContext alcDestroyContext;
232     palcGetCurrentContext alcGetCurrentContext;
233     palcGetContextsDevice alcGetContextsDevice;
234     palcOpenDevice alcOpenDevice;
235     palcCloseDevice alcCloseDevice;
236     palcGetError alcGetError;
237     palcIsExtensionPresent alcIsExtensionPresent;
238     palcGetProcAddress alcGetProcAddress;
239     palcGetEnumValue alcGetEnumValue;
240     palcGetString alcGetString;
241     palcGetIntegerv alcGetIntegerv;
242     palcCaptureOpenDevice alcCaptureOpenDevice;
243     palcCaptureCloseDevice alcCaptureCloseDevice;
244     palcCaptureStart alcCaptureStart;
245     palcCaptureStop alcCaptureStop;
246     palcCaptureSamples alcCaptureSamples;
247 
248     version(AL_EFX) {
249         //EFX Functions
250         palGenEffects alGenEffects;
251         palDeleteEffects alDeleteEffects;
252         palIsEffect alIsEffect;
253         palEffecti alEffecti;
254         palEffectiv alEffectiv;
255         palEffectf alEffectf;
256         palEffectfv alEffectfv;
257         palGetEffecti alGetEffecti;
258         palGetEffectiv alGetEffectiv;
259         palGetEffectf alGetEffectf;
260         palGetEffectfv alGetEffectfv;
261         palGenFilters alGenFilters;
262         palDeleteFilters alDeleteFilters;
263         palIsFilter alIsFilter;
264         palFilteri alFilteri;
265         palFilteriv alFilteriv;
266         palFilterf alFilterf;
267         palFilterfv alFilterfv;
268         palGetFilteri alGetFilteri;
269         palGetFilteriv alGetFilteriv;
270         palGetFilterf alGetFilterf;
271         palGetFilterfv alGetFilterfv;
272         palGenAuxiliaryEffectSlots alGenAuxiliaryEffectSlots;
273         palDeleteAuxiliaryEffectSlots alDeleteAuxiliaryEffectSlots;
274         palIsAuxiliaryEffectSlot alIsAuxiliaryEffectSlot;
275         palAuxiliaryEffectSloti alAuxiliaryEffectSloti;
276         palAuxiliaryEffectSlotiv alAuxiliaryEffectSlotiv;
277         palAuxiliaryEffectSlotf alAuxiliaryEffectSlotf;
278         palAuxiliaryEffectSlotfv alAuxiliaryEffectSlotfv;
279         palGetAuxiliaryEffectSloti alGetAuxiliaryEffectSloti;
280         palGetAuxiliaryEffectSlotiv alGetAuxiliaryEffectSlotiv;
281         palGetAuxiliaryEffectSlotf alGetAuxiliaryEffectSlotf;
282         palGetAuxiliaryEffectSlotfv alGetAuxiliaryEffectSlotfv;
283     }
284 }
285 
286 private {
287     SharedLib lib;
288     ALSupport loadedVersion;
289 }
290 
291 @nogc nothrow:
292 
293 void unloadOpenAL()
294 {
295     if(lib != invalidHandle) {
296         lib.unload();
297     }
298 }
299 
300 ALSupport loadedOpenALVersion() { return loadedVersion; }
301 bool isOpenALLoaded() { return lib != invalidHandle; }
302 
303 ALSupport loadOpenAL()
304 {
305     version(Windows) {
306         const(char)[][3] libNames = ["soft_oal.dll", "soft-oal.dll", "OpenAL32.dll"];
307     }
308     else version(OSX) {
309         const(char)[][3] libNames = [
310             "../Frameworks/OpenAL.framework/OpenAL",
311             "/Library/Frameworks/OpenAL.framework/OpenAL",
312             "/System/Library/Frameworks/OpenAL.framework/OpenAL"
313         ];
314     }
315     else version(Posix) {
316         const(char)[][5] libNames = [
317             "libal.so", "libAL.so",
318             "libopenal.so", "libopenal.so.1", "libopenal.so.0"
319         ];
320     }
321     else static assert(0, "bindbc-openal is not yet supported on this platform");
322 
323     ALSupport ret;
324     foreach(name; libNames) {
325         ret = loadOpenAL(name.ptr);
326         if(ret != ALSupport.noLibrary) break;
327     }
328     return ret;
329 }
330 
331 ALSupport loadOpenAL(const(char)* libName)
332 {
333     // If the library isn't yet loaded, load it now.
334     if(lib == invalidHandle) {
335         lib = load(libName);
336         if(lib == invalidHandle) {
337             return ALSupport.noLibrary;
338         }
339     }
340 
341     auto errCount = errorCount();
342     lib.bindSymbol(cast(void**)&alEnable, "alEnable");
343     lib.bindSymbol(cast(void**)&alDisable, "alDisable");
344     lib.bindSymbol(cast(void**)&alIsEnabled, "alIsEnabled");
345     lib.bindSymbol(cast(void**)&alGetString, "alGetString");
346     lib.bindSymbol(cast(void**)&alGetBooleanv, "alGetBooleanv");
347     lib.bindSymbol(cast(void**)&alGetIntegerv, "alGetIntegerv");
348     lib.bindSymbol(cast(void**)&alGetFloatv, "alGetFloatv");
349     lib.bindSymbol(cast(void**)&alGetDoublev, "alGetDoublev");
350     lib.bindSymbol(cast(void**)&alGetInteger, "alGetInteger");
351     lib.bindSymbol(cast(void**)&alGetFloat, "alGetFloat");
352     lib.bindSymbol(cast(void**)&alGetDouble, "alGetDouble");
353     lib.bindSymbol(cast(void**)&alGetError, "alGetError");
354     lib.bindSymbol(cast(void**)&alIsExtensionPresent, "alIsExtensionPresent");
355     lib.bindSymbol(cast(void**)&alGetProcAddress, "alGetProcAddress");
356     lib.bindSymbol(cast(void**)&alGetEnumValue, "alGetEnumValue");
357     lib.bindSymbol(cast(void**)&alListenerf, "alListenerf");
358     lib.bindSymbol(cast(void**)&alListener3f, "alListener3f");
359     lib.bindSymbol(cast(void**)&alListenerfv, "alListenerfv");
360     lib.bindSymbol(cast(void**)&alListeneri, "alListeneri");
361     lib.bindSymbol(cast(void**)&alListener3i, "alListener3i");
362     lib.bindSymbol(cast(void**)&alListeneriv, "alListeneriv");
363     lib.bindSymbol(cast(void**)&alGetListenerf, "alGetListenerf");
364     lib.bindSymbol(cast(void**)&alGetListener3f, "alGetListener3f");
365     lib.bindSymbol(cast(void**)&alGetListenerfv, "alGetListenerfv");
366     lib.bindSymbol(cast(void**)&alGetListeneri, "alGetListeneri");
367     lib.bindSymbol(cast(void**)&alGetListener3i, "alGetListener3i");
368     lib.bindSymbol(cast(void**)&alGetListeneriv, "alGetListeneriv");
369     lib.bindSymbol(cast(void**)&alGenSources, "alGenSources");
370     lib.bindSymbol(cast(void**)&alDeleteSources, "alDeleteSources");
371     lib.bindSymbol(cast(void**)&alIsSource, "alIsSource");
372     lib.bindSymbol(cast(void**)&alSourcef, "alSourcef");
373     lib.bindSymbol(cast(void**)&alSource3f, "alSource3f");
374     lib.bindSymbol(cast(void**)&alSourcefv, "alSourcefv");
375     lib.bindSymbol(cast(void**)&alSourcei, "alSourcei");
376     lib.bindSymbol(cast(void**)&alSource3i, "alSource3i");
377     lib.bindSymbol(cast(void**)&alSourceiv, "alSourceiv");
378     lib.bindSymbol(cast(void**)&alGetSourcef, "alGetSourcef");
379     lib.bindSymbol(cast(void**)&alGetSource3f, "alGetSource3f");
380     lib.bindSymbol(cast(void**)&alGetSourcefv, "alGetSourcefv");
381     lib.bindSymbol(cast(void**)&alGetSourcei, "alGetSourcei");
382     lib.bindSymbol(cast(void**)&alGetSource3i, "alGetSource3i");
383     lib.bindSymbol(cast(void**)&alGetSourceiv, "alGetSourceiv");
384     lib.bindSymbol(cast(void**)&alSourcePlayv, "alSourcePlayv");
385     lib.bindSymbol(cast(void**)&alSourceStopv, "alSourceStopv");
386     lib.bindSymbol(cast(void**)&alSourceRewindv, "alSourceRewindv");
387     lib.bindSymbol(cast(void**)&alSourcePausev, "alSourcePausev");
388     lib.bindSymbol(cast(void**)&alSourcePlay, "alSourcePlay");
389     lib.bindSymbol(cast(void**)&alSourcePause, "alSourcePause");
390     lib.bindSymbol(cast(void**)&alSourceRewind, "alSourceRewind");
391     lib.bindSymbol(cast(void**)&alSourceStop, "alSourceStop");
392     lib.bindSymbol(cast(void**)&alSourceQueueBuffers, "alSourceQueueBuffers");
393     lib.bindSymbol(cast(void**)&alSourceUnqueueBuffers, "alSourceUnqueueBuffers");
394     lib.bindSymbol(cast(void**)&alGenBuffers, "alGenBuffers");
395     lib.bindSymbol(cast(void**)&alDeleteBuffers, "alDeleteBuffers");
396     lib.bindSymbol(cast(void**)&alIsBuffer, "alIsBuffer");
397     lib.bindSymbol(cast(void**)&alBufferData, "alBufferData");
398     lib.bindSymbol(cast(void**)&alBufferf, "alBufferf");
399     lib.bindSymbol(cast(void**)&alBuffer3f, "alBuffer3f");
400     lib.bindSymbol(cast(void**)&alBufferfv, "alBufferfv");
401     lib.bindSymbol(cast(void**)&alBufferi, "alBufferi");
402     lib.bindSymbol(cast(void**)&alBuffer3i, "alBuffer3i");
403     lib.bindSymbol(cast(void**)&alBufferiv, "alBufferiv");
404     lib.bindSymbol(cast(void**)&alGetBufferf, "alGetBufferf");
405     lib.bindSymbol(cast(void**)&alGetBuffer3f, "alGetBuffer3f");
406     lib.bindSymbol(cast(void**)&alGetBufferfv, "alGetBufferfv");
407     lib.bindSymbol(cast(void**)&alGetBufferi, "alGetBufferi");
408     lib.bindSymbol(cast(void**)&alGetBuffer3i, "alGetBuffer3i");
409     lib.bindSymbol(cast(void**)&alGetBufferiv, "alGetBufferiv");
410     lib.bindSymbol(cast(void**)&alDopplerFactor, "alDopplerFactor");
411     lib.bindSymbol(cast(void**)&alDopplerVelocity, "alDopplerVelocity");
412     lib.bindSymbol(cast(void**)&alSpeedOfSound, "alSpeedOfSound");
413     lib.bindSymbol(cast(void**)&alDistanceModel, "alDistanceModel");
414     lib.bindSymbol(cast(void**)&alcCreateContext, "alcCreateContext");
415     lib.bindSymbol(cast(void**)&alcMakeContextCurrent, "alcMakeContextCurrent");
416     lib.bindSymbol(cast(void**)&alcProcessContext, "alcProcessContext");
417     lib.bindSymbol(cast(void**)&alcGetCurrentContext, "alcGetCurrentContext");
418     lib.bindSymbol(cast(void**)&alcGetContextsDevice, "alcGetContextsDevice");
419     lib.bindSymbol(cast(void**)&alcSuspendContext, "alcSuspendContext");
420     lib.bindSymbol(cast(void**)&alcDestroyContext, "alcDestroyContext");
421     lib.bindSymbol(cast(void**)&alcOpenDevice, "alcOpenDevice");
422     lib.bindSymbol(cast(void**)&alcCloseDevice, "alcCloseDevice");
423     lib.bindSymbol(cast(void**)&alcGetError, "alcGetError");
424     lib.bindSymbol(cast(void**)&alcIsExtensionPresent, "alcIsExtensionPresent");
425     lib.bindSymbol(cast(void**)&alcGetProcAddress, "alcGetProcAddress");
426     lib.bindSymbol(cast(void**)&alcGetEnumValue, "alcGetEnumValue");
427     lib.bindSymbol(cast(void**)&alcGetString, "alcGetString");
428     lib.bindSymbol(cast(void**)&alcGetIntegerv, "alcGetIntegerv");
429     lib.bindSymbol(cast(void**)&alcCaptureOpenDevice, "alcCaptureOpenDevice");
430     lib.bindSymbol(cast(void**)&alcCaptureCloseDevice, "alcCaptureCloseDevice");
431     lib.bindSymbol(cast(void**)&alcCaptureStart, "alcCaptureStart");
432     lib.bindSymbol(cast(void**)&alcCaptureStop, "alcCaptureStop");
433     lib.bindSymbol(cast(void**)&alcCaptureSamples, "alcCaptureSamples");
434 
435     version(AL_EFX) {
436         //EFX Extension
437         lib.bindSymbol(cast(void**)&alGenEffects, "alGenEffects");
438         lib.bindSymbol(cast(void**)&alDeleteEffects, "alDeleteEffects");
439         lib.bindSymbol(cast(void**)&alIsEffect, "alIsEffect");
440         lib.bindSymbol(cast(void**)&alEffecti, "alEffecti");
441         lib.bindSymbol(cast(void**)&alEffectiv, "alEffectiv");
442         lib.bindSymbol(cast(void**)&alEffectf, "alEffectf");
443         lib.bindSymbol(cast(void**)&alEffectfv, "alEffectfv");
444         lib.bindSymbol(cast(void**)&alGetEffecti, "alGetEffecti");
445         lib.bindSymbol(cast(void**)&alGetEffectiv, "alGetEffectiv");
446         lib.bindSymbol(cast(void**)&alGetEffectf, "alGetEffectf");
447         lib.bindSymbol(cast(void**)&alGetEffectfv, "alGetEffectfv");
448         lib.bindSymbol(cast(void**)&alGenFilters, "alGenFilters");
449         lib.bindSymbol(cast(void**)&alDeleteFilters, "alDeleteFilters");
450         lib.bindSymbol(cast(void**)&alIsFilter, "alIsFilter");
451         lib.bindSymbol(cast(void**)&alFilteri, "alFilteri");
452         lib.bindSymbol(cast(void**)&alFilteriv, "alFilteriv");
453         lib.bindSymbol(cast(void**)&alFilterf, "alFilterf");
454         lib.bindSymbol(cast(void**)&alFilterfv, "alFilterfv");
455         lib.bindSymbol(cast(void**)&alGetFilteri, "alGetFilteri");
456         lib.bindSymbol(cast(void**)&alGetFilteriv, "alGetFilteriv");
457         lib.bindSymbol(cast(void**)&alGetFilterf, "alGetFilterf");
458         lib.bindSymbol(cast(void**)&alGetFilterfv, "alGetFilterfv");
459         lib.bindSymbol(cast(void**)&alGenAuxiliaryEffectSlots, "alGenAuxiliaryEffectSlots");
460         lib.bindSymbol(cast(void**)&alDeleteAuxiliaryEffectSlots, "alDeleteAuxiliaryEffectSlots");
461         lib.bindSymbol(cast(void**)&alIsAuxiliaryEffectSlot, "alIsAuxiliaryEffectSlot");
462         lib.bindSymbol(cast(void**)&alAuxiliaryEffectSloti, "alAuxiliaryEffectSloti");
463         lib.bindSymbol(cast(void**)&alAuxiliaryEffectSlotiv, "alAuxiliaryEffectSlotiv");
464         lib.bindSymbol(cast(void**)&alAuxiliaryEffectSlotf, "alAuxiliaryEffectSlotf");
465         lib.bindSymbol(cast(void**)&alAuxiliaryEffectSlotfv, "alAuxiliaryEffectSlotfv");
466         lib.bindSymbol(cast(void**)&alGetAuxiliaryEffectSloti, "alGetAuxiliaryEffectSloti");
467         lib.bindSymbol(cast(void**)&alGetAuxiliaryEffectSlotiv, "alGetAuxiliaryEffectSlotiv");
468         lib.bindSymbol(cast(void**)&alGetAuxiliaryEffectSlotf, "alGetAuxiliaryEffectSlotf");
469         lib.bindSymbol(cast(void**)&alGetAuxiliaryEffectSlotfv, "alGetAuxiliaryEffectSlotfv");
470     }
471 
472     if(errorCount() != errCount) loadedVersion = ALSupport.badLibrary;
473     else loadedVersion = ALSupport.al11;
474 
475     return loadedVersion;
476 }