diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 3391a8d304..dece4cfee9 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -953,6 +953,20 @@ bool audio_driver_stop(void) return current_audio->stop(audio_driver_context_audio_data); } +void audio_driver_unset_callback(void) +{ + audio_callback.callback = NULL; + audio_callback.set_state = NULL; +} + +bool audio_driver_alive(void) +{ + if (!current_audio || !current_audio->alive + || !audio_driver_context_audio_data) + return false; + return current_audio->alive(audio_driver_context_audio_data); +} + bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data) { switch (state) @@ -965,15 +979,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_UNSET_CALLBACK: - audio_callback.callback = NULL; - audio_callback.set_state = NULL; - break; - case RARCH_AUDIO_CTL_ALIVE: - if (!current_audio || !current_audio->alive - || !audio_driver_context_audio_data) - return false; - return current_audio->alive(audio_driver_context_audio_data); case RARCH_AUDIO_CTL_SET_OWN_DRIVER: audio_driver_data_own = true; break; diff --git a/audio/audio_driver.h b/audio/audio_driver.h index e3eeafc08e..fc33d95225 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -42,8 +42,6 @@ enum rarch_audio_ctl_state RARCH_AUDIO_CTL_NONE = 0, RARCH_AUDIO_CTL_DESTROY, RARCH_AUDIO_CTL_DESTROY_DATA, - RARCH_AUDIO_CTL_UNSET_CALLBACK, - RARCH_AUDIO_CTL_ALIVE, RARCH_AUDIO_CTL_FRAME_IS_REVERSE, RARCH_AUDIO_CTL_SET_OWN_DRIVER, RARCH_AUDIO_CTL_UNSET_OWN_DRIVER, @@ -189,6 +187,10 @@ bool audio_driver_start(void); bool audio_driver_stop(void); +void audio_driver_unset_callback(void); + +bool audio_driver_alive(void); + bool audio_driver_deinit(void); bool audio_driver_init(void); diff --git a/command_event.c b/command_event.c index a5065dc23a..6859f17908 100644 --- a/command_event.c +++ b/command_event.c @@ -1211,14 +1211,14 @@ bool event_cmd_ctl(enum event_command cmd, void *data) event_save_auto_state(); break; case EVENT_CMD_AUDIO_STOP: - if (!audio_driver_ctl(RARCH_AUDIO_CTL_ALIVE, NULL)) + if (!audio_driver_alive()) return false; if (!audio_driver_stop()) return false; break; case EVENT_CMD_AUDIO_START: - if (audio_driver_ctl(RARCH_AUDIO_CTL_ALIVE, NULL)) + if (!audio_driver_alive()) return false; if (!settings->audio.mute_enable && !audio_driver_start()) diff --git a/runloop.c b/runloop.c index 72d1f9e4ae..32ce249a2e 100644 --- a/runloop.c +++ b/runloop.c @@ -707,7 +707,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) runloop_key_event = NULL; runloop_frontend_key_event = NULL; - audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_CALLBACK, NULL); + audio_driver_unset_callback(); memset(&runloop_system, 0, sizeof(rarch_system_info_t)); break; case RUNLOOP_CTL_SET_FRAME_TIME_LAST: