Commit 5b24501a authored by David Reid's avatar David Reid

WASAPI/UWP: Fix errors with device enumeration.

This is the same issue as the earlier commit that fixes the non-UWP
enumeration for WASAPI.
parent 8fdb156d
...@@ -3130,18 +3130,22 @@ static mal_result mal_enumerate_devices__wasapi(mal_context* pContext, mal_devic ...@@ -3130,18 +3130,22 @@ static mal_result mal_enumerate_devices__wasapi(mal_context* pContext, mal_devic
#else #else
// The MMDevice API is only supported on desktop applications. For now, while I'm still figuring out how to properly enumerate // The MMDevice API is only supported on desktop applications. For now, while I'm still figuring out how to properly enumerate
// over devices without using MMDevice, I'm restricting devices to defaults. // over devices without using MMDevice, I'm restricting devices to defaults.
if (infoSize > 0) { if (pInfo != NULL) {
if (type == mal_device_type_playback) { if (infoSize > 0) {
mal_copy_memory(pInfo->id.wasapi, &g_malIID_DEVINTERFACE_AUDIO_RENDER, sizeof(g_malIID_DEVINTERFACE_AUDIO_RENDER)); if (type == mal_device_type_playback) {
mal_strncpy_s(pInfo->name, sizeof(pInfo->name), "Default Playback Device", (size_t)-1); mal_copy_memory(pInfo->id.wasapi, &g_malIID_DEVINTERFACE_AUDIO_RENDER, sizeof(g_malIID_DEVINTERFACE_AUDIO_RENDER));
} else { mal_strncpy_s(pInfo->name, sizeof(pInfo->name), "Default Playback Device", (size_t)-1);
mal_copy_memory(pInfo->id.wasapi, &g_malIID_DEVINTERFACE_AUDIO_CAPTURE, sizeof(g_malIID_DEVINTERFACE_AUDIO_CAPTURE)); } else {
mal_strncpy_s(pInfo->name, sizeof(pInfo->name), "Default Capture Device", (size_t)-1); mal_copy_memory(pInfo->id.wasapi, &g_malIID_DEVINTERFACE_AUDIO_CAPTURE, sizeof(g_malIID_DEVINTERFACE_AUDIO_CAPTURE));
mal_strncpy_s(pInfo->name, sizeof(pInfo->name), "Default Capture Device", (size_t)-1);
}
pInfo += 1;
*pCount += 1;
} }
} else {
*pCount += 1;
} }
pInfo += 1;
*pCount += 1;
#endif #endif
return MAL_SUCCESS; return MAL_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment