libsnes: dumb change to dumb code slightly lessens appearance rate of rice crispies in some situations
This commit is contained in:
parent
9b8e54989c
commit
fd5494a316
|
@ -73,11 +73,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
public static extern IntPtr snes_get_memory_data(SNES_MEMORY id);
|
public static extern IntPtr snes_get_memory_data(SNES_MEMORY id);
|
||||||
|
|
||||||
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int snes_serialize_size();
|
public static extern int snes_serialize_size();
|
||||||
|
|
||||||
[return: MarshalAs(UnmanagedType.U1)]
|
[return: MarshalAs(UnmanagedType.U1)]
|
||||||
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool snes_serialize(IntPtr data, int size);
|
public static extern bool snes_serialize(IntPtr data, int size);
|
||||||
|
|
||||||
[return: MarshalAs(UnmanagedType.U1)]
|
[return: MarshalAs(UnmanagedType.U1)]
|
||||||
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue