From 00ddabe46a7b39ef0605f550c0ef61f8166ecfc0 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sat, 10 Feb 2024 04:23:26 +0000 Subject: [PATCH] Fixed sound loading issue in youare. --- src/mami.js/youare.jsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mami.js/youare.jsx b/src/mami.js/youare.jsx index a09fa03..2a60014 100644 --- a/src/mami.js/youare.jsx +++ b/src/mami.js/youare.jsx @@ -1,4 +1,5 @@ #include animate.js +#include rng.js const MamiYouAreAnIdiot = function() { const html =
@@ -15,19 +16,14 @@ const MamiYouAreAnIdiot = function() {
; + const rng = new MamiRNG; let soundSrc; const pub = { getElement: () => html, onViewPush: async () => { - const soundMgr = mami.getSound(); - if(soundMgr === undefined || soundMgr === null) - return; - try { - const sources = mami.getSoundLibrary().getSources('misc:youare'); - - soundSrc = soundMgr.loadSource(sources); + soundSrc = await mami.getSoundLibrary().loadSource('misc:youare'); soundSrc.setMuted(true); soundSrc.setLoop(true, 0.21, 5); soundSrc.play(); @@ -50,7 +46,7 @@ const MamiYouAreAnIdiot = function() { }, pushOn: async views => views.push(pub, ctx => MamiAnimate({ async: true, - duration: 1500, + duration: rng.next(1500, 15001), easing: 'outBounce', start: () => ctx.toElem.style.top = '-100%', update: t => ctx.toElem.style.top = `${-100 + (t * 100)}%`,