diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index 1601fc650..574d6a020 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -26,7 +26,8 @@ Scratch3SensingBlocks.prototype.getPrimitives = function () { sensing_mousedown: this.getMouseDown, sensing_keypressed: this.getKeyPressed, sensing_current: this.current, - sensing_dayssince2000: this.daysSince2000 + sensing_dayssince2000: this.daysSince2000, + sensing_loudness: this.getLoudness }; }; @@ -125,6 +126,11 @@ Scratch3SensingBlocks.prototype.daysSince2000 = function () { return mSecsSinceStart / msPerDay; }; +Scratch3SensingBlocks.prototype.getLoudness = function () { + if (typeof this.runtime.audioEngine === 'undefined') return 0; + return this.runtime.audioEngine.getLoudness(); +}; + Scratch3SensingBlocks.prototype.getAttributeOf = function (args) { var attrTarget;