mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
Get rid of runloop_ctl calls inside audio drivers
This commit is contained in:
parent
d4b7edff4a
commit
90bc170829
@ -470,7 +470,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
&& !settings->audio.mute_enable
|
||||
&& audio_cb_inited
|
||||
)
|
||||
audio_driver_start();
|
||||
audio_driver_start(false);
|
||||
|
||||
return true;
|
||||
|
||||
@ -968,12 +968,12 @@ bool audio_driver_toggle_mute(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool audio_driver_start(void)
|
||||
bool audio_driver_start(bool is_shutdown)
|
||||
{
|
||||
if (!current_audio || !current_audio->start
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
return current_audio->start(audio_driver_context_audio_data);
|
||||
return current_audio->start(audio_driver_context_audio_data, is_shutdown);
|
||||
}
|
||||
|
||||
bool audio_driver_stop(void)
|
||||
|
@ -55,7 +55,7 @@ typedef struct audio_driver
|
||||
bool (*stop)(void *data);
|
||||
|
||||
/* Starts driver. */
|
||||
bool (*start)(void *data);
|
||||
bool (*start)(void *data, bool is_shutdown);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
@ -171,7 +171,7 @@ bool audio_driver_find_driver(void);
|
||||
|
||||
bool audio_driver_toggle_mute(void);
|
||||
|
||||
bool audio_driver_start(void);
|
||||
bool audio_driver_start(bool is_shutdown);
|
||||
|
||||
bool audio_driver_stop(void);
|
||||
|
||||
|
@ -35,6 +35,7 @@ typedef struct audio_thread
|
||||
bool stopped;
|
||||
bool stopped_ack;
|
||||
bool is_paused;
|
||||
bool is_shutdown;
|
||||
bool use_float;
|
||||
|
||||
int inited;
|
||||
@ -100,7 +101,7 @@ static void audio_thread_loop(void *data)
|
||||
|
||||
scond_wait(thr->cond, thr->lock);
|
||||
}
|
||||
thr->driver->start(thr->driver_data);
|
||||
thr->driver->start(thr->driver_data, thr->is_shutdown);
|
||||
}
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
@ -197,7 +198,7 @@ static bool audio_thread_stop(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool audio_thread_start(void *data)
|
||||
static bool audio_thread_start(void *data, bool is_shutdown)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
|
||||
@ -206,7 +207,8 @@ static bool audio_thread_start(void *data)
|
||||
|
||||
audio_driver_enable_callback();
|
||||
|
||||
thr->is_paused = false;
|
||||
thr->is_paused = false;
|
||||
thr->is_shutdown = is_shutdown;
|
||||
audio_thread_unblock(thr);
|
||||
|
||||
return true;
|
||||
|
@ -271,7 +271,7 @@ static void alsa_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_start(void *data)
|
||||
static bool alsa_start(void *data, bool is_shutdown)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static bool alsa_qsa_alive(void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool alsa_qsa_start(void *data)
|
||||
static bool alsa_qsa_start(void *data, bool is_shutdown)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
|
@ -318,7 +318,7 @@ static void alsa_thread_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_thread_start(void *data)
|
||||
static bool alsa_thread_start(void *data, bool is_shutdown)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
|
||||
|
@ -397,7 +397,7 @@ static bool coreaudio_stop(void *data)
|
||||
return dev->is_paused ? true : false;
|
||||
}
|
||||
|
||||
static bool coreaudio_start(void *data)
|
||||
static bool coreaudio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (!dev)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#include "../../performance_counters.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -242,14 +241,13 @@ static bool ctr_csnd_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_start(void *data)
|
||||
static bool ctr_csnd_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
if (is_shutdown)
|
||||
return true;
|
||||
|
||||
#if 0
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../performance_counters.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
@ -162,14 +161,13 @@ static bool ctr_dsp_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_start(void *data)
|
||||
static bool ctr_dsp_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
if (is_shutdown)
|
||||
return true;
|
||||
|
||||
ndspSetMasterVol(1.0);
|
||||
|
@ -396,7 +396,7 @@ static bool dsound_stop(void *data)
|
||||
return (ds->is_paused) ? true : false;
|
||||
}
|
||||
|
||||
static bool dsound_start(void *data)
|
||||
static bool dsound_start(void *data, bool is_shutdown)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
|
@ -173,7 +173,7 @@ static void gx_audio_set_nonblock_state(void *data, bool state)
|
||||
wa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool gx_audio_start(void *data)
|
||||
static bool gx_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)data;
|
||||
|
||||
|
@ -322,7 +322,7 @@ static void ja_set_nonblock_state(void *data, bool state)
|
||||
jd->nonblock = state;
|
||||
}
|
||||
|
||||
static bool ja_start(void *data)
|
||||
static bool ja_start(void *data, bool is_shutdown)
|
||||
{
|
||||
jack_t *jd = (jack_t*)data;
|
||||
if (jd)
|
||||
|
@ -55,7 +55,7 @@ static bool null_audio_alive(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool null_audio_start(void *data)
|
||||
static bool null_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
|
@ -235,7 +235,7 @@ static void al_set_nonblock_state(void *data, bool state)
|
||||
al->nonblock = state;
|
||||
}
|
||||
|
||||
static bool al_start(void *data)
|
||||
static bool al_start(void *data, bool is_shutdown)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
if (al)
|
||||
|
@ -221,7 +221,7 @@ static void sl_set_nonblock_state(void *data, bool state)
|
||||
sl->nonblock = state;
|
||||
}
|
||||
|
||||
static bool sl_start(void *data)
|
||||
static bool sl_start(void *data, bool is_shutdown)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_PLAYING)
|
||||
|
@ -125,7 +125,7 @@ static bool oss_stop(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool oss_start(void *data)
|
||||
static bool oss_start(void *data, bool is_shutdown)
|
||||
{
|
||||
(void)data;
|
||||
oss_is_paused = false;
|
||||
|
@ -177,7 +177,7 @@ static bool ps3_audio_stop(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ps3_audio_start(void *data)
|
||||
static bool ps3_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
ps3_audio_t *aud = data;
|
||||
if (!aud->started)
|
||||
|
@ -285,7 +285,7 @@ static bool psp_audio_stop(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool psp_audio_start(void *data)
|
||||
static bool psp_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
SceKernelThreadInfo info;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
@ -291,7 +291,7 @@ static bool pulse_alive(void *data)
|
||||
return !pa->is_paused;
|
||||
}
|
||||
|
||||
static bool pulse_start(void *data)
|
||||
static bool pulse_start(void *data, bool is_shutdown)
|
||||
{
|
||||
bool ret;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
@ -109,7 +109,7 @@ static void ra_set_nonblock_state(void *data, bool state)
|
||||
roar->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ra_start(void *data)
|
||||
static bool ra_start(void *data, bool is_shutdown)
|
||||
{
|
||||
roar_t *roar = (roar_t*)data;
|
||||
if (roar)
|
||||
|
@ -177,7 +177,7 @@ static bool rs_alive(void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rs_start(void *data)
|
||||
static bool rs_start(void *data, bool is_shutdown)
|
||||
{
|
||||
rsd_t *rsd = (rsd_t*)data;
|
||||
if (rsd_start(rsd->rd) < 0)
|
||||
|
@ -76,7 +76,7 @@ static bool rwebaudio_alive(void *data)
|
||||
return !rwebaudio_is_paused;
|
||||
}
|
||||
|
||||
static bool rwebaudio_start(void *data)
|
||||
static bool rwebaudio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
(void)data;
|
||||
rwebaudio_is_paused = false;
|
||||
|
@ -203,7 +203,7 @@ static bool sdl_audio_alive(void *data)
|
||||
return !sdl->is_paused;
|
||||
}
|
||||
|
||||
static bool sdl_audio_start(void *data)
|
||||
static bool sdl_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
sdl->is_paused = false;
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "performance_counters.h"
|
||||
#include "runloop.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -180,14 +179,13 @@ static int ax_audio_limit(int in)
|
||||
return in;
|
||||
}
|
||||
|
||||
static bool ax_audio_start(void* data)
|
||||
static bool ax_audio_start(void* data, bool is_shutdown)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
if (is_shutdown)
|
||||
return true;
|
||||
|
||||
//set back to playing on enough buffered data
|
||||
|
@ -316,7 +316,7 @@ static void xa_set_nonblock_state(void *data, bool state)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xa_start(void *data)
|
||||
static bool xa_start(void *data, bool is_shutdown)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
xa->is_paused = false;
|
||||
|
@ -112,7 +112,7 @@ static void xenon360_audio_set_nonblock_state(void *data, bool state)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xenon360_audio_start(void *data)
|
||||
static bool xenon360_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
xenon_audio_t *xa = data;
|
||||
xa->is_paused = false;
|
||||
|
@ -2055,7 +2055,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
if (audio_driver_alive())
|
||||
return false;
|
||||
|
||||
if (settings && !settings->audio.mute_enable && !audio_driver_start())
|
||||
if (settings && !settings->audio.mute_enable && !audio_driver_start(runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)))
|
||||
{
|
||||
RARCH_ERR("%s\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_START_AUDIO_DRIVER));
|
||||
|
Loading…
Reference in New Issue
Block a user