Majority of the code is shared with MM_WIN32_DESKTOP. Extra flag is introduced MA_WIN32_GDK, which is defined if application is built with GDK. You may want to keep using one define to control UWP and non-UWP code, like MA_WASAPI_FULL or MA_WASAPI_UWP; I don't know what approach is preferred.
GDK advertise itself with defines:
_GAMING_DESKTOP - defined for Win32 app, when GDK is available, also WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
_GAMING_XBOX - defined for any console, also WINAPI_FAMILY == WINAPI_FAMILY_GAMES
One of _GAMING_XBOX_XBOXONE (Xbox One) or _GAMING_XBOX_SCARLETT (Xbox Series X/S) is defined when _GAMING_XBOX is present if for some reason there is a need to distinguish between platforms. All this information is available in samples mentioned above.
In PR only check for WINAPI_FAMILY == WINAPI_FAMILY_GAMES is present, since there is a fallback to MA_WIN32_DESKTOP when no other platform is detected, which fit nicely.
In samples I didn't found any ifdefs related to platforms so WASAPI should work exactly like on desktop.
Capture and enumerating extra devices I suspect work in same everywhere.
I tested only playback and it works (with and without MA_NO_RUNTIME_LINKING, it has no effect on the build).
This add rough on the edges support for building with Microsoft GDK, which enable miniaudio to work on Xbox consoles.
GDK is publicly available https://github.com/microsoft/GDK and Samples using WASAPI (https://github.com/microsoft/Xbox-GDK-Samples/tree/main/Samples/Audio/SimpleWASAPIPlaySound) are publicly available.
Majority of the code is shared with MM_WIN32_DESKTOP. Extra flag is introduced MA_WIN32_GDK, which is defined if application is built with GDK. You may want to keep using one define to control UWP and non-UWP code, like MA_WASAPI_FULL or MA_WASAPI_UWP; I don't know what approach is preferred.
GDK advertise itself with defines:
_GAMING_DESKTOP
- defined for Win32 app, when GDK is available, alsoWINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
_GAMING_XBOX
- defined for any console, alsoWINAPI_FAMILY == WINAPI_FAMILY_GAMES
One of
_GAMING_XBOX_XBOXONE
(Xbox One) or_GAMING_XBOX_SCARLETT
(Xbox Series X/S) is defined when_GAMING_XBOX
is present if for some reason there is a need to distinguish between platforms. All this information is available in samples mentioned above.In PR only check for
WINAPI_FAMILY == WINAPI_FAMILY_GAMES
is present, since there is a fallback to MA_WIN32_DESKTOP when no other platform is detected, which fit nicely.In samples I didn't found any ifdefs related to platforms so WASAPI should work exactly like on desktop. Capture and enumerating extra devices I suspect work in same everywhere.
I tested only playback and it works (with and without MA_NO_RUNTIME_LINKING, it has no effect on the build).