summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sounddevice.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/sounddevice.py b/sounddevice.py
index e59244b..0784726 100644
--- a/sounddevice.py
+++ b/sounddevice.py
@@ -1832,16 +1832,20 @@ class DeviceList(tuple):
odev = _get_device_id(default.device['output'], 'output')
digits = len(str(_lib.Pa_GetDeviceCount() - 1))
hostapi_names = [hostapi['name'] for hostapi in query_hostapis()]
+
+ def get_mark(idx):
+ return (' ', '>', '<', '*')[(idx == idev) + 2 * (idx == odev)]
+
text = '\n'.join(
'{mark} {idx:{dig}} {name}, {ha} ({ins} in, {outs} out)'.format(
- mark=(' ', '>', '<', '*')[(idx == idev) + 2 * (idx == odev)],
- idx=idx,
+ mark=get_mark(info['index']),
+ idx=info['index'],
dig=digits,
name=info['name'],
ha=hostapi_names[info['hostapi']],
ins=info['max_input_channels'],
outs=info['max_output_channels'])
- for idx, info in enumerate(self))
+ for info in self)
return text