From 8c1270a51cb70c3c61cda7cd9153c4e164f7e7e8 Mon Sep 17 00:00:00 2001 From: Frank Force Date: Tue, 19 Nov 2024 00:19:22 -0600 Subject: [PATCH] fix music can be double played in stress test need to investigate better way to track when sound is being played --- examples/stress/index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/stress/index.html b/examples/stress/index.html index 3233d8f1..30223017 100644 --- a/examples/stress/index.html +++ b/examples/stress/index.html @@ -20,7 +20,7 @@ 'use strict'; // keep our own list of simple sprites and track fps -let sprites, timeMS, fpsDisplay, statsDisplay, spriteColor, spriteAdditiveColor; +let playedMusic, sprites, timeMS, fpsDisplay, statsDisplay, spriteColor, spriteAdditiveColor; /////////////////////////////////////////////////////////////////////////////// @@ -61,8 +61,11 @@ /////////////////////////////////////////////////////////////////////////////// function gameUpdate() { - if (mouseWasPressed(0) && !music.getSource()) + if (mouseWasPressed(0) && !playedMusic) + { + playedMusic = 1; music.play(); + } // mouse click = change color if (mouseWasPressed(0) || mouseIsDown(2))