Audio: Improve error messages for sample counts.
This commit is contained in:
parent
528d04defe
commit
7d2b332b2d
2 changed files with 26 additions and 13 deletions
|
@ -339,11 +339,15 @@ static u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) {
|
|||
}
|
||||
|
||||
auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2];
|
||||
if (!chan.reserved) {
|
||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved");
|
||||
}
|
||||
|
||||
chan.leftVolume = vol;
|
||||
chan.rightVolume = vol;
|
||||
chan.sampleAddress = dataPtr;
|
||||
hleEatCycles(10000);
|
||||
|
||||
hleEatCycles(10000);
|
||||
int result = __AudioEnqueue(chan, PSP_AUDIO_CHANNEL_OUTPUT2, true);
|
||||
if (result < 0)
|
||||
return hleLogError(SCEAUDIO, result);
|
||||
|
@ -351,22 +355,25 @@ static u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) {
|
|||
}
|
||||
|
||||
static u32 sceAudioOutput2ChangeLength(u32 sampleCount) {
|
||||
if (!chans[PSP_AUDIO_CHANNEL_OUTPUT2].reserved) {
|
||||
ERROR_LOG(SCEAUDIO, "sceAudioOutput2ChangeLength(%08x) - channel not reserved ", sampleCount);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2];
|
||||
if (!chan.reserved) {
|
||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved");
|
||||
}
|
||||
DEBUG_LOG(SCEAUDIO, "sceAudioOutput2ChangeLength(%08x)", sampleCount);
|
||||
chans[PSP_AUDIO_CHANNEL_OUTPUT2].sampleCount = sampleCount;
|
||||
return 0;
|
||||
chan.sampleCount = sampleCount;
|
||||
return hleLogSuccessI(SCEAUDIO, 0);
|
||||
}
|
||||
|
||||
static u32 sceAudioOutput2GetRestSample() {
|
||||
if (!chans[PSP_AUDIO_CHANNEL_OUTPUT2].reserved) {
|
||||
ERROR_LOG(SCEAUDIO, "sceAudioOutput2GetRestSample() - channel not reserved ");
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2];
|
||||
if (!chan.reserved) {
|
||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved");
|
||||
}
|
||||
DEBUG_LOG(SCEAUDIO, "sceAudioOutput2GetRestSample()");
|
||||
return (u32) chans[PSP_AUDIO_CHANNEL_OUTPUT2].sampleQueue.size() / 2;
|
||||
u32 size = (u32)chan.sampleQueue.size() / 2;
|
||||
if (size > chan.sampleCount) {
|
||||
// If ChangeLength reduces the size, it still gets output but this return is clamped.
|
||||
size = chan.sampleCount;
|
||||
}
|
||||
return hleLogSuccessI(SCEAUDIO, size);
|
||||
}
|
||||
|
||||
static u32 sceAudioOutput2Release() {
|
||||
|
@ -382,6 +389,7 @@ static u32 sceAudioOutput2Release() {
|
|||
}
|
||||
|
||||
static u32 sceAudioSetFrequency(u32 freq) {
|
||||
// TODO: Not available from user code.
|
||||
if (freq == 44100 || freq == 48000) {
|
||||
INFO_LOG(SCEAUDIO, "sceAudioSetFrequency(%08x)", freq);
|
||||
__AudioSetOutputFrequency(freq);
|
||||
|
@ -449,6 +457,10 @@ static u32 sceAudioSRCOutputBlocking(u32 vol, u32 buf) {
|
|||
}
|
||||
|
||||
auto &chan = chans[PSP_AUDIO_CHANNEL_SRC];
|
||||
if (!chan.reserved) {
|
||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved");
|
||||
}
|
||||
|
||||
chan.leftVolume = vol;
|
||||
chan.rightVolume = vol;
|
||||
chan.sampleAddress = buf;
|
||||
|
@ -511,7 +523,7 @@ const HLEFunction sceAudio[] =
|
|||
{0X95FD0C2D, &WrapU_UU<sceAudioChangeChannelConfig>, "sceAudioChangeChannelConfig", 'x', "ii" },
|
||||
{0XB7E1D8E7, &WrapU_UUU<sceAudioChangeChannelVolume>, "sceAudioChangeChannelVolume", 'x', "ixx" },
|
||||
|
||||
// Not sure about the point of these, maybe like traditional but with ability to do sample rate conversion?
|
||||
// Like Output2, but with ability to do sample rate conversion.
|
||||
{0X38553111, &WrapU_UUU<sceAudioSRCChReserve>, "sceAudioSRCChReserve", 'x', "iii" },
|
||||
{0X5C37C0AE, &WrapU_V<sceAudioSRCChRelease>, "sceAudioSRCChRelease", 'x', "" },
|
||||
{0XE0727056, &WrapU_UU<sceAudioSRCOutputBlocking>, "sceAudioSRCOutputBlocking", 'x', "xx" },
|
||||
|
|
|
@ -377,6 +377,7 @@ int main(int argc, const char* argv[])
|
|||
g_Config.bHighQualityDepth = true;
|
||||
g_Config.bMemStickInserted = true;
|
||||
g_Config.bFragmentTestCache = true;
|
||||
g_Config.iAudioLatency = 1;
|
||||
|
||||
#ifdef _WIN32
|
||||
InitSysDirectories();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue