From a7d8dad063e81b16bf92debddd996961bf0aad90 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Wed, 14 Apr 2021 13:45:31 -0500 Subject: [PATCH] miscLimits should control whether sound effect updates yield --- src/blocks/scratch3_sound.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index 4dd0045f..78754a57 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -275,14 +275,17 @@ class Scratch3SoundBlocks { soundState.effects[effect] = value; } - if (util.target.runtime.runtimeOptions.miscLimits) { + const miscLimits = util.target.runtime.runtimeOptions.miscLimits; + if (miscLimits) { const {min, max} = Scratch3SoundBlocks.EFFECT_RANGE[effect]; soundState.effects[effect] = MathUtil.clamp(soundState.effects[effect], min, max); } this._syncEffectsForTarget(util.target); - // Yield until the next tick. - return Promise.resolve(); + if (miscLimits) { + // Yield until the next tick. + return Promise.resolve(); + } } _syncEffectsForTarget (target) { @@ -328,8 +331,10 @@ class Scratch3SoundBlocks { util.target.volume = volume; this._syncEffectsForTarget(util.target); - // Yield until the next tick. - return Promise.resolve(); + if (util.target.runtime.runtimeOptions.miscLimits) { + // Yield until the next tick. + return Promise.resolve(); + } } getVolume (args, util) {