diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index 4c1350ee..e47a688a 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -93,7 +93,8 @@ Scratch3SoundBlocks.prototype.setInstrument = function (args, util) { var instNum = Cast.toNumber(args.INSTRUMENT); instNum -= 1; // instruments are one-indexed instNum = MathUtil.wrapClamp(instNum, 0, this.runtime.audioEngine.numInstruments); - return util.target.audioPlayer.setInstrument(instNum); + util.target.setInstrument(instNum); + return this.runtime.audioEngine.instrumentPlayer.loadInstrument(instNum); }; Scratch3SoundBlocks.prototype.setEffect = function (args, util) { diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index e31616e4..714d11dc 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -484,6 +484,10 @@ RenderedTarget.prototype.updateAllDrawableProperties = function () { RenderedTarget.prototype.playSound = function (index) { return this.audioPlayer.playSound(this.sprite.sounds[index].md5); }; + +RenderedTarget.prototype.setInstrument = function (num) { + this.currentInstrument = num; +}; /** * Return the human-readable name for this rendered target, e.g., the sprite's name. * @override