mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
OpenAL: Improvements to how the shared library is opened at runtime.
This commit is contained in:
@@ -9376,30 +9376,27 @@ mal_result mal_context_init__openal(mal_context* pContext)
|
|||||||
mal_assert(pContext != NULL);
|
mal_assert(pContext != NULL);
|
||||||
|
|
||||||
#ifndef MAL_NO_RUNTIME_LINKING
|
#ifndef MAL_NO_RUNTIME_LINKING
|
||||||
const char* libName = NULL;
|
const char* libNames[] = {
|
||||||
#ifdef MAL_WIN32
|
#if defined(MAL_WIN32)
|
||||||
libName = "OpenAL32.dll";
|
"OpenAL32.dll",
|
||||||
|
"soft_oal.dll"
|
||||||
#endif
|
#endif
|
||||||
#if defined(MAL_UNIX) && !defined(MAL_APPLE)
|
#if defined(MAL_UNIX) && !defined(MAL_APPLE)
|
||||||
libName = "libopenal.so";
|
"libopenal.so",
|
||||||
|
"libopenal.so.1"
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAL_APPLE
|
#if defined(MAL_APPLE)
|
||||||
libName = "OpenAL.framework/OpenAL";
|
"OpenAL.framework/OpenAL"
|
||||||
#endif
|
#endif
|
||||||
if (libName == NULL) {
|
};
|
||||||
return MAL_NO_BACKEND; // Don't know what the library name is called.
|
|
||||||
|
for (size_t i = 0; i < mal_countof(libNames); ++i) {
|
||||||
|
pContext->openal.hOpenAL = mal_dlopen(libNames[i]);
|
||||||
|
if (pContext->openal.hOpenAL != NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pContext->openal.hOpenAL = mal_dlopen(libName);
|
|
||||||
|
|
||||||
#ifdef MAL_WIN32
|
|
||||||
// Special case for Win32 - try "soft_oal.dll" for OpenAL-Soft drop-ins.
|
|
||||||
if (pContext->openal.hOpenAL == NULL) {
|
|
||||||
pContext->openal.hOpenAL = mal_dlopen("soft_oal.dll");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pContext->openal.hOpenAL == NULL) {
|
if (pContext->openal.hOpenAL == NULL) {
|
||||||
return MAL_FAILED_TO_INIT_BACKEND;
|
return MAL_FAILED_TO_INIT_BACKEND;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user