mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
ALSA: Make runtime linking more robust.
This commit is contained in:
@@ -11098,8 +11098,22 @@ mal_result mal_context_init__alsa(mal_context* pContext)
|
||||
mal_assert(pContext != NULL);
|
||||
|
||||
#ifndef MAL_NO_RUNTIME_LINKING
|
||||
pContext->alsa.asoundSO = mal_dlopen("libasound.so");
|
||||
const char* libasoundNames[] = {
|
||||
"libasound.so.2",
|
||||
"libasound.so"
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < mal_countof(libasoundNames); ++i) {
|
||||
pContext->alsa.asoundSO = mal_dlopen(libasoundNames[i]);
|
||||
if (pContext->alsa.asoundSO != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pContext->alsa.asoundSO == NULL) {
|
||||
#ifdef MAL_DEBUG_OUTPUT
|
||||
printf("[ALSA] Failed to open shared object.\n");
|
||||
#endif
|
||||
return MAL_NO_BACKEND;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user