This commit is contained in:
Caitlin Hennessy 2017-12-14 09:17:47 -08:00
parent 2d81be3b24
commit cb648019bb
3 changed files with 8 additions and 3 deletions

View File

@ -168,10 +168,13 @@ void playTone(int frequency, int ms) {
*/ */
//% help=music/stop-sound //% help=music/stop-sound
//% blockId=music_stop_sounds block="stop all sounds" //% blockId=music_stop_sounds block="stop all sounds"
//% parts="headphone" async //% parts="headphone"
//% blockNamespace=music //% blockNamespace=music
//% weight=76 blockGap=8 //% weight=76 blockGap=8
void stopSounds() { void stopSounds() {
if (currentSample) {
samplePtr = currentSample->length;
}
_stopSound(); _stopSound();
} }

View File

@ -30,7 +30,7 @@ declare namespace music {
*/ */
//% help=music/stop-sound //% help=music/stop-sound
//% blockId=music_stop_sounds block="stop all sounds" //% blockId=music_stop_sounds block="stop all sounds"
//% parts="headphone" async //% parts="headphone"
//% blockNamespace=music //% blockNamespace=music
//% weight=76 blockGap=8 shim=music::stopSounds //% weight=76 blockGap=8 shim=music::stopSounds
function stopSounds(): void; function stopSounds(): void;

View File

@ -43,7 +43,9 @@ namespace pxsim.SoundMethods {
} }
export function stop() { export function stop() {
audio.pause(); if (audio) {
audio.pause();
}
} }
} }