Clamp bad audio pitches for safety.

This commit is contained in:
Henrik Rydgard 2013-08-27 22:47:45 +02:00
parent dd667156f5
commit a530d47fcd

View File

@ -256,6 +256,15 @@ u32 sceSasSetPitch(u32 core, int voiceNum, int pitch) {
}
SasVoice &v = sas->voices[voiceNum];
// Clamp pitch
if (pitch < PSP_SAS_PITCH_MIN) {
WARN_LOG(SAS, "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(SAS, "bad pitch %i, clamping to %i", pitch, PSP_SAS_PITCH_MAX);
pitch = PSP_SAS_PITCH_MAX;
}
v.pitch = pitch;
v.ChangedParams(false);
return 0;