Add loudness block

This commit is contained in:
Eric Rosenbaum 2017-03-20 17:01:44 -04:00
parent 106db6a024
commit b4a94c266f

View file

@ -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;