ALSA: detect 'default' (no colon) as default device

This commit is contained in:
Andrew Kelley 2015-07-29 01:15:01 -07:00
parent 31678c7777
commit a5e1c0024d
2 changed files with 3 additions and 4 deletions

View file

@ -273,8 +273,6 @@ view `coverage/index.html` in a browser.
call lock and then unlock when done.
0. Should pause/resume be callable from outside the callbacks?
0. device.name -> device.id, device.description -> device.name
0. PulseAudio: when opening a device start it corked that way we can get
accurate buffer readings
0. clean up API and improve documentation
- make sure every function which can return an error documents which errors
it can return

View file

@ -556,16 +556,17 @@ static int refresh_devices(SoundIoPrivate *si) {
}
SoundIoList<SoundIoDevice *> *device_list;
bool is_default = str_has_prefix(name, "default:") || strcmp(name, "default") == 0;
if (stream == SND_PCM_STREAM_PLAYBACK) {
device->purpose = SoundIoDevicePurposeOutput;
device_list = &devices_info->output_devices;
if (devices_info->default_output_index < 0 && str_has_prefix(name, "default:"))
if (devices_info->default_output_index < 0 && is_default)
devices_info->default_output_index = device_list->length;
} else {
assert(stream == SND_PCM_STREAM_CAPTURE);
device->purpose = SoundIoDevicePurposeInput;
device_list = &devices_info->input_devices;
if (devices_info->default_input_index < 0 && str_has_prefix(name, "default:"))
if (devices_info->default_input_index < 0 && is_default)
devices_info->default_input_index = device_list->length;
}