mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-02 11:43:31 +00:00
Negative volume means unchanged, not error.
This commit is contained in:
parent
a1060ffabd
commit
4c36f12889
@ -276,6 +276,11 @@ template<u32 func(u32, int, int)> void WrapU_UII() {
|
|||||||
RETURN(retval);
|
RETURN(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<u32 func(u32, int, int, u32)> void WrapU_UIIU() {
|
||||||
|
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
|
||||||
|
RETURN(retval);
|
||||||
|
}
|
||||||
|
|
||||||
template<int func(u32, int, int, u32, u32)> void WrapI_UIIUU() {
|
template<int func(u32, int, int, u32, u32)> void WrapI_UIIUU() {
|
||||||
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
|
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
|
||||||
RETURN(retval);
|
RETURN(retval);
|
||||||
|
@ -52,7 +52,7 @@ AudioChannel chans[PSP_AUDIO_CHANNEL_MAX + 1];
|
|||||||
// Not sure about the range of volume, I often see 0x800 so that might be either
|
// Not sure about the range of volume, I often see 0x800 so that might be either
|
||||||
// max or 50%?
|
// max or 50%?
|
||||||
|
|
||||||
u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
|
u32 sceAudioOutputBlocking(u32 chan, int vol, u32 samplePtr) {
|
||||||
if (vol > 0xFFFF) {
|
if (vol > 0xFFFF) {
|
||||||
ERROR_LOG(HLE, "sceAudioOutputBlocking() - invalid volume");
|
ERROR_LOG(HLE, "sceAudioOutputBlocking() - invalid volume");
|
||||||
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
||||||
@ -67,14 +67,16 @@ u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
|
|||||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_LOG(HLE, "sceAudioOutputBlocking(%08x, %08x, %08x)", chan, vol, samplePtr);
|
DEBUG_LOG(HLE, "sceAudioOutputBlocking(%08x, %08x, %08x)", chan, vol, samplePtr);
|
||||||
|
if (vol >= 0) {
|
||||||
chans[chan].leftVolume = vol;
|
chans[chan].leftVolume = vol;
|
||||||
chans[chan].rightVolume = vol;
|
chans[chan].rightVolume = vol;
|
||||||
|
}
|
||||||
chans[chan].sampleAddress = samplePtr;
|
chans[chan].sampleAddress = samplePtr;
|
||||||
return __AudioEnqueue(chans[chan], chan, true);
|
return __AudioEnqueue(chans[chan], chan, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sceAudioOutputPannedBlocking(u32 chan, u32 leftvol, u32 rightvol, u32 samplePtr) {
|
u32 sceAudioOutputPannedBlocking(u32 chan, int leftvol, int rightvol, u32 samplePtr) {
|
||||||
if (leftvol > 0xFFFF || rightvol > 0xFFFF) {
|
if (leftvol > 0xFFFF || rightvol > 0xFFFF) {
|
||||||
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - invalid volume");
|
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - invalid volume");
|
||||||
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
||||||
@ -89,14 +91,18 @@ u32 sceAudioOutputPannedBlocking(u32 chan, u32 leftvol, u32 rightvol, u32 sample
|
|||||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr);
|
DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr);
|
||||||
|
if (leftvol >= 0) {
|
||||||
chans[chan].leftVolume = leftvol;
|
chans[chan].leftVolume = leftvol;
|
||||||
|
}
|
||||||
|
if (rightvol >= 0) {
|
||||||
chans[chan].rightVolume = rightvol;
|
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, int vol, u32 samplePtr) {
|
||||||
if (vol > 0xFFFF) {
|
if (vol > 0xFFFF) {
|
||||||
ERROR_LOG(HLE, "sceAudioOutput() - invalid volume");
|
ERROR_LOG(HLE, "sceAudioOutput() - invalid volume");
|
||||||
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
||||||
@ -111,14 +117,16 @@ u32 sceAudioOutput(u32 chan, u32 vol, u32 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);
|
DEBUG_LOG(HLE, "sceAudioOutputPanned(%08x, %08x, %08x)", chan, vol, samplePtr);
|
||||||
|
if (vol >= 0) {
|
||||||
chans[chan].leftVolume = vol;
|
chans[chan].leftVolume = vol;
|
||||||
chans[chan].rightVolume = vol;
|
chans[chan].rightVolume = vol;
|
||||||
|
}
|
||||||
chans[chan].sampleAddress = samplePtr;
|
chans[chan].sampleAddress = samplePtr;
|
||||||
return __AudioEnqueue(chans[chan], chan, false);
|
return __AudioEnqueue(chans[chan], chan, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sceAudioOutputPanned(u32 chan, u32 leftvol, u32 rightvol, u32 samplePtr) {
|
u32 sceAudioOutputPanned(u32 chan, int leftvol, int rightvol, u32 samplePtr) {
|
||||||
if (leftvol > 0xFFFF || rightvol > 0xFFFF) {
|
if (leftvol > 0xFFFF || rightvol > 0xFFFF) {
|
||||||
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - invalid volume");
|
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking() - invalid volume");
|
||||||
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
return SCE_ERROR_AUDIO_INVALID_VOLUME;
|
||||||
@ -133,8 +141,12 @@ u32 sceAudioOutputPanned(u32 chan, u32 leftvol, u32 rightvol, u32 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);
|
DEBUG_LOG(HLE,"sceAudioOutputPanned(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr);
|
||||||
|
if (leftvol >= 0) {
|
||||||
chans[chan].leftVolume = leftvol;
|
chans[chan].leftVolume = leftvol;
|
||||||
|
}
|
||||||
|
if (rightvol >= 0) {
|
||||||
chans[chan].rightVolume = rightvol;
|
chans[chan].rightVolume = rightvol;
|
||||||
|
}
|
||||||
chans[chan].sampleAddress = samplePtr;
|
chans[chan].sampleAddress = samplePtr;
|
||||||
return __AudioEnqueue(chans[chan], chan, false);
|
return __AudioEnqueue(chans[chan], chan, false);
|
||||||
}
|
}
|
||||||
@ -166,10 +178,10 @@ static u32 GetFreeChannel() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sceAudioChReserve(u32 chan, u32 sampleCount, u32 format) {
|
u32 sceAudioChReserve(int chan, u32 sampleCount, u32 format) {
|
||||||
if ((int)chan < 0) {
|
if (chan < 0) {
|
||||||
chan = GetFreeChannel();
|
chan = GetFreeChannel();
|
||||||
if ((int)chan < 0) {
|
if (chan < 0) {
|
||||||
ERROR_LOG(HLE, "sceAudioChReserve - no channels remaining");
|
ERROR_LOG(HLE, "sceAudioChReserve - no channels remaining");
|
||||||
return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
|
return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
|
||||||
}
|
}
|
||||||
@ -195,6 +207,8 @@ u32 sceAudioChReserve(u32 chan, u32 sampleCount, u32 format) {
|
|||||||
chans[chan].sampleCount = sampleCount;
|
chans[chan].sampleCount = sampleCount;
|
||||||
chans[chan].format = format;
|
chans[chan].format = format;
|
||||||
chans[chan].reserved = true;
|
chans[chan].reserved = true;
|
||||||
|
chans[chan].leftVolume = 0;
|
||||||
|
chans[chan].rightVolume = 0;
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,11 +416,11 @@ const HLEFunction sceAudio[] =
|
|||||||
{0x210567F7, WrapU_V<sceAudioEnd>, "sceAudioEnd"},
|
{0x210567F7, WrapU_V<sceAudioEnd>, "sceAudioEnd"},
|
||||||
{0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"},
|
{0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"},
|
||||||
{0x927AC32B, WrapU_V<sceAudioSetVolumeOffset>, "sceAudioSetVolumeOffset"},
|
{0x927AC32B, WrapU_V<sceAudioSetVolumeOffset>, "sceAudioSetVolumeOffset"},
|
||||||
{0x8c1009b2, WrapU_UUU<sceAudioOutput>, "sceAudioOutput"},
|
{0x8c1009b2, WrapU_UIU<sceAudioOutput>, "sceAudioOutput"},
|
||||||
{0x136CAF51, WrapU_UUU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"},
|
{0x136CAF51, WrapU_UIU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"},
|
||||||
{0xE2D56B2D, WrapU_UUUU<sceAudioOutputPanned>, "sceAudioOutputPanned"},
|
{0xE2D56B2D, WrapU_UIIU<sceAudioOutputPanned>, "sceAudioOutputPanned"},
|
||||||
{0x13F592BC, WrapU_UUUU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"},
|
{0x13F592BC, WrapU_UIIU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"},
|
||||||
{0x5EC81C55, WrapU_UUU<sceAudioChReserve>, "sceAudioChReserve"},
|
{0x5EC81C55, WrapU_IUU<sceAudioChReserve>, "sceAudioChReserve"},
|
||||||
{0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"},
|
{0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"},
|
||||||
{0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"},
|
{0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"},
|
||||||
{0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"},
|
{0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user