mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 05:16:18 +00:00
(audio driver) Refactors
This commit is contained in:
parent
8b714d2932
commit
8125579b7c
@ -874,7 +874,7 @@ bool audio_driver_set_callback(const void *data)
|
||||
|
||||
bool audio_driver_enable_callback(void)
|
||||
{
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
if (!audio_driver_has_callback())
|
||||
return false;
|
||||
if (audio_callback.set_state)
|
||||
audio_callback.set_state(true);
|
||||
@ -883,7 +883,7 @@ bool audio_driver_enable_callback(void)
|
||||
|
||||
bool audio_driver_disable_callback(void)
|
||||
{
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
if (!audio_driver_has_callback())
|
||||
return false;
|
||||
|
||||
if (audio_callback.set_state)
|
||||
@ -902,6 +902,22 @@ void audio_driver_monitor_set_rate(void)
|
||||
audio_driver_data.audio_rate.source_ratio.current = new_src_ratio;
|
||||
}
|
||||
|
||||
bool audio_driver_callback(void)
|
||||
{
|
||||
if (!audio_driver_has_callback())
|
||||
return false;
|
||||
|
||||
if (audio_callback.callback)
|
||||
audio_callback.callback();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool audio_driver_has_callback(void)
|
||||
{
|
||||
return audio_callback.callback;
|
||||
}
|
||||
|
||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -916,15 +932,6 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
case RARCH_AUDIO_CTL_DESTROY_DATA:
|
||||
audio_driver_context_audio_data = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_HAS_CALLBACK:
|
||||
return audio_callback.callback;
|
||||
case RARCH_AUDIO_CTL_CALLBACK:
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
return false;
|
||||
|
||||
if (audio_callback.callback)
|
||||
audio_callback.callback();
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_UNSET_CALLBACK:
|
||||
audio_callback.callback = NULL;
|
||||
audio_callback.set_state = NULL;
|
||||
|
@ -48,8 +48,6 @@ enum rarch_audio_ctl_state
|
||||
RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES,
|
||||
RARCH_AUDIO_CTL_MUTE_TOGGLE,
|
||||
RARCH_AUDIO_CTL_UNSET_CALLBACK,
|
||||
RARCH_AUDIO_CTL_CALLBACK,
|
||||
RARCH_AUDIO_CTL_HAS_CALLBACK,
|
||||
RARCH_AUDIO_CTL_ALIVE,
|
||||
RARCH_AUDIO_CTL_FRAME_IS_REVERSE,
|
||||
RARCH_AUDIO_CTL_SET_OWN_DRIVER,
|
||||
@ -179,6 +177,10 @@ void audio_driver_setup_rewind(void);
|
||||
|
||||
bool audio_driver_set_callback(const void *data);
|
||||
|
||||
bool audio_driver_callback(void);
|
||||
|
||||
bool audio_driver_has_callback(void);
|
||||
|
||||
/* Sets audio monitor rate to new value. */
|
||||
void audio_driver_monitor_set_rate(void);
|
||||
|
||||
|
@ -102,7 +102,7 @@ static void audio_thread_loop(void *data)
|
||||
}
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_CALLBACK, NULL);
|
||||
audio_driver_callback();
|
||||
}
|
||||
|
||||
RARCH_LOG("[Audio Thread]: Tearing down driver.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user