aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-09-03 11:56:46 -0700
committerChris Robinson <[email protected]>2015-09-03 11:56:46 -0700
commit87e4ec66204ae9c241602589b907f213def8d879 (patch)
tree3828dd745a8bdafa09893b8731b618894fd0c2af /Alc/backends
parent7b4f1cfb4a2cdbc203299b0b89710545f2d2d287 (diff)
Use the correct device name when opening a device by name
Duplicate device names will have a '#2' or such appended, so the device's reported name may be incorrect.
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/mmdevapi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index aeb8446a..b965e1ad 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -690,7 +690,9 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi
{
if(al_string_cmp_cstr(iter->name, deviceName) == 0)
{
+ ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->devid = strdupW(iter->devid);
+ al_string_copy(&device->DeviceName, iter->name);
hr = S_OK;
break;
}
@@ -752,7 +754,8 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self)
if(SUCCEEDED(hr))
{
self->client = ptr;
- get_device_name(self->mmdev, &device->DeviceName);
+ if(al_string_empty(device->DeviceName))
+ get_device_name(self->mmdev, &device->DeviceName);
}
if(FAILED(hr))
@@ -1326,7 +1329,9 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device
WARN("Failed to find device name matching \"%s\"\n", deviceName);
else
{
+ ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->devid = strdupW(iter->devid);
+ al_string_copy(&device->DeviceName, iter->name);
hr = S_OK;
}
#undef MATCH_NAME
@@ -1403,7 +1408,8 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self)
if(SUCCEEDED(hr))
{
self->client = ptr;
- get_device_name(self->mmdev, &device->DeviceName);
+ if(al_string_empty(device->DeviceName))
+ get_device_name(self->mmdev, &device->DeviceName);
}
if(FAILED(hr))