mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 09:32:52 +00:00
(audio driver) Refactor
This commit is contained in:
parent
13998f583a
commit
8b714d2932
@ -891,6 +891,17 @@ bool audio_driver_disable_callback(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sets audio monitor rate to new value. */
|
||||||
|
void audio_driver_monitor_set_rate(void)
|
||||||
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
double new_src_ratio = (double)settings->audio.out_rate /
|
||||||
|
audio_driver_data.audio_rate.input;
|
||||||
|
|
||||||
|
audio_driver_data.audio_rate.source_ratio.original = new_src_ratio;
|
||||||
|
audio_driver_data.audio_rate.source_ratio.current = new_src_ratio;
|
||||||
|
}
|
||||||
|
|
||||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -921,15 +932,6 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
|||||||
case RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES:
|
case RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES:
|
||||||
audio_monitor_adjust_system_rates();
|
audio_monitor_adjust_system_rates();
|
||||||
break;
|
break;
|
||||||
case RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE:
|
|
||||||
{
|
|
||||||
double new_src_ratio = (double)settings->audio.out_rate /
|
|
||||||
audio_driver_data.audio_rate.input;
|
|
||||||
|
|
||||||
audio_driver_data.audio_rate.source_ratio.original = new_src_ratio;
|
|
||||||
audio_driver_data.audio_rate.source_ratio.current = new_src_ratio;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RARCH_AUDIO_CTL_MUTE_TOGGLE:
|
case RARCH_AUDIO_CTL_MUTE_TOGGLE:
|
||||||
if (!audio_driver_context_audio_data)
|
if (!audio_driver_context_audio_data)
|
||||||
return false;
|
return false;
|
||||||
|
@ -45,8 +45,6 @@ enum rarch_audio_ctl_state
|
|||||||
RARCH_AUDIO_CTL_DESTROY_DATA,
|
RARCH_AUDIO_CTL_DESTROY_DATA,
|
||||||
RARCH_AUDIO_CTL_START,
|
RARCH_AUDIO_CTL_START,
|
||||||
RARCH_AUDIO_CTL_STOP,
|
RARCH_AUDIO_CTL_STOP,
|
||||||
/* Sets audio monitor refresh rate to new value. */
|
|
||||||
RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE,
|
|
||||||
RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES,
|
RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES,
|
||||||
RARCH_AUDIO_CTL_MUTE_TOGGLE,
|
RARCH_AUDIO_CTL_MUTE_TOGGLE,
|
||||||
RARCH_AUDIO_CTL_UNSET_CALLBACK,
|
RARCH_AUDIO_CTL_UNSET_CALLBACK,
|
||||||
@ -181,6 +179,9 @@ void audio_driver_setup_rewind(void);
|
|||||||
|
|
||||||
bool audio_driver_set_callback(const void *data);
|
bool audio_driver_set_callback(const void *data);
|
||||||
|
|
||||||
|
/* Sets audio monitor rate to new value. */
|
||||||
|
void audio_driver_monitor_set_rate(void);
|
||||||
|
|
||||||
bool audio_driver_find_driver(void);
|
bool audio_driver_find_driver(void);
|
||||||
|
|
||||||
bool audio_driver_deinit(void);
|
bool audio_driver_deinit(void);
|
||||||
|
2
driver.c
2
driver.c
@ -477,7 +477,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
|||||||
{
|
{
|
||||||
float *hz = (float*)data;
|
float *hz = (float*)data;
|
||||||
video_monitor_set_refresh_rate(*hz);
|
video_monitor_set_refresh_rate(*hz);
|
||||||
audio_driver_ctl(RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE, NULL);
|
audio_driver_monitor_set_rate();
|
||||||
driver_adjust_system_rates();
|
driver_adjust_system_rates();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user