LoadOAL.linux.cpp 23 KB

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