2 * QLIB 1.0 Preloaded Sound
\r
3 * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
\r
4 * This program is free software; you can redistribute it and/or
\r
5 * modify it under the terms of the GNU General Public License
\r
6 * as published by the Free Software Foundation; either version 2
\r
7 * of the License, or (at your option) any later version.
\r
8 * http://qlib.quazzle.com
\r
11 function QSound_play(loop) {
\r
12 this._out.loop = loop || 0;
\r
13 this._out.src = this._buf.src;
\r
16 function QSound_stop() {
\r
21 function QSound_setVolume(volume) {
\r
22 this._out.volume = this.volume = volume;
\r
25 function QSound(parent, name, src, volume) {
\r
26 this.init(parent, name);
\r
27 this.volume = volume || 0;
\r
28 this.play = this.stop = this.setVolume = QControl.nop;
\r
30 document.write('<bgsound id="' + id + '" src="" volume="' + volume + '">');
\r
31 if (document.all && document.all.item) {
\r
32 this._out = document.all.item(id);
\r
33 if (_out && (typeof _out.src != "undefined") && (_out.volume === volume)) {
\r
34 document.write('<bgsound id="b' + id + '" src="' + src + '" volume="-10000">');
\r
35 this._buf = document.all.item("b" + id);
\r
37 this.play = QSound_play;
\r
38 this.stop = QSound_stop;
\r
39 this.setVolume = QSound_setVolume;
\r
41 _out.onreadystatechange = new Function("alert(0)");
\r
47 QSound.prototype = new QControl();
\r