aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-20 21:46:01 -0800
committerChris Robinson <[email protected]>2012-02-20 21:46:01 -0800
commit2b64df05e63eb21dc2ecfa3aa32fd54e5413a13e (patch)
treea0575001e2cebbfe1530f5bf1ced9e29f5978188
parent01d8d956da139180174cea333633023b675dd264 (diff)
Avoid using a default name with the MMDevApi backend
-rw-r--r--Alc/backends/mmdevapi.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 59068406..f28a7906 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -72,7 +72,6 @@ typedef struct {
GUID guid;
} DevMap;
-static const ALCchar mmDevice[] = "WASAPI Default";
static DevMap *PlaybackDeviceList;
static ALuint NumPlaybackDevices;
static DevMap *CaptureDeviceList;
@@ -676,10 +675,7 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
if(SUCCEEDED(hr))
{
Enumerator = ptr;
- if(IsEqualGUID(&data->guid, &GUID_NULL))
- hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(Enumerator, eRender, eMultimedia, &data->mmdev);
- else
- hr = get_mmdevice_by_guid(Enumerator, eRender, &data->guid, &data->mmdev);
+ hr = get_mmdevice_by_guid(Enumerator, eRender, &data->guid, &data->mmdev);
IMMDeviceEnumerator_Release(Enumerator);
Enumerator = NULL;
}
@@ -848,22 +844,22 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName
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)
- deviceName = mmDevice;
- else if(strcmp(deviceName, mmDevice) != 0)
+ if(!deviceName && NumPlaybackDevices > 0)
+ {
+ deviceName = PlaybackDeviceList[0].name;
+ data->guid = PlaybackDeviceList[0].guid;
+ }
+ else
{
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;
for(i = 0;i < NumPlaybackDevices;i++)
{