Revert "Reset resample hist on keyon, round up read."

This reverts commit 3edebbfba9.
This commit is contained in:
Unknown W. Brackets committed 2014-02-23 08:45:46 -08:00
1 parent b7651b61c7
commit d6f203db99
1 file changed
+4 -8
+4 -8
View File
@@ -452,7 +452,7 @@ void SasInstance::MixVoice(SasVoice &voice) {
// Actually this is not entirely correct - we need to get one extra sample, and store it
// for the next time around. A little complicated...
// But for now, see Smoothness HACKERY below :P
u32 numSamples = ((u32)voice.sampleFrac + (u32)grainSize * (u32)voice.pitch + PSP_SAS_PITCH_BASE - 1) >> PSP_SAS_PITCH_BASE_SHIFT;
u32 numSamples = ((u32)voice.sampleFrac + (u32)grainSize * (u32)voice.pitch) >> PSP_SAS_PITCH_BASE_SHIFT;
if ((int)numSamples > grainSize * 4) {
ERROR_LOG(SASMIX, "numSamples too large, clamping: %i vs %i", numSamples, grainSize * 4);
numSamples = grainSize * 4;
@@ -507,7 +507,6 @@ void SasInstance::MixSamples(SasVoice &voice) {
if (g_Config.iSFXVolume >= 0 && g_Config.iSFXVolume < MAX_CONFIG_VOLUME)
volumeShift += MAX_CONFIG_VOLUME - g_Config.iSFXVolume;
// The first two are resample history, were we done with the last one?
const int offset = sampleFrac == 0 ? 2 : 1;
for (int i = 0; i < grainSize; i++) {
const int readIndex = sampleFrac >> PSP_SAS_PITCH_BASE_SHIFT;
@@ -529,11 +528,10 @@ void SasInstance::MixSamplesHalfPitch(SasVoice &voice) {
if (g_Config.iSFXVolume >= 0 && g_Config.iSFXVolume < MAX_CONFIG_VOLUME)
volumeShift += MAX_CONFIG_VOLUME - g_Config.iSFXVolume;
// The first two are resample history, were we done with the last one?
int readIndex2 = voice.sampleFrac == 0 ? 4 : 3;
int readIndex2 = voice.sampleFrac == 0 ? 0 : -1;
for (int i = 0; i < grainSize; i++) {
int sample1 = resampleBuffer[(readIndex2 >> 1)];
int sample2 = resampleBuffer[(readIndex2 >> 1) + 1];
int sample1 = resampleBuffer[(readIndex2 >> 1) + 2];
int sample2 = resampleBuffer[(readIndex2 >> 1) + 1 + 2];
int sample = readIndex2 & 1 ? ((sample1 + sample2) >> 1) : sample1;
++readIndex2;
@@ -549,7 +547,6 @@ void SasInstance::MixSamplesOptimal(SasVoice &voice) {
if (g_Config.iSFXVolume >= 0 && g_Config.iSFXVolume < MAX_CONFIG_VOLUME)
volumeShift += MAX_CONFIG_VOLUME - g_Config.iSFXVolume;
// The first two are resample history.
int readIndex = 2;
for (int i = 0; i < grainSize; i++) {
int sample = resampleBuffer[readIndex++];
@@ -703,7 +700,6 @@ void SasVoice::KeyOn() {
on = true;
paused = false;
sampleFrac = 0;
Reset();
}
void SasVoice::KeyOff() {