[PS2] Some audio improvements

This commit is contained in:
Francisco Javier Trujillo Mata 2019-03-06 20:11:15 +01:00
parent 7f726fc1eb
commit 27ab4ac78b
4 changed files with 9 additions and 15 deletions

View File

@ -23,13 +23,12 @@
#include "../audio_driver.h"
#define AUDIO_BUFFER 64 * 1024
#define AUDIO_BUFFER 128 * 1024
#define AUDIO_CHANNELS 2
#define AUDIO_BITS 16
typedef struct ps2_audio
{
fifo_buffer_t* buffer;
bool nonblocking;
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)
{
int bytes_sent;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (!ps2->running)
return -1;
if (ps2->nonblocking)
{
if (fifo_write_avail(ps2->buffer) < size)
return 0;
}
bytes_sent = audsrv_play_audio(buf, size);
audsrv_wait_audio(size);
audsrv_play_audio(buf, size);
return size;
return bytes_sent;
}
static bool ps2_audio_alive(void *data)

View File

@ -248,6 +248,7 @@ static void frontend_ps2_deinit(void *data)
padEnd();
audsrv_quit();
fileXioExit();
Exit(0);
}
static void frontend_ps2_exec(const char *path, bool should_load_game)

View File

@ -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
return fseek(stream->fp, (long)offset, whence);
#elif defined(PS2)
int64_t ret = fioLseek(fileno(stream->fp), (off_t)offset, whence);
/* fioLseek could return positive numbers */
int64_t ret = fileXioLseek(fileno(stream->fp), (off_t)offset, whence);
/* fileXioLseek could return positive numbers */
if (ret > 0) {
ret = 0;
}

View File

@ -158,7 +158,7 @@ bool waitUntilDeviceIsReady(enum BootDeviceIDs device_id)
while(openFile < 0 && retries > 0)
{
openFile = fioDopen(rootDevice);
openFile = fileXioDopen(rootDevice);
/* Wait untill the device is ready */
nopdelay();
nopdelay();
@ -172,7 +172,7 @@ bool waitUntilDeviceIsReady(enum BootDeviceIDs device_id)
retries--;
};
fioDclose(openFile);
fileXioDclose(openFile);
return openFile >= 0;
}