Skip to content

Commit

Permalink
Is playing now working, moved block to micro:bit v2 group (#5320)
Browse files Browse the repository at this point in the history
  • Loading branch information
srietkerk authored Jul 24, 2023
1 parent bbffc70 commit 260840f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions libs/core/music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libs/core/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 260840f

Please sign in to comment.