Skip to content

Commit

Permalink
Return None for known but unavailable hostapis
Browse files Browse the repository at this point in the history
  • Loading branch information
dholl committed Apr 26, 2017
1 parent c151bc1 commit 45842ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sounddevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,12 @@ def _populate_hostapis():
class HostAPIs(_namedtuple('HostAPIs', (h['apiname'] for h in hostapi_list))):
"""Access to PortAudio Host API's"""
__slots__ = ()

all_apinames = set(_typeid_to_apiname.values())
missing_apinames = all_apinames - set(h['apiname'] for h in hostapi_list)
for apiname in missing_apinames:
setattr(HostAPIs, apiname, None)

hostapis = HostAPIs(*(_HostAPI(**h) for h in hostapi_list))


Expand Down

0 comments on commit 45842ee

Please sign in to comment.