mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-23 06:15:38 +00:00
ALSA: detect 'default' (no colon) as default device
This commit is contained in:
parent
31678c7777
commit
a5e1c0024d
|
@ -273,8 +273,6 @@ view `coverage/index.html` in a browser.
|
||||||
call lock and then unlock when done.
|
call lock and then unlock when done.
|
||||||
0. Should pause/resume be callable from outside the callbacks?
|
0. Should pause/resume be callable from outside the callbacks?
|
||||||
0. device.name -> device.id, device.description -> device.name
|
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
|
0. clean up API and improve documentation
|
||||||
- make sure every function which can return an error documents which errors
|
- make sure every function which can return an error documents which errors
|
||||||
it can return
|
it can return
|
||||||
|
|
|
@ -556,16 +556,17 @@ static int refresh_devices(SoundIoPrivate *si) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundIoList<SoundIoDevice *> *device_list;
|
SoundIoList<SoundIoDevice *> *device_list;
|
||||||
|
bool is_default = str_has_prefix(name, "default:") || strcmp(name, "default") == 0;
|
||||||
if (stream == SND_PCM_STREAM_PLAYBACK) {
|
if (stream == SND_PCM_STREAM_PLAYBACK) {
|
||||||
device->purpose = SoundIoDevicePurposeOutput;
|
device->purpose = SoundIoDevicePurposeOutput;
|
||||||
device_list = &devices_info->output_devices;
|
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;
|
devices_info->default_output_index = device_list->length;
|
||||||
} else {
|
} else {
|
||||||
assert(stream == SND_PCM_STREAM_CAPTURE);
|
assert(stream == SND_PCM_STREAM_CAPTURE);
|
||||||
device->purpose = SoundIoDevicePurposeInput;
|
device->purpose = SoundIoDevicePurposeInput;
|
||||||
device_list = &devices_info->input_devices;
|
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;
|
devices_info->default_input_index = device_list->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue