LoadOAL.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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. g_hOpenALDLL = LoadLibraryA("openal32.dll");
  35. if (!g_hOpenALDLL)
  36. return AL_FALSE;
  37. memset(lpOALFnTable, 0, sizeof(OPENALFNTABLE));
  38. // Get function pointers
  39. lpOALFnTable->alEnable = (LPALENABLE)GetProcAddress(g_hOpenALDLL, "alEnable");
  40. if (lpOALFnTable->alEnable == NULL)
  41. {
  42. OutputDebugStringA("Failed to retrieve 'alEnable' function address\n");
  43. return AL_FALSE;
  44. }
  45. lpOALFnTable->alDisable = (LPALDISABLE)GetProcAddress(g_hOpenALDLL, "alDisable");
  46. if (lpOALFnTable->alDisable == NULL)
  47. {
  48. OutputDebugStringA("Failed to retrieve 'alDisable' function address\n");
  49. return AL_FALSE;
  50. }
  51. lpOALFnTable->alIsEnabled = (LPALISENABLED)GetProcAddress(g_hOpenALDLL, "alIsEnabled");
  52. if (lpOALFnTable->alIsEnabled == NULL)
  53. {
  54. OutputDebugStringA("Failed to retrieve 'alIsEnabled' function address\n");
  55. return AL_FALSE;
  56. }
  57. lpOALFnTable->alGetBoolean = (LPALGETBOOLEAN)GetProcAddress(g_hOpenALDLL, "alGetBoolean");
  58. if (lpOALFnTable->alGetBoolean == NULL)
  59. {
  60. OutputDebugStringA("Failed to retrieve 'alGetBoolean' function address\n");
  61. return AL_FALSE;
  62. }
  63. lpOALFnTable->alGetInteger = (LPALGETINTEGER)GetProcAddress(g_hOpenALDLL, "alGetInteger");
  64. if (lpOALFnTable->alGetInteger == NULL)
  65. {
  66. OutputDebugStringA("Failed to retrieve 'alGetInteger' function address\n");
  67. return AL_FALSE;
  68. }
  69. lpOALFnTable->alGetFloat = (LPALGETFLOAT)GetProcAddress(g_hOpenALDLL, "alGetFloat");
  70. if (lpOALFnTable->alGetFloat == NULL)
  71. {
  72. OutputDebugStringA("Failed to retrieve 'alGetFloat' function address\n");
  73. return AL_FALSE;
  74. }
  75. lpOALFnTable->alGetDouble = (LPALGETDOUBLE)GetProcAddress(g_hOpenALDLL, "alGetDouble");
  76. if (lpOALFnTable->alGetDouble == NULL)
  77. {
  78. OutputDebugStringA("Failed to retrieve 'alGetDouble' function address\n");
  79. return AL_FALSE;
  80. }
  81. lpOALFnTable->alGetBooleanv = (LPALGETBOOLEANV)GetProcAddress(g_hOpenALDLL, "alGetBooleanv");
  82. if (lpOALFnTable->alGetBooleanv == NULL)
  83. {
  84. OutputDebugStringA("Failed to retrieve 'alGetBooleanv' function address\n");
  85. return AL_FALSE;
  86. }
  87. lpOALFnTable->alGetIntegerv = (LPALGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alGetIntegerv");
  88. if (lpOALFnTable->alGetIntegerv == NULL)
  89. {
  90. OutputDebugStringA("Failed to retrieve 'alGetIntegerv' function address\n");
  91. return AL_FALSE;
  92. }
  93. lpOALFnTable->alGetFloatv = (LPALGETFLOATV)GetProcAddress(g_hOpenALDLL, "alGetFloatv");
  94. if (lpOALFnTable->alGetFloatv == NULL)
  95. {
  96. OutputDebugStringA("Failed to retrieve 'alGetFloatv' function address\n");
  97. return AL_FALSE;
  98. }
  99. lpOALFnTable->alGetDoublev = (LPALGETDOUBLEV)GetProcAddress(g_hOpenALDLL, "alGetDoublev");
  100. if (lpOALFnTable->alGetDoublev == NULL)
  101. {
  102. OutputDebugStringA("Failed to retrieve 'alGetDoublev' function address\n");
  103. return AL_FALSE;
  104. }
  105. lpOALFnTable->alGetString = (LPALGETSTRING)GetProcAddress(g_hOpenALDLL, "alGetString");
  106. if (lpOALFnTable->alGetString == NULL)
  107. {
  108. OutputDebugStringA("Failed to retrieve 'alGetString' function address\n");
  109. return AL_FALSE;
  110. }
  111. lpOALFnTable->alGetError = (LPALGETERROR)GetProcAddress(g_hOpenALDLL, "alGetError");
  112. if (lpOALFnTable->alGetError == NULL)
  113. {
  114. OutputDebugStringA("Failed to retrieve 'alGetError' function address\n");
  115. return AL_FALSE;
  116. }
  117. lpOALFnTable->alIsExtensionPresent = (LPALISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alIsExtensionPresent");
  118. if (lpOALFnTable->alIsExtensionPresent == NULL)
  119. {
  120. OutputDebugStringA("Failed to retrieve 'alIsExtensionPresent' function address\n");
  121. return AL_FALSE;
  122. }
  123. lpOALFnTable->alGetProcAddress = (LPALGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alGetProcAddress");
  124. if (lpOALFnTable->alGetProcAddress == NULL)
  125. {
  126. OutputDebugStringA("Failed to retrieve 'alGetProcAddress' function address\n");
  127. return AL_FALSE;
  128. }
  129. lpOALFnTable->alGetEnumValue = (LPALGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alGetEnumValue");
  130. if (lpOALFnTable->alGetEnumValue == NULL)
  131. {
  132. OutputDebugStringA("Failed to retrieve 'alGetEnumValue' function address\n");
  133. return AL_FALSE;
  134. }
  135. lpOALFnTable->alListeneri = (LPALLISTENERI)GetProcAddress(g_hOpenALDLL, "alListeneri");
  136. if (lpOALFnTable->alListeneri == NULL)
  137. {
  138. OutputDebugStringA("Failed to retrieve 'alListeneri' function address\n");
  139. return AL_FALSE;
  140. }
  141. lpOALFnTable->alListenerf = (LPALLISTENERF)GetProcAddress(g_hOpenALDLL, "alListenerf");
  142. if (lpOALFnTable->alListenerf == NULL)
  143. {
  144. OutputDebugStringA("Failed to retrieve 'alListenerf' function address\n");
  145. return AL_FALSE;
  146. }
  147. lpOALFnTable->alListener3f = (LPALLISTENER3F)GetProcAddress(g_hOpenALDLL, "alListener3f");
  148. if (lpOALFnTable->alListener3f == NULL)
  149. {
  150. OutputDebugStringA("Failed to retrieve 'alListener3f' function address\n");
  151. return AL_FALSE;
  152. }
  153. lpOALFnTable->alListenerfv = (LPALLISTENERFV)GetProcAddress(g_hOpenALDLL, "alListenerfv");
  154. if (lpOALFnTable->alListenerfv == NULL)
  155. {
  156. OutputDebugStringA("Failed to retrieve 'alListenerfv' function address\n");
  157. return AL_FALSE;
  158. }
  159. lpOALFnTable->alGetListeneri = (LPALGETLISTENERI)GetProcAddress(g_hOpenALDLL, "alGetListeneri");
  160. if (lpOALFnTable->alGetListeneri == NULL)
  161. {
  162. OutputDebugStringA("Failed to retrieve 'alGetListeneri' function address\n");
  163. return AL_FALSE;
  164. }
  165. lpOALFnTable->alGetListenerf =(LPALGETLISTENERF)GetProcAddress(g_hOpenALDLL, "alGetListenerf");
  166. if (lpOALFnTable->alGetListenerf == NULL)
  167. {
  168. OutputDebugStringA("Failed to retrieve 'alGetListenerf' function address\n");
  169. return AL_FALSE;
  170. }
  171. lpOALFnTable->alGetListener3f = (LPALGETLISTENER3F)GetProcAddress(g_hOpenALDLL, "alGetListener3f");
  172. if (lpOALFnTable->alGetListener3f == NULL)
  173. {
  174. OutputDebugStringA("Failed to retrieve 'alGetListener3f' function address\n");
  175. return AL_FALSE;
  176. }
  177. lpOALFnTable->alGetListenerfv = (LPALGETLISTENERFV)GetProcAddress(g_hOpenALDLL, "alGetListenerfv");
  178. if (lpOALFnTable->alGetListenerfv == NULL)
  179. {
  180. OutputDebugStringA("Failed to retrieve 'alGetListenerfv' function address\n");
  181. return AL_FALSE;
  182. }
  183. lpOALFnTable->alGenSources = (LPALGENSOURCES)GetProcAddress(g_hOpenALDLL, "alGenSources");
  184. if (lpOALFnTable->alGenSources == NULL)
  185. {
  186. OutputDebugStringA("Failed to retrieve 'alGenSources' function address\n");
  187. return AL_FALSE;
  188. }
  189. lpOALFnTable->alDeleteSources = (LPALDELETESOURCES)GetProcAddress(g_hOpenALDLL, "alDeleteSources");
  190. if (lpOALFnTable->alDeleteSources == NULL)
  191. {
  192. OutputDebugStringA("Failed to retrieve 'alDeleteSources' function address\n");
  193. return AL_FALSE;
  194. }
  195. lpOALFnTable->alIsSource = (LPALISSOURCE)GetProcAddress(g_hOpenALDLL, "alIsSource");
  196. if (lpOALFnTable->alIsSource == NULL)
  197. {
  198. OutputDebugStringA("Failed to retrieve 'alIsSource' function address\n");
  199. return AL_FALSE;
  200. }
  201. lpOALFnTable->alSourcei = (LPALSOURCEI)GetProcAddress(g_hOpenALDLL, "alSourcei");
  202. if (lpOALFnTable->alSourcei == NULL)
  203. {
  204. OutputDebugStringA("Failed to retrieve 'alSourcei' function address\n");
  205. return AL_FALSE;
  206. }
  207. lpOALFnTable->alSourcef = (LPALSOURCEF)GetProcAddress(g_hOpenALDLL, "alSourcef");
  208. if (lpOALFnTable->alSourcef == NULL)
  209. {
  210. OutputDebugStringA("Failed to retrieve 'alSourcef' function address\n");
  211. return AL_FALSE;
  212. }
  213. lpOALFnTable->alSource3f = (LPALSOURCE3F)GetProcAddress(g_hOpenALDLL, "alSource3f");
  214. if (lpOALFnTable->alSource3f == NULL)
  215. {
  216. OutputDebugStringA("Failed to retrieve 'alSource3f' function address\n");
  217. return AL_FALSE;
  218. }
  219. lpOALFnTable->alSourcefv = (LPALSOURCEFV)GetProcAddress(g_hOpenALDLL, "alSourcefv");
  220. if (lpOALFnTable->alSourcefv == NULL)
  221. {
  222. OutputDebugStringA("Failed to retrieve 'alSourcefv' function address\n");
  223. return AL_FALSE;
  224. }
  225. lpOALFnTable->alGetSourcei = (LPALGETSOURCEI)GetProcAddress(g_hOpenALDLL, "alGetSourcei");
  226. if (lpOALFnTable->alGetSourcei == NULL)
  227. {
  228. OutputDebugStringA("Failed to retrieve 'alGetSourcei' function address\n");
  229. return AL_FALSE;
  230. }
  231. lpOALFnTable->alGetSourcef = (LPALGETSOURCEF)GetProcAddress(g_hOpenALDLL, "alGetSourcef");
  232. if (lpOALFnTable->alGetSourcef == NULL)
  233. {
  234. OutputDebugStringA("Failed to retrieve 'alGetSourcef' function address\n");
  235. return AL_FALSE;
  236. }
  237. lpOALFnTable->alGetSourcefv = (LPALGETSOURCEFV)GetProcAddress(g_hOpenALDLL, "alGetSourcefv");
  238. if (lpOALFnTable->alGetSourcefv == NULL)
  239. {
  240. OutputDebugStringA("Failed to retrieve 'alGetSourcefv' function address\n");
  241. return AL_FALSE;
  242. }
  243. lpOALFnTable->alSourcePlayv = (LPALSOURCEPLAYV)GetProcAddress(g_hOpenALDLL, "alSourcePlayv");
  244. if (lpOALFnTable->alSourcePlayv == NULL)
  245. {
  246. OutputDebugStringA("Failed to retrieve 'alSourcePlayv' function address\n");
  247. return AL_FALSE;
  248. }
  249. lpOALFnTable->alSourceStopv = (LPALSOURCESTOPV)GetProcAddress(g_hOpenALDLL, "alSourceStopv");
  250. if (lpOALFnTable->alSourceStopv == NULL)
  251. {
  252. OutputDebugStringA("Failed to retrieve 'alSourceStopv' function address\n");
  253. return AL_FALSE;
  254. }
  255. lpOALFnTable->alSourcePlay = (LPALSOURCEPLAY)GetProcAddress(g_hOpenALDLL, "alSourcePlay");
  256. if (lpOALFnTable->alSourcePlay == NULL)
  257. {
  258. OutputDebugStringA("Failed to retrieve 'alSourcePlay' function address\n");
  259. return AL_FALSE;
  260. }
  261. lpOALFnTable->alSourcePause = (LPALSOURCEPAUSE)GetProcAddress(g_hOpenALDLL, "alSourcePause");
  262. if (lpOALFnTable->alSourcePause == NULL)
  263. {
  264. OutputDebugStringA("Failed to retrieve 'alSourcePause' function address\n");
  265. return AL_FALSE;
  266. }
  267. lpOALFnTable->alSourceStop = (LPALSOURCESTOP)GetProcAddress(g_hOpenALDLL, "alSourceStop");
  268. if (lpOALFnTable->alSourceStop == NULL)
  269. {
  270. OutputDebugStringA("Failed to retrieve 'alSourceStop' function address\n");
  271. return AL_FALSE;
  272. }
  273. lpOALFnTable->alSourceRewind = (LPALSOURCEREWIND)GetProcAddress(g_hOpenALDLL, "alSourceRewind");
  274. if (lpOALFnTable->alSourceRewind == NULL)
  275. {
  276. OutputDebugStringA("Failed to retrieve 'alSourceRewind' function address\n");
  277. return AL_FALSE;
  278. }
  279. lpOALFnTable->alGenBuffers = (LPALGENBUFFERS)GetProcAddress(g_hOpenALDLL, "alGenBuffers");
  280. if (lpOALFnTable->alGenBuffers == NULL)
  281. {
  282. OutputDebugStringA("Failed to retrieve 'alGenBuffers' function address\n");
  283. return AL_FALSE;
  284. }
  285. lpOALFnTable->alDeleteBuffers = (LPALDELETEBUFFERS)GetProcAddress(g_hOpenALDLL, "alDeleteBuffers");
  286. if (lpOALFnTable->alDeleteBuffers == NULL)
  287. {
  288. OutputDebugStringA("Failed to retrieve 'alDeleteBuffers' function address\n");
  289. return AL_FALSE;
  290. }
  291. lpOALFnTable->alIsBuffer = (LPALISBUFFER)GetProcAddress(g_hOpenALDLL, "alIsBuffer");
  292. if (lpOALFnTable->alIsBuffer == NULL)
  293. {
  294. OutputDebugStringA("Failed to retrieve 'alIsBuffer' function address\n");
  295. return AL_FALSE;
  296. }
  297. lpOALFnTable->alBufferData = (LPALBUFFERDATA)GetProcAddress(g_hOpenALDLL, "alBufferData");
  298. if (lpOALFnTable->alBufferData == NULL)
  299. {
  300. OutputDebugStringA("Failed to retrieve 'alBufferData' function address\n");
  301. return AL_FALSE;
  302. }
  303. lpOALFnTable->alGetBufferi = (LPALGETBUFFERI)GetProcAddress(g_hOpenALDLL, "alGetBufferi");
  304. if (lpOALFnTable->alGetBufferi == NULL)
  305. {
  306. OutputDebugStringA("Failed to retrieve 'alGetBufferi' function address\n");
  307. return AL_FALSE;
  308. }
  309. lpOALFnTable->alGetBufferf = (LPALGETBUFFERF)GetProcAddress(g_hOpenALDLL, "alGetBufferf");
  310. if (lpOALFnTable->alGetBufferf == NULL)
  311. {
  312. OutputDebugStringA("Failed to retrieve 'alGetBufferf' function address\n");
  313. return AL_FALSE;
  314. }
  315. lpOALFnTable->alSourceQueueBuffers = (LPALSOURCEQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceQueueBuffers");
  316. if (lpOALFnTable->alSourceQueueBuffers == NULL)
  317. {
  318. OutputDebugStringA("Failed to retrieve 'alSourceQueueBuffers' function address\n");
  319. return AL_FALSE;
  320. }
  321. lpOALFnTable->alSourceUnqueueBuffers = (LPALSOURCEUNQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceUnqueueBuffers");
  322. if (lpOALFnTable->alSourceUnqueueBuffers == NULL)
  323. {
  324. OutputDebugStringA("Failed to retrieve 'alSourceUnqueueBuffers' function address\n");
  325. return AL_FALSE;
  326. }
  327. lpOALFnTable->alDistanceModel = (LPALDISTANCEMODEL)GetProcAddress(g_hOpenALDLL, "alDistanceModel");
  328. if (lpOALFnTable->alDistanceModel == NULL)
  329. {
  330. OutputDebugStringA("Failed to retrieve 'alDistanceModel' function address\n");
  331. return AL_FALSE;
  332. }
  333. lpOALFnTable->alDopplerFactor = (LPALDOPPLERFACTOR)GetProcAddress(g_hOpenALDLL, "alDopplerFactor");
  334. if (lpOALFnTable->alDopplerFactor == NULL)
  335. {
  336. OutputDebugStringA("Failed to retrieve 'alDopplerFactor' function address\n");
  337. return AL_FALSE;
  338. }
  339. lpOALFnTable->alDopplerVelocity = (LPALDOPPLERVELOCITY)GetProcAddress(g_hOpenALDLL, "alDopplerVelocity");
  340. if (lpOALFnTable->alDopplerVelocity == NULL)
  341. {
  342. OutputDebugStringA("Failed to retrieve 'alDopplerVelocity' function address\n");
  343. return AL_FALSE;
  344. }
  345. lpOALFnTable->alcGetString = (LPALCGETSTRING)GetProcAddress(g_hOpenALDLL, "alcGetString");
  346. if (lpOALFnTable->alcGetString == NULL)
  347. {
  348. OutputDebugStringA("Failed to retrieve 'alcGetString' function address\n");
  349. return AL_FALSE;
  350. }
  351. lpOALFnTable->alcGetIntegerv = (LPALCGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alcGetIntegerv");
  352. if (lpOALFnTable->alcGetIntegerv == NULL)
  353. {
  354. OutputDebugStringA("Failed to retrieve 'alcGetIntegerv' function address\n");
  355. return AL_FALSE;
  356. }
  357. lpOALFnTable->alcOpenDevice = (LPALCOPENDEVICE)GetProcAddress(g_hOpenALDLL, "alcOpenDevice");
  358. if (lpOALFnTable->alcOpenDevice == NULL)
  359. {
  360. OutputDebugStringA("Failed to retrieve 'alcOpenDevice' function address\n");
  361. return AL_FALSE;
  362. }
  363. lpOALFnTable->alcCloseDevice = (LPALCCLOSEDEVICE)GetProcAddress(g_hOpenALDLL, "alcCloseDevice");
  364. if (lpOALFnTable->alcCloseDevice == NULL)
  365. {
  366. OutputDebugStringA("Failed to retrieve 'alcCloseDevice' function address\n");
  367. return AL_FALSE;
  368. }
  369. lpOALFnTable->alcCreateContext = (LPALCCREATECONTEXT)GetProcAddress(g_hOpenALDLL, "alcCreateContext");
  370. if (lpOALFnTable->alcCreateContext == NULL)
  371. {
  372. OutputDebugStringA("Failed to retrieve 'alcCreateContext' function address\n");
  373. return AL_FALSE;
  374. }
  375. lpOALFnTable->alcMakeContextCurrent = (LPALCMAKECONTEXTCURRENT)GetProcAddress(g_hOpenALDLL, "alcMakeContextCurrent");
  376. if (lpOALFnTable->alcMakeContextCurrent == NULL)
  377. {
  378. OutputDebugStringA("Failed to retrieve 'alcMakeContextCurrent' function address\n");
  379. return AL_FALSE;
  380. }
  381. lpOALFnTable->alcProcessContext = (LPALCPROCESSCONTEXT)GetProcAddress(g_hOpenALDLL, "alcProcessContext");
  382. if (lpOALFnTable->alcProcessContext == NULL)
  383. {
  384. OutputDebugStringA("Failed to retrieve 'alcProcessContext' function address\n");
  385. return AL_FALSE;
  386. }
  387. lpOALFnTable->alcGetCurrentContext = (LPALCGETCURRENTCONTEXT)GetProcAddress(g_hOpenALDLL, "alcGetCurrentContext");
  388. if (lpOALFnTable->alcGetCurrentContext == NULL)
  389. {
  390. OutputDebugStringA("Failed to retrieve 'alcGetCurrentContext' function address\n");
  391. return AL_FALSE;
  392. }
  393. lpOALFnTable->alcGetContextsDevice = (LPALCGETCONTEXTSDEVICE)GetProcAddress(g_hOpenALDLL, "alcGetContextsDevice");
  394. if (lpOALFnTable->alcGetContextsDevice == NULL)
  395. {
  396. OutputDebugStringA("Failed to retrieve 'alcGetContextsDevice' function address\n");
  397. return AL_FALSE;
  398. }
  399. lpOALFnTable->alcSuspendContext = (LPALCSUSPENDCONTEXT)GetProcAddress(g_hOpenALDLL, "alcSuspendContext");
  400. if (lpOALFnTable->alcSuspendContext == NULL)
  401. {
  402. OutputDebugStringA("Failed to retrieve 'alcSuspendContext' function address\n");
  403. return AL_FALSE;
  404. }
  405. lpOALFnTable->alcDestroyContext = (LPALCDESTROYCONTEXT)GetProcAddress(g_hOpenALDLL, "alcDestroyContext");
  406. if (lpOALFnTable->alcDestroyContext == NULL)
  407. {
  408. OutputDebugStringA("Failed to retrieve 'alcDestroyContext' function address\n");
  409. return AL_FALSE;
  410. }
  411. lpOALFnTable->alcGetError = (LPALCGETERROR)GetProcAddress(g_hOpenALDLL, "alcGetError");
  412. if (lpOALFnTable->alcGetError == NULL)
  413. {
  414. OutputDebugStringA("Failed to retrieve 'alcGetError' function address\n");
  415. return AL_FALSE;
  416. }
  417. lpOALFnTable->alcIsExtensionPresent = (LPALCISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alcIsExtensionPresent");
  418. if (lpOALFnTable->alcIsExtensionPresent == NULL)
  419. {
  420. OutputDebugStringA("Failed to retrieve 'alcIsExtensionPresent' function address\n");
  421. return AL_FALSE;
  422. }
  423. lpOALFnTable->alcGetProcAddress = (LPALCGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alcGetProcAddress");
  424. if (lpOALFnTable->alcGetProcAddress == NULL)
  425. {
  426. OutputDebugStringA("Failed to retrieve 'alcGetProcAddress' function address\n");
  427. return AL_FALSE;
  428. }
  429. lpOALFnTable->alcGetEnumValue = (LPALCGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alcGetEnumValue");
  430. if (lpOALFnTable->alcGetEnumValue == NULL)
  431. {
  432. OutputDebugStringA("Failed to retrieve 'alcGetEnumValue' function address\n");
  433. return AL_FALSE;
  434. }
  435. return AL_TRUE;
  436. }
  437. ALvoid UnloadOAL10Library()
  438. {
  439. // Unload the dll
  440. if (g_hOpenALDLL)
  441. {
  442. FreeLibrary(g_hOpenALDLL);
  443. g_hOpenALDLL = NULL;
  444. }
  445. }