mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
WASAPI/UWP: Fix errors with device enumeration.
This is the same issue as the earlier commit that fixes the non-UWP enumeration for WASAPI.
This commit is contained in:
@@ -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;
|
pInfo += 1;
|
||||||
*pCount += 1;
|
*pCount += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*pCount += 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return MAL_SUCCESS;
|
return MAL_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user