From 821abec74f4f5861a710757fde2ea2e012522d94 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 19 Aug 2018 15:05:43 +1000 Subject: [PATCH] WASAPI: Experiment with hardware offloading. --- mini_al.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mini_al.h b/mini_al.h index 715ee967..5185cc1b 100644 --- a/mini_al.h +++ b/mini_al.h @@ -6521,6 +6521,24 @@ mal_result mal_device_init_internal__wasapi(mal_context* pContext, mal_device_ty } #endif + // Try enabling hardware offloading. + mal_IAudioClient2* pAudioClient2; + hr = mal_IAudioClient_QueryInterface(pData->pAudioClient, &MAL_IID_IAudioClient2, (void**)&pAudioClient2); + if (SUCCEEDED(hr)) { + BOOL isHardwareOffloadingSupported = 0; + hr = mal_IAudioClient2_IsOffloadCapable(pAudioClient2, MAL_AudioCategory_Other, &isHardwareOffloadingSupported); + if (SUCCEEDED(hr) && isHardwareOffloadingSupported) { + mal_AudioClientProperties clientProperties; + mal_zero_object(&clientProperties); + clientProperties.cbSize = sizeof(clientProperties); + clientProperties.bIsOffload = 1; + clientProperties.eCategory = MAL_AudioCategory_Other; + mal_IAudioClient2_SetClientProperties(pAudioClient2, &clientProperties); + } + } + + + WAVEFORMATEXTENSIBLE wf; mal_zero_object(&wf); wf.Format.cbSize = sizeof(wf); @@ -28216,6 +28234,7 @@ mal_uint64 mal_sine_wave_read_ex(mal_sine_wave* pSineWave, mal_uint64 frameCount // - WASAPI and Core Audio: Add support for stream routing. When the application is using a default device and the // user switches the default device via the operating system's audio preferences, mini_al will automatically switch // the internal device to the new default. +// - Add support for compiling the UWP build as C. // - mal_device_set_recv_callback() and mal_device_set_send_callback() have been deprecated. You must now set this // when the device is initialized with mal_device_init*(). These will be removed in version 0.9.0. //