mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Only start/stop ps3 audio port if it makes sense.
Might be the cause of issues with threaded audio, might not. (cellAudioStartPort would have been called twice in a row).
This commit is contained in:
parent
c90a8bcfec
commit
f097b93a29
@ -30,6 +30,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
uint32_t audio_port;
|
uint32_t audio_port;
|
||||||
bool nonblocking;
|
bool nonblocking;
|
||||||
|
bool started;
|
||||||
volatile bool quit_thread;
|
volatile bool quit_thread;
|
||||||
fifo_buffer_t *buffer;
|
fifo_buffer_t *buffer;
|
||||||
|
|
||||||
@ -128,6 +129,7 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||||||
sys_lwcond_create(&data->cond, &data->cond_lock, &cond_attr);
|
sys_lwcond_create(&data->cond, &data->cond_lock, &cond_attr);
|
||||||
|
|
||||||
cellAudioPortStart(data->audio_port);
|
cellAudioPortStart(data->audio_port);
|
||||||
|
data->started = true;
|
||||||
sys_ppu_thread_create(&data->thread, event_loop,
|
sys_ppu_thread_create(&data->thread, event_loop,
|
||||||
#ifdef __PSL1GHT__
|
#ifdef __PSL1GHT__
|
||||||
data,
|
data,
|
||||||
@ -163,14 +165,22 @@ static ssize_t ps3_audio_write(void *data, const void *buf, size_t size)
|
|||||||
static bool ps3_audio_stop(void *data)
|
static bool ps3_audio_stop(void *data)
|
||||||
{
|
{
|
||||||
ps3_audio_t *aud = data;
|
ps3_audio_t *aud = data;
|
||||||
|
if (data->started)
|
||||||
|
{
|
||||||
cellAudioPortStop(aud->audio_port);
|
cellAudioPortStop(aud->audio_port);
|
||||||
|
data->started = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ps3_audio_start(void *data)
|
static bool ps3_audio_start(void *data)
|
||||||
{
|
{
|
||||||
ps3_audio_t *aud = data;
|
ps3_audio_t *aud = data;
|
||||||
|
if (!data->started)
|
||||||
|
{
|
||||||
cellAudioPortStart(aud->audio_port);
|
cellAudioPortStart(aud->audio_port);
|
||||||
|
data->started = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,10 +196,10 @@ static void ps3_audio_free(void *data)
|
|||||||
ps3_audio_t *aud = data;
|
ps3_audio_t *aud = data;
|
||||||
|
|
||||||
aud->quit_thread = true;
|
aud->quit_thread = true;
|
||||||
cellAudioPortStart(aud->audio_port);
|
ps3_audio_start(aud);
|
||||||
sys_ppu_thread_join(aud->thread, &val);
|
sys_ppu_thread_join(aud->thread, &val);
|
||||||
|
|
||||||
cellAudioPortStop(aud->audio_port);
|
ps3_audio_stop(aud);
|
||||||
cellAudioPortClose(aud->audio_port);
|
cellAudioPortClose(aud->audio_port);
|
||||||
cellAudioQuit();
|
cellAudioQuit();
|
||||||
fifo_free(aud->buffer);
|
fifo_free(aud->buffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user