Issue 116 - Recognize two digit number, as well as single digit

number, for Windows audio device number in configuration file ADEVICE.
This commit is contained in:
wb2osz 2017-11-12 19:46:47 -05:00
parent b81de60aec
commit 590c82b040
1 changed files with 8 additions and 0 deletions

View File

@ -313,10 +313,15 @@ int audio_open (struct audio_s *pa)
/* Does config file have a number? */ /* Does config file have a number? */
/* If so, it is an index into list of devices. */ /* If so, it is an index into list of devices. */
/* Originally only a single digit was recognized. */
/* v 1.5 also recognizes two digits. (Issue 116) */
if (strlen(pa->adev[a].adevice_in) == 1 && isdigit(pa->adev[a].adevice_in[0])) { if (strlen(pa->adev[a].adevice_in) == 1 && isdigit(pa->adev[a].adevice_in[0])) {
in_dev_no[a] = atoi(pa->adev[a].adevice_in); in_dev_no[a] = atoi(pa->adev[a].adevice_in);
} }
else if (strlen(pa->adev[a].adevice_in) == 2 && isdigit(pa->adev[a].adevice_in[0]) && isdigit(pa->adev[a].adevice_in[1])) {
in_dev_no[a] = atoi(pa->adev[a].adevice_in);
}
/* Otherwise, does it have search string? */ /* Otherwise, does it have search string? */
@ -344,6 +349,9 @@ int audio_open (struct audio_s *pa)
if (strlen(pa->adev[a].adevice_out) == 1 && isdigit(pa->adev[a].adevice_out[0])) { if (strlen(pa->adev[a].adevice_out) == 1 && isdigit(pa->adev[a].adevice_out[0])) {
out_dev_no[a] = atoi(pa->adev[a].adevice_out); out_dev_no[a] = atoi(pa->adev[a].adevice_out);
} }
else if (strlen(pa->adev[a].adevice_out) == 2 && isdigit(pa->adev[a].adevice_out[0]) && isdigit(pa->adev[a].adevice_out[1])) {
out_dev_no[a] = atoi(pa->adev[a].adevice_out);
}
if ((UINT)(out_dev_no[a]) == WAVE_MAPPER && strlen(pa->adev[a].adevice_out) >= 1) { if ((UINT)(out_dev_no[a]) == WAVE_MAPPER && strlen(pa->adev[a].adevice_out) >= 1) {
num_devices = waveOutGetNumDevs(); num_devices = waveOutGetNumDevs();