mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-11 10:24:43 +00:00
Fake VOICETYPE_PCM code
This commit is contained in:
parent
1cbc0deef6
commit
4b86fd7567
@ -330,7 +330,34 @@ void SasInstance::Mix(u32 outAddr) {
|
||||
}
|
||||
}
|
||||
else if (voice.type == VOICETYPE_PCM && voice.pcmAddr != 0) {
|
||||
// PCM mixing should be easy, can share code with VAG
|
||||
resampleBuffer[0] = voice.resampleHist[0];
|
||||
resampleBuffer[1] = voice.resampleHist[1];
|
||||
u32 numSamples = voice.sampleFrac + grainSize ;
|
||||
if ((int)numSamples > grainSize * 4) {
|
||||
ERROR_LOG(SAS, "numSamples too large, clamping: %i vs %i", numSamples, grainSize * 4);
|
||||
numSamples = grainSize * 4;
|
||||
}
|
||||
resampleBuffer[2 + numSamples] = resampleBuffer[2 + numSamples - 1];
|
||||
voice.resampleHist[0] = resampleBuffer[2 + numSamples - 2];
|
||||
voice.resampleHist[1] = resampleBuffer[2 + numSamples - 1];
|
||||
u32 sampleFrac = voice.sampleFrac;
|
||||
for (int i = 0; i < grainSize; i++) {
|
||||
int sample = resampleBuffer[sampleFrac + 2];
|
||||
int envelopeValue = voice.envelope.GetHeight();
|
||||
envelopeValue = ((envelopeValue >> 15) + 1) >> 1;
|
||||
sample = sample * envelopeValue >> 15;
|
||||
mixBuffer[i * 2] += sample * voice.volumeLeft >> 15;
|
||||
mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 15;
|
||||
sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 15;
|
||||
sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 15;
|
||||
voice.envelope.Step();
|
||||
}
|
||||
voice.sampleFrac = sampleFrac;
|
||||
voice.sampleFrac -= numSamples ;
|
||||
if (voice.envelope.HasEnded()) {
|
||||
NOTICE_LOG(SAS, "Hit end of envelope");
|
||||
voice.playing = false;
|
||||
}
|
||||
}
|
||||
else if (voice.type == VOICETYPE_NOISE && voice.noiseFreq != 0) {
|
||||
// Generate noise?
|
||||
|
Loading…
Reference in New Issue
Block a user