blob: df39fd905cec962964525c324fb854527188ac4d (
plain)
1
2
3
4
5
6
7
|
from pyaudio import PyAudio
def getAudioDeviceIndex(name: str, pa: PyAudio) -> int:
for i in range(pa.get_device_count()):
if pa.get_device_info_by_index(i)["name"].startswith(name):
return i
raise Exception(f"Audio device not found: {name}")
|