libsnes: dumb change to dumb code slightly lessens appearance rate of rice crispies in some situations

This commit is contained in:
goyuken 2012-09-05 01:30:09 +00:00
parent 9b8e54989c
commit fd5494a316
1 changed files with 20 additions and 8 deletions

View File

@ -458,7 +458,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
} }
} }
// TODO: replace this with something that took more than 5 seconds to write
public void GetSamples(short[] samples) public void GetSamples(short[] samples)
{ {
// resample approximately 32k->44k // resample approximately 32k->44k
@ -473,8 +473,20 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
for (i = 0; i < inputcount * 2 && AudioBuffer.Count > 0; i++) for (i = 0; i < inputcount * 2 && AudioBuffer.Count > 0; i++)
input[i] = AudioBuffer.Dequeue(); input[i] = AudioBuffer.Dequeue();
for (; i < inputcount * 2; i++) short lastl, lastr;
input[i] = 0; if (i >= 2)
{
lastl = input[i - 2];
lastr = input[i - 1];
}
else
lastl = lastr = 0;
for (; i < inputcount * 2; )
{
input[i++] = lastl;
input[i++] = lastr;
}
LinearDownsampler(input, samples); LinearDownsampler(input, samples);