From 76a475c31cd52fa15ccbcd7550637ffd2aae64ff Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 10 Jan 2017 18:00:33 -0500 Subject: [PATCH] cast args to numbers --- src/blocks/scratch3_sound.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index 8e1779571..c2a481356 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -71,15 +71,20 @@ Scratch3SoundBlocks.prototype.stopAllSounds = function (args, util) { }; Scratch3SoundBlocks.prototype.playNoteForBeats = function (args, util) { - return util.target.audioPlayer.playNoteForBeats(args.NOTE, args.BEATS); + var note = Cast.toNumber(args.NOTE); + var beats = Cast.toNumber(args.BEATS); + return util.target.audioPlayer.playNoteForBeats(note, beats); }; Scratch3SoundBlocks.prototype.playDrumForBeats = function (args, util) { - return util.target.audioPlayer.playDrumForBeats(args.DRUM, args.BEATS); + var drum = Cast.toNumber(args.DRUMTYPE); + var beats = Cast.toNumber(args.BEATS); + return util.target.audioPlayer.playDrumForBeats(drum, beats); }; Scratch3SoundBlocks.prototype.restForBeats = function (args, util) { - return util.target.audioPlayer.waitForBeats(args.BEATS); + var beats = Cast.toNumber(args.BEATS); + return util.target.audioPlayer.waitForBeats(beats); }; Scratch3SoundBlocks.prototype.setInstrument = function (args, util) {