This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WinRT: got the XAudio2 backend compiling (but not running, yet)
- Loading branch information
1 parent
65dfa99
commit 30e298d
Showing
6 changed files
with
238 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
#include <xaudio2.h> | ||
#include "SDL_xaudio2_winrthelpers.h" | ||
|
||
using Windows::Devices::Enumeration::DeviceClass; | ||
using Windows::Devices::Enumeration::DeviceInformation; | ||
using Windows::Devices::Enumeration::DeviceInformationCollection; | ||
|
||
HRESULT IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount) | ||
{ | ||
auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); | ||
while (operation->Status != Windows::Foundation::AsyncStatus::Completed) | ||
{ | ||
} | ||
|
||
DeviceInformationCollection^ devices = operation->GetResults(); | ||
*devcount = devices->Size; | ||
return S_OK; | ||
} | ||
|
||
HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details) | ||
{ | ||
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; | ||
} |
Oops, something went wrong.