From 5cc595bbe7d1308f04cc516bc461146da2cb5779 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Tue, 18 Jul 2023 23:16:05 +0530 Subject: [PATCH] fix roll sound popping --- src/Marble.hx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Marble.hx b/src/Marble.hx index 7efb5afb..49c428b9 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -963,7 +963,7 @@ class Marble extends GameObject { if (rollVolume > 1) rollVolume = 1; if (contactPct < 0.05) - rollVolume = 0; + rollVolume = rollSound.volume / 5; // We decrease it slowly var slipVolume = 0.0; if (slipAmount > 1e-4) { @@ -989,7 +989,7 @@ class Marble extends GameObject { rollMegaSound.volume = 0; } } - slipSound.volume = slipVolume; + slipVolume = 0; if (rollSound.getEffect(Pitch) == null) { rollSound.addEffect(new Pitch()); @@ -1001,13 +1001,8 @@ class Marble extends GameObject { } } - var pitch = Util.clamp(rollVel.length() / 15, 0, 1) * 0.75 + 0.75; + var pitch = Util.clamp(rollVel.length() / _maxRollVelocity, 0, 1) * 0.75 + 0.75; - // #if js - // // Apparently audio crashes the whole thing if pitch is less than 0.2 - // if (pitch < 0.2) - // pitch = 0.2; - // #end var rPitch = rollSound.getEffect(Pitch); rPitch.value = pitch;