2019-08-14 22:09:18 -06:00
|
|
|
/*
|
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
2019-08-22 22:21:03 -06:00
|
|
|
var sfx = {};
|
2019-08-14 22:09:18 -06:00
|
|
|
|
2019-08-22 22:21:03 -06:00
|
|
|
function initSFX() {
|
|
|
|
if (localStorage.getItem("alertsound") == null) {
|
|
|
|
localStorage.setItem("alertsound", "sonar");
|
|
|
|
}
|
|
|
|
|
|
|
|
var alertNoiseName = localStorage.getItem("alertsound");
|
|
|
|
|
|
|
|
sfx = {
|
|
|
|
"alert": new Audio("assets/audio/alert." + alertNoiseName + ".mp3"),
|
|
|
|
"ok": new Audio("assets/audio/ok.mp3"),
|
|
|
|
"error": new Audio("assets/audio/error.mp3")
|
|
|
|
};
|
|
|
|
}
|
2019-08-14 22:09:18 -06:00
|
|
|
|
|
|
|
function playSound(sound) {
|
|
|
|
sfx[sound].play();
|
2019-08-22 22:21:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
initSFX();
|