Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
78694e86a2 | |||
aeaa3d7bc1 | |||
af8ce3fccf |
@ -9,6 +9,8 @@
|
||||
"AcceleratorRange.TwoG|block": "2g",
|
||||
"BaudRate.BaudRate115200|block": "115200",
|
||||
"BaudRate.BaudRate9600|block": "9600",
|
||||
"BeatFraction.Breve|block": "4",
|
||||
"BeatFraction.Double|block": "2",
|
||||
"BeatFraction.Eighth|block": "1/8",
|
||||
"BeatFraction.Half|block": "1/2",
|
||||
"BeatFraction.Quarter|block": "1/4",
|
||||
|
@ -119,7 +119,11 @@ enum BeatFraction {
|
||||
//% block="1/8"
|
||||
Eighth = 8,
|
||||
//% block="1/16"
|
||||
Sixteenth = 16
|
||||
Sixteenth = 16,
|
||||
//% block="2"
|
||||
Double = 32,
|
||||
//% block="4",
|
||||
Breve = 64
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,11 +192,15 @@ namespace music {
|
||||
init();
|
||||
if (fraction == null) fraction = BeatFraction.Whole;
|
||||
let beat = 60000 / beatsPerMinute;
|
||||
if (fraction == BeatFraction.Whole) return beat;
|
||||
else if (fraction == BeatFraction.Half) return beat / 2;
|
||||
else if (fraction == BeatFraction.Quarter) return beat / 4
|
||||
else if (fraction == BeatFraction.Eighth) return beat / 8;
|
||||
else return beat / 16;
|
||||
switch (fraction) {
|
||||
case BeatFraction.Half: return beat / 2;
|
||||
case BeatFraction.Quarter: return beat / 4;
|
||||
case BeatFraction.Eighth: return beat / 8;
|
||||
case BeatFraction.Sixteenth: return beat / 16;
|
||||
case BeatFraction.Double: return beat * 2;
|
||||
case BeatFraction.Breve: return beat * 4;
|
||||
default: return beat;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-microbit",
|
||||
"version": "0.6.23",
|
||||
"version": "0.6.24",
|
||||
"description": "micro:bit target for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
|
Reference in New Issue
Block a user