| 40 | | typedef ALboolean function(char*) pfalIsExtensionPresent; |
|---|
| 41 | | typedef ALboolean function(char*) pfalGetProcAddress; |
|---|
| 42 | | typedef ALenum function(char*) pfalGetEnumValue; |
|---|
| 43 | | pfalIsExtensionPresent alIsExtensionPresent; |
|---|
| 44 | | pfalGetProcAddress alGetProcAddress; |
|---|
| 45 | | pfalGetEnumValue alGetEnumValue; |
|---|
| 46 | | |
|---|
| 47 | | typedef void function(ALenum, ALfloat) pfalListenerf; |
|---|
| 48 | | typedef void function(ALenum, ALint) pfalListeneri; |
|---|
| 49 | | typedef void function(ALenum, ALfloat, ALfloat, ALfloat) pfalListener3f; |
|---|
| 50 | | typedef void function(ALenum, ALfloat*) pfalListenerfv; |
|---|
| 51 | | typedef void function(ALenum, ALint*) pfalGetListeneri; |
|---|
| 52 | | typedef void function(ALenum, ALfloat*) pfalGetListenerf; |
|---|
| 53 | | //typedef void function(ALenum, ALint*) pfalGetListeneriv; |
|---|
| 54 | | typedef void function(ALenum, ALfloat*) pfalGetListenerfv; |
|---|
| 55 | | typedef void function(ALenum, ALfloat*, ALfloat*, ALfloat*) pfalGetListener3f; |
|---|
| 56 | | pfalListenerf alListenerf; |
|---|
| 57 | | pfalListeneri alListeneri; |
|---|
| 58 | | pfalListener3f alListener3f; |
|---|
| 59 | | pfalListenerfv alListenerfv; |
|---|
| 60 | | pfalGetListeneri alGetListeneri; |
|---|
| 61 | | pfalGetListenerf alGetListenerf; |
|---|
| 62 | | //pfalGetListeneriv alGetListeneriv; |
|---|
| 63 | | pfalGetListenerfv alGetListenerfv; |
|---|
| 64 | | pfalGetListener3f alGetListener3f; |
|---|
| 65 | | |
|---|
| 66 | | typedef void function(ALsizei, ALuint*) pfalGenSources; |
|---|
| 67 | | typedef void function(ALsizei, ALuint*) pfalDeleteSources; |
|---|
| 68 | | typedef void function(ALuint) pfalIsSource; |
|---|
| 69 | | typedef void function(ALuint, ALenum, ALint) pfalSourcei; |
|---|
| 70 | | typedef void function(ALuint, ALenum, ALfloat) pfalSourcef; |
|---|
| 71 | | typedef void function(ALuint, ALenum, ALfloat, ALfloat, ALfloat) pfalSource3f; |
|---|
| 72 | | typedef void function(ALuint, ALenum, ALfloat*) pfalSourcefv; |
|---|
| 73 | | typedef void function(ALuint, ALenum, ALint*) pfalGetSourcei; |
|---|
| 74 | | typedef void function(ALuint, ALenum, ALfloat*) pfalGetSourcef; |
|---|
| 75 | | //typedef void function(ALuint, ALenum, ALint*) pfalGetSourceiv; |
|---|
| 76 | | typedef void function(ALuint, ALenum, ALfloat*) pfalGetSourcefv; |
|---|
| 77 | | typedef void function(ALuint, ALenum, ALfloat*, ALfloat*, ALfloat*) pfalGetSource3f; |
|---|
| 78 | | pfalGenSources alGenSources; |
|---|
| 79 | | pfalDeleteSources alDeleteSources; |
|---|
| 80 | | pfalIsSource alIsSource; |
|---|
| 81 | | pfalSourcei alSourcei; |
|---|
| 82 | | pfalSourcef alSourcef; |
|---|
| 83 | | pfalSource3f alSource3f; |
|---|
| 84 | | pfalSourcefv alSourcefv; |
|---|
| 85 | | pfalGetSourcei alGetSourcei; |
|---|
| 86 | | pfalGetSourcef alGetSourcef; |
|---|
| 87 | | //pfalGetSourceiv alGetSourceiv; |
|---|
| 88 | | pfalGetSourcefv alGetSourcefv; |
|---|
| 89 | | pfalGetSource3f alGetSource3f; |
|---|
| 90 | | |
|---|
| 91 | | typedef void function(ALsizei, ALuint*) pfalSourcePlayv; |
|---|
| 92 | | typedef void function(ALsizei, ALuint*) pfalSourceStopv; |
|---|
| 93 | | typedef void function(ALsizei, ALuint*) pfalSourceRewindv; |
|---|
| 94 | | typedef void function(ALsizei, ALuint*) pfalSourcePausev; |
|---|
| 95 | | typedef void function(ALuint) pfalSourcePlay; |
|---|
| 96 | | typedef void function(ALuint) pfalSourcePause; |
|---|
| 97 | | typedef void function(ALuint) pfalSourceRewind; |
|---|
| 98 | | typedef void function(ALuint) pfalSourceStop; |
|---|
| 99 | | pfalSourcePlayv alSourcePlayv; |
|---|
| 100 | | pfalSourceStopv alSourceStopv; |
|---|
| 101 | | pfalSourceRewindv alSourceRewindv; |
|---|
| 102 | | pfalSourcePausev alSourcePausev; |
|---|
| 103 | | pfalSourcePlay alSourcePlay; |
|---|
| 104 | | pfalSourcePause alSourcePause; |
|---|
| 105 | | pfalSourceRewind alSourceRewind; |
|---|
| 106 | | pfalSourceStop alSourceStop; |
|---|
| 107 | | |
|---|
| 108 | | typedef void function(ALsizei, ALuint*) pfalGenBuffers; |
|---|
| 109 | | typedef void function(ALsizei, ALuint*) pfalDeleteBuffers; |
|---|
| 110 | | typedef void function(ALuint) pfalIsBuffer; |
|---|
| 111 | | typedef void function(ALuint, ALenum, ALvoid*, ALsizei, ALsizei) pfalBufferData; |
|---|
| 112 | | typedef void function(ALuint, ALenum, ALint*) pfalGetBufferi; |
|---|
| 113 | | typedef void function(ALuint, ALenum, ALfloat*) pfalGetBufferf; |
|---|
| 114 | | pfalGenBuffers alGenBuffers; |
|---|
| 115 | | pfalDeleteBuffers alDeleteBuffers; |
|---|
| 116 | | pfalIsBuffer alIsBuffer; |
|---|
| 117 | | pfalBufferData alBufferData; |
|---|
| 118 | | pfalGetBufferi alGetBufferi; |
|---|
| 119 | | pfalGetBufferf alGetBufferf; |
|---|
| 120 | | |
|---|
| 121 | | version(linux) |
|---|
| 122 | | { |
|---|
| 123 | | typedef void function(ALuint, ALenum, ALint*) pfalGetBufferiv; |
|---|
| 124 | | typedef void function(ALuint, ALenum, ALfloat*) pfalGetBufferfv; |
|---|
| 125 | | pfalGetBufferiv alGetBufferiv; |
|---|
| 126 | | pfalGetBufferfv alGetBufferfv; |
|---|
| 127 | | } |
|---|
| 128 | | |
|---|
| 129 | | typedef void function(ALuint, ALsizei, ALuint*) pfalSourceQueueBuffers; |
|---|
| 130 | | typedef void function(ALuint, ALsizei, ALuint*) pfalSourceUnqueueBuffers; |
|---|
| 131 | | pfalSourceQueueBuffers alSourceQueueBuffers; |
|---|
| 132 | | pfalSourceUnqueueBuffers alSourceUnqueueBuffers; |
|---|
| 133 | | |
|---|
| 134 | | typedef void function(ALfloat) pfalDopplerFactor; |
|---|
| 135 | | typedef void function(ALfloat) pfalDopplerVelocity; |
|---|
| 136 | | typedef void function(ALenum) pfalDistanceModel; |
|---|
| 137 | | pfalDopplerFactor alDopplerFactor; |
|---|
| 138 | | pfalDopplerVelocity alDopplerVelocity; |
|---|
| 139 | | pfalDistanceModel alDistanceModel; |
|---|
| 140 | | |
|---|
| 141 | | } |
|---|
| 142 | | |
|---|
| 143 | | //============================================================================== |
|---|
| 144 | | // Loader |
|---|
| 145 | | //============================================================================== |
|---|
| 146 | | private import derelict.util.loader; |
|---|
| 147 | | |
|---|
| 148 | | private SharedLib libAL; |
|---|
| 149 | | |
|---|
| 150 | | private void* getProc(char[] procName) |
|---|
| 151 | | { |
|---|
| 152 | | return Derelict_GetProc(libAL, procName); |
|---|
| 153 | | } |
|---|
| 154 | | |
|---|
| 155 | | private void loadAL() |
|---|
| 156 | | { |
|---|
| 157 | | // al functions |
|---|
| 158 | | alEnable = cast(pfalEnable)getProc("alEnable"); |
|---|
| 159 | | alDisable = cast(pfalDisable)getProc("alDisable"); |
|---|
| 160 | | alIsEnabled = cast(pfalIsEnabled)getProc("alIsEnabled"); |
|---|
| 161 | | // alHint = cast(pfalHint)getProc("alHint"); |
|---|
| 162 | | alGetBooleanv = cast(pfalGetBooleanv)getProc("alGetBooleanv"); |
|---|
| 163 | | alGetIntegerv = cast(pfalGetIntegerv)getProc("alGetIntegerv"); |
|---|
| 164 | | alGetFloatv = cast(pfalGetFloatv)getProc("alGetFloatv"); |
|---|
| 165 | | alGetDoublev = cast(pfalGetDoublev)getProc("alGetDoublev"); |
|---|
| 166 | | alGetString = cast(pfalGetString)getProc("alGetString"); |
|---|
| 167 | | alGetInteger = cast(pfalGetInteger)getProc("alGetInteger"); |
|---|
| 168 | | alGetFloat = cast(pfalGetFloat)getProc("alGetFloat"); |
|---|
| 169 | | alGetDouble = cast(pfalGetDouble)getProc("alGetDouble"); |
|---|
| 170 | | alGetError = cast(pfalGetError)getProc("alGetError"); |
|---|
| 171 | | alIsExtensionPresent = cast(pfalIsExtensionPresent)getProc("alIsExtensionPresent"); |
|---|
| 172 | | alGetProcAddress = cast(pfalGetProcAddress)getProc("alGetProcAddress"); |
|---|
| 173 | | alGetEnumValue = cast(pfalGetEnumValue)getProc("alGetEnumValue"); |
|---|
| 174 | | alListenerf = cast(pfalListenerf)getProc("alListenerf"); |
|---|
| 175 | | alListeneri = cast(pfalListeneri)getProc("alListeneri"); |
|---|
| 176 | | alListener3f = cast(pfalListener3f)getProc("alListener3f"); |
|---|
| 177 | | alListenerfv = cast(pfalListenerfv)getProc("alListenerfv"); |
|---|
| 178 | | alGetListeneri = cast(pfalGetListeneri)getProc("alGetListeneri"); |
|---|
| 179 | | alGetListenerf = cast(pfalGetListenerf)getProc("alGetListenerf"); |
|---|
| 180 | | // alGetListeneriv = cast(pfalGetListeneriv)getProc("alGetListeneriv"); |
|---|
| 181 | | alGetListenerfv = cast(pfalGetListenerfv)getProc("alGetListenerfv"); |
|---|
| 182 | | alGetListener3f = cast(pfalGetListener3f)getProc("alGetListener3f"); |
|---|
| 183 | | alGenSources = cast(pfalGenSources)getProc("alGenSources"); |
|---|
| 184 | | alDeleteSources = cast(pfalDeleteSources)getProc("alDeleteSources"); |
|---|
| 185 | | alIsSource = cast(pfalIsSource)getProc("alIsSource"); |
|---|
| 186 | | alSourcei = cast(pfalSourcei)getProc("alSourcei"); |
|---|
| 187 | | alSourcef = cast(pfalSourcef)getProc("alSourcef"); |
|---|
| 188 | | alSource3f = cast(pfalSource3f)getProc("alSource3f"); |
|---|
| 189 | | alSourcefv = cast(pfalSourcefv)getProc("alSourcefv"); |
|---|
| 190 | | alGetSourcei = cast(pfalGetSourcei)getProc("alGetSourcei"); |
|---|
| 191 | | alGetSourcef = cast(pfalGetSourcef)getProc("alGetSourcef"); |
|---|
| 192 | | // alGetSourceiv = cast(pfalGetSourceiv)getProc("alGetSourceiv"); |
|---|
| 193 | | alGetSourcefv = cast(pfalGetSourcefv)getProc("alGetSourcefv"); |
|---|
| 194 | | alGetSource3f = cast(pfalGetSource3f)getProc("alGetSource3f"); |
|---|
| 195 | | alSourcePlayv = cast(pfalSourcePlayv)getProc("alSourcePlayv"); |
|---|
| 196 | | alSourceStopv = cast(pfalSourceStopv)getProc("alSourceStopv"); |
|---|
| 197 | | alSourceRewindv = cast(pfalSourceRewindv)getProc("alSourceRewindv"); |
|---|
| 198 | | alSourcePausev = cast(pfalSourcePausev)getProc("alSourcePausev"); |
|---|
| 199 | | alSourcePlay = cast(pfalSourcePlay)getProc("alSourcePlay"); |
|---|
| 200 | | alSourcePause = cast(pfalSourcePause)getProc("alSourcePause"); |
|---|
| 201 | | alSourceRewind = cast(pfalSourceRewind)getProc("alSourceRewind"); |
|---|
| 202 | | alSourceStop = cast(pfalSourceStop)getProc("alSourceStop"); |
|---|
| 203 | | alGenBuffers = cast(pfalGenBuffers)getProc("alGenBuffers"); |
|---|
| 204 | | alDeleteBuffers = cast(pfalDeleteBuffers)getProc("alDeleteBuffers"); |
|---|
| 205 | | alIsBuffer = cast(pfalIsBuffer)getProc("alIsBuffer"); |
|---|
| 206 | | alBufferData = cast(pfalBufferData)getProc("alBufferData"); |
|---|
| 207 | | alGetBufferi = cast(pfalGetBufferi)getProc("alGetBufferi"); |
|---|
| 208 | | alGetBufferf = cast(pfalGetBufferf)getProc("alGetBufferf"); |
|---|
| 209 | | version(linux) |
|---|
| 210 | | { |
|---|
| 211 | | alGetBufferfv = cast(pfalGetBufferfv)getProc("pfalGetBufferfv"); |
|---|
| 212 | | alGetBufferiv = cast(pfalGetBufferiv)getProc("pfalGetBufferiv"); |
|---|
| 213 | | } |
|---|
| 214 | | alSourceQueueBuffers = cast(pfalSourceQueueBuffers)getProc("alSourceQueueBuffers"); |
|---|
| 215 | | alSourceUnqueueBuffers = cast(pfalSourceUnqueueBuffers)getProc("alSourceUnqueueBuffers"); |
|---|
| 216 | | alDopplerFactor = cast(pfalDopplerFactor)getProc("alDopplerFactor"); |
|---|
| 217 | | alDopplerVelocity = cast(pfalDopplerVelocity)getProc("alDopplerVelocity"); |
|---|
| 218 | | alDistanceModel = cast(pfalDistanceModel)getProc("alDistanceModel"); |
|---|
| 219 | | } |
|---|
| 220 | | |
|---|
| 221 | | public void DerelictAL_Load(char[] libName) |
|---|
| 222 | | { |
|---|
| 223 | | if(libAL !is null) |
|---|
| 224 | | return; |
|---|
| 225 | | |
|---|
| 226 | | libAL = Derelict_LoadSharedLib(libName); |
|---|
| 227 | | loadAL(); |
|---|
| 228 | | } |
|---|
| 229 | | |
|---|
| 230 | | public void DerelictAL_Load() |
|---|
| 231 | | { |
|---|
| 232 | | version(Windows) |
|---|
| 233 | | DerelictAL_Load("OpenAL32.dll"); |
|---|
| 234 | | version(linux) |
|---|
| 235 | | DerelictAL_Load("libal.so"); |
|---|
| 236 | | } |
|---|
| 237 | | |
|---|
| 238 | | public void DerelictAL_Unload() |
|---|
| 239 | | { |
|---|
| 240 | | Derelict_UnloadSharedLib(libAL); |
|---|
| 241 | | } |
|---|
| 242 | | |
|---|
| 243 | | version(Windows) |
|---|
| 244 | | { |
|---|
| 245 | | public void DerelictAL_LoadALU() |
|---|
| 246 | | { |
|---|
| 247 | | aluF2L = cast(pfaluF2L)getProc("aluF2L"); |
|---|
| 248 | | aluF2S = cast(pfaluF2S)getProc("aluF2S"); |
|---|
| 249 | | aluCrossproduct = cast(pfaluCrossproduct)getProc("aluCrossproduct"); |
|---|
| 250 | | aluDotproduct = cast(pfaluDotproduct)getProc("aluDotproduct"); |
|---|
| 251 | | aluNormalize = cast(pfaluNormalize)getProc("aluNormalize"); |
|---|
| 252 | | aluMatrixVector = cast(pfaluMatrixVector)getProc("aluMatrixVector"); |
|---|
| 253 | | aluCalculateSourceParameters = cast(pfaluCalculateSourceParameters)getProc("aluCalculateSourceParameters"); |
|---|
| 254 | | aluMixData = cast(pfaluMixData)getProc("aluMixData"); |
|---|
| 255 | | aluSetReverb = cast(pfaluSetReverb)getProc("aluSetReverb"); |
|---|
| 256 | | aluReverb = cast(pfaluReverb)getProc("aluReverb"); |
|---|
| 257 | | } |
|---|
| 258 | | } // version(Windows) |
|---|
| 259 | | |
|---|
| 260 | | static ~this() |
|---|
| 261 | | { |
|---|
| 262 | | DerelictAL_Unload(); |
|---|
| 263 | | } |
|---|