Implement sceAudioSRCChReserve/Release/OutputBlocking

This commit is contained in:
raven02 2013-01-24 23:29:49 +08:00
parent 6ca6fdd02a
commit 2a1e366d33

View file

@ -28,6 +28,7 @@
// We simply map it to the first of the 8 channels. // We simply map it to the first of the 8 channels.
AudioChannel chans[8]; AudioChannel chans[8];
int src;
// Enqueues the buffer pointer on the channel. If channel buffer queue is full (2 items?) will block until it isn't. // Enqueues the buffer pointer on the channel. If channel buffer queue is full (2 items?) will block until it isn't.
// For solid audio output we'll need a queue length of 2 buffers at least, we'll try that first. // For solid audio output we'll need a queue length of 2 buffers at least, we'll try that first.
@ -37,17 +38,16 @@ AudioChannel chans[8];
u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) { u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
if (samplePtr == 0) { if (samplePtr == 0) {
ERROR_LOG(HLE, "sceAudioOutputBlocking - Sample pointer null"); ERROR_LOG(HLE, "sceAudioOutputBlocking() - Sample pointer null");
return 0; return 0;
} } else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) { ERROR_LOG(HLE,"sceAudioOutputBlocking() - bad channel");
ERROR_LOG(HLE,"sceAudioOutputBlocking() - BAD CHANNEL");
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} else if (!chans[chan].reserved) { } else if (!chans[chan].reserved) {
ERROR_LOG(HLE,"sceAudioOutputBlocking() - channel not reserved"); ERROR_LOG(HLE,"sceAudioOutputBlocking() - channel not reserved");
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} else { } else {
DEBUG_LOG(HLE, "sceAudioOutputBlocking(%d, %d, %08x )",chan,vol,samplePtr); DEBUG_LOG(HLE, "sceAudioOutputBlocking(%08x, %08x, %08x)", chan, vol, samplePtr);
chans[chan].leftVolume = vol; chans[chan].leftVolume = vol;
chans[chan].rightVolume = vol; chans[chan].rightVolume = vol;
chans[chan].sampleAddress = samplePtr; chans[chan].sampleAddress = samplePtr;
@ -55,285 +55,262 @@ u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
} }
} }
u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr) { u32 sceAudioOutputPannedBlocking(u32 chan, u32 leftvol, u32 rightvol, u32 samplePtr) {
if (samplePtr == 0) { if (samplePtr == 0) {
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking - Sample pointer null"); ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - Sample pointer null");
return 0; return 0;
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) { } else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL"); ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - bad channel");
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} else if (!chans[chan].reserved) { } else if (!chans[chan].reserved) {
ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - CHANNEL NOT RESERVED"); ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - channel not reserved");
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} else { } else {
DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr); DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr);
chans[chan].leftVolume = volume1; chans[chan].leftVolume = leftvol;
chans[chan].rightVolume = volume2; chans[chan].rightVolume = rightvol;
chans[chan].sampleAddress = samplePtr; chans[chan].sampleAddress = samplePtr;
return __AudioEnqueue(chans[chan], chan, true); return __AudioEnqueue(chans[chan], chan, true);
} }
} }
u32 sceAudioOutput(u32 chan, u32 vol, u32 samplePtr) u32 sceAudioOutput(u32 chan, u32 vol, u32 samplePtr) {
{ if (samplePtr == 0) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) { ERROR_LOG(HLE, "sceAudioOutput() - Sample pointer null");
ERROR_LOG(HLE,"sceAudioOutput() - BAD CHANNEL"); return 0;
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
ERROR_LOG(HLE,"sceAudioOutput() - bad channel");
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} } else if (!chans[chan].reserved) {
else if (!chans[chan].reserved) ERROR_LOG(HLE,"sceAudioOutput(%08x, %08x, %08x) - channel not reserved", chan, vol, samplePtr);
{
ERROR_LOG(HLE,"sceAudioOutput(%d, %d, %08x) - channel not reserved", chan, vol, samplePtr);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} } else {
else DEBUG_LOG(HLE, "sceAudioOutputPanned(%08x, %08x, %08x)", chan, vol, samplePtr);
{
chans[chan].leftVolume = vol; chans[chan].leftVolume = vol;
chans[chan].rightVolume = vol; chans[chan].rightVolume = vol;
chans[chan].sampleAddress = samplePtr; chans[chan].sampleAddress = samplePtr;
u32 retval = __AudioEnqueue(chans[chan], chan, false); return __AudioEnqueue(chans[chan], chan, false);
DEBUG_LOG(HLE, "%08x=sceAudioOutputPanned(%d, %d, %08x)", retval, chan, vol, samplePtr);
return retval;
} }
} }
u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr) u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr) {
{ if (samplePtr == 0) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - Sample pointer null");
{ return 0;
ERROR_LOG(HLE,"sceAudioOutputPanned() - BAD CHANNEL"); } else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
ERROR_LOG(HLE,"sceAudioOutputPanned() - bad channel");
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} } else if (!chans[chan].reserved) {
else if (!chans[chan].reserved) ERROR_LOG(HLE,"sceAudioOutputPanned(%08x, %08x, %08x, %08x) - channel not reserved", chan, leftVol, rightVol, samplePtr);
{
ERROR_LOG(HLE,"sceAudioOutputPanned(%d, %d, %d, %08x) - channel not reserved", chan, leftVol, rightVol, samplePtr);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} } else {
else DEBUG_LOG(HLE,"sceAudioOutputPanned(%08x, %08x, %08x, %08x)", chan, leftVol, rightVol, samplePtr);
{
chans[chan].leftVolume = leftVol; chans[chan].leftVolume = leftVol;
chans[chan].rightVolume = rightVol; chans[chan].rightVolume = rightVol;
chans[chan].sampleAddress = samplePtr; chans[chan].sampleAddress = samplePtr;
u32 retval = __AudioEnqueue(chans[chan], chan, false); return __AudioEnqueue(chans[chan], chan, false);
DEBUG_LOG(HLE, "%08x=sceAudioOutputPanned(%d, %d, %d, %08x)", retval, chan, leftVol, rightVol, samplePtr);
return retval;
} }
} }
int sceAudioGetChannelRestLen(u32 chan) int sceAudioGetChannelRestLen(u32 chan) {
{ if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE, "sceAudioGetChannelRestLen(%08x) - bad channel", chan);
{
ERROR_LOG(HLE, "sceAudioGetChannelRestLen(%i) - BAD CHANNEL", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} }
DEBUG_LOG(HLE,"sceAudioGetChannelRestLen(%08x)", chan);
int sz = (int)chans[chan].sampleQueue.size() / 2; return (int)chans[chan].sampleQueue.size() / 2;
DEBUG_LOG(HLE,"UNTESTED %i = sceAudioGetChannelRestLen(%i)", sz, chan);
return sz;
} }
int sceAudioGetChannelRestLength(u32 chan) int sceAudioGetChannelRestLength(u32 chan) {
{ if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE, "sceAudioGetChannelRestLength(%08x) - bad channel", chan);
{
ERROR_LOG(HLE, "sceAudioGetChannelRestLength(%i) - BAD CHANNEL", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} }
DEBUG_LOG(HLE,"sceAudioGetChannelRestLength(%08x)", chan);
int sz = (int)chans[chan].sampleQueue.size() / 2; return (int)chans[chan].sampleQueue.size() / 2;
DEBUG_LOG(HLE,"UNTESTED %i = sceAudioGetChannelRestLen(%i)", sz, chan);
return sz;
} }
static int GetFreeChannel() static int GetFreeChannel() {
{
for (int i = 0; i < PSP_AUDIO_CHANNEL_MAX ; i++) for (int i = 0; i < PSP_AUDIO_CHANNEL_MAX ; i++)
if (!chans[i].reserved) if (!chans[i].reserved)
return i; return i;
return -1; return -1;
} }
u32 sceAudioChReserve(u32 channel, u32 sampleCount, u32 format) //.Allocate sound channel u32 sceAudioChReserve(u32 chan, u32 sampleCount, u32 format) {
{ if (chan == (u32)-1) {
if (channel == (u32)-1) chan = GetFreeChannel();
{ } else {
channel = GetFreeChannel(); ERROR_LOG(HLE,"sceAudioChReserve - reserve channel failed");
}
else
{
ERROR_LOG(HLE,"sceAudioChReserve failed");
return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE; return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
} }
if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (channel >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE ,"sceAudioChReserve(%08x, %08x, %08x) - bad channel", chan, sampleCount, format);
{
ERROR_LOG(HLE ,"sceAudioChReserve(channel = %d, sampleCount = %d, format = %d) - BAD CHANNEL", channel, sampleCount, format);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} }
if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO) {
if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO) ERROR_LOG(HLE, "sceAudioChReserve(%08x, %08x, %08x) - invalid format", chan, sampleCount, format);
{
ERROR_LOG(HLE, "sceAudioChReserve(channel = %d, sampleCount = %d, format = %d): invalid format", channel, sampleCount, format);
return SCE_ERROR_AUDIO_INVALID_FORMAT; return SCE_ERROR_AUDIO_INVALID_FORMAT;
} }
if (chans[chan].reserved) {
if (chans[channel].reserved) WARN_LOG(HLE, "WARNING: Reserving already reserved channel.");
{
WARN_LOG(HLE, "WARNING: Reserving already reserved channel. Error?");
}
DEBUG_LOG(HLE, "sceAudioChReserve(channel = %d, sampleCount = %d, format = %d)", channel, sampleCount, format);
chans[channel].sampleCount = sampleCount;
chans[channel].reserved = true;
return channel; //return handle
} }
u32 sceAudioChRelease(u32 chan) DEBUG_LOG(HLE, "sceAudioChReserve(%08x, %08x, %08x)", chan, sampleCount, format);
{ chans[chan].sampleCount = sampleCount;
if (chan >= PSP_AUDIO_CHANNEL_MAX) chans[chan].reserved = true;
{ return chan;
ERROR_LOG(HLE, "sceAudioChRelease(%i) - BAD CHANNEL", chan); }
u32 sceAudioChRelease(u32 chan) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) {
ERROR_LOG(HLE, "sceAudioChRelease(%i) - bad channel", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} }
if (!chans[chan].reserved) if (!chans[chan].reserved) {
{ ERROR_LOG(HLE,"sceAudioChRelease(%i) - channel not reserved", chan);
ERROR_LOG(HLE,"sceAudioChRelease(%i): channel not reserved", chan);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} }
chans[chan].reserved = false;
DEBUG_LOG(HLE, "sceAudioChRelease(%i)", chan); DEBUG_LOG(HLE, "sceAudioChRelease(%i)", chan);
chans[chan].reserved = false;
return 1; return 1;
} }
u32 sceAudioSetChannelDataLen(u32 chan, u32 len) u32 sceAudioSetChannelDataLen(u32 chan, u32 len) {
{ if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%08x, %08x) - bad channel", chan, len);
{
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - BAD CHANNEL", chan, len);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} } else if (!chans[chan].reserved) {
else if (!chans[chan].reserved) ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%08x, %08x) - channel not reserved", chan, len);
{
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - channel not reserved", chan, len);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} } else {
else DEBUG_LOG(HLE, "sceAudioSetChannelDataLen(%08x, %08x)", chan, len);
{
DEBUG_LOG(HLE, "sceAudioSetChannelDataLen(%i, %i)", chan, len);
chans[chan].sampleCount = len; chans[chan].sampleCount = len;
return 0; return 0;
} }
} }
u32 sceAudioChangeChannelConfig(u32 chan, u32 format) u32 sceAudioChangeChannelConfig(u32 chan, u32 format) {
{ if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%08x, %08x) - invalid channel number", chan, format);
{
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - invalid channel number", chan, format);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} } else if (!chans[chan].reserved) {
else if (!chans[chan].reserved) ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%08x, %08x) - channel not reserved", chan, format);
{
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - channel not reserved", chan, format);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} } else {
else DEBUG_LOG(HLE, "sceAudioChangeChannelConfig(%08x, %08x)", chan, format);
{
DEBUG_LOG(HLE, "sceAudioChangeChannelConfig(%i, %i)", chan, format);
chans[chan].format = format; chans[chan].format = format;
return 0; return 0;
} }
} }
u32 sceAudioChangeChannelVolume(u32 chan, u32 lvolume, u32 rvolume) u32 sceAudioChangeChannelVolume(u32 chan, u32 leftvol, u32 rightvol) {
{ if (chan >= PSP_AUDIO_CHANNEL_MAX) {
if (chan >= PSP_AUDIO_CHANNEL_MAX) ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%08x, %08x, %08x) - invalid channel number", chan, leftvol, rightvol);
{
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - invalid channel number", chan, lvolume, rvolume);
return SCE_ERROR_AUDIO_INVALID_CHANNEL; return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} } else if (!chans[chan].reserved) {
else if (!chans[chan].reserved) ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%08x, %08x, %08x) - channel not reserved", chan, leftvol, rightvol);
{
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - channel not reserved", chan, lvolume, rvolume);
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
} } else {
else DEBUG_LOG(HLE, "sceAudioChangeChannelVolume(%08x, %08x, %08x)", chan, leftvol, rightvol);
{ chans[chan].leftVolume = leftvol;
DEBUG_LOG(HLE, "sceAudioChangeChannelVolume(%i, %i, %i)", chan, lvolume, rvolume); chans[chan].rightVolume = rightvol;
chans[chan].leftVolume = lvolume;
chans[chan].rightVolume = rvolume;
return 0; return 0;
} }
} }
u32 sceAudioInit() u32 sceAudioInit(){
{
DEBUG_LOG(HLE,"sceAudioInit()"); DEBUG_LOG(HLE,"sceAudioInit()");
// Don't need to do anything // Don't need to do anything
return 0; return 0;
} }
u32 sceAudioEnd()
{ u32 sceAudioEnd(){
DEBUG_LOG(HLE,"sceAudioEnd()"); DEBUG_LOG(HLE,"sceAudioEnd()");
// Don't need to do anything // Don't need to do anything
return 0; return 0;
} }
u32 sceAudioOutput2Reserve(u32 sampleCount) u32 sceAudioOutput2Reserve(u32 sampleCount){
{ DEBUG_LOG(HLE,"sceAudioOutput2Reserve(%08x)", sampleCount);
DEBUG_LOG(HLE,"sceAudioOutput2Reserve(%i)", sampleCount); if (!chans[src].reserved) {
chans[0].sampleCount = sampleCount; chans[0].sampleCount = sampleCount;
chans[0].reserved = true; chans[0].reserved = true;
}
return 0; return 0;
} }
u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr){
{ DEBUG_LOG(HLE,"sceAudioOutput2OutputBlocking(%08x, %08x)", vol, dataPtr);
DEBUG_LOG(HLE,"FAKE sceAudioOutput2OutputBlocking(%i, %08x)", vol, dataPtr);
chans[0].leftVolume = vol; chans[0].leftVolume = vol;
chans[0].rightVolume = vol; chans[0].rightVolume = vol;
chans[0].sampleAddress = dataPtr; chans[0].sampleAddress = dataPtr;
return __AudioEnqueue(chans[0], 0, true); return __AudioEnqueue(chans[0], 0, true);
} }
u32 sceAudioOutput2ChangeLength(u32 sampleCount) u32 sceAudioOutput2ChangeLength(u32 sampleCount){
{ DEBUG_LOG(HLE,"sceAudioOutput2ChangeLength(%08x)", sampleCount);
DEBUG_LOG(HLE,"sceAudioOutput2ChangeLength(%i)", sampleCount);
chans[0].sampleCount = sampleCount; chans[0].sampleCount = sampleCount;
return 0; return 0;
} }
u32 sceAudioOutput2GetRestSample() u32 sceAudioOutput2GetRestSample(){
{ DEBUG_LOG(HLE,"sceAudioOutput2GetRestSample()");
DEBUG_LOG(HLE,"UNTESTED sceAudioOutput2GetRestSample()");
return (u32) chans[0].sampleQueue.size() * 2; return (u32) chans[0].sampleQueue.size() * 2;
} }
u32 sceAudioOutput2Release() u32 sceAudioOutput2Release(){
{
DEBUG_LOG(HLE,"sceAudioOutput2Release()"); DEBUG_LOG(HLE,"sceAudioOutput2Release()");
if (!chans[0].reserved) {
chans[0].reserved = false; chans[0].reserved = false;
}
return 0; return 0;
} }
u32 sceAudioSetFrequency(u32 freq) { u32 sceAudioSetFrequency(u32 freq) {
if (freq == 44100 || freq == 48000) { if (freq == 44100 || freq == 48000) {
INFO_LOG(HLE, "sceAudioSetFrequency(%i)", freq); INFO_LOG(HLE, "sceAudioSetFrequency(%08x)", freq);
__AudioSetOutputFrequency(freq); __AudioSetOutputFrequency(freq);
return 0; return 0;
} else { } else {
ERROR_LOG(HLE, "sceAudioSetFrequency(%i) - invalid frequency (must be 44.1 or 48 khz)", freq); ERROR_LOG(HLE, "sceAudioSetFrequency(%08x) - invalid frequency (must be 44.1 or 48 khz)", freq);
return -1; return -1;
} }
} }
u32 sceAudioSetVolumeOffset(u32 unknown) { u32 sceAudioSetVolumeOffset() {
ERROR_LOG(HLE, "UNIMPL sceAudioSetVolumeOffset(%i)", unknown); ERROR_LOG(HLE, "UNIMPL sceAudioSetVolumeOffset()");
return 0; return 0;
} }
u32 sceAudioSRCChReserve(u32 sampleCount, u32 freq, u32 format) {
DEBUG_LOG(HLE, "sceAudioSRCChReserve(%08x, %08x, %08x)", sampleCount, freq, format);
if (!chans[src].reserved) {
chans[src].reserved = true;
chans[src].sampleCount = sampleCount;
chans[src].format = format;
__AudioSetOutputFrequency(freq);
}
return 0;
}
u32 sceAudioSRCChRelease() {
DEBUG_LOG(HLE, "sceAudioSRCChRelease()");
if (!chans[src].reserved) {
chans[src].reserved = false;
}
return 0;
}
u32 sceAudioSRCOutputBlocking(u32 vol, u32 buf) {
DEBUG_LOG(HLE, "sceAudioSRCOutputBlocking(%08x, %08x)", vol, buf);
chans[src].leftVolume = vol;
chans[src].rightVolume = vol;
chans[src].sampleAddress = buf;
return __AudioEnqueue(chans[src], src, true);
}
const HLEFunction sceAudio[] = const HLEFunction sceAudio[] =
{ {
// Newer simplified single channel audio output. Presumably for games that use Atrac3 // Newer simplified single channel audio output. Presumably for games that use Atrac3
@ -343,30 +320,24 @@ const HLEFunction sceAudio[] =
{0x63f2889c, WrapU_U<sceAudioOutput2ChangeLength>, "sceAudioOutput2ChangeLength"}, {0x63f2889c, WrapU_U<sceAudioOutput2ChangeLength>, "sceAudioOutput2ChangeLength"},
{0x647cef33, WrapU_V<sceAudioOutput2GetRestSample>, "sceAudioOutput2GetRestSample"}, {0x647cef33, WrapU_V<sceAudioOutput2GetRestSample>, "sceAudioOutput2GetRestSample"},
{0x43196845, WrapU_V<sceAudioOutput2Release>, "sceAudioOutput2Release"}, {0x43196845, WrapU_V<sceAudioOutput2Release>, "sceAudioOutput2Release"},
{0x80F1F7E0, WrapU_V<sceAudioInit>, "sceAudioInit"}, {0x80F1F7E0, WrapU_V<sceAudioInit>, "sceAudioInit"},
{0x210567F7, WrapU_V<sceAudioEnd>, "sceAudioEnd"}, {0x210567F7, WrapU_V<sceAudioEnd>, "sceAudioEnd"},
{0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"}, {0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"},
{0x927AC32B, WrapU_U<sceAudioSetVolumeOffset>, "sceAudioSetVolumeOffset"}, {0x927AC32B, WrapU_V<sceAudioSetVolumeOffset>, "sceAudioSetVolumeOffset"},
// The oldest and standard audio interface. Supports 8 channels, most games use 1-2.
{0x8c1009b2, WrapU_UUU<sceAudioOutput>, "sceAudioOutput"}, {0x8c1009b2, WrapU_UUU<sceAudioOutput>, "sceAudioOutput"},
{0x136CAF51, WrapU_UUU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"}, {0x136CAF51, WrapU_UUU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"},
{0xE2D56B2D, WrapU_UUUU<sceAudioOutputPanned>, "sceAudioOutputPanned"}, {0xE2D56B2D, WrapU_UUUU<sceAudioOutputPanned>, "sceAudioOutputPanned"},
{0x13F592BC, WrapU_UUUU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"}, //(u32, u32, u32, void *)Output sound, blocking {0x13F592BC, WrapU_UUUU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"},
{0x5EC81C55, WrapU_UUU<sceAudioChReserve>, "sceAudioChReserve"}, //(u32, u32 samplecount, u32) Initialize channel and allocate buffer long, long samplecount, long);//init buffer? returns handle, minus if error {0x5EC81C55, WrapU_UUU<sceAudioChReserve>, "sceAudioChReserve"},
{0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"}, //(long handle)Terminate channel and deallocate buffer //free buffer? {0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"},
{0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"}, {0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"},
{0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"}, // Is there a difference between this and sceAudioGetChannelRestLen? {0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"},
{0xCB2E439E, WrapU_UU<sceAudioSetChannelDataLen>, "sceAudioSetChannelDataLen"}, //(u32, u32) {0xCB2E439E, WrapU_UU<sceAudioSetChannelDataLen>, "sceAudioSetChannelDataLen"},
{0x95FD0C2D, WrapU_UU<sceAudioChangeChannelConfig>, "sceAudioChangeChannelConfig"}, {0x95FD0C2D, WrapU_UU<sceAudioChangeChannelConfig>, "sceAudioChangeChannelConfig"},
{0xB7E1D8E7, WrapU_UUU<sceAudioChangeChannelVolume>, "sceAudioChangeChannelVolume"}, {0xB7E1D8E7, WrapU_UUU<sceAudioChangeChannelVolume>, "sceAudioChangeChannelVolume"},
{0x38553111, WrapU_UUU<sceAudioSRCChReserve>, "sceAudioSRCChReserve"},
// I guess these are like the others but do sample rate conversion? {0x5C37C0AE, WrapU_V<sceAudioSRCChRelease>, "sceAudioSRCChRelease"},
{0x38553111, 0, "sceAudioSRCChReserve"}, {0xE0727056, WrapU_UU<sceAudioSRCOutputBlocking>, "sceAudioSRCOutputBlocking"},
{0x5C37C0AE, 0, "sceAudioSRCChRelease"},
{0xE0727056, 0, "sceAudioSRCOutputBlocking"},
// Never seen these used // Never seen these used
{0x41efade7, 0, "sceAudioOneshotOutput"}, {0x41efade7, 0, "sceAudioOneshotOutput"},
@ -382,8 +353,6 @@ const HLEFunction sceAudio[] =
{0x87b2e651, 0, "sceAudioWaitInputEnd"}, {0x87b2e651, 0, "sceAudioWaitInputEnd"},
}; };
void Register_sceAudio() void Register_sceAudio()
{ {
RegisterModule("sceAudio", ARRAY_SIZE(sceAudio), sceAudio); RegisterModule("sceAudio", ARRAY_SIZE(sceAudio), sceAudio);