diff options
author | Chris Robinson <[email protected]> | 2015-09-03 11:56:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-09-03 11:56:46 -0700 |
commit | 87e4ec66204ae9c241602589b907f213def8d879 (patch) | |
tree | 3828dd745a8bdafa09893b8731b618894fd0c2af | |
parent | 7b4f1cfb4a2cdbc203299b0b89710545f2d2d287 (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.
-rw-r--r-- | Alc/backends/mmdevapi.c | 10 |
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)) |