mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(psp_audio.c) Cut down on ifdefs
This commit is contained in:
parent
87d5fe2092
commit
43ff75fd72
@ -190,20 +190,24 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
|||||||
uint16_t write_pos = psp->write_pos;
|
uint16_t write_pos = psp->write_pos;
|
||||||
uint16_t sampleCount = size / sizeof(uint32_t);
|
uint16_t sampleCount = size / sizeof(uint32_t);
|
||||||
|
|
||||||
#ifdef VITA
|
|
||||||
if (psp->nonblocking)
|
if (psp->nonblocking)
|
||||||
{
|
{
|
||||||
|
#ifdef VITA
|
||||||
if (AUDIO_BUFFER_SIZE - ((uint16_t)
|
if (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
/* TODO */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VITA
|
||||||
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size){
|
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
||||||
sceKernelWaitLwCond((struct SceKernelLwCondWork*)&psp->cond, 0);
|
sceKernelWaitLwCond((struct SceKernelLwCondWork*)&psp->cond, 0);
|
||||||
}
|
|
||||||
|
|
||||||
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
||||||
{
|
{
|
||||||
@ -219,36 +223,13 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
|||||||
write_pos += sampleCount;
|
write_pos += sampleCount;
|
||||||
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
||||||
psp->write_pos = write_pos;
|
psp->write_pos = write_pos;
|
||||||
|
|
||||||
|
#ifdef VITA
|
||||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
#else
|
#else
|
||||||
|
return sampleCount;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (psp->nonblocking)
|
|
||||||
{
|
|
||||||
/* TODO */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
|
||||||
{
|
|
||||||
memcpy(psp->buffer + write_pos, buf,
|
|
||||||
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
|
|
||||||
memcpy(psp->buffer, (uint32_t*) buf +
|
|
||||||
(AUDIO_BUFFER_SIZE - write_pos),
|
|
||||||
(write_pos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
memcpy(psp->buffer + write_pos, buf, size);
|
|
||||||
|
|
||||||
write_pos += sampleCount;
|
|
||||||
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
|
||||||
psp->write_pos = write_pos;
|
|
||||||
|
|
||||||
return sampleCount;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user