diff options
| author | Eddy Pedroni <epedroni@pm.me> | 2026-10-13 20:36:02 +0200 |
|---|---|---|
| committer | Eddy Pedroni <epedroni@pm.me> | 2026-10-13 20:36:02 +0200 |
| commit | 05a3406de3e26d21865db87960f80c5f40f9cd83 (patch) | |
| tree | 372597a6c1210cb1203238b7193ce6dcd565a5fa /solo-tool-project/src/solo_tool/utils.py | |
| parent | edc8d820df84c147ddb6e723b9639bddd6d15344 (diff) | |
Add option to specify audio device (only applicable for metronome and recorder)
Diffstat (limited to 'solo-tool-project/src/solo_tool/utils.py')
| -rw-r--r-- | solo-tool-project/src/solo_tool/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/solo-tool-project/src/solo_tool/utils.py b/solo-tool-project/src/solo_tool/utils.py new file mode 100644 index 0000000..df39fd9 --- /dev/null +++ b/solo-tool-project/src/solo_tool/utils.py @@ -0,0 +1,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}") |
