mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 21:36:26 +00:00
Add more RARCH_AUDIO_CTL commands
This commit is contained in:
parent
66d853358a
commit
0972c19f77
@ -436,12 +436,10 @@ void init_audio(void)
|
||||
|
||||
audio_data.buffer_free_samples_count = 0;
|
||||
|
||||
/* Threaded driver is initially stopped. */
|
||||
if (driver->audio_active && !settings->audio.mute_enable &&
|
||||
audio_data.audio_callback.callback)
|
||||
{
|
||||
/* Threaded driver is initially stopped. */
|
||||
driver->audio->start(driver->audio_data);
|
||||
}
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_START, NULL);
|
||||
|
||||
return;
|
||||
|
||||
@ -505,21 +503,7 @@ void audio_driver_readjust_input_rate(void)
|
||||
|
||||
|
||||
|
||||
bool audio_driver_start(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = audio_get_ptr(driver);
|
||||
|
||||
return audio->start(driver->audio_data);
|
||||
}
|
||||
|
||||
bool audio_driver_stop(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = audio_get_ptr(driver);
|
||||
|
||||
return audio->stop(driver->audio_data);
|
||||
}
|
||||
|
||||
void audio_driver_set_nonblock_state(bool toggle)
|
||||
{
|
||||
@ -862,6 +846,10 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_ALIVE:
|
||||
return audio->alive(driver->audio_data);
|
||||
case RARCH_AUDIO_CTL_START:
|
||||
return audio->start(driver->audio_data);
|
||||
case RARCH_AUDIO_CTL_STOP:
|
||||
return audio->stop(driver->audio_data);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -75,6 +75,8 @@ typedef struct audio_driver
|
||||
enum rarch_audio_ctl_state
|
||||
{
|
||||
RARCH_AUDIO_CTL_NONE = 0,
|
||||
RARCH_AUDIO_CTL_START,
|
||||
RARCH_AUDIO_CTL_STOP,
|
||||
RARCH_AUDIO_CTL_ALIVE
|
||||
};
|
||||
|
||||
@ -107,10 +109,6 @@ bool audio_driver_mute_toggle(void);
|
||||
*/
|
||||
void audio_driver_readjust_input_rate(void);
|
||||
|
||||
bool audio_driver_start(void);
|
||||
|
||||
bool audio_driver_stop(void);
|
||||
|
||||
void audio_driver_set_nonblock_state(bool toggle);
|
||||
|
||||
void audio_driver_set_nonblocking_state(bool enable);
|
||||
|
@ -1306,14 +1306,14 @@ bool event_command(enum event_command cmd)
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_ALIVE, NULL))
|
||||
return false;
|
||||
|
||||
if (!audio_driver_stop())
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_STOP, NULL))
|
||||
return false;
|
||||
break;
|
||||
case EVENT_CMD_AUDIO_START:
|
||||
if (!driver->audio_data || audio_driver_ctl(RARCH_AUDIO_CTL_ALIVE, NULL))
|
||||
return false;
|
||||
|
||||
if (!settings->audio.mute_enable && !audio_driver_start())
|
||||
if (!settings->audio.mute_enable && !audio_driver_ctl(RARCH_AUDIO_CTL_START, NULL))
|
||||
{
|
||||
RARCH_ERR("Failed to start audio driver. Will continue without audio.\n");
|
||||
driver->audio_active = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user