fixing music simulator
This commit is contained in:
		@@ -8,21 +8,10 @@ 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="speaker"
 | 
					    //% parts="speaker" async
 | 
				
			||||||
    void playTone(int freqency, int ms) {
 | 
					    void playTone(int freqency, int ms) {
 | 
				
			||||||
        uBit.soundmotor.soundOn(freqency);
 | 
					        uBit.soundmotor.soundOn(freqency);
 | 
				
			||||||
        if(ms > 0) uBit.sleep(ms);
 | 
					        if(ms > 0) uBit.sleep(ms);
 | 
				
			||||||
        uBit.soundmotor.soundOff();
 | 
					        uBit.soundmotor.soundOff();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Plays a tone through ``speaker``.
 | 
					 | 
				
			||||||
     * @param frequency pitch of the tone to play in Hertz (Hz)
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    //% help=music/ring-tone weight=80
 | 
					 | 
				
			||||||
    //% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8
 | 
					 | 
				
			||||||
    //% parts="speaker"
 | 
					 | 
				
			||||||
   void ringTone(int frequency) {
 | 
					 | 
				
			||||||
      playTone(frequency, 0);
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -140,6 +140,16 @@ namespace music {
 | 
				
			|||||||
        playTone(0, ms);
 | 
					        playTone(0, ms);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Plays a tone through ``speaker``.
 | 
				
			||||||
 | 
					     * @param frequency pitch of the tone to play in Hertz (Hz)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    //% help=music/ring-tone weight=80
 | 
				
			||||||
 | 
					    //% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8
 | 
				
			||||||
 | 
					    //% parts="speaker" async
 | 
				
			||||||
 | 
					    export function ringTone(frequency: number) {
 | 
				
			||||||
 | 
					        playTone(frequency, 0);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the frequency of a note.
 | 
					     * Gets the frequency of a note.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								libs/core/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								libs/core/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -554,17 +554,8 @@ declare 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="speaker" shim=music::playTone
 | 
					    //% parts="speaker" async shim=music::playTone
 | 
				
			||||||
    function playTone(freqency: number, ms: number): void;
 | 
					    function playTone(freqency: number, ms: number): void;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Plays a tone through ``speaker``.
 | 
					 | 
				
			||||||
     * @param frequency pitch of the tone to play in Hertz (Hz)
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    //% help=music/ring-tone weight=80
 | 
					 | 
				
			||||||
    //% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8
 | 
					 | 
				
			||||||
    //% parts="speaker" shim=music::ringTone
 | 
					 | 
				
			||||||
    function ringTone(frequency: number): void;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
declare namespace pins {
 | 
					declare namespace pins {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user