From 57a728fd41f45be5cfe664fc6b6d349dd7b0de6e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 21 May 2021 22:36:46 +0200 Subject: [PATCH] Rename audio_out_rate to audio_output_sample_rate --- configuration.c | 2 +- configuration.h | 2 +- menu/menu_setting.c | 2 +- retroarch.c | 32 ++++++++++++++++---------------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/configuration.c b/configuration.c index 0517e8915b..e86bbd75f0 100644 --- a/configuration.c +++ b/configuration.c @@ -2037,7 +2037,7 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("ozone_menu_color_theme", &settings->uints.menu_ozone_color_theme, true, DEFAULT_OZONE_COLOR_THEME, false); #endif #endif - SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, DEFAULT_OUTPUT_RATE, false); + SETTING_UINT("audio_out_rate", &settings->uints.audio_output_sample_rate, true, DEFAULT_OUTPUT_RATE, false); SETTING_UINT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false); SETTING_UINT("crt_switch_resolution_super", &settings->uints.crt_switch_resolution_super, true, DEFAULT_CRT_SWITCH_RESOLUTION_SUPER, false); SETTING_UINT("custom_viewport_height", &settings->video_viewport_custom.height, false, 0 /* TODO */, false); diff --git a/configuration.h b/configuration.h index 1ffcfc34e8..ba76318143 100644 --- a/configuration.h +++ b/configuration.h @@ -134,7 +134,7 @@ typedef struct settings unsigned led_map[MAX_LEDS]; - unsigned audio_out_rate; + unsigned audio_output_sample_rate; unsigned audio_block_frames; unsigned audio_latency; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7be63f547b..660b67fed0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -12037,7 +12037,7 @@ static bool setting_append_list( CONFIG_UINT( list, list_info, - &settings->uints.audio_out_rate, + &settings->uints.audio_output_sample_rate, MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE, MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, DEFAULT_OUTPUT_RATE, diff --git a/retroarch.c b/retroarch.c index f7b500f5ac..4e7c0f898e 100644 --- a/retroarch.c +++ b/retroarch.c @@ -28175,10 +28175,7 @@ static bool audio_driver_init_internal( #endif if (!audio_enable) - { - runloop_state.audio_active = false; - return false; - } + goto audio_not_active; audio_driver_find_driver(p_rarch, settings, "audio driver", verbosity_enabled); @@ -28186,8 +28183,7 @@ static bool audio_driver_init_internal( if (!p_rarch->current_audio || !p_rarch->current_audio->init) { RARCH_ERR("Failed to initialize audio driver. Will continue without audio.\n"); - runloop_state.audio_active = false; - return false; + goto audio_not_active; } #ifdef HAVE_THREADS @@ -28199,7 +28195,7 @@ static bool audio_driver_init_internal( &runloop_state.audio_context_audio_data, *settings->arrays.audio_device ? settings->arrays.audio_device : NULL, - settings->uints.audio_out_rate, &new_rate, + settings->uints.audio_output_sample_rate, &new_rate, audio_latency, settings->uints.audio_block_frames, p_rarch->current_audio)) @@ -28214,14 +28210,14 @@ static bool audio_driver_init_internal( runloop_state.audio_context_audio_data = p_rarch->current_audio->init(*settings->arrays.audio_device ? settings->arrays.audio_device : NULL, - settings->uints.audio_out_rate, + settings->uints.audio_output_sample_rate, audio_latency, settings->uints.audio_block_frames, &new_rate); } if (new_rate != 0) - configuration_set_int(settings, settings->uints.audio_out_rate, new_rate); + configuration_set_int(settings, settings->uints.audio_output_sample_rate, new_rate); if (!runloop_state.audio_context_audio_data) { @@ -28253,14 +28249,14 @@ static bool audio_driver_init_internal( RARCH_WARN("[Audio]: Input samplerate is invalid (%.3f Hz)." " Using output samplerate (%u Hz).\n", runloop_state.audio_input_sample_rate, - settings->uints.audio_out_rate); + settings->uints.audio_output_sample_rate); - runloop_state.audio_input_sample_rate = settings->uints.audio_out_rate; + runloop_state.audio_input_sample_rate = settings->uints.audio_output_sample_rate; } runloop_state.audio_source_ratio_original = runloop_state.audio_source_ratio_current = - (double)settings->uints.audio_out_rate / runloop_state.audio_input_sample_rate; + (double)settings->uints.audio_output_sample_rate / runloop_state.audio_input_sample_rate; if (!retro_resampler_realloc( &runloop_state.audio_resampler_data, @@ -28276,7 +28272,7 @@ static bool audio_driver_init_internal( runloop_state.audio_data_ptr = 0; - retro_assert(settings->uints.audio_out_rate < + retro_assert(settings->uints.audio_output_sample_rate < runloop_state.audio_input_sample_rate * AUDIO_MAX_RATIO); samples_buf = (float*)memalign_alloc(64, outsamples_max * sizeof(float)); @@ -28313,7 +28309,7 @@ static bool audio_driver_init_internal( runloop_state.free_audio_samples_count = 0; #ifdef HAVE_AUDIOMIXER - audio_mixer_init(settings->uints.audio_out_rate); + audio_mixer_init(settings->uints.audio_output_sample_rate); #endif /* Threaded driver is initially stopped. */ @@ -28328,6 +28324,10 @@ static bool audio_driver_init_internal( error: return audio_driver_deinit(p_rarch, settings); + +audio_not_active: + runloop_state.audio_active = false; + return false; } /** @@ -33473,7 +33473,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data) { float *hz = (float*)data; settings_t *settings = p_rarch->configuration_settings; - unsigned audio_out_rate = settings->uints.audio_out_rate; + unsigned audio_output_sample_rate = settings->uints.audio_output_sample_rate; bool vrr_runloop_enable = settings->bools.vrr_runloop_enable; float video_refresh_rate = settings->floats.video_refresh_rate; float audio_max_timing_skew = settings->floats.audio_max_timing_skew; @@ -33485,7 +33485,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data) /* Sets audio monitor rate to new value. */ runloop_state.audio_source_ratio_original = runloop_state.audio_source_ratio_current = - (double)audio_out_rate + (double)audio_output_sample_rate / runloop_state.audio_input_sample_rate; driver_adjust_system_rates(p_rarch,