| @@ -59,6 +59,11 @@ function stopSfx(name) { | |||||
| cleanPlaying(); | cleanPlaying(); | ||||
| } | } | ||||
| function stopAllSfx() { | |||||
| playing.map(item => item.stop()); | |||||
| cleanPlaying(); | |||||
| } | |||||
| function stopLoop(name) { | function stopLoop(name) { | ||||
| if (looping[name]) { | if (looping[name]) { | ||||
| looping[name].stop(); | 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() { | function cleanPlaying() { | ||||
| playing = playing.filter(item => !item.done); | playing = playing.filter(item => !item.done); | ||||
| } | } | ||||