Some improvements to audio error logging.
@@ -275,7 +275,7 @@ bool32_t mic_start(const char *device_name) {
config.pUserData = nullptr;
ma_result result = ma_device_init(&au_context, &config, &au_mic_device);
if (result != MA_SUCCESS) {
- log_warnf("mic_start has failed: %d", result);
+ log_warnf("audio: Mic start failed, '%s'", ma_result_description(result));
return false;
}
ma_device_start(&au_mic_device);
@@ -331,12 +331,12 @@ bool audio_init() {
HRESULT hr = isac_adapter->Activate(isac_data_callback);
if (SUCCEEDED(hr)) {
- log_diag("Using audio backend: ISAC");
+ log_diag("audio: Using backend ISAC");
return true;
} else if (hr == E_NOT_VALID_STATE){
- log_diag("ISAC not available, falling back to miniaudio! It's likely the device doesn't have Windows Sonic enabled, which can be found under Settings->Sound->Device Properties->Spatial Sound.");
+ log_diag("audio: ISAC not available, falling back to miniaudio! It's likely the device doesn't have Windows Sonic enabled, which can be found under Settings->Sound->Device Properties->Spatial Sound.");
} else {
- log_warnf("ISAC failed 0x%X, falling back to miniaudio!", hr);
+ log_warnf("audio: ISAC failed 0x%X, falling back to miniaudio!", hr);
}
delete isac_adapter;
isac_adapter = nullptr;
@@ -349,20 +349,22 @@ bool audio_init() {
au_config.dataCallback = data_callback;
au_config.pUserData = nullptr;
- if (ma_device_init(&au_context, &au_config, &au_device) != MA_SUCCESS) {
- log_err("miniaudio: Failed to open playback device.");
+ ma_result result = ma_device_init(&au_context, &au_config, &au_device);
+ if (result != MA_SUCCESS) {
+ log_errf("audio: Failed to open playback device, '%s'.", ma_result_description(result));
return false;
}
- if (ma_device_start(&au_device) != MA_SUCCESS) {
- log_err("miniaudio: Failed to start playback device.");
+ result = ma_device_start(&au_device);
+ if (result != MA_SUCCESS) {
+ log_errf("audio: Failed to start playback device, '%s'.", ma_result_description(result));
ma_device_uninit(&au_device);
return false;
}
au_mic_name = nullptr;
- log_diagf("miniaudio: using backend %s", ma_get_backend_name(au_device.pContext->backend));
+ log_diagf("audio: Using backend %s", ma_get_backend_name(au_device.pContext->backend));
return true;
}
