(XAudio 2.8) Audio device selection can now be set

This commit is contained in:
twinaphex 2019-07-26 20:46:11 +02:00
parent 1650a03b80
commit 8a4d3f7431
2 changed files with 6 additions and 4 deletions

View File

@ -93,16 +93,15 @@ void *mmdevice_list_new(void *u)
br = string_list_append(sl, dev_name_str, attr);
if (!br)
goto error;
if (dev_id_str)
sl->elems[sl->size-1].userdata = dev_id_str;
PropVariantClear(&prop_var);
prop_var_init = false;
if (dev_id_wstr)
CoTaskMemFree(dev_id_wstr);
if (dev_id_str)
free(dev_id_str);
if (dev_name_str)
free(dev_name_str);
dev_id_str = NULL;
dev_name_str = NULL;
dev_id_wstr = NULL;
IFACE_RELEASE(prop_store);

View File

@ -243,7 +243,10 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
{
wchar_t *temp = utf8_to_utf16_string_alloc((const char*)(char)idx_found);
wchar_t *temp = NULL;
if (device)
temp = utf8_to_utf16_string_alloc((const char*)list->elems[idx_found].userdata);
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, (LPCWSTR)(uintptr_t)temp, NULL, AudioCategory_GameEffects)))
{
free(temp);