]> jfr.im git - irc/quakenet/qwebirc.git/blob - js/sound.js
Update SoundManager, also use the minified version.
[irc/quakenet/qwebirc.git] / js / sound.js
1 qwebirc.sound.domReady = false;
2 window.addEvent("domready", function() {
3 qwebirc.sound.domReady = true;
4 });
5
6 qwebirc.sound.SoundPlayer = new Class({
7 Implements: [Events],
8 initialize: function() {
9 this.loadingSWF = false;
10 this.loadedSWF = false;
11 },
12 go: function() {
13 if(qwebirc.sound.domReady) {
14 this.loadSoundManager();
15 } else {
16 window.addEvent("domready", function() {
17 this.loadSoundManager();
18 }.bind(this));
19 }
20 },
21 loadSoundManager: function() {
22 if(this.loadingSWF)
23 return;
24 this.loadingSWF = true;
25 if(eval("typeof soundManager") != "undefined") {
26 this.loadedSWF = true;
27 this.fireEvent("ready");
28 return;
29 }
30
31 var debugMode = false;
32 qwebirc.util.importJS("/js/" + (debugMode?"soundmanager2":"soundmanager2-nodebug-jsmin") + ".js", "soundManager", function() {
33 soundManager.url = "/sound/";
34
35 soundManager.debugMode = debugMode;
36 soundManager.useConsole = debugMode;
37 soundManager.onload = function() {
38 this.loadedSWF = true;
39 this.fireEvent("ready");
40 }.bind(this);
41 soundManager.beginDelayedInit();
42 }.bind(this));
43 },
44 createSound: function(name, src) {
45 soundManager.createSound(name, src);
46 },
47 playSound: function(name) {
48 soundManager.play(name);
49 },
50 beep: function() {
51 if(!this.beepLoaded) {
52 this.createSound("beep", "/sound/beep3.mp3");
53 this.beepLoaded = true;
54 }
55 this.playSound("beep");
56 }
57 });