fds audio: clip. intro to Metroid now sounds passable
This commit is contained in:
parent
966495cbae
commit
3378ea8001
|
@ -266,15 +266,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
for (int i = 0; i < samples.Length; i += 2)
|
for (int i = 0; i < samples.Length; i += 2)
|
||||||
{
|
{
|
||||||
|
// worst imaginable resampling
|
||||||
int pos = i * samplebuffpos / samples.Length;
|
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);
|
// NES audio is mono, so this should be identical anyway
|
||||||
// nothing for clipping, and the worst imaginable resampling
|
samples[i + 1] = samples[i];
|
||||||
samples[i] += samp;
|
|
||||||
samples[i + 1] += samp;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Console.WriteLine("##{0}##", samplebuffpos);
|
//Console.WriteLine("##{0}##", samplebuffpos);
|
||||||
samplebuffpos = 0;
|
samplebuffpos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue