From cb4209b27a82797257eaaac9cb312d3f9b3dd7c4 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 30 Jan 2017 10:56:06 -0500 Subject: [PATCH] target handles playnote via audio engine --- src/blocks/scratch3_sound.js | 2 +- src/sprites/rendered-target.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index e47a688a4..bb9c4daac 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -73,7 +73,7 @@ Scratch3SoundBlocks.prototype.stopAllSounds = function (args, util) { Scratch3SoundBlocks.prototype.playNoteForBeats = function (args, util) { var note = Cast.toNumber(args.NOTE); var beats = Cast.toNumber(args.BEATS); - return util.target.audioPlayer.playNoteForBeats(note, beats); + return util.target.playNoteForBeats(note, beats); }; Scratch3SoundBlocks.prototype.playDrumForBeats = function (args, util) { diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index 714d11dce..4464addd5 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -488,6 +488,11 @@ RenderedTarget.prototype.playSound = function (index) { RenderedTarget.prototype.setInstrument = function (num) { this.currentInstrument = num; }; + +RenderedTarget.prototype.playNoteForBeats = function (note, beats) { + return this.runtime.audioEngine.playNoteForBeatsWithInst(note, beats, this.currentInstrument); +}; + /** * Return the human-readable name for this rendered target, e.g., the sprite's name. * @override