mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
target manages instrument setting
This commit is contained in:
parent
4e4b0b86e1
commit
5966a46bbd
2 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue