mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Round the drum num arg
This commit is contained in:
parent
c26198d050
commit
14e2ca8d99
1 changed files with 1 additions and 0 deletions
|
@ -423,6 +423,7 @@ class Scratch3MusicBlocks {
|
||||||
playDrumForBeats (args, util) {
|
playDrumForBeats (args, util) {
|
||||||
if (this._stackTimerNeedsInit(util)) {
|
if (this._stackTimerNeedsInit(util)) {
|
||||||
let drum = Cast.toNumber(args.DRUM);
|
let drum = Cast.toNumber(args.DRUM);
|
||||||
|
drum = Math.round(drum);
|
||||||
drum -= 1; // drums are one-indexed
|
drum -= 1; // drums are one-indexed
|
||||||
if (typeof this.runtime.audioEngine === 'undefined') return;
|
if (typeof this.runtime.audioEngine === 'undefined') return;
|
||||||
drum = MathUtil.wrapClamp(drum, 0, this.runtime.audioEngine.numDrums - 1);
|
drum = MathUtil.wrapClamp(drum, 0, this.runtime.audioEngine.numDrums - 1);
|
||||||
|
|
Loading…
Reference in a new issue