SDL_xaudio2_winrthelpers.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | XAUDIO2_DEVICE_DETAILS

## Functions

HRESULT | IXAudio2_GetDeviceCount (IXAudio2 *unused, UINT32 *devcount)
HRESULT | IXAudio2_GetDeviceDetails (IXAudio2 *unused, UINT32 index, XAUDIO2_DEVICE_DETAILS *details)

## Function Documentation

HRESULT IXAudio2_GetDeviceCount | ( | IXAudio2 * | unused,
|  | UINT32 * | devcount
| ) |  |

Definition at line 32 of file SDL_xaudio2_winrthelpers.cpp.

References S_OK.

{
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
// There doesn't seem to be any audio device enumeration on Windows Phone.
// In lieu of this, just treat things as if there is one and only one
// audio device.
*devcount = 1;
return S_OK;
#else
// TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background
auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
{
}
DeviceInformationCollection^ devices = operation->GetResults();
*devcount = devices->Size;
return S_OK;
#endif
}
S_OK
#define S_OK
Definition: SDL_directx.h:47

HRESULT IXAudio2_GetDeviceDetails | ( | IXAudio2 * | unused,
|  | UINT32 | index,
|  | XAUDIO2_DEVICE_DETAILS * | details
| ) |  |

Definition at line 53 of file SDL_xaudio2_winrthelpers.cpp.

References d, XAUDIO2_DEVICE_DETAILS::DeviceID, XAUDIO2_DEVICE_DETAILS::DisplayName, and S_OK.

{
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
// Windows Phone doesn't seem to have the same device enumeration APIs that
// Windows 8/RT has, or it doesn't have them at all. In lieu of this,
// just treat things as if there is one, and only one, default device.
if (index != 0)
{
return XAUDIO2_E_INVALID_CALL;
}
if (details)
{
wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE);
wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE);
}
return S_OK;
#else
auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
{
}
DeviceInformationCollection^ devices = operation->GetResults();
if (index >= devices->Size)
{
return XAUDIO2_E_INVALID_CALL;
}
DeviceInformation^ d = devices->GetAt(index);
if (details)
{
wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE);
wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE);
}
return S_OK;
#endif
}
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
XAUDIO2_DEVICE_DETAILS::DeviceID
WCHAR DeviceID[256]
Definition: SDL_xaudio2_winrthelpers.h:28
S_OK
#define S_OK
Definition: SDL_directx.h:47
index
GLuint index
Definition: SDL_opengl_glext.h:660
XAUDIO2_DEVICE_DETAILS::DisplayName
WCHAR DisplayName[256]
Definition: SDL_xaudio2_winrthelpers.h:29