Accept -1 as device index

This commit is contained in:
Fierelier 2023-02-09 12:49:43 +01:00
parent fa3e88082c
commit e4f0ad050e
3 changed files with 3 additions and 1 deletions

View File

@ -18,7 +18,7 @@ Audio I/O for real-time applications, like VoIP.
Arguments are pairs of key=value.
### in & out:
- `device`: The device, a number (Default: Your default audio device.)
- `device`: The device, a number (Default: `-1` aka. your default device)
- `format`: The encoding of your audio, choices: [https://people.csail.mit.edu/hubert/pyaudio/docs/#pasampleformat](https://people.csail.mit.edu/hubert/pyaudio/docs/#pasampleformat) (Default: `paUInt8`)
- `channels`: How many channels the audio has (Default: `1`)
- `bitrate`: How high the refresh rate of the audio is in Hz (Default: `8000`)

View File

@ -31,6 +31,7 @@ audioChannels = getSetting(settings,int,["c","channel","channels"],1)
audioRate = getSetting(settings,int,["r","rate","bitrate"],8000)
audioBuffer = getSetting(settings,float,["b","buffer","buffersize"],0.05)
audioDevice = getSetting(settings,int,["d","device"],None)
if audioDevice == -1: audioDevice = None
audioFormat = getattr(pyaudio,audioFormat)
audioBuffer = round(audioRate * audioBuffer)

View File

@ -81,6 +81,7 @@ audioRate = getSetting(settings,int,["r","rate","bitrate"],8000)
audioBuffer = getSetting(settings,float,["b","buffer","buffersize"],0.05)
audioStore = getSetting(settings,float,["s","store"],0.3)
audioDevice = getSetting(settings,int,["d","device"],None)
if audioDevice == -1: audioDevice = None
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
audioBitrate = audioFormat