spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
980 stars 145 forks source link

Device index is not part of query_devices() #403

Closed mgeier closed 2 years ago

mgeier commented 2 years ago

Another inconvenient issue is that the index is not returned by query_devices. I could not find a good way to get the index, other than constructing the index from the order of the devices returned by query_devices().

Originally posted by @vvaradarajan in https://github.com/spatialaudio/python-sounddevice/issues/307#issuecomment-1118113206

mgeier commented 2 years ago

constructing the index from the order of the devices returned by query_devices()

That's currently the way to do it.

But it would be possible to add an index field to the dictionaries that are returned from query_devices(). I've done this in #404, can you please try if that works for you, @vvaradarajan?