mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 16:20:39 +00:00
[PS2] Some audio improvements
This commit is contained in:
parent
7f726fc1eb
commit
27ab4ac78b
@ -23,13 +23,12 @@
|
|||||||
|
|
||||||
#include "../audio_driver.h"
|
#include "../audio_driver.h"
|
||||||
|
|
||||||
#define AUDIO_BUFFER 64 * 1024
|
#define AUDIO_BUFFER 128 * 1024
|
||||||
#define AUDIO_CHANNELS 2
|
#define AUDIO_CHANNELS 2
|
||||||
#define AUDIO_BITS 16
|
#define AUDIO_BITS 16
|
||||||
|
|
||||||
typedef struct ps2_audio
|
typedef struct ps2_audio
|
||||||
{
|
{
|
||||||
fifo_buffer_t* buffer;
|
|
||||||
bool nonblocking;
|
bool nonblocking;
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
@ -82,21 +81,15 @@ static void ps2_audio_free(void *data)
|
|||||||
|
|
||||||
static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
|
static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
|
||||||
{
|
{
|
||||||
|
int bytes_sent;
|
||||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||||
|
|
||||||
if (!ps2->running)
|
if (!ps2->running)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ps2->nonblocking)
|
bytes_sent = audsrv_play_audio(buf, size);
|
||||||
{
|
|
||||||
if (fifo_write_avail(ps2->buffer) < size)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
audsrv_wait_audio(size);
|
return bytes_sent;
|
||||||
audsrv_play_audio(buf, size);
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ps2_audio_alive(void *data)
|
static bool ps2_audio_alive(void *data)
|
||||||
|
@ -248,6 +248,7 @@ static void frontend_ps2_deinit(void *data)
|
|||||||
padEnd();
|
padEnd();
|
||||||
audsrv_quit();
|
audsrv_quit();
|
||||||
fileXioExit();
|
fileXioExit();
|
||||||
|
Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frontend_ps2_exec(const char *path, bool should_load_game)
|
static void frontend_ps2_exec(const char *path, bool should_load_game)
|
||||||
|
@ -222,8 +222,8 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i
|
|||||||
#elif defined(__CELLOS_LV2__) || defined(_MSC_VER) && _MSC_VER <= 1310
|
#elif defined(__CELLOS_LV2__) || defined(_MSC_VER) && _MSC_VER <= 1310
|
||||||
return fseek(stream->fp, (long)offset, whence);
|
return fseek(stream->fp, (long)offset, whence);
|
||||||
#elif defined(PS2)
|
#elif defined(PS2)
|
||||||
int64_t ret = fioLseek(fileno(stream->fp), (off_t)offset, whence);
|
int64_t ret = fileXioLseek(fileno(stream->fp), (off_t)offset, whence);
|
||||||
/* fioLseek could return positive numbers */
|
/* fileXioLseek could return positive numbers */
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ bool waitUntilDeviceIsReady(enum BootDeviceIDs device_id)
|
|||||||
|
|
||||||
while(openFile < 0 && retries > 0)
|
while(openFile < 0 && retries > 0)
|
||||||
{
|
{
|
||||||
openFile = fioDopen(rootDevice);
|
openFile = fileXioDopen(rootDevice);
|
||||||
/* Wait untill the device is ready */
|
/* Wait untill the device is ready */
|
||||||
nopdelay();
|
nopdelay();
|
||||||
nopdelay();
|
nopdelay();
|
||||||
@ -172,7 +172,7 @@ bool waitUntilDeviceIsReady(enum BootDeviceIDs device_id)
|
|||||||
retries--;
|
retries--;
|
||||||
};
|
};
|
||||||
|
|
||||||
fioDclose(openFile);
|
fileXioDclose(openFile);
|
||||||
|
|
||||||
return openFile >= 0;
|
return openFile >= 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user