From 909e181a497074c52e0be927c007cb6b6d66fc8c From: Michael Forney Date: Mon, 15 Feb 2021 09:40:11 +0000 Subject: games/snes: use linear interpolation to resample This is still not ideal, but noticably better than nearest-neighbor. diff b78eaf915465b6d6d13f2dc36964c9aad9a2b76c 909e181a497074c52e0be927c007cb6b6d66fc8c --- a/sys/src/games/snes/dsp.c Mon Feb 15 01:38:22 2021 +++ b/sys/src/games/snes/dsp.c Mon Feb 15 01:40:11 2021 @@ -64,13 +64,17 @@ static void audiosample(s16int *s) { + static s16int s1[2]; + stime -= 1<<16; do { - sbufp[0] = s[0]; - sbufp[1] = s[1]; + sbufp[0] = s[0] + ((s[0] - s1[0]) * stime >> 16); + sbufp[1] = s[1] + ((s[1] - s1[1]) * stime >> 16); sbufp += 2; stime += (32000<<16)/Freq; } while(stime < 0); + s1[0] = s[0]; + s1[1] = s[1]; } int