Avoid using a default name with the MMDevApi backend
This commit is contained in:
parent
01d8d956da
commit
2b64df05e6
@ -72,7 +72,6 @@ typedef struct {
|
|||||||
GUID guid;
|
GUID guid;
|
||||||
} DevMap;
|
} DevMap;
|
||||||
|
|
||||||
static const ALCchar mmDevice[] = "WASAPI Default";
|
|
||||||
static DevMap *PlaybackDeviceList;
|
static DevMap *PlaybackDeviceList;
|
||||||
static ALuint NumPlaybackDevices;
|
static ALuint NumPlaybackDevices;
|
||||||
static DevMap *CaptureDeviceList;
|
static DevMap *CaptureDeviceList;
|
||||||
@ -676,10 +675,7 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
|
|||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
Enumerator = ptr;
|
Enumerator = ptr;
|
||||||
if(IsEqualGUID(&data->guid, &GUID_NULL))
|
hr = get_mmdevice_by_guid(Enumerator, eRender, &data->guid, &data->mmdev);
|
||||||
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(Enumerator, eRender, eMultimedia, &data->mmdev);
|
|
||||||
else
|
|
||||||
hr = get_mmdevice_by_guid(Enumerator, eRender, &data->guid, &data->mmdev);
|
|
||||||
IMMDeviceEnumerator_Release(Enumerator);
|
IMMDeviceEnumerator_Release(Enumerator);
|
||||||
Enumerator = NULL;
|
Enumerator = NULL;
|
||||||
}
|
}
|
||||||
@ -848,22 +844,22 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName
|
|||||||
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
data->guid = GUID_NULL;
|
if(!PlaybackDeviceList)
|
||||||
|
{
|
||||||
|
ThreadRequest req = { data->MsgEvent, 0 };
|
||||||
|
if(PostThreadMessage(ThreadID, WM_USER_Enumerate, (WPARAM)&req, ALL_DEVICE_PROBE))
|
||||||
|
(void)WaitForResponse(&req);
|
||||||
|
}
|
||||||
|
|
||||||
if(!deviceName)
|
if(!deviceName && NumPlaybackDevices > 0)
|
||||||
deviceName = mmDevice;
|
{
|
||||||
else if(strcmp(deviceName, mmDevice) != 0)
|
deviceName = PlaybackDeviceList[0].name;
|
||||||
|
data->guid = PlaybackDeviceList[0].guid;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ALuint i;
|
ALuint i;
|
||||||
|
|
||||||
if(!PlaybackDeviceList)
|
|
||||||
{
|
|
||||||
ThreadRequest req = { data->MsgEvent, 0 };
|
|
||||||
|
|
||||||
if(PostThreadMessage(ThreadID, WM_USER_Enumerate, (WPARAM)&req, ALL_DEVICE_PROBE))
|
|
||||||
(void)WaitForResponse(&req);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
for(i = 0;i < NumPlaybackDevices;i++)
|
for(i = 0;i < NumPlaybackDevices;i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user