diff options
author | Max Kellermann <max@duempel.org> | 2015-03-05 09:03:25 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-03-05 10:07:07 +0100 |
commit | 81059f80d8836294dae9ef85191f01f64949b59c (patch) | |
tree | c438082f0b5370116e400045a16d12a1b126acbd | |
parent | a261442279b51a916806dd1bf4c6bd4ba6431074 (diff) |
output/winmm: convert device name to filesystem charset
-rw-r--r-- | src/output/plugins/WinmmOutputPlugin.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/output/plugins/WinmmOutputPlugin.cxx b/src/output/plugins/WinmmOutputPlugin.cxx index 4a6cace29..35efb0f93 100644 --- a/src/output/plugins/WinmmOutputPlugin.cxx +++ b/src/output/plugins/WinmmOutputPlugin.cxx @@ -22,6 +22,7 @@ #include "../OutputAPI.hxx" #include "pcm/PcmBuffer.hxx" #include "mixer/MixerList.hxx" +#include "fs/AllocatedPath.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "util/Macros.hxx" @@ -108,6 +109,11 @@ get_device_id(const char *device_name, UINT *device_id, Error &error) } /* check for device name */ + const AllocatedPath device_name_fs = + AllocatedPath::FromUTF8(device_name, error); + if (device_name_fs.IsNull()) + return false; + for (UINT i = 0; i < numdevs; i++) { WAVEOUTCAPS caps; MMRESULT result = waveOutGetDevCaps(i, &caps, sizeof(caps)); @@ -115,7 +121,7 @@ get_device_id(const char *device_name, UINT *device_id, Error &error) continue; /* szPname is only 32 chars long, so it is often truncated. Use partial match to work around this. */ - if (StringStartsWith(device_name, caps.szPname)) { + if (StringStartsWith(device_name_fs.c_str(), caps.szPname)) { *device_id = i; return true; } |