Skip to content

Commit 45842ee

Browse files
committed
Return None for known but unavailable hostapis
1 parent c151bc1 commit 45842ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sounddevice.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,6 +2454,12 @@ def _populate_hostapis():
24542454
class HostAPIs(_namedtuple('HostAPIs', (h['apiname'] for h in hostapi_list))):
24552455
"""Access to PortAudio Host API's"""
24562456
__slots__ = ()
2457+
2458+
all_apinames = set(_typeid_to_apiname.values())
2459+
missing_apinames = all_apinames - set(h['apiname'] for h in hostapi_list)
2460+
for apiname in missing_apinames:
2461+
setattr(HostAPIs, apiname, None)
2462+
24572463
hostapis = HostAPIs(*(_HostAPI(**h) for h in hostapi_list))
24582464

24592465

0 commit comments

Comments
 (0)