From 9de444c59cdf28556ca3111c3701fde1070cb193 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 25 Apr 2018 10:04:16 +1000 Subject: [PATCH] OpenAL: Add support for retrieving detailed device info. --- mini_al.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/mini_al.h b/mini_al.h index 17aa5310..c1a52feb 100644 --- a/mini_al.h +++ b/mini_al.h @@ -13315,12 +13315,28 @@ mal_result mal_context_get_device_info__openal(mal_context* pContext, mal_device return result; } - if (data.foundDevice) { - return MAL_SUCCESS; - } else { + if (!data.foundDevice) { return MAL_NO_DEVICE; } } + + // mini_al's OpenAL backend only supports: + // - mono and stereo + // - u8, s16 and f32 + // - All standard sample rates + pDeviceInfo->minChannels = 1; + pDeviceInfo->maxChannels = 2; + pDeviceInfo->minSampleRate = MAL_MIN_SAMPLE_RATE; + pDeviceInfo->maxSampleRate = MAL_MAX_SAMPLE_RATE; + pDeviceInfo->formatCount = 2; + pDeviceInfo->formats[0] = mal_format_u8; + pDeviceInfo->formats[1] = mal_format_s16; + if (pContext->openal.isFloat32Supported) { + pDeviceInfo->formats[pDeviceInfo->formatCount] = mal_format_f32; + pDeviceInfo->formatCount += 1; + } + + return MAL_SUCCESS; } mal_result mal_context_init__openal(mal_context* pContext)