From 260840fa1483bbe6a9c599b304843f81b4b6730d Mon Sep 17 00:00:00 2001 From: Sarah Rietkerk <49178322+srietkerk@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:22:53 -0700 Subject: [PATCH] Is playing now working, moved block to micro:bit v2 group (#5320) --- libs/core/music.cpp | 9 +++++++-- libs/core/shims.d.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/core/music.cpp b/libs/core/music.cpp index d75fa157240..3a5ed5d7dd5 100644 --- a/libs/core/music.cpp +++ b/libs/core/music.cpp @@ -67,12 +67,17 @@ void setBuiltInSpeakerEnabled(bool enabled) { * Check whether any sound is being played, no matter the source */ //% blockId=music_sound_is_playing block="sound is playing" -//% group="Volume" +//% group="micro:bit (V2)" //% help=music/volume //% weight=0 bool isSoundPlaying() { #if MICROBIT_CODAL - uBit.audio.isPlaying(); + if (uBit.audio.mixer.getSilenceStartTime() == 0) { + return false; + } else { + return uBit.audio.isPlaying(); + } + #else target_panic(PANIC_VARIANT_NOT_SUPPORTED); #endif diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 3956975d633..96bab41d195 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -681,7 +681,7 @@ declare namespace music { * Check whether any sound is being played, no matter the source */ //% blockId=music_sound_is_playing block="sound is playing" - //% group="Volume" + //% group="micro:bit (V2)" //% help=music/volume //% weight=0 shim=music::isSoundPlaying function isSoundPlaying(): boolean;