Ver código fonte

Added functions to stop all sounds

tags/v0.1.0
Fen Dweller 6 anos atrás
pai
commit
bad48e0e15
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: E80B35A6F11C3656
1 arquivos alterados com 17 adições e 0 exclusões
  1. +17
    -0
      audio.js

+ 17
- 0
audio.js Ver arquivo

@@ -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);
}


Carregando…
Cancelar
Salvar