mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-21 17:30:46 +00:00
Return an error for an invalid pitch, per tests.
This commit is contained in:
parent
1efcebb121
commit
139c91fe19
@ -45,6 +45,7 @@ enum {
|
||||
ERROR_SAS_BAD_ADDRESS = 0x80420005,
|
||||
ERROR_SAS_INVALID_VOICE = 0x80420010,
|
||||
ERROR_SAS_INVALID_NOISE_FREQ = 0x80420011,
|
||||
ERROR_SAS_INVALID_PITCH = 0x80420012,
|
||||
ERROR_SAS_INVALID_ADSR_CURVE_MODE = 0x80420013,
|
||||
ERROR_SAS_INVALID_PARAMETER = 0x80420014,
|
||||
ERROR_SAS_INVALID_LOOP_POS = 0x80420015,
|
||||
@ -263,23 +264,17 @@ u32 sceSasSetVolume(u32 core, int voiceNum, int leftVol, int rightVol, int effec
|
||||
}
|
||||
|
||||
u32 sceSasSetPitch(u32 core, int voiceNum, int pitch) {
|
||||
DEBUG_LOG(SCESAS, "sceSasSetPitch(%08x, %i, %i)", core, voiceNum, pitch);
|
||||
|
||||
if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) {
|
||||
WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum);
|
||||
return ERROR_SAS_INVALID_VOICE;
|
||||
}
|
||||
|
||||
SasVoice &v = sas->voices[voiceNum];
|
||||
// Clamp pitch
|
||||
if (pitch < PSP_SAS_PITCH_MIN) {
|
||||
WARN_LOG(SCESAS, "sceSasSetPitch: bad pitch %i, clamping to %i", pitch, PSP_SAS_PITCH_MIN);
|
||||
pitch = PSP_SAS_PITCH_MIN;
|
||||
} else if (pitch > PSP_SAS_PITCH_MAX) {
|
||||
WARN_LOG(SCESAS, "sceSasSetPitch: bad pitch %i, clamping to %i", pitch, PSP_SAS_PITCH_MAX);
|
||||
pitch = PSP_SAS_PITCH_MAX;
|
||||
if (pitch < PSP_SAS_PITCH_MIN || pitch > PSP_SAS_PITCH_MAX) {
|
||||
WARN_LOG(SCESAS, "sceSasSetPitch(%08x, %i, %i): bad pitch", core, voiceNum, pitch);
|
||||
return ERROR_SAS_INVALID_PITCH;
|
||||
}
|
||||
|
||||
DEBUG_LOG(SCESAS, "sceSasSetPitch(%08x, %i, %i)", core, voiceNum, pitch);
|
||||
SasVoice &v = sas->voices[voiceNum];
|
||||
v.pitch = pitch;
|
||||
v.ChangedParams(false);
|
||||
return 0;
|
||||
|
@ -29,7 +29,7 @@
|
||||
enum {
|
||||
PSP_SAS_VOICES_MAX = 32,
|
||||
|
||||
PSP_SAS_PITCH_MIN = 1,
|
||||
PSP_SAS_PITCH_MIN = 0x0000,
|
||||
PSP_SAS_PITCH_BASE = 0x1000,
|
||||
PSP_SAS_PITCH_MAX = 0x4000,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user