Progress
This commit is contained in:
parent
2d81be3b24
commit
cb648019bb
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
libs/music/shims.d.ts
vendored
2
libs/music/shims.d.ts
vendored
@ -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;
|
||||||
|
@ -43,7 +43,9 @@ namespace pxsim.SoundMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function stop() {
|
export function stop() {
|
||||||
audio.pause();
|
if (audio) {
|
||||||
|
audio.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user