mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
(wiiu) Cleanups
This commit is contained in:
parent
a321e4a97b
commit
a8c9cd91d8
@ -48,7 +48,7 @@ typedef struct
|
|||||||
OSSpinLock spinlock;
|
OSSpinLock spinlock;
|
||||||
} ax_audio_t;
|
} ax_audio_t;
|
||||||
|
|
||||||
//3072 samples main buffer, 64ms total
|
/* 3072 samples main buffer, 64ms total */
|
||||||
#define AX_AUDIO_COUNT 3072
|
#define AX_AUDIO_COUNT 3072
|
||||||
#define AX_AUDIO_SIZE (AX_AUDIO_COUNT << 1u)
|
#define AX_AUDIO_SIZE (AX_AUDIO_COUNT << 1u)
|
||||||
|
|
||||||
@ -87,17 +87,18 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
|||||||
unsigned block_frames,
|
unsigned block_frames,
|
||||||
unsigned *new_rate)
|
unsigned *new_rate)
|
||||||
{
|
{
|
||||||
|
AXVoiceOffsets offsets[2];
|
||||||
|
u16 setup_buf[0x30] = {0};
|
||||||
|
setup_buf[0x25] = 2; /* we request 2 channels */
|
||||||
|
AXInitParams init = {AX_INIT_RENDERER_48KHZ, 0, 0};
|
||||||
|
AXVoiceVeData ve = {0xF000, 0};
|
||||||
ax_audio_t* ax = (ax_audio_t*)calloc(1, sizeof(ax_audio_t));
|
ax_audio_t* ax = (ax_audio_t*)calloc(1, sizeof(ax_audio_t));
|
||||||
|
|
||||||
if (!ax)
|
if (!ax)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
AXInitParams init = {AX_INIT_RENDERER_48KHZ, 0, 0};
|
|
||||||
|
|
||||||
AXInitWithParams(&init);
|
AXInitWithParams(&init);
|
||||||
|
|
||||||
u16 setup_buf[0x30] = {0};
|
|
||||||
setup_buf[0x25] = 2; //we request 2 channels
|
|
||||||
AXAcquireMultiVoice(31, NULL, 0, setup_buf, &ax->mvoice);
|
AXAcquireMultiVoice(31, NULL, 0, setup_buf, &ax->mvoice);
|
||||||
|
|
||||||
if (!ax->mvoice || ax->mvoice->channels != 2)
|
if (!ax->mvoice || ax->mvoice->channels != 2)
|
||||||
@ -113,8 +114,7 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
|||||||
DCFlushRange(ax->buffer_l,AX_AUDIO_SIZE);
|
DCFlushRange(ax->buffer_l,AX_AUDIO_SIZE);
|
||||||
DCFlushRange(ax->buffer_r,AX_AUDIO_SIZE);
|
DCFlushRange(ax->buffer_r,AX_AUDIO_SIZE);
|
||||||
|
|
||||||
//shared by both voices
|
/* shared by both voices */
|
||||||
AXVoiceOffsets offsets[2];
|
|
||||||
offsets[0].currentOffset = 0;
|
offsets[0].currentOffset = 0;
|
||||||
offsets[0].loopOffset = 0;
|
offsets[0].loopOffset = 0;
|
||||||
offsets[0].endOffset = AX_AUDIO_COUNT - 1;
|
offsets[0].endOffset = AX_AUDIO_COUNT - 1;
|
||||||
@ -122,7 +122,7 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
|||||||
offsets[0].dataType = AX_VOICE_FORMAT_LPCM16;
|
offsets[0].dataType = AX_VOICE_FORMAT_LPCM16;
|
||||||
memcpy(&offsets[1], &offsets[0], sizeof(AXVoiceOffsets));
|
memcpy(&offsets[1], &offsets[0], sizeof(AXVoiceOffsets));
|
||||||
|
|
||||||
//different buffers per voice
|
/* different buffers per voice */
|
||||||
offsets[0].data = ax->buffer_l;
|
offsets[0].data = ax->buffer_l;
|
||||||
offsets[1].data = ax->buffer_r;
|
offsets[1].data = ax->buffer_r;
|
||||||
AXSetMultiVoiceOffsets(ax->mvoice, offsets);
|
AXSetMultiVoiceOffsets(ax->mvoice, offsets);
|
||||||
@ -130,7 +130,6 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
|||||||
AXSetMultiVoiceSrcType(ax->mvoice, AX_VOICE_SRC_TYPE_NONE);
|
AXSetMultiVoiceSrcType(ax->mvoice, AX_VOICE_SRC_TYPE_NONE);
|
||||||
AXSetMultiVoiceSrcRatio(ax->mvoice, 1.0f);
|
AXSetMultiVoiceSrcRatio(ax->mvoice, 1.0f);
|
||||||
|
|
||||||
AXVoiceVeData ve = {0xF000, 0};
|
|
||||||
AXSetMultiVoiceVe(ax->mvoice, &ve);
|
AXSetMultiVoiceVe(ax->mvoice, &ve);
|
||||||
|
|
||||||
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_DRC, 0, 0, 0x8000, 0);
|
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_DRC, 0, 0, 0x8000, 0);
|
||||||
@ -140,8 +139,7 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
|||||||
|
|
||||||
ax->pos = 0;
|
ax->pos = 0;
|
||||||
ax->written = 0;
|
ax->written = 0;
|
||||||
|
*new_rate = AX_AUDIO_RATE;
|
||||||
config_get_ptr()->audio.out_rate = AX_AUDIO_RATE;
|
|
||||||
|
|
||||||
OSInitSpinLock(&ax->spinlock);
|
OSInitSpinLock(&ax->spinlock);
|
||||||
|
|
||||||
@ -203,10 +201,12 @@ static bool ax_audio_start(void* data)
|
|||||||
|
|
||||||
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
static struct retro_perf_counter ax_audio_write_perf = {0};
|
static struct retro_perf_counter ax_audio_write_perf = {0};
|
||||||
|
size_t countAvail = 0;
|
||||||
ax_audio_t* ax = (ax_audio_t*)data;
|
ax_audio_t* ax = (ax_audio_t*)data;
|
||||||
const uint16_t* src = buf;
|
const uint16_t* src = buf;
|
||||||
int i;
|
int count = size >> 2;
|
||||||
|
|
||||||
if(!size || (size & 0x3))
|
if(!size || (size & 0x3))
|
||||||
return 0;
|
return 0;
|
||||||
@ -215,12 +215,11 @@ static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
|||||||
performance_counter_init(&ax_audio_write_perf, "ax_audio_write");
|
performance_counter_init(&ax_audio_write_perf, "ax_audio_write");
|
||||||
performance_counter_start(&ax_audio_write_perf);
|
performance_counter_start(&ax_audio_write_perf);
|
||||||
|
|
||||||
int count = size >> 2;
|
|
||||||
|
|
||||||
if(count > AX_AUDIO_MAX_FREE)
|
if(count > AX_AUDIO_MAX_FREE)
|
||||||
count = AX_AUDIO_MAX_FREE;
|
count = AX_AUDIO_MAX_FREE;
|
||||||
|
|
||||||
size_t countAvail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
|
countAvail = ((ax->written > AX_AUDIO_MAX_FREE) ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
|
||||||
|
|
||||||
if (ax->nonblocking)
|
if (ax->nonblocking)
|
||||||
{
|
{
|
||||||
//not enough available for 3ms of data
|
//not enough available for 3ms of data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user