fix: mp2 player would not play the very first frame

This commit is contained in:
minjaesong
2023-01-16 23:29:41 +09:00
parent 5b86e88779
commit dfe5bf3390
5 changed files with 17 additions and 12 deletions

View File

@@ -30,10 +30,7 @@ function s16Tou8(i) {
function u16Tos16(i) { return (i > 32767) ? i - 65536 : i }
function randomRound(k) {
let rnd = (Math.random() + Math.random()) / 2.0 // this produces triangular distribution
if (rnd < (k - (k|0)))
return Math.ceil(k)
else
return Math.floor(k)
return (rnd < (k - (k|0))) ? Math.ceil(k) : Math.floor(k)
}
function lerp(start, end, x) {
return (1 - x) * start + x * end