diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index fb9254b1fe..542b3953f1 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -48,7 +48,7 @@ static const s8 f[16][2] = { { 0, 0 }, }; -void VagDecoder::Start(u32 data, int vagSize, bool loopEnabled) { +void VagDecoder::Start(u32 data, u32 vagSize, bool loopEnabled) { loopEnabled_ = loopEnabled; loopAtNextBlock_ = false; loopStartBlock_ = 0; @@ -462,6 +462,9 @@ void SasInstance::MixVoice(SasVoice &voice) { const bool ignorePitch = voice.type == VOICETYPE_PCM && voice.pitch > PSP_SAS_PITCH_BASE; if (voice.envelope.NeedsKeyOn()) { int delay = ignorePitch ? 32 : (32 * (u32)voice.pitch) >> PSP_SAS_PITCH_BASE_SHIFT; + // VAG seems to have an extra sample delay (not shared by PCM.) + if (voice.type == VOICETYPE_VAG) + ++delay; voice.ReadSamples(resampleBuffer + 2 + delay, numSamples - delay); } else { voice.ReadSamples(resampleBuffer + 2, numSamples); diff --git a/Core/HW/SasAudio.h b/Core/HW/SasAudio.h index ffcf66eddb..0c825652ab 100644 --- a/Core/HW/SasAudio.h +++ b/Core/HW/SasAudio.h @@ -88,7 +88,7 @@ enum VoiceType { class VagDecoder { public: VagDecoder() : data_(0), read_(0), end_(true) {} - void Start(u32 dataPtr, int vagSize, bool loopEnabled); + void Start(u32 dataPtr, u32 vagSize, bool loopEnabled); void GetSamples(s16 *outSamples, int numSamples); @@ -229,7 +229,7 @@ struct SasVoice { VoiceType type; u32 vagAddr; - int vagSize; + u32 vagSize; u32 pcmAddr; int pcmSize; int pcmIndex;