LoadOAL.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * Copyright (c) 2006, Creative Labs Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification, are permitted provided
  6. * that the following conditions are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright notice, this list of conditions and
  9. * the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
  11. * and the following disclaimer in the documentation and/or other materials provided with the distribution.
  12. * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or
  13. * promote products derived from this software without specific prior written permission.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  17. * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  19. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  21. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  22. * POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #include <windows.h>
  25. #include "sfx/openal/LoadOAL.h"
  26. HINSTANCE g_hOpenALDLL = NULL;
  27. ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable)
  28. {
  29. if (!lpOALFnTable)
  30. return AL_FALSE;
  31. if (szOALFullPathName)
  32. g_hOpenALDLL = LoadLibraryA(szOALFullPathName);
  33. else
  34. {
  35. #ifdef TORQUE_DEBUG
  36. g_hOpenALDLL = LoadLibraryA("openal32d.dll");
  37. #else
  38. g_hOpenALDLL = LoadLibraryA("openal32.dll");
  39. #endif
  40. }
  41. if (!g_hOpenALDLL)
  42. return AL_FALSE;
  43. memset(lpOALFnTable, 0, sizeof(OPENALFNTABLE));
  44. // Get function pointers
  45. lpOALFnTable->alEnable = (LPALENABLE)GetProcAddress(g_hOpenALDLL, "alEnable");
  46. if (lpOALFnTable->alEnable == NULL)
  47. {
  48. OutputDebugStringA("Failed to retrieve 'alEnable' function address\n");
  49. return AL_FALSE;
  50. }
  51. lpOALFnTable->alDisable = (LPALDISABLE)GetProcAddress(g_hOpenALDLL, "alDisable");
  52. if (lpOALFnTable->alDisable == NULL)
  53. {
  54. OutputDebugStringA("Failed to retrieve 'alDisable' function address\n");
  55. return AL_FALSE;
  56. }
  57. lpOALFnTable->alIsEnabled = (LPALISENABLED)GetProcAddress(g_hOpenALDLL, "alIsEnabled");
  58. if (lpOALFnTable->alIsEnabled == NULL)
  59. {
  60. OutputDebugStringA("Failed to retrieve 'alIsEnabled' function address\n");
  61. return AL_FALSE;
  62. }
  63. lpOALFnTable->alGetBoolean = (LPALGETBOOLEAN)GetProcAddress(g_hOpenALDLL, "alGetBoolean");
  64. if (lpOALFnTable->alGetBoolean == NULL)
  65. {
  66. OutputDebugStringA("Failed to retrieve 'alGetBoolean' function address\n");
  67. return AL_FALSE;
  68. }
  69. lpOALFnTable->alGetInteger = (LPALGETINTEGER)GetProcAddress(g_hOpenALDLL, "alGetInteger");
  70. if (lpOALFnTable->alGetInteger == NULL)
  71. {
  72. OutputDebugStringA("Failed to retrieve 'alGetInteger' function address\n");
  73. return AL_FALSE;
  74. }
  75. lpOALFnTable->alGetFloat = (LPALGETFLOAT)GetProcAddress(g_hOpenALDLL, "alGetFloat");
  76. if (lpOALFnTable->alGetFloat == NULL)
  77. {
  78. OutputDebugStringA("Failed to retrieve 'alGetFloat' function address\n");
  79. return AL_FALSE;
  80. }
  81. lpOALFnTable->alGetDouble = (LPALGETDOUBLE)GetProcAddress(g_hOpenALDLL, "alGetDouble");
  82. if (lpOALFnTable->alGetDouble == NULL)
  83. {
  84. OutputDebugStringA("Failed to retrieve 'alGetDouble' function address\n");
  85. return AL_FALSE;
  86. }
  87. lpOALFnTable->alGetBooleanv = (LPALGETBOOLEANV)GetProcAddress(g_hOpenALDLL, "alGetBooleanv");
  88. if (lpOALFnTable->alGetBooleanv == NULL)
  89. {
  90. OutputDebugStringA("Failed to retrieve 'alGetBooleanv' function address\n");
  91. return AL_FALSE;
  92. }
  93. lpOALFnTable->alGetIntegerv = (LPALGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alGetIntegerv");
  94. if (lpOALFnTable->alGetIntegerv == NULL)
  95. {
  96. OutputDebugStringA("Failed to retrieve 'alGetIntegerv' function address\n");
  97. return AL_FALSE;
  98. }
  99. lpOALFnTable->alGetFloatv = (LPALGETFLOATV)GetProcAddress(g_hOpenALDLL, "alGetFloatv");
  100. if (lpOALFnTable->alGetFloatv == NULL)
  101. {
  102. OutputDebugStringA("Failed to retrieve 'alGetFloatv' function address\n");
  103. return AL_FALSE;
  104. }
  105. lpOALFnTable->alGetDoublev = (LPALGETDOUBLEV)GetProcAddress(g_hOpenALDLL, "alGetDoublev");
  106. if (lpOALFnTable->alGetDoublev == NULL)
  107. {
  108. OutputDebugStringA("Failed to retrieve 'alGetDoublev' function address\n");
  109. return AL_FALSE;
  110. }
  111. lpOALFnTable->alGetString = (LPALGETSTRING)GetProcAddress(g_hOpenALDLL, "alGetString");
  112. if (lpOALFnTable->alGetString == NULL)
  113. {
  114. OutputDebugStringA("Failed to retrieve 'alGetString' function address\n");
  115. return AL_FALSE;
  116. }
  117. lpOALFnTable->alGetError = (LPALGETERROR)GetProcAddress(g_hOpenALDLL, "alGetError");
  118. if (lpOALFnTable->alGetError == NULL)
  119. {
  120. OutputDebugStringA("Failed to retrieve 'alGetError' function address\n");
  121. return AL_FALSE;
  122. }
  123. lpOALFnTable->alIsExtensionPresent = (LPALISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alIsExtensionPresent");
  124. if (lpOALFnTable->alIsExtensionPresent == NULL)
  125. {
  126. OutputDebugStringA("Failed to retrieve 'alIsExtensionPresent' function address\n");
  127. return AL_FALSE;
  128. }
  129. lpOALFnTable->alGetProcAddress = (LPALGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alGetProcAddress");
  130. if (lpOALFnTable->alGetProcAddress == NULL)
  131. {
  132. OutputDebugStringA("Failed to retrieve 'alGetProcAddress' function address\n");
  133. return AL_FALSE;
  134. }
  135. lpOALFnTable->alGetEnumValue = (LPALGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alGetEnumValue");
  136. if (lpOALFnTable->alGetEnumValue == NULL)
  137. {
  138. OutputDebugStringA("Failed to retrieve 'alGetEnumValue' function address\n");
  139. return AL_FALSE;
  140. }
  141. lpOALFnTable->alListeneri = (LPALLISTENERI)GetProcAddress(g_hOpenALDLL, "alListeneri");
  142. if (lpOALFnTable->alListeneri == NULL)
  143. {
  144. OutputDebugStringA("Failed to retrieve 'alListeneri' function address\n");
  145. return AL_FALSE;
  146. }
  147. lpOALFnTable->alListenerf = (LPALLISTENERF)GetProcAddress(g_hOpenALDLL, "alListenerf");
  148. if (lpOALFnTable->alListenerf == NULL)
  149. {
  150. OutputDebugStringA("Failed to retrieve 'alListenerf' function address\n");
  151. return AL_FALSE;
  152. }
  153. lpOALFnTable->alListener3f = (LPALLISTENER3F)GetProcAddress(g_hOpenALDLL, "alListener3f");
  154. if (lpOALFnTable->alListener3f == NULL)
  155. {
  156. OutputDebugStringA("Failed to retrieve 'alListener3f' function address\n");
  157. return AL_FALSE;
  158. }
  159. lpOALFnTable->alListenerfv = (LPALLISTENERFV)GetProcAddress(g_hOpenALDLL, "alListenerfv");
  160. if (lpOALFnTable->alListenerfv == NULL)
  161. {
  162. OutputDebugStringA("Failed to retrieve 'alListenerfv' function address\n");
  163. return AL_FALSE;
  164. }
  165. lpOALFnTable->alGetListeneri = (LPALGETLISTENERI)GetProcAddress(g_hOpenALDLL, "alGetListeneri");
  166. if (lpOALFnTable->alGetListeneri == NULL)
  167. {
  168. OutputDebugStringA("Failed to retrieve 'alGetListeneri' function address\n");
  169. return AL_FALSE;
  170. }
  171. lpOALFnTable->alGetListenerf =(LPALGETLISTENERF)GetProcAddress(g_hOpenALDLL, "alGetListenerf");
  172. if (lpOALFnTable->alGetListenerf == NULL)
  173. {
  174. OutputDebugStringA("Failed to retrieve 'alGetListenerf' function address\n");
  175. return AL_FALSE;
  176. }
  177. lpOALFnTable->alGetListener3f = (LPALGETLISTENER3F)GetProcAddress(g_hOpenALDLL, "alGetListener3f");
  178. if (lpOALFnTable->alGetListener3f == NULL)
  179. {
  180. OutputDebugStringA("Failed to retrieve 'alGetListener3f' function address\n");
  181. return AL_FALSE;
  182. }
  183. lpOALFnTable->alGetListenerfv = (LPALGETLISTENERFV)GetProcAddress(g_hOpenALDLL, "alGetListenerfv");
  184. if (lpOALFnTable->alGetListenerfv == NULL)
  185. {
  186. OutputDebugStringA("Failed to retrieve 'alGetListenerfv' function address\n");
  187. return AL_FALSE;
  188. }
  189. lpOALFnTable->alGenSources = (LPALGENSOURCES)GetProcAddress(g_hOpenALDLL, "alGenSources");
  190. if (lpOALFnTable->alGenSources == NULL)
  191. {
  192. OutputDebugStringA("Failed to retrieve 'alGenSources' function address\n");
  193. return AL_FALSE;
  194. }
  195. lpOALFnTable->alDeleteSources = (LPALDELETESOURCES)GetProcAddress(g_hOpenALDLL, "alDeleteSources");
  196. if (lpOALFnTable->alDeleteSources == NULL)
  197. {
  198. OutputDebugStringA("Failed to retrieve 'alDeleteSources' function address\n");
  199. return AL_FALSE;
  200. }
  201. lpOALFnTable->alIsSource = (LPALISSOURCE)GetProcAddress(g_hOpenALDLL, "alIsSource");
  202. if (lpOALFnTable->alIsSource == NULL)
  203. {
  204. OutputDebugStringA("Failed to retrieve 'alIsSource' function address\n");
  205. return AL_FALSE;
  206. }
  207. lpOALFnTable->alSourcei = (LPALSOURCEI)GetProcAddress(g_hOpenALDLL, "alSourcei");
  208. if (lpOALFnTable->alSourcei == NULL)
  209. {
  210. OutputDebugStringA("Failed to retrieve 'alSourcei' function address\n");
  211. return AL_FALSE;
  212. }
  213. lpOALFnTable->alSourcef = (LPALSOURCEF)GetProcAddress(g_hOpenALDLL, "alSourcef");
  214. if (lpOALFnTable->alSourcef == NULL)
  215. {
  216. OutputDebugStringA("Failed to retrieve 'alSourcef' function address\n");
  217. return AL_FALSE;
  218. }
  219. lpOALFnTable->alSource3f = (LPALSOURCE3F)GetProcAddress(g_hOpenALDLL, "alSource3f");
  220. if (lpOALFnTable->alSource3f == NULL)
  221. {
  222. OutputDebugStringA("Failed to retrieve 'alSource3f' function address\n");
  223. return AL_FALSE;
  224. }
  225. lpOALFnTable->alSourcefv = (LPALSOURCEFV)GetProcAddress(g_hOpenALDLL, "alSourcefv");
  226. if (lpOALFnTable->alSourcefv == NULL)
  227. {
  228. OutputDebugStringA("Failed to retrieve 'alSourcefv' function address\n");
  229. return AL_FALSE;
  230. }
  231. lpOALFnTable->alGetSourcei = (LPALGETSOURCEI)GetProcAddress(g_hOpenALDLL, "alGetSourcei");
  232. if (lpOALFnTable->alGetSourcei == NULL)
  233. {
  234. OutputDebugStringA("Failed to retrieve 'alGetSourcei' function address\n");
  235. return AL_FALSE;
  236. }
  237. lpOALFnTable->alGetSourcef = (LPALGETSOURCEF)GetProcAddress(g_hOpenALDLL, "alGetSourcef");
  238. if (lpOALFnTable->alGetSourcef == NULL)
  239. {
  240. OutputDebugStringA("Failed to retrieve 'alGetSourcef' function address\n");
  241. return AL_FALSE;
  242. }
  243. lpOALFnTable->alGetSourcefv = (LPALGETSOURCEFV)GetProcAddress(g_hOpenALDLL, "alGetSourcefv");
  244. if (lpOALFnTable->alGetSourcefv == NULL)
  245. {
  246. OutputDebugStringA("Failed to retrieve 'alGetSourcefv' function address\n");
  247. return AL_FALSE;
  248. }
  249. lpOALFnTable->alSourcePlayv = (LPALSOURCEPLAYV)GetProcAddress(g_hOpenALDLL, "alSourcePlayv");
  250. if (lpOALFnTable->alSourcePlayv == NULL)
  251. {
  252. OutputDebugStringA("Failed to retrieve 'alSourcePlayv' function address\n");
  253. return AL_FALSE;
  254. }
  255. lpOALFnTable->alSourceStopv = (LPALSOURCESTOPV)GetProcAddress(g_hOpenALDLL, "alSourceStopv");
  256. if (lpOALFnTable->alSourceStopv == NULL)
  257. {
  258. OutputDebugStringA("Failed to retrieve 'alSourceStopv' function address\n");
  259. return AL_FALSE;
  260. }
  261. lpOALFnTable->alSourcePlay = (LPALSOURCEPLAY)GetProcAddress(g_hOpenALDLL, "alSourcePlay");
  262. if (lpOALFnTable->alSourcePlay == NULL)
  263. {
  264. OutputDebugStringA("Failed to retrieve 'alSourcePlay' function address\n");
  265. return AL_FALSE;
  266. }
  267. lpOALFnTable->alSourcePause = (LPALSOURCEPAUSE)GetProcAddress(g_hOpenALDLL, "alSourcePause");
  268. if (lpOALFnTable->alSourcePause == NULL)
  269. {
  270. OutputDebugStringA("Failed to retrieve 'alSourcePause' function address\n");
  271. return AL_FALSE;
  272. }
  273. lpOALFnTable->alSourceStop = (LPALSOURCESTOP)GetProcAddress(g_hOpenALDLL, "alSourceStop");
  274. if (lpOALFnTable->alSourceStop == NULL)
  275. {
  276. OutputDebugStringA("Failed to retrieve 'alSourceStop' function address\n");
  277. return AL_FALSE;
  278. }
  279. lpOALFnTable->alSourceRewind = (LPALSOURCEREWIND)GetProcAddress(g_hOpenALDLL, "alSourceRewind");
  280. if (lpOALFnTable->alSourceRewind == NULL)
  281. {
  282. OutputDebugStringA("Failed to retrieve 'alSourceRewind' function address\n");
  283. return AL_FALSE;
  284. }
  285. lpOALFnTable->alGenBuffers = (LPALGENBUFFERS)GetProcAddress(g_hOpenALDLL, "alGenBuffers");
  286. if (lpOALFnTable->alGenBuffers == NULL)
  287. {
  288. OutputDebugStringA("Failed to retrieve 'alGenBuffers' function address\n");
  289. return AL_FALSE;
  290. }
  291. lpOALFnTable->alDeleteBuffers = (LPALDELETEBUFFERS)GetProcAddress(g_hOpenALDLL, "alDeleteBuffers");
  292. if (lpOALFnTable->alDeleteBuffers == NULL)
  293. {
  294. OutputDebugStringA("Failed to retrieve 'alDeleteBuffers' function address\n");
  295. return AL_FALSE;
  296. }
  297. lpOALFnTable->alIsBuffer = (LPALISBUFFER)GetProcAddress(g_hOpenALDLL, "alIsBuffer");
  298. if (lpOALFnTable->alIsBuffer == NULL)
  299. {
  300. OutputDebugStringA("Failed to retrieve 'alIsBuffer' function address\n");
  301. return AL_FALSE;
  302. }
  303. lpOALFnTable->alBufferData = (LPALBUFFERDATA)GetProcAddress(g_hOpenALDLL, "alBufferData");
  304. if (lpOALFnTable->alBufferData == NULL)
  305. {
  306. OutputDebugStringA("Failed to retrieve 'alBufferData' function address\n");
  307. return AL_FALSE;
  308. }
  309. lpOALFnTable->alGetBufferi = (LPALGETBUFFERI)GetProcAddress(g_hOpenALDLL, "alGetBufferi");
  310. if (lpOALFnTable->alGetBufferi == NULL)
  311. {
  312. OutputDebugStringA("Failed to retrieve 'alGetBufferi' function address\n");
  313. return AL_FALSE;
  314. }
  315. lpOALFnTable->alGetBufferf = (LPALGETBUFFERF)GetProcAddress(g_hOpenALDLL, "alGetBufferf");
  316. if (lpOALFnTable->alGetBufferf == NULL)
  317. {
  318. OutputDebugStringA("Failed to retrieve 'alGetBufferf' function address\n");
  319. return AL_FALSE;
  320. }
  321. lpOALFnTable->alSourceQueueBuffers = (LPALSOURCEQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceQueueBuffers");
  322. if (lpOALFnTable->alSourceQueueBuffers == NULL)
  323. {
  324. OutputDebugStringA("Failed to retrieve 'alSourceQueueBuffers' function address\n");
  325. return AL_FALSE;
  326. }
  327. lpOALFnTable->alSourceUnqueueBuffers = (LPALSOURCEUNQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceUnqueueBuffers");
  328. if (lpOALFnTable->alSourceUnqueueBuffers == NULL)
  329. {
  330. OutputDebugStringA("Failed to retrieve 'alSourceUnqueueBuffers' function address\n");
  331. return AL_FALSE;
  332. }
  333. lpOALFnTable->alDistanceModel = (LPALDISTANCEMODEL)GetProcAddress(g_hOpenALDLL, "alDistanceModel");
  334. if (lpOALFnTable->alDistanceModel == NULL)
  335. {
  336. OutputDebugStringA("Failed to retrieve 'alDistanceModel' function address\n");
  337. return AL_FALSE;
  338. }
  339. lpOALFnTable->alDopplerFactor = (LPALDOPPLERFACTOR)GetProcAddress(g_hOpenALDLL, "alDopplerFactor");
  340. if (lpOALFnTable->alDopplerFactor == NULL)
  341. {
  342. OutputDebugStringA("Failed to retrieve 'alDopplerFactor' function address\n");
  343. return AL_FALSE;
  344. }
  345. lpOALFnTable->alDopplerVelocity = (LPALDOPPLERVELOCITY)GetProcAddress(g_hOpenALDLL, "alDopplerVelocity");
  346. if (lpOALFnTable->alDopplerVelocity == NULL)
  347. {
  348. OutputDebugStringA("Failed to retrieve 'alDopplerVelocity' function address\n");
  349. return AL_FALSE;
  350. }
  351. lpOALFnTable->alcGetString = (LPALCGETSTRING)GetProcAddress(g_hOpenALDLL, "alcGetString");
  352. if (lpOALFnTable->alcGetString == NULL)
  353. {
  354. OutputDebugStringA("Failed to retrieve 'alcGetString' function address\n");
  355. return AL_FALSE;
  356. }
  357. lpOALFnTable->alcGetIntegerv = (LPALCGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alcGetIntegerv");
  358. if (lpOALFnTable->alcGetIntegerv == NULL)
  359. {
  360. OutputDebugStringA("Failed to retrieve 'alcGetIntegerv' function address\n");
  361. return AL_FALSE;
  362. }
  363. lpOALFnTable->alcOpenDevice = (LPALCOPENDEVICE)GetProcAddress(g_hOpenALDLL, "alcOpenDevice");
  364. if (lpOALFnTable->alcOpenDevice == NULL)
  365. {
  366. OutputDebugStringA("Failed to retrieve 'alcOpenDevice' function address\n");
  367. return AL_FALSE;
  368. }
  369. lpOALFnTable->alcCloseDevice = (LPALCCLOSEDEVICE)GetProcAddress(g_hOpenALDLL, "alcCloseDevice");
  370. if (lpOALFnTable->alcCloseDevice == NULL)
  371. {
  372. OutputDebugStringA("Failed to retrieve 'alcCloseDevice' function address\n");
  373. return AL_FALSE;
  374. }
  375. lpOALFnTable->alcCreateContext = (LPALCCREATECONTEXT)GetProcAddress(g_hOpenALDLL, "alcCreateContext");
  376. if (lpOALFnTable->alcCreateContext == NULL)
  377. {
  378. OutputDebugStringA("Failed to retrieve 'alcCreateContext' function address\n");
  379. return AL_FALSE;
  380. }
  381. lpOALFnTable->alcMakeContextCurrent = (LPALCMAKECONTEXTCURRENT)GetProcAddress(g_hOpenALDLL, "alcMakeContextCurrent");
  382. if (lpOALFnTable->alcMakeContextCurrent == NULL)
  383. {
  384. OutputDebugStringA("Failed to retrieve 'alcMakeContextCurrent' function address\n");
  385. return AL_FALSE;
  386. }
  387. lpOALFnTable->alcProcessContext = (LPALCPROCESSCONTEXT)GetProcAddress(g_hOpenALDLL, "alcProcessContext");
  388. if (lpOALFnTable->alcProcessContext == NULL)
  389. {
  390. OutputDebugStringA("Failed to retrieve 'alcProcessContext' function address\n");
  391. return AL_FALSE;
  392. }
  393. lpOALFnTable->alcGetCurrentContext = (LPALCGETCURRENTCONTEXT)GetProcAddress(g_hOpenALDLL, "alcGetCurrentContext");
  394. if (lpOALFnTable->alcGetCurrentContext == NULL)
  395. {
  396. OutputDebugStringA("Failed to retrieve 'alcGetCurrentContext' function address\n");
  397. return AL_FALSE;
  398. }
  399. lpOALFnTable->alcGetContextsDevice = (LPALCGETCONTEXTSDEVICE)GetProcAddress(g_hOpenALDLL, "alcGetContextsDevice");
  400. if (lpOALFnTable->alcGetContextsDevice == NULL)
  401. {
  402. OutputDebugStringA("Failed to retrieve 'alcGetContextsDevice' function address\n");
  403. return AL_FALSE;
  404. }
  405. lpOALFnTable->alcSuspendContext = (LPALCSUSPENDCONTEXT)GetProcAddress(g_hOpenALDLL, "alcSuspendContext");
  406. if (lpOALFnTable->alcSuspendContext == NULL)
  407. {
  408. OutputDebugStringA("Failed to retrieve 'alcSuspendContext' function address\n");
  409. return AL_FALSE;
  410. }
  411. lpOALFnTable->alcDestroyContext = (LPALCDESTROYCONTEXT)GetProcAddress(g_hOpenALDLL, "alcDestroyContext");
  412. if (lpOALFnTable->alcDestroyContext == NULL)
  413. {
  414. OutputDebugStringA("Failed to retrieve 'alcDestroyContext' function address\n");
  415. return AL_FALSE;
  416. }
  417. lpOALFnTable->alcGetError = (LPALCGETERROR)GetProcAddress(g_hOpenALDLL, "alcGetError");
  418. if (lpOALFnTable->alcGetError == NULL)
  419. {
  420. OutputDebugStringA("Failed to retrieve 'alcGetError' function address\n");
  421. return AL_FALSE;
  422. }
  423. lpOALFnTable->alcIsExtensionPresent = (LPALCISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alcIsExtensionPresent");
  424. if (lpOALFnTable->alcIsExtensionPresent == NULL)
  425. {
  426. OutputDebugStringA("Failed to retrieve 'alcIsExtensionPresent' function address\n");
  427. return AL_FALSE;
  428. }
  429. lpOALFnTable->alcGetProcAddress = (LPALCGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alcGetProcAddress");
  430. if (lpOALFnTable->alcGetProcAddress == NULL)
  431. {
  432. OutputDebugStringA("Failed to retrieve 'alcGetProcAddress' function address\n");
  433. return AL_FALSE;
  434. }
  435. lpOALFnTable->alcGetEnumValue = (LPALCGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alcGetEnumValue");
  436. if (lpOALFnTable->alcGetEnumValue == NULL)
  437. {
  438. OutputDebugStringA("Failed to retrieve 'alcGetEnumValue' function address\n");
  439. return AL_FALSE;
  440. }
  441. #if defined(AL_ALEXT_PROTOTYPES)
  442. lpOALFnTable->alGenEffects = (LPALGENEFFECTS)GetProcAddress(g_hOpenALDLL, "alGenEffects");
  443. if (lpOALFnTable->alGenEffects == NULL)
  444. {
  445. OutputDebugStringA("Failed to retrieve 'alGenEffects' function address\n");
  446. }
  447. lpOALFnTable->alEffecti = (LPALEFFECTI)GetProcAddress(g_hOpenALDLL, "alEffecti");
  448. if (lpOALFnTable->alEffecti == NULL)
  449. {
  450. OutputDebugStringA("Failed to retrieve 'alEffecti' function address\n");
  451. }
  452. lpOALFnTable->alEffectiv = (LPALEFFECTIV)GetProcAddress(g_hOpenALDLL, "alEffectiv");
  453. if (lpOALFnTable->alEffectiv == NULL)
  454. {
  455. OutputDebugStringA("Failed to retrieve 'alEffectiv' function address\n");
  456. }
  457. lpOALFnTable->alEffectf = (LPALEFFECTF)GetProcAddress(g_hOpenALDLL, "alEffectf");
  458. if (lpOALFnTable->alEffectf == NULL)
  459. {
  460. OutputDebugStringA("Failed to retrieve 'alEffectf' function address\n");
  461. }
  462. lpOALFnTable->alEffectfv = (LPALEFFECTFV)GetProcAddress(g_hOpenALDLL, "alEffectfv");
  463. if (lpOALFnTable->alEffectfv == NULL)
  464. {
  465. OutputDebugStringA("Failed to retrieve 'alEffectfv' function address\n");
  466. }
  467. lpOALFnTable->alGetEffecti = (LPALGETEFFECTI)GetProcAddress(g_hOpenALDLL, "alGetEffecti");
  468. if (lpOALFnTable->alGetEffecti == NULL)
  469. {
  470. OutputDebugStringA("Failed to retrieve 'alGetEffecti' function address\n");
  471. }
  472. lpOALFnTable->alGetEffectiv = (LPALGETEFFECTIV)GetProcAddress(g_hOpenALDLL, "alGetEffectiv");
  473. if (lpOALFnTable->alGetEffectiv == NULL)
  474. {
  475. OutputDebugStringA("Failed to retrieve 'alGetEffectiv' function address\n");
  476. }
  477. lpOALFnTable->alGetEffectf = (LPALGETEFFECTF)GetProcAddress(g_hOpenALDLL, "alGetEffectf");
  478. if (lpOALFnTable->alGetEffectf == NULL)
  479. {
  480. OutputDebugStringA("Failed to retrieve 'alGetEffectf' function address\n");
  481. }
  482. lpOALFnTable->alGetEffectfv = (LPALGETEFFECTFV)GetProcAddress(g_hOpenALDLL, "alGetEffectfv");
  483. if (lpOALFnTable->alGetEffectfv == NULL)
  484. {
  485. OutputDebugStringA("Failed to retrieve 'alGetEffectfv' function address\n");
  486. }
  487. lpOALFnTable->alDeleteEffects = (LPALDELETEEFFECTS)GetProcAddress(g_hOpenALDLL, "alDeleteEffects");
  488. if (lpOALFnTable->alDeleteEffects == NULL)
  489. {
  490. OutputDebugStringA("Failed to retrieve 'alDeleteEffects' function address\n");
  491. }
  492. lpOALFnTable->alIsEffect = (LPALISEFFECT)GetProcAddress(g_hOpenALDLL, "alIsEffect");
  493. if (lpOALFnTable->alIsEffect == NULL)
  494. {
  495. OutputDebugStringA("Failed to retrieve 'alIsEffect' function address\n");
  496. }
  497. lpOALFnTable->alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)GetProcAddress(g_hOpenALDLL, "alAuxiliaryEffectSlotf");
  498. if (lpOALFnTable->alAuxiliaryEffectSlotf == NULL)
  499. {
  500. OutputDebugStringA("Failed to retrieve 'alAuxiliaryEffectSlotf' function address\n");
  501. }
  502. lpOALFnTable->alAuxiliaryEffectSlotfv = (LPALAUXILIARYEFFECTSLOTFV)GetProcAddress(g_hOpenALDLL, "alAuxiliaryEffectSlotfv");
  503. if (lpOALFnTable->alAuxiliaryEffectSlotfv == NULL)
  504. {
  505. OutputDebugStringA("Failed to retrieve 'alAuxiliaryEffectSlotfv' function address\n");
  506. }
  507. lpOALFnTable->alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)GetProcAddress(g_hOpenALDLL, "alAuxiliaryEffectSloti");
  508. if (lpOALFnTable->alAuxiliaryEffectSloti == NULL)
  509. {
  510. OutputDebugStringA("Failed to retrieve 'alAuxiliaryEffectSloti' function address\n");
  511. }
  512. lpOALFnTable->alAuxiliaryEffectSlotiv = (LPALAUXILIARYEFFECTSLOTIV)GetProcAddress(g_hOpenALDLL, "alAuxiliaryEffectSlotiv");
  513. if (lpOALFnTable->alAuxiliaryEffectSlotiv == NULL)
  514. {
  515. OutputDebugStringA("Failed to retrieve 'alAuxiliaryEffectSlotiv' function address\n");
  516. }
  517. lpOALFnTable->alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)GetProcAddress(g_hOpenALDLL, "alIsAuxiliaryEffectSlot");
  518. if (lpOALFnTable->alIsAuxiliaryEffectSlot == NULL)
  519. {
  520. OutputDebugStringA("Failed to retrieve 'alIsAuxiliaryEffectSlot' function address\n");
  521. }
  522. lpOALFnTable->alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)GetProcAddress(g_hOpenALDLL, "alGenAuxiliaryEffectSlots");
  523. if (lpOALFnTable->alGenAuxiliaryEffectSlots == NULL)
  524. {
  525. OutputDebugStringA("Failed to retrieve 'alGenAuxiliaryEffectSlots' function address\n");
  526. }
  527. lpOALFnTable->alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)GetProcAddress(g_hOpenALDLL, "alDeleteAuxiliaryEffectSlots");
  528. if (lpOALFnTable->alDeleteAuxiliaryEffectSlots == NULL)
  529. {
  530. OutputDebugStringA("Failed to retrieve 'alDeleteAuxiliaryEffectSlots' function address\n");
  531. }
  532. lpOALFnTable->alGetAuxiliaryEffectSlotf = (LPALGETAUXILIARYEFFECTSLOTF)GetProcAddress(g_hOpenALDLL, "alGetAuxiliaryEffectSlotf");
  533. if (lpOALFnTable->alGetAuxiliaryEffectSlotf == NULL)
  534. {
  535. OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotf' function address\n");
  536. }
  537. lpOALFnTable->alGetAuxiliaryEffectSlotfv = (LPALGETAUXILIARYEFFECTSLOTFV)GetProcAddress(g_hOpenALDLL, "alGetAuxiliaryEffectSlotfv");
  538. if (lpOALFnTable->alGetAuxiliaryEffectSlotfv == NULL)
  539. {
  540. OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotfv' function address\n");
  541. }
  542. lpOALFnTable->alGetAuxiliaryEffectSloti = (LPALGETAUXILIARYEFFECTSLOTI)GetProcAddress(g_hOpenALDLL, "alGetAuxiliaryEffectSloti");
  543. if (lpOALFnTable->alGetAuxiliaryEffectSloti == NULL)
  544. {
  545. OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSloti' function address\n");
  546. }
  547. lpOALFnTable->alGetAuxiliaryEffectSlotiv = (LPALGETAUXILIARYEFFECTSLOTIV)GetProcAddress(g_hOpenALDLL, "alGetAuxiliaryEffectSlotiv");
  548. if (lpOALFnTable->alGetAuxiliaryEffectSlotiv == NULL)
  549. {
  550. OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotiv' function address\n");
  551. }
  552. lpOALFnTable->alSource3i = (LPALSOURCE3I)GetProcAddress(g_hOpenALDLL, "alSource3i");
  553. lpOALFnTable->alGenFilters = (LPALGENFILTERS)GetProcAddress(g_hOpenALDLL, "alGenFilters");
  554. if (lpOALFnTable->alGenFilters == NULL)
  555. {
  556. OutputDebugStringA("Failed to retrieve 'alGenFilters' function address\n");
  557. return AL_FALSE;
  558. }
  559. lpOALFnTable->alDeleteFilters = (LPALDELETEFILTERS)GetProcAddress(g_hOpenALDLL, "alDeleteFilters");
  560. if (lpOALFnTable->alGenFilters == NULL)
  561. {
  562. OutputDebugStringA("Failed to retrieve 'alDeleteFilters' function address\n");
  563. return AL_FALSE;
  564. }
  565. lpOALFnTable->alFilteri = (LPALFILTERI)GetProcAddress(g_hOpenALDLL, "alFilteri");
  566. if (lpOALFnTable->alGenFilters == NULL)
  567. {
  568. OutputDebugStringA("Failed to retrieve 'alFilteri' function address\n");
  569. return AL_FALSE;
  570. }
  571. lpOALFnTable->alcGetStringiSOFT = (LPALCGETSTRINGISOFT)GetProcAddress(g_hOpenALDLL, "alcGetStringiSOFT");
  572. if (lpOALFnTable->alcGetStringiSOFT == NULL)
  573. {
  574. OutputDebugStringA("Failed to retrieve 'alcGetStringiSOFT' function address\n");
  575. return AL_FALSE;
  576. }
  577. #endif
  578. return AL_TRUE;
  579. }
  580. ALvoid UnloadOAL10Library()
  581. {
  582. // Unload the dll
  583. if (g_hOpenALDLL)
  584. {
  585. FreeLibrary(g_hOpenALDLL);
  586. g_hOpenALDLL = NULL;
  587. }
  588. }