LoadOAL.posix.cpp 24 KB

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