fixed sounds in simulator

This commit is contained in:
Peli de Halleux 2016-10-24 23:17:16 -07:00
parent 60e71e3e35
commit e7aed1d162
3 changed files with 40 additions and 39 deletions

View File

@ -136,7 +136,7 @@ namespace music {
*/ */
//% help=music/play-tone weight=90 //% help=music/play-tone weight=90
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
//% parts="headphone" //% parts="speaker"
export function playTone(frequency: number, ms: number): void { export function playTone(frequency: number, ms: number): void {
pins.analogSetPitchPin(AnalogPin.P0); pins.analogSetPitchPin(AnalogPin.P0);
pins.analogPitch(frequency, ms); pins.analogPitch(frequency, ms);
@ -148,7 +148,7 @@ namespace music {
*/ */
//% help=music/ring-tone weight=80 //% help=music/ring-tone weight=80
//% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8 //% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8
//% parts="headphone" //% parts="speaker"
export function ringTone(frequency: number): void { export function ringTone(frequency: number): void {
pins.analogSetPitchPin(AnalogPin.P0); pins.analogSetPitchPin(AnalogPin.P0);
pins.analogPitch(frequency, 0); pins.analogPitch(frequency, 0);
@ -160,7 +160,7 @@ namespace music {
*/ */
//% help=music/rest weight=79 //% help=music/rest weight=79
//% blockId=device_rest block="rest(ms)|%duration=device_beat" //% blockId=device_rest block="rest(ms)|%duration=device_beat"
//% parts="headphone" //% parts="speaker"
export function rest(ms: number): void { export function rest(ms: number): void {
playTone(0, ms); playTone(0, ms);
} }

View File

@ -106,54 +106,54 @@
"visual": "calliope", "visual": "calliope",
"gpioPinBlocks": [ "gpioPinBlocks": [
[ [
"P0" "EDGE_P0"
], ],
[ [
"P1" "EDGE_P1"
], ],
[ [
"P2" "EDGE_P2"
], ],
[ [
"P3" "EDGE_P3"
], ],
[ [
"P4", "C_P4",
"P5", "C_P5",
"P6", "C_P6",
"P7" "C_P7"
], ],
[ [
"P8", "C_P8",
"P9", "C_P9",
"P10", "C_P10",
"P11", "C_P11",
"P12" "C_P12"
], ],
[ [
"P16" "C_P16"
] ]
], ],
"gpioPinMap": { "gpioPinMap": {
"P0": "P0", "P0": "EDGE_P0",
"P1": "P1", "P1": "EDGE_P1",
"P2": "P2", "P2": "EDGE_P2",
"P3": "P3", "P3": "EDGE_P3",
"P4": "P4", "P4": "C_P4",
"P5": "P5", "P5": "C_P5",
"P6": "P6", "P6": "C_P6",
"P7": "P7", "P7": "C_P7",
"P8": "P8", "P8": "C_P8",
"P9": "P9", "P9": "C_P9",
"P10": "P10", "P10": "C_P10",
"P11": "P11", "P11": "C_P11",
"P12": "P12", "P12": "C_P12",
"P13": "P13", "P13": "C_P13",
"P14": "P14", "P14": "C_P14",
"P15": "P15", "P15": "C_P15",
"P16": "P16", "P16": "C_P16",
"P19": "P19", "P19": "C_P19",
"P20": "P20", "P20": "C_P20",
"EXT_PWR":"EXT_PWR", "EXT_PWR":"EXT_PWR",
"SPKR":"EXT_PWR", "SPKR":"EXT_PWR",
"BTN_A": "BTN_A", "BTN_A": "BTN_A",
@ -178,10 +178,10 @@
"P10" "P10"
], ],
"groundPins": [ "groundPins": [
"GND" "EDGE_GND"
], ],
"threeVoltPins": [ "threeVoltPins": [
"+3v3" "EDGE_VCC"
], ],
"attachPowerOnRight": true, "attachPowerOnRight": true,
"onboardComponents": [ "onboardComponents": [

View File

@ -1077,6 +1077,7 @@ namespace pxsim.visuals {
204.92835235595703, 204.92835235595703,
56.631452560424805 56.631452560424805
], ],
// rings
"EDGE_P0": [ "EDGE_P0": [
56.002254486083984, 56.002254486083984,
95.43130111694336 95.43130111694336