target manages instrument setting

This commit is contained in:
Eric Rosenbaum committed 2017-01-30 10:54:24 -05:00
1 parent 4e4b0b86e1
commit 5966a46bbd
2 files changed
+6 -1

No files matched your search

+2 -1
View File
@@ -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) {
+4
View File
@@ -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