Closed dbz400 closed 11 years ago
This code fix the voice concatenated issue in MotoGP however cut off the voice from other games
for (int i = 0; i < grainSize; i++) {
// For now: nearest neighbour, not even using the resample history at all.
int sample = resampleBuffer[bufferPos / PSP_SAS_PITCH_BASE];
bufferPos += voice.pitch;
voice.samplePos++;
if (voice.samplePos >= voice.vagSize) {
voice.playing = false;
}
// Reduce envelope to 15 bits, rounding down.
int envelopeValue = voice.envelope.GetHeight();
envelopeValue = ((envelopeValue >> 15) + 1) >> 1;
// We just scale by the envelope before we scale by volumes.
sample = sample * envelopeValue >> 15;
// We mix into this 32-bit temp buffer and clip in a second loop
// Ideally, the shift right should be there too but for now I'm concerned about
// not overflowing.
mixBuffer[i * 2] += sample * voice.volumeLeft >> 12;
mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 12;
sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 12;
sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 12;
voice.envelope.Step();
}
//voice.samplePos += voice.pitch * grainSize;
Commit 27e8e4c6 fixed this voice concatenated issue .Closed :)
A number of voices seem to be concatenated together in MotoGP . Only this game so far catch this issue.
37:09:326 HLE\sceSas.cpp:61 I[HLE]: 0=sceSasInit(08a7d340, grainSize=256, maxVoices=32, 0, 44100) 37:09:326 HLE\sceSas.cpp:330 N[HLE]: 0=sceSasRevType(core=08a7d340, type=3) 37:09:327 HLE\sceSas.cpp:353 N[HLE]: 0=sceSasRevVON(core=08a7d340, dry=1, wet=1) 37:09:327 HLE\sceSas.cpp:345 N[HLE]: 0=sceSasRevEVOL(core=08a7d340, leftVolume=32767, rightVolume=32767) 37:09:327 HLE\sceKernelThread.cpp:1025 I[HLE]: 283 = sceKernelCreateThread(name="SasCore thread", entry=0890abe4, prio=10, stacksize=65536) 37:09:327 HLE\sceKernelThread.cpp:1053 I[HLE]: sceKernelStartThread(thread=283, argSize=0, argPtr= 00000000 ) 37:09:328 HLE\sceSas.cpp:86 N[HLE]: 0=sceSasCore(, 08cf1cc0) (grain: 256 samples) 37:09:328 HLE\sceSas.cpp:79 N[HLE]: ffffffff=sceSasGetEndFlag()