target handles playnote via audio engine

This commit is contained in:
Eric Rosenbaum 2017-01-30 10:56:06 -05:00
parent 5966a46bbd
commit cb4209b27a
2 changed files with 6 additions and 1 deletions

View file

@ -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) {

View file

@ -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