mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 18:25:35 +00:00
Return more descriptive/exact errors when available in WASAPI.
This commit is contained in:
parent
61c04c3730
commit
b88355eaaf
17
src/wasapi.c
17
src/wasapi.c
|
@ -713,8 +713,9 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
}
|
||||
if (FAILED(hr = IMMDevice_GetId(rd.default_capture_device, &rd.lpwstr))) {
|
||||
deinit_refresh_devices(&rd);
|
||||
// MSDN states the IMMDevice_GetId can fail if the device is NULL, or if we're out of memory
|
||||
// We know the device point isn't NULL so we're necessarily out of memory.
|
||||
if(hr == E_OUTOFMEMORY) {
|
||||
return SoundIoErrorNoMem;
|
||||
}
|
||||
return SoundIoErrorNoMem;
|
||||
}
|
||||
if ((err = from_lpwstr(rd.lpwstr, &rd.default_capture_id, &rd.default_capture_id_len))) {
|
||||
|
@ -932,8 +933,8 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
}
|
||||
int device_name_len;
|
||||
if ((err = from_lpwstr(rd.prop_variant_value.pwszVal, &rd.device_shared->name, &device_name_len))) {
|
||||
rd.device_shared->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_raw->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_shared->probe_error = err;
|
||||
rd.device_raw->probe_error = err;
|
||||
rd.device_shared = NULL;
|
||||
rd.device_raw = NULL;
|
||||
continue;
|
||||
|
@ -974,19 +975,19 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
if ((err = detect_valid_sample_rates(&rd, valid_wave_format, dev_raw,
|
||||
AUDCLNT_SHAREMODE_EXCLUSIVE)))
|
||||
{
|
||||
rd.device_raw->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_raw->probe_error = err;
|
||||
rd.device_raw = NULL;
|
||||
}
|
||||
if (rd.device_raw && (err = detect_valid_formats(&rd, valid_wave_format, dev_raw,
|
||||
AUDCLNT_SHAREMODE_EXCLUSIVE)))
|
||||
{
|
||||
rd.device_raw->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_raw->probe_error = err;
|
||||
rd.device_raw = NULL;
|
||||
}
|
||||
if (rd.device_raw && (err = detect_valid_layouts(&rd, valid_wave_format, dev_raw,
|
||||
AUDCLNT_SHAREMODE_EXCLUSIVE)))
|
||||
{
|
||||
rd.device_raw->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_raw->probe_error = err;
|
||||
rd.device_raw = NULL;
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1031,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
if ((err = detect_valid_formats(&rd, rd.wave_format, dev_shared,
|
||||
AUDCLNT_SHAREMODE_SHARED)))
|
||||
{
|
||||
rd.device_shared->probe_error = SoundIoErrorOpeningDevice;
|
||||
rd.device_shared->probe_error = err;
|
||||
rd.device_shared = NULL;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue