summaryrefslogtreecommitdiff
path: root/sounddevice.py
diff options
context:
space:
mode:
authorMatthias Geier <Matthias.Geier@gmail.com>2016-08-02 12:40:35 +0200
committerMatthias Geier <Matthias.Geier@gmail.com>2016-08-02 12:40:35 +0200
commite33bd89cb1d4527aa4b788d2fbc5ffc7e673e413 (patch)
tree7c56a3c39572607558688a6f1b87172105e6c288 /sounddevice.py
parent76fe59d45bac5b4be16a7cb48f2cf26ba8d0b2aa (diff)
Use MBCS encoding for MME, too
Diffstat (limited to 'sounddevice.py')
-rw-r--r--sounddevice.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/sounddevice.py b/sounddevice.py
index 874054a..c4edf33 100644
--- a/sounddevice.py
+++ b/sounddevice.py
@@ -620,12 +620,10 @@ def query_devices(device=None, kind=None):
if not info:
raise PortAudioError("Error querying device {0}".format(device))
assert info.structVersion == 2
- if info.hostApi == _lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paDirectSound):
- encoding = 'mbcs'
- else:
- encoding = 'utf-8'
device_dict = {
- 'name': _ffi.string(info.name).decode(encoding, 'replace'),
+ 'name': _ffi.string(info.name).decode('mbcs' if info.hostApi in (
+ _lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paDirectSound),
+ _lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paMME)) else 'utf-8'),
'hostapi': info.hostApi,
'max_input_channels': info.maxInputChannels,
'max_output_channels': info.maxOutputChannels,