fds audio: clip. intro to Metroid now sounds passable

This commit is contained in:
goyuken 2012-10-22 17:04:37 +00:00
parent 966495cbae
commit 3378ea8001
1 changed files with 12 additions and 6 deletions

View File

@ -266,15 +266,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
for (int i = 0; i < samples.Length; i += 2)
{
// worst imaginable resampling
int pos = i * samplebuffpos / samples.Length;
int samp = samplebuff[pos] * 20 - 20160;
samp += samples[i];
if (samp > 32767)
samples[i] = 32767;
else if (samp < -32768)
samples[i] = -32768;
else
samples[i] = (short)samp;
short samp = (short)(samplebuff[pos] * 20 - 20160);
// nothing for clipping, and the worst imaginable resampling
samples[i] += samp;
samples[i + 1] += samp;
// NES audio is mono, so this should be identical anyway
samples[i + 1] = samples[i];
}
Console.WriteLine("##{0}##", samplebuffpos);
//Console.WriteLine("##{0}##", samplebuffpos);
samplebuffpos = 0;
}
}