|
|
|
|
@ -22,6 +22,9 @@
@@ -22,6 +22,9 @@
|
|
|
|
|
"use strict"; |
|
|
|
|
define(['underscore', 'Howler', 'require'], function(_, Howler, require) { |
|
|
|
|
|
|
|
|
|
// playSound
|
|
|
|
|
return ["appData", function(appData) { |
|
|
|
|
|
|
|
|
|
var SoundInterval = function(sound, id, time) { |
|
|
|
|
this.sound = sound; |
|
|
|
|
this.id = id; |
|
|
|
|
@ -104,13 +107,15 @@ define(['underscore', 'Howler', 'require'], function(_, Howler, require) {
@@ -104,13 +107,15 @@ define(['underscore', 'Howler', 'require'], function(_, Howler, require) {
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sound.prototype.play = function(id, interval, autostart) { |
|
|
|
|
|
|
|
|
|
if (!this.sound) { |
|
|
|
|
console.log("Play sound but not initialized.", id); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if (!this.shouldPlaySound(id)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
id = this.getId(id); |
|
|
|
|
|
|
|
|
|
@ -151,13 +156,15 @@ define(['underscore', 'Howler', 'require'], function(_, Howler, require) {
@@ -151,13 +156,15 @@ define(['underscore', 'Howler', 'require'], function(_, Howler, require) {
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Sound.prototype.shouldPlaySound = function (id) { |
|
|
|
|
var data = appData.get(); |
|
|
|
|
return data && data.master.settings.playSoundEffects; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// Active initialized sound instances are kept here.
|
|
|
|
|
var registry = {}; |
|
|
|
|
window.PLAYSOUND = registry; // make available for debug.
|
|
|
|
|
|
|
|
|
|
// playSound
|
|
|
|
|
return [function() { |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
initialize: function(options, name, aliases) { |
|
|
|
|
if (!name) { |
|
|
|
|
|