You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PackageHelper/www/assets/js/audio.js

27 lines
662 B
JavaScript

/*
* 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.
*/
var sfx = {};
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")
};
}
function playSound(sound) {
sfx[sound].play();
}
initSFX();