浏览代码

Added functions to stop all sounds

tags/v0.1.0
Fen Dweller 6 年前
父节点
当前提交
bad48e0e15
找不到此签名对应的密钥 GPG 密钥 ID: E80B35A6F11C3656
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. +17
    -0
      audio.js

+ 17
- 0
audio.js 查看文件

@@ -59,6 +59,11 @@ function stopSfx(name) {
cleanPlaying();
}

function stopAllSfx() {
playing.map(item => item.stop());
cleanPlaying();
}

function stopLoop(name) {
if (looping[name]) {
looping[name].stop();
@@ -66,6 +71,18 @@ function stopLoop(name) {
}
}

function stopAllLoops() {
Object.entries(looping).forEach(([key, val]) => {
val.stop();
delete looping[key];
});
}

function stopAllSound() {
stopAllSfx();
stopAllLoops();
}

function cleanPlaying() {
playing = playing.filter(item => !item.done);
}


正在加载...
取消
保存