From 4e57ab561d0672e5fc16bc2b7463a75fd2d49ed0 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 30 Jan 2017 10:45:15 -0500 Subject: [PATCH] move playsound function to target --- src/blocks/scratch3_sound.js | 4 ++-- src/sprites/rendered-target.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index 87fbb0aaf..4bdfd2da8 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -39,12 +39,12 @@ Scratch3SoundBlocks.prototype.getPrimitives = function () { Scratch3SoundBlocks.prototype.playSound = function (args, util) { var index = this._getSoundIndex(args.SOUND_MENU, util); - util.target.audioPlayer.playSound(index); + util.target.playSound(index); }; Scratch3SoundBlocks.prototype.playSoundAndWait = function (args, util) { var index = this._getSoundIndex(args.SOUND_MENU, util); - return util.target.audioPlayer.playSound(index); + return util.target.playSound(index); }; Scratch3SoundBlocks.prototype._getSoundIndex = function (soundName, util) { diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index d7a94fd06..3eab61429 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -465,6 +465,9 @@ RenderedTarget.prototype.updateAllDrawableProperties = function () { this.runtime.spriteInfoReport(this); }; +RenderedTarget.prototype.playSound = function (index) { + return this.audioPlayer.playSound(this.sprite.sounds[index].md5); +}; /** * Return the human-readable name for this rendered target, e.g., the sprite's name. * @override