Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
BF: Non-ASCII audio driver names causes error
- Loading branch information
Showing
with
4 additions
and
2 deletions.
-
+1
−1
psychopy/sound/__init__.py
-
+3
−1
psychopy/sound/backend_pyo.py
|
@@ -139,7 +139,7 @@ def setDevice(dev, kind=None): |
|
|
pass # do nothing |
|
|
elif dev not in backend.getDevices(kind='output'): |
|
|
devNames = backend.getDevices(kind='output').keys() |
|
|
logging.error("Requested audio device '{}' that is not available on " |
|
|
logging.error(u"Requested audio device '{}' that is not available on " |
|
|
"this hardware. The 'audioDevice' preference should be one of " |
|
|
"{}".format(dev, devNames)) |
|
|
else: |
|
|
|
@@ -54,6 +54,7 @@ def getDevices(kind=None): |
|
|
|
|
|
The dict keys are names and items are dicts of properties |
|
|
""" |
|
|
osEncoding = sys.getfilesystemencoding() |
|
|
inputs, outputs = pyo.pa_get_devices_infos() |
|
|
if kind is None: |
|
|
allDevs = inputs.update(outputs) |
|
@@ -64,7 +65,8 @@ def getDevices(kind=None): |
|
|
devs = {} |
|
|
for ii in allDevs: # in pyo this is a dict but keys are ii ! :-/ |
|
|
dev = allDevs[ii] |
|
|
devs[dev['name']] = dev |
|
|
devName = dev['name'].decode(osEncoding) # convert to unicode |
|
|
devs[devName] = dev |
|
|
dev['id'] = ii |
|
|
return devs |
|
|
|
|
|