soundjs-0.5.2.min.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. /*!
  2. * @license SoundJS
  3. * Visit http://createjs.com/ for documentation, updates and examples.
  4. *
  5. * Copyright (c) 2011-2013 gskinner.com, inc.
  6. *
  7. * Distributed under the terms of the MIT license.
  8. * http://www.opensource.org/licenses/mit-license.html
  9. *
  10. * This notice shall be included in all copies or substantial portions of the Software.
  11. */
  12. /**!
  13. * SoundJS FlashPlugin also includes swfobject (http://code.google.com/p/swfobject/)
  14. */
  15. this.createjs = this.createjs || {},
  16. function() {
  17. var a = createjs.SoundJS = createjs.SoundJS || {};
  18. a.version = "0.5.2", a.buildDate = "Thu, 12 Dec 2013 23:33:37 GMT"
  19. }(), this.createjs = this.createjs || {},
  20. function() {
  21. "use strict";
  22. var a = function() {},
  23. b = a.prototype;
  24. a.initialize = function(a) {
  25. a.addEventListener = b.addEventListener, a.on = b.on, a.removeEventListener = a.off = b.removeEventListener, a.removeAllEventListeners = b.removeAllEventListeners, a.hasEventListener = b.hasEventListener, a.dispatchEvent = b.dispatchEvent, a._dispatchEvent = b._dispatchEvent, a.willTrigger = b.willTrigger
  26. }, b._listeners = null, b._captureListeners = null, b.initialize = function() {}, b.addEventListener = function(a, b, c) {
  27. var d;
  28. d = c ? this._captureListeners = this._captureListeners || {} : this._listeners = this._listeners || {};
  29. var e = d[a];
  30. return e && this.removeEventListener(a, b, c), e = d[a], e ? e.push(b) : d[a] = [b], b
  31. }, b.on = function(a, b, c, d, e, f) {
  32. return b.handleEvent && (c = c || b, b = b.handleEvent), c = c || this, this.addEventListener(a, function(a) {
  33. b.call(c, a, e), d && a.remove()
  34. }, f)
  35. }, b.removeEventListener = function(a, b, c) {
  36. var d = c ? this._captureListeners : this._listeners;
  37. if (d) {
  38. var e = d[a];
  39. if (e)
  40. for (var f = 0, g = e.length; g > f; f++)
  41. if (e[f] == b) {
  42. 1 == g ? delete d[a] : e.splice(f, 1);
  43. break
  44. }
  45. }
  46. }, b.off = b.removeEventListener, b.removeAllEventListeners = function(a) {
  47. a ? (this._listeners && delete this._listeners[a], this._captureListeners && delete this._captureListeners[a]) : this._listeners = this._captureListeners = null
  48. }, b.dispatchEvent = function(a, b) {
  49. if ("string" == typeof a) {
  50. var c = this._listeners;
  51. if (!c || !c[a]) return !1;
  52. a = new createjs.Event(a)
  53. }
  54. if (a.target = b || this, a.bubbles && this.parent) {
  55. for (var d = this, e = [d]; d.parent;) e.push(d = d.parent);
  56. var f, g = e.length;
  57. for (f = g - 1; f >= 0 && !a.propagationStopped; f--) e[f]._dispatchEvent(a, 1 + (0 == f));
  58. for (f = 1; g > f && !a.propagationStopped; f++) e[f]._dispatchEvent(a, 3)
  59. } else this._dispatchEvent(a, 2);
  60. return a.defaultPrevented
  61. }, b.hasEventListener = function(a) {
  62. var b = this._listeners,
  63. c = this._captureListeners;
  64. return !!(b && b[a] || c && c[a])
  65. }, b.willTrigger = function(a) {
  66. for (var b = this; b;) {
  67. if (b.hasEventListener(a)) return !0;
  68. b = b.parent
  69. }
  70. return !1
  71. }, b.toString = function() {
  72. return "[EventDispatcher]"
  73. }, b._dispatchEvent = function(a, b) {
  74. var c, d = 1 == b ? this._captureListeners : this._listeners;
  75. if (a && d) {
  76. var e = d[a.type];
  77. if (!e || !(c = e.length)) return;
  78. a.currentTarget = this, a.eventPhase = b, a.removed = !1, e = e.slice();
  79. for (var f = 0; c > f && !a.immediatePropagationStopped; f++) {
  80. var g = e[f];
  81. g.handleEvent ? g.handleEvent(a) : g(a), a.removed && (this.off(a.type, g, 1 == b), a.removed = !1)
  82. }
  83. }
  84. }, createjs.EventDispatcher = a
  85. }(), this.createjs = this.createjs || {},
  86. function() {
  87. "use strict";
  88. var a = function(a, b, c) {
  89. this.initialize(a, b, c)
  90. },
  91. b = a.prototype;
  92. b.type = null, b.target = null, b.currentTarget = null, b.eventPhase = 0, b.bubbles = !1, b.cancelable = !1, b.timeStamp = 0, b.defaultPrevented = !1, b.propagationStopped = !1, b.immediatePropagationStopped = !1, b.removed = !1, b.initialize = function(a, b, c) {
  93. this.type = a, this.bubbles = b, this.cancelable = c, this.timeStamp = (new Date).getTime()
  94. }, b.preventDefault = function() {
  95. this.defaultPrevented = !0
  96. }, b.stopPropagation = function() {
  97. this.propagationStopped = !0
  98. }, b.stopImmediatePropagation = function() {
  99. this.immediatePropagationStopped = this.propagationStopped = !0
  100. }, b.remove = function() {
  101. this.removed = !0
  102. }, b.clone = function() {
  103. return new a(this.type, this.bubbles, this.cancelable)
  104. }, b.toString = function() {
  105. return "[Event (type=" + this.type + ")]"
  106. }, createjs.Event = a
  107. }(), this.createjs = this.createjs || {},
  108. function() {
  109. "use strict";
  110. createjs.indexOf = function(a, b) {
  111. for (var c = 0, d = a.length; d > c; c++)
  112. if (b === a[c]) return c;
  113. return -1
  114. }
  115. }(), this.createjs = this.createjs || {},
  116. function() {
  117. "use strict";
  118. createjs.proxy = function(a, b) {
  119. var c = Array.prototype.slice.call(arguments, 2);
  120. return function() {
  121. return a.apply(b, Array.prototype.slice.call(arguments, 0).concat(c))
  122. }
  123. }
  124. }(), this.createjs = this.createjs || {},
  125. function() {
  126. "use strict";
  127. function a() {
  128. throw "Sound cannot be instantiated"
  129. }
  130. function b(a, b) {
  131. this.init(a, b)
  132. }
  133. function c() {
  134. this.isDefault = !0, this.addEventListener = this.removeEventListener = this.removeAllEventListeners = this.dispatchEvent = this.hasEventListener = this._listeners = this._interrupt = this._playFailed = this.pause = this.resume = this.play = this._beginPlaying = this._cleanUp = this.stop = this.setMasterVolume = this.setVolume = this.mute = this.setMute = this.getMute = this.setPan = this.getPosition = this.setPosition = this.playFailed = function() {
  135. return !1
  136. }, this.getVolume = this.getPan = this.getDuration = function() {
  137. return 0
  138. }, this.playState = a.PLAY_FAILED, this.toString = function() {
  139. return "[Sound Default Sound Instance]"
  140. }
  141. }
  142. function d() {}
  143. var e = a;
  144. e.DELIMITER = "|", e.INTERRUPT_ANY = "any", e.INTERRUPT_EARLY = "early", e.INTERRUPT_LATE = "late", e.INTERRUPT_NONE = "none", e.PLAY_INITED = "playInited", e.PLAY_SUCCEEDED = "playSucceeded", e.PLAY_INTERRUPTED = "playInterrupted", e.PLAY_FINISHED = "playFinished", e.PLAY_FAILED = "playFailed", e.SUPPORTED_EXTENSIONS = ["mp3", "ogg", "mpeg", "wav", "m4a", "mp4", "aiff", "wma", "mid"], e.EXTENSION_MAP = {
  145. m4a: "mp4"
  146. }, e.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/, e.defaultInterruptBehavior = e.INTERRUPT_NONE, e.alternateExtensions = [], e._lastID = 0, e.activePlugin = null, e._pluginsRegistered = !1, e._masterVolume = 1, e._masterMute = !1, e._instances = [], e._idHash = {}, e._preloadHash = {}, e._defaultSoundInstance = null, e.addEventListener = null, e.removeEventListener = null, e.removeAllEventListeners = null, e.dispatchEvent = null, e.hasEventListener = null, e._listeners = null, createjs.EventDispatcher.initialize(e), e._sendFileLoadEvent = function(a) {
  147. if (e._preloadHash[a])
  148. for (var b = 0, c = e._preloadHash[a].length; c > b; b++) {
  149. var d = e._preloadHash[a][b];
  150. if (e._preloadHash[a][b] = !0, e.hasEventListener("fileload")) {
  151. var f = new createjs.Event("fileload");
  152. f.src = d.src, f.id = d.id, f.data = d.data, e.dispatchEvent(f)
  153. }
  154. }
  155. }, e.getPreloadHandlers = function() {
  156. return {
  157. callback: createjs.proxy(e.initLoad, e),
  158. types: ["sound"],
  159. extensions: e.SUPPORTED_EXTENSIONS
  160. }
  161. }, e.registerPlugin = function(a) {
  162. try {
  163. console.log("createjs.Sound.registerPlugin has been deprecated. Please use registerPlugins.")
  164. } catch (b) {}
  165. return e._registerPlugin(a)
  166. }, e._registerPlugin = function(a) {
  167. return e._pluginsRegistered = !0, null == a ? !1 : a.isSupported() ? (e.activePlugin = new a, !0) : !1
  168. }, e.registerPlugins = function(a) {
  169. for (var b = 0, c = a.length; c > b; b++) {
  170. var d = a[b];
  171. if (e._registerPlugin(d)) return !0
  172. }
  173. return !1
  174. }, e.initializeDefaultPlugins = function() {
  175. return null != e.activePlugin ? !0 : e._pluginsRegistered ? !1 : e.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin]) ? !0 : !1
  176. }, e.isReady = function() {
  177. return null != e.activePlugin
  178. }, e.getCapabilities = function() {
  179. return null == e.activePlugin ? null : e.activePlugin._capabilities
  180. }, e.getCapability = function(a) {
  181. return null == e.activePlugin ? null : e.activePlugin._capabilities[a]
  182. }, e.initLoad = function(a, b, c, d, f) {
  183. a = a.replace(f, "");
  184. var g = e.registerSound(a, c, d, !1, f);
  185. return null == g ? !1 : g
  186. }, e.registerSound = function(a, c, d, f, g) {
  187. if (!e.initializeDefaultPlugins()) return !1;
  188. if (a instanceof Object && (g = c, c = a.id, d = a.data, a = a.src), e.alternateExtensions.length) var h = e._parsePath2(a, "sound", c, d);
  189. else var h = e._parsePath(a, "sound", c, d);
  190. if (null == h) return !1;
  191. null != g && (a = g + a, h.src = g + h.src), null != c && (e._idHash[c] = h.src);
  192. var i = null;
  193. null != d && (isNaN(d.channels) ? isNaN(d) || (i = parseInt(d)) : i = parseInt(d.channels));
  194. var j = e.activePlugin.register(h.src, i);
  195. if (null != j && (null != j.numChannels && (i = j.numChannels), b.create(h.src, i), null != d && isNaN(d) ? d.channels = h.data.channels = i || b.maxPerChannel() : d = h.data = i || b.maxPerChannel(), null != j.tag ? h.tag = j.tag : j.src && (h.src = j.src), null != j.completeHandler && (h.completeHandler = j.completeHandler), j.type && (h.type = j.type)), 0 != f)
  196. if (e._preloadHash[h.src] || (e._preloadHash[h.src] = []), e._preloadHash[h.src].push({
  197. src: a,
  198. id: c,
  199. data: d
  200. }), 1 == e._preloadHash[h.src].length) e.activePlugin.preload(h.src, j);
  201. else if (1 == e._preloadHash[h.src][0]) return !0;
  202. return h
  203. }, e.registerManifest = function(a, b) {
  204. for (var c = [], d = 0, e = a.length; e > d; d++) c[d] = createjs.Sound.registerSound(a[d].src, a[d].id, a[d].data, a[d].preload, b);
  205. return c
  206. }, e.removeSound = function(a, c) {
  207. if (null == e.activePlugin) return !1;
  208. if (a instanceof Object && (a = a.src), a = e._getSrcById(a), e.alternateExtensions.length) var d = e._parsePath2(a);
  209. else var d = e._parsePath(a);
  210. if (null == d) return !1;
  211. null != c && (d.src = c + d.src), a = d.src;
  212. for (var f in e._idHash) e._idHash[f] == a && delete e._idHash[f];
  213. return b.removeSrc(a), delete e._preloadHash[a], e.activePlugin.removeSound(a), !0
  214. }, e.removeManifest = function(a, b) {
  215. for (var c = [], d = 0, e = a.length; e > d; d++) c[d] = createjs.Sound.removeSound(a[d].src, b);
  216. return c
  217. }, e.removeAllSounds = function() {
  218. e._idHash = {}, e._preloadHash = {}, b.removeAll(), e.activePlugin.removeAllSounds()
  219. }, e.loadComplete = function(a) {
  220. if (e.alternateExtensions.length) var b = e._parsePath2(a, "sound");
  221. else var b = e._parsePath(a, "sound");
  222. return a = b ? e._getSrcById(b.src) : e._getSrcById(a), 1 == e._preloadHash[a][0]
  223. }, e._parsePath = function(a, b, c, d) {
  224. "string" != typeof a && (a = a.toString());
  225. var f = a.split(e.DELIMITER);
  226. if (f.length > 1) try {
  227. console.log('createjs.Sound.DELIMITER "|" loading approach has been deprecated. Please use the new alternateExtensions property.')
  228. } catch (g) {}
  229. for (var h = {
  230. type: b || "sound",
  231. id: c,
  232. data: d
  233. }, i = e.getCapabilities(), j = 0, k = f.length; k > j; j++) {
  234. var l = f[j],
  235. m = l.match(e.FILE_PATTERN);
  236. if (null == m) return !1;
  237. var n = m[4],
  238. o = m[5];
  239. if (i[o] && createjs.indexOf(e.SUPPORTED_EXTENSIONS, o) > -1) return h.name = n, h.src = l, h.extension = o, h
  240. }
  241. return null
  242. }, e._parsePath2 = function(a, b, c, d) {
  243. "string" != typeof a && (a = a.toString());
  244. var f = a.match(e.FILE_PATTERN);
  245. if (null == f) return !1;
  246. for (var g = f[4], h = f[5], i = e.getCapabilities(), j = 0; !i[h];)
  247. if (h = e.alternateExtensions[j++], j > e.alternateExtensions.length) return null;
  248. a = a.replace("." + f[5], "." + h);
  249. var k = {
  250. type: b || "sound",
  251. id: c,
  252. data: d
  253. };
  254. return k.name = g, k.src = a, k.extension = h, k
  255. }, e.play = function(a, b, c, d, f, g, h) {
  256. var i = e.createInstance(a),
  257. j = e._playInstance(i, b, c, d, f, g, h);
  258. return j || i.playFailed(), i
  259. }, e.createInstance = function(c) {
  260. if (!e.initializeDefaultPlugins()) return e._defaultSoundInstance;
  261. if (c = e._getSrcById(c), e.alternateExtensions.length) var d = e._parsePath2(c, "sound");
  262. else var d = e._parsePath(c, "sound");
  263. var f = null;
  264. return null != d && null != d.src ? (b.create(d.src), f = e.activePlugin.create(d.src)) : f = a._defaultSoundInstance, f.uniqueId = e._lastID++, f
  265. }, e.setVolume = function(a) {
  266. if (null == Number(a)) return !1;
  267. if (a = Math.max(0, Math.min(1, a)), e._masterVolume = a, !this.activePlugin || !this.activePlugin.setVolume || !this.activePlugin.setVolume(a))
  268. for (var b = this._instances, c = 0, d = b.length; d > c; c++) b[c].setMasterVolume(a)
  269. }, e.getVolume = function() {
  270. return e._masterVolume
  271. }, e.setMute = function(a) {
  272. if (null == a || void 0 == a) return !1;
  273. if (this._masterMute = a, !this.activePlugin || !this.activePlugin.setMute || !this.activePlugin.setMute(a))
  274. for (var b = this._instances, c = 0, d = b.length; d > c; c++) b[c].setMasterMute(a);
  275. return !0
  276. }, e.getMute = function() {
  277. return this._masterMute
  278. }, e.stop = function() {
  279. for (var a = this._instances, b = a.length; b--;) a[b].stop()
  280. }, e._playInstance = function(a, b, c, d, f, g, h) {
  281. if (b instanceof Object && (c = b.delay, d = b.offset, f = b.loop, g = b.volume, h = b.pan, b = b.interrupt), b = b || e.defaultInterruptBehavior, null == c && (c = 0), null == d && (d = a.getPosition()), null == f && (f = 0), null == g && (g = a.volume), null == h && (h = a.pan), 0 == c) {
  282. var i = e._beginPlaying(a, b, d, f, g, h);
  283. if (!i) return !1
  284. } else {
  285. var j = setTimeout(function() {
  286. e._beginPlaying(a, b, d, f, g, h)
  287. }, c);
  288. a._delayTimeoutId = j
  289. }
  290. return this._instances.push(a), !0
  291. }, e._beginPlaying = function(a, c, d, e, f, g) {
  292. if (!b.add(a, c)) return !1;
  293. var h = a._beginPlaying(d, e, f, g);
  294. if (!h) {
  295. var i = createjs.indexOf(this._instances, a);
  296. return i > -1 && this._instances.splice(i, 1), !1
  297. }
  298. return !0
  299. }, e._getSrcById = function(a) {
  300. return null == e._idHash || null == e._idHash[a] ? a : e._idHash[a]
  301. }, e._playFinished = function(a) {
  302. b.remove(a);
  303. var c = createjs.indexOf(this._instances, a);
  304. c > -1 && this._instances.splice(c, 1)
  305. }, createjs.Sound = a, b.channels = {}, b.create = function(a, c) {
  306. var d = b.get(a);
  307. return null == d ? (b.channels[a] = new b(a, c), !0) : !1
  308. }, b.removeSrc = function(a) {
  309. var c = b.get(a);
  310. return null == c ? !1 : (c.removeAll(), delete b.channels[a], !0)
  311. }, b.removeAll = function() {
  312. for (var a in b.channels) b.channels[a].removeAll();
  313. b.channels = {}
  314. }, b.add = function(a, c) {
  315. var d = b.get(a.src);
  316. return null == d ? !1 : d.add(a, c)
  317. }, b.remove = function(a) {
  318. var c = b.get(a.src);
  319. return null == c ? !1 : (c.remove(a), !0)
  320. }, b.maxPerChannel = function() {
  321. return f.maxDefault
  322. }, b.get = function(a) {
  323. return b.channels[a]
  324. };
  325. var f = b.prototype;
  326. f.src = null, f.max = null, f.maxDefault = 100, f.length = 0, f.init = function(a, b) {
  327. this.src = a, this.max = b || this.maxDefault, -1 == this.max && (this.max = this.maxDefault), this._instances = []
  328. }, f.get = function(a) {
  329. return this._instances[a]
  330. }, f.add = function(a, b) {
  331. return this.getSlot(b, a) ? (this._instances.push(a), this.length++, !0) : !1
  332. }, f.remove = function(a) {
  333. var b = createjs.indexOf(this._instances, a);
  334. return -1 == b ? !1 : (this._instances.splice(b, 1), this.length--, !0)
  335. }, f.removeAll = function() {
  336. for (var a = this.length - 1; a >= 0; a--) this._instances[a].stop()
  337. }, f.getSlot = function(b) {
  338. for (var c, d, e = 0, f = this.max; f > e; e++) {
  339. if (c = this.get(e), null == c) return !0;
  340. (b != a.INTERRUPT_NONE || c.playState == a.PLAY_FINISHED) && (0 != e ? c.playState == a.PLAY_FINISHED || c.playState == a.PLAY_INTERRUPTED || c.playState == a.PLAY_FAILED ? d = c : (b == a.INTERRUPT_EARLY && c.getPosition() < d.getPosition() || b == a.INTERRUPT_LATE && c.getPosition() > d.getPosition()) && (d = c) : d = c)
  341. }
  342. return null != d ? (d._interrupt(), this.remove(d), !0) : !1
  343. }, f.toString = function() {
  344. return "[Sound SoundChannel]"
  345. }, a._defaultSoundInstance = new c, d.init = function() {
  346. var a = window.navigator.userAgent;
  347. d.isFirefox = a.indexOf("Firefox") > -1, d.isOpera = null != window.opera, d.isChrome = a.indexOf("Chrome") > -1, d.isIOS = a.indexOf("iPod") > -1 || a.indexOf("iPhone") > -1 || a.indexOf("iPad") > -1, d.isAndroid = a.indexOf("Android") > -1, d.isBlackberry = a.indexOf("Blackberry") > -1
  348. }, d.init(), createjs.Sound.BrowserDetect = d
  349. }(), this.createjs = this.createjs || {},
  350. function() {
  351. "use strict";
  352. function a() {
  353. this._init()
  354. }
  355. var b = a;
  356. b._capabilities = null, b.isSupported = function() {
  357. var a = createjs.Sound.BrowserDetect.isIOS || createjs.Sound.BrowserDetect.isAndroid || createjs.Sound.BrowserDetect.isBlackberry;
  358. return "file:" != location.protocol || a || this._isFileXHRSupported() ? (b._generateCapabilities(), null == b.context ? !1 : !0) : !1
  359. }, b._isFileXHRSupported = function() {
  360. var a = !0,
  361. b = new XMLHttpRequest;
  362. try {
  363. b.open("GET", "fail.fail", !1)
  364. } catch (c) {
  365. return a = !1
  366. }
  367. b.onerror = function() {
  368. a = !1
  369. }, b.onload = function() {
  370. a = 404 == this.status || 200 == this.status || 0 == this.status && "" != this.response
  371. };
  372. try {
  373. b.send()
  374. } catch (c) {
  375. a = !1
  376. }
  377. return a
  378. }, b._generateCapabilities = function() {
  379. if (null == b._capabilities) {
  380. var a = document.createElement("audio");
  381. if (null == a.canPlayType) return null;
  382. if (window.webkitAudioContext) b.context = new webkitAudioContext;
  383. else {
  384. if (!window.AudioContext) return null;
  385. b.context = new AudioContext
  386. }
  387. b._compatibilitySetUp(), b.playEmptySound(), b._capabilities = {
  388. panning: !0,
  389. volume: !0,
  390. tracks: -1
  391. };
  392. for (var c = createjs.Sound.SUPPORTED_EXTENSIONS, d = createjs.Sound.EXTENSION_MAP, e = 0, f = c.length; f > e; e++) {
  393. var g = c[e],
  394. h = d[g] || g;
  395. b._capabilities[g] = "no" != a.canPlayType("audio/" + g) && "" != a.canPlayType("audio/" + g) || "no" != a.canPlayType("audio/" + h) && "" != a.canPlayType("audio/" + h)
  396. }
  397. b.context.destination.numberOfChannels < 2 && (b._capabilities.panning = !1), b.dynamicsCompressorNode = b.context.createDynamicsCompressor(), b.dynamicsCompressorNode.connect(b.context.destination), b.gainNode = b.context.createGain(), b.gainNode.connect(b.dynamicsCompressorNode)
  398. }
  399. }, b._compatibilitySetUp = function() {
  400. if (!b.context.createGain) {
  401. b.context.createGain = b.context.createGainNode;
  402. var a = b.context.createBufferSource();
  403. a.__proto__.start = a.__proto__.noteGrainOn, a.__proto__.stop = a.__proto__.noteOff, this._panningModel = 0
  404. }
  405. }, b.playEmptySound = function() {
  406. var a = this.context.createBuffer(1, 1, 22050),
  407. b = this.context.createBufferSource();
  408. b.buffer = a, b.connect(this.context.destination), b.start(0, 0, 0)
  409. };
  410. var c = a.prototype;
  411. c._capabilities = null, c._volume = 1, c.context = null, c._panningModel = "equalpower", c.dynamicsCompressorNode = null, c.gainNode = null, c._arrayBuffers = null, c._init = function() {
  412. this._capabilities = b._capabilities, this._arrayBuffers = {}, this.context = b.context, this.gainNode = b.gainNode, this.dynamicsCompressorNode = b.dynamicsCompressorNode
  413. }, c.register = function(a) {
  414. this._arrayBuffers[a] = !0;
  415. var b = new createjs.WebAudioPlugin.Loader(a, this);
  416. return {
  417. tag: b
  418. }
  419. }, c.isPreloadStarted = function(a) {
  420. return null != this._arrayBuffers[a]
  421. }, c.isPreloadComplete = function(a) {
  422. return !(null == this._arrayBuffers[a] || 1 == this._arrayBuffers[a])
  423. }, c.removeSound = function(a) {
  424. delete this._arrayBuffers[a]
  425. }, c.removeAllSounds = function() {
  426. this._arrayBuffers = {}
  427. }, c.addPreloadResults = function(a, b) {
  428. this._arrayBuffers[a] = b
  429. }, c._handlePreloadComplete = function() {
  430. createjs.Sound._sendFileLoadEvent(this.src)
  431. }, c.preload = function(a) {
  432. this._arrayBuffers[a] = !0;
  433. var b = new createjs.WebAudioPlugin.Loader(a, this);
  434. b.onload = this._handlePreloadComplete, b.load()
  435. }, c.create = function(a) {
  436. return this.isPreloadStarted(a) || this.preload(a), new createjs.WebAudioPlugin.SoundInstance(a, this)
  437. }, c.setVolume = function(a) {
  438. return this._volume = a, this._updateVolume(), !0
  439. }, c._updateVolume = function() {
  440. var a = createjs.Sound._masterMute ? 0 : this._volume;
  441. a != this.gainNode.gain.value && (this.gainNode.gain.value = a)
  442. }, c.getVolume = function() {
  443. return this._volume
  444. }, c.setMute = function() {
  445. return this._updateVolume(), !0
  446. }, c.toString = function() {
  447. return "[WebAudioPlugin]"
  448. }, createjs.WebAudioPlugin = a
  449. }(),
  450. function() {
  451. "use strict";
  452. function a(a, b) {
  453. this._init(a, b)
  454. }
  455. var b = a.prototype = new createjs.EventDispatcher;
  456. b.src = null, b.uniqueId = -1, b.playState = null, b._owner = null, b._offset = 0, b._delay = 0, b._volume = 1;
  457. try {
  458. Object.defineProperty(b, "volume", {
  459. get: function() {
  460. return this._volume
  461. },
  462. set: function(a) {
  463. return null == Number(a) ? !1 : (a = Math.max(0, Math.min(1, a)), this._volume = a, this._updateVolume(), void 0)
  464. }
  465. })
  466. } catch (c) {}
  467. b._pan = 0;
  468. try {
  469. Object.defineProperty(b, "pan", {
  470. get: function() {
  471. return this._pan
  472. },
  473. set: function(a) {
  474. return this._owner._capabilities.panning && null != Number(a) ? (a = Math.max(-1, Math.min(1, a)), this._pan = a, this.panNode.setPosition(a, 0, -.5), void 0) : !1
  475. }
  476. })
  477. } catch (c) {}
  478. b._duration = 0, b._remainingLoops = 0, b._delayTimeoutId = null, b._soundCompleteTimeout = null, b.gainNode = null, b.panNode = null, b.sourceNode = null, b._sourceNodeNext = null, b._muted = !1, b._paused = !1, b._startTime = 0, b._endedHandler = null, b._sendEvent = function(a) {
  479. var b = new createjs.Event(a);
  480. this.dispatchEvent(b)
  481. }, b._init = function(a, b) {
  482. this._owner = b, this.src = a, this.gainNode = this._owner.context.createGain(), this.panNode = this._owner.context.createPanner(), this.panNode.panningModel = this._owner._panningModel, this.panNode.connect(this.gainNode), this._owner.isPreloadComplete(this.src) && (this._duration = 1e3 * this._owner._arrayBuffers[this.src].duration), this._endedHandler = createjs.proxy(this._handleSoundComplete, this)
  483. }, b._cleanUp = function() {
  484. this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this.sourceNode = this._cleanUpAudioNode(this.sourceNode), this._sourceNodeNext = this._cleanUpAudioNode(this._sourceNodeNext)), 0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(0), clearTimeout(this._delayTimeoutId), clearTimeout(this._soundCompleteTimeout), this._startTime = 0, null != window.createjs && createjs.Sound._playFinished(this)
  485. }, b._cleanUpAudioNode = function(a) {
  486. return a && (a.stop(0), a.disconnect(this.panNode), a = null), a
  487. }, b._interrupt = function() {
  488. this._cleanUp(), this.playState = createjs.Sound.PLAY_INTERRUPTED, this._paused = !1, this._sendEvent("interrupted")
  489. }, b._handleSoundReady = function() {
  490. if (null != window.createjs) {
  491. if (1e3 * this._offset > this.getDuration()) return this.playFailed(), void 0;
  492. this._offset < 0 && (this._offset = 0), this.playState = createjs.Sound.PLAY_SUCCEEDED, this._paused = !1, this.gainNode.connect(this._owner.gainNode);
  493. var a = this._owner._arrayBuffers[this.src].duration;
  494. this.sourceNode = this._createAndPlayAudioNode(this._owner.context.currentTime - a, this._offset), this._duration = 1e3 * a, this._startTime = this.sourceNode.startTime - this._offset, this._soundCompleteTimeout = setTimeout(this._endedHandler, 1e3 * (a - this._offset)), 0 != this._remainingLoops && (this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime, 0))
  495. }
  496. }, b._createAndPlayAudioNode = function(a, b) {
  497. var c = this._owner.context.createBufferSource();
  498. return c.buffer = this._owner._arrayBuffers[this.src], c.connect(this.panNode), this._owner.context.currentTime, c.startTime = a + c.buffer.duration, c.start(c.startTime, b, c.buffer.duration - b), c
  499. }, b.play = function(a, b, c, d, e, f) {
  500. this._cleanUp(), createjs.Sound._playInstance(this, a, b, c, d, e, f)
  501. }, b._beginPlaying = function(a, b, c, d) {
  502. return null != window.createjs && this.src ? (this._offset = a / 1e3, this._remainingLoops = b, this.volume = c, this.pan = d, this._owner.isPreloadComplete(this.src) ? (this._handleSoundReady(null), this._sendEvent("succeeded"), 1) : (this.playFailed(), void 0)) : void 0
  503. }, b.pause = function() {
  504. return this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED ? !1 : (this._paused = !0, this._offset = this._owner.context.currentTime - this._startTime, this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), 0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(), clearTimeout(this._delayTimeoutId), clearTimeout(this._soundCompleteTimeout), !0)
  505. }, b.resume = function() {
  506. return this._paused ? (this._handleSoundReady(null), !0) : !1
  507. }, b.stop = function() {
  508. return this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._offset = 0, !0
  509. }, b.setVolume = function(a) {
  510. return this.volume = a, !0
  511. }, b._updateVolume = function() {
  512. var a = this._muted ? 0 : this._volume;
  513. return a != this.gainNode.gain.value ? (this.gainNode.gain.value = a, !0) : !1
  514. }, b.getVolume = function() {
  515. return this.volume
  516. }, b.setMute = function(a) {
  517. return null == a || void 0 == a ? !1 : (this._muted = a, this._updateVolume(), !0)
  518. }, b.getMute = function() {
  519. return this._muted
  520. }, b.setPan = function(a) {
  521. return this.pan = a, this.pan != a ? !1 : void 0
  522. }, b.getPan = function() {
  523. return this.pan
  524. }, b.getPosition = function() {
  525. if (this._paused || null == this.sourceNode) var a = this._offset;
  526. else var a = this._owner.context.currentTime - this._startTime;
  527. return 1e3 * a
  528. }, b.setPosition = function(a) {
  529. return this._offset = a / 1e3, this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), clearTimeout(this._soundCompleteTimeout)), this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED || this._handleSoundReady(null), !0
  530. }, b.getDuration = function() {
  531. return this._duration
  532. }, b._handleSoundComplete = function() {
  533. return this._offset = 0, 0 != this._remainingLoops ? (this._remainingLoops--, this._sourceNodeNext ? (this._cleanUpAudioNode(this.sourceNode), this.sourceNode = this._sourceNodeNext, this._startTime = this.sourceNode.startTime, this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime, 0), this._soundCompleteTimeout = setTimeout(this._endedHandler, this._duration)) : this._handleSoundReady(null), this._sendEvent("loop"), void 0) : (null != window.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._sendEvent("complete")), void 0)
  534. }, b.playFailed = function() {
  535. null != window.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FAILED, this._sendEvent("failed"))
  536. }, b.toString = function() {
  537. return "[WebAudioPlugin SoundInstance]"
  538. }, createjs.WebAudioPlugin.SoundInstance = a
  539. }(),
  540. function() {
  541. "use strict";
  542. function a(a, b) {
  543. this._init(a, b)
  544. }
  545. var b = a.prototype;
  546. b.request = null, b.owner = null, b.progress = -1, b.src = null, b.originalSrc = null, b.result = null, b.onload = null, b.onprogress = null, b.onError = null, b._init = function(a, b) {
  547. this.src = a, this.originalSrc = a, this.owner = b
  548. }, b.load = function(a) {
  549. null != a && (this.src = a), this.request = new XMLHttpRequest, this.request.open("GET", this.src, !0), this.request.responseType = "arraybuffer", this.request.onload = createjs.proxy(this.handleLoad, this), this.request.onError = createjs.proxy(this.handleError, this), this.request.onprogress = createjs.proxy(this.handleProgress, this), this.request.send()
  550. }, b.handleProgress = function(a, b) {
  551. this.progress = a / b, null != this.onprogress && this.onprogress({
  552. loaded: a,
  553. total: b,
  554. progress: this.progress
  555. })
  556. }, b.handleLoad = function() {
  557. this.owner.context.decodeAudioData(this.request.response, createjs.proxy(this.handleAudioDecoded, this), createjs.proxy(this.handleError, this))
  558. }, b.handleAudioDecoded = function(a) {
  559. this.progress = 1, this.result = a, this.src = this.originalSrc, this.owner.addPreloadResults(this.src, this.result), this.onload && this.onload()
  560. }, b.handleError = function(a) {
  561. this.owner.removeSound(this.src), this.onerror && this.onerror(a)
  562. }, b.toString = function() {
  563. return "[WebAudioPlugin Loader]"
  564. }, createjs.WebAudioPlugin.Loader = a
  565. }(), this.createjs = this.createjs || {},
  566. function() {
  567. "use strict";
  568. function a() {
  569. this._init()
  570. }
  571. var b = a;
  572. b.MAX_INSTANCES = 30, b._AUDIO_READY = "canplaythrough", b._AUDIO_ENDED = "ended", b._AUDIO_SEEKED = "seeked", b._AUDIO_STALLED = "stalled", b._capabilities = null, b.enableIOS = !1, b.isSupported = function() {
  573. if (createjs.Sound.BrowserDetect.isIOS && !b.enableIOS) return !1;
  574. b._generateCapabilities();
  575. var a = b.tag;
  576. return null == a || null == b._capabilities ? !1 : !0
  577. }, b._generateCapabilities = function() {
  578. if (null == b._capabilities) {
  579. var a = b.tag = document.createElement("audio");
  580. if (null == a.canPlayType) return null;
  581. b._capabilities = {
  582. panning: !0,
  583. volume: !0,
  584. tracks: -1
  585. };
  586. for (var c = createjs.Sound.SUPPORTED_EXTENSIONS, d = createjs.Sound.EXTENSION_MAP, e = 0, f = c.length; f > e; e++) {
  587. var g = c[e],
  588. h = d[g] || g;
  589. b._capabilities[g] = "no" != a.canPlayType("audio/" + g) && "" != a.canPlayType("audio/" + g) || "no" != a.canPlayType("audio/" + h) && "" != a.canPlayType("audio/" + h)
  590. }
  591. }
  592. };
  593. var c = a.prototype;
  594. c._capabilities = null, c._audioSources = null, c.defaultNumChannels = 2, c.loadedHandler = null, c._init = function() {
  595. this._capabilities = b._capabilities, this._audioSources = {}
  596. }, c.register = function(a, b) {
  597. this._audioSources[a] = !0;
  598. for (var c = createjs.HTMLAudioPlugin.TagPool.get(a), d = null, e = b || this.defaultNumChannels, f = 0; e > f; f++) d = this._createTag(a), c.add(d);
  599. if (d.id = a, this.loadedHandler = createjs.proxy(this._handleTagLoad, this), d.addEventListener && d.addEventListener("canplaythrough", this.loadedHandler), null == d.onreadystatechange) d.onreadystatechange = this.loadedHandler;
  600. else {
  601. var g = d.onreadystatechange;
  602. d.onreadystatechange = function() {
  603. g(), this.loadedHandler()
  604. }
  605. }
  606. return {
  607. tag: d,
  608. numChannels: e
  609. }
  610. }, c._handleTagLoad = function(a) {
  611. a.target.removeEventListener && a.target.removeEventListener("canplaythrough", this.loadedHandler), a.target.onreadystatechange = null, a.target.src != a.target.id && createjs.HTMLAudioPlugin.TagPool.checkSrc(a.target.id)
  612. }, c._createTag = function(a) {
  613. var b = document.createElement("audio");
  614. return b.autoplay = !1, b.preload = "none", b.src = a, b
  615. }, c.removeSound = function(a) {
  616. delete this._audioSources[a], createjs.HTMLAudioPlugin.TagPool.remove(a)
  617. }, c.removeAllSounds = function() {
  618. this._audioSources = {}, createjs.HTMLAudioPlugin.TagPool.removeAll()
  619. }, c.create = function(a) {
  620. if (!this.isPreloadStarted(a)) {
  621. var b = createjs.HTMLAudioPlugin.TagPool.get(a),
  622. c = this._createTag(a);
  623. c.id = a, b.add(c), this.preload(a, {
  624. tag: c
  625. })
  626. }
  627. return new createjs.HTMLAudioPlugin.SoundInstance(a, this)
  628. }, c.isPreloadStarted = function(a) {
  629. return null != this._audioSources[a]
  630. }, c.preload = function(a, b) {
  631. this._audioSources[a] = !0, new createjs.HTMLAudioPlugin.Loader(a, b.tag)
  632. }, c.toString = function() {
  633. return "[HTMLAudioPlugin]"
  634. }, createjs.HTMLAudioPlugin = a
  635. }(),
  636. function() {
  637. "use strict";
  638. function a(a, b) {
  639. this._init(a, b)
  640. }
  641. var b = a.prototype = new createjs.EventDispatcher;
  642. b.src = null, b.uniqueId = -1, b.playState = null, b._owner = null, b.loaded = !1, b._offset = 0, b._delay = 0, b._volume = 1;
  643. try {
  644. Object.defineProperty(b, "volume", {
  645. get: function() {
  646. return this._volume
  647. },
  648. set: function(a) {
  649. null != Number(a) && (a = Math.max(0, Math.min(1, a)), this._volume = a, this._updateVolume())
  650. }
  651. })
  652. } catch (c) {}
  653. b.pan = 0, b._duration = 0, b._remainingLoops = 0, b._delayTimeoutId = null, b.tag = null, b._muted = !1, b._paused = !1, b._endedHandler = null, b._readyHandler = null, b._stalledHandler = null, b.loopHandler = null, b._init = function(a, b) {
  654. this.src = a, this._owner = b, this._endedHandler = createjs.proxy(this._handleSoundComplete, this), this._readyHandler = createjs.proxy(this._handleSoundReady, this), this._stalledHandler = createjs.proxy(this._handleSoundStalled, this), this.loopHandler = createjs.proxy(this.handleSoundLoop, this)
  655. }, b._sendEvent = function(a) {
  656. var b = new createjs.Event(a);
  657. this.dispatchEvent(b)
  658. }, b._cleanUp = function() {
  659. var a = this.tag;
  660. if (null != a) {
  661. a.pause(), a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED, this._endedHandler, !1), a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
  662. try {
  663. a.currentTime = 0
  664. } catch (b) {}
  665. createjs.HTMLAudioPlugin.TagPool.setInstance(this.src, a), this.tag = null
  666. }
  667. clearTimeout(this._delayTimeoutId), null != window.createjs && createjs.Sound._playFinished(this)
  668. }, b._interrupt = function() {
  669. null != this.tag && (this.playState = createjs.Sound.PLAY_INTERRUPTED, this._cleanUp(), this._paused = !1, this._sendEvent("interrupted"))
  670. }, b.play = function(a, b, c, d, e, f) {
  671. this._cleanUp(), createjs.Sound._playInstance(this, a, b, c, d, e, f)
  672. }, b._beginPlaying = function(a, b, c, d) {
  673. if (null == window.createjs) return -1;
  674. var e = this.tag = createjs.HTMLAudioPlugin.TagPool.getInstance(this.src);
  675. return null == e ? (this.playFailed(), -1) : (e.addEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED, this._endedHandler, !1), this._offset = a, this.volume = c, this.pan = d, this._updateVolume(), this._remainingLoops = b, 4 !== e.readyState ? (e.addEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), e.addEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED, this._stalledHandler, !1), e.preload = "auto", e.load()) : this._handleSoundReady(null), this._sendEvent("succeeded"), 1)
  676. }, b._handleSoundStalled = function() {
  677. this._cleanUp(), this._sendEvent("failed")
  678. }, b._handleSoundReady = function() {
  679. if (null != window.createjs) {
  680. if (this._duration = 1e3 * this.tag.duration, this.playState = createjs.Sound.PLAY_SUCCEEDED, this._paused = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), this._offset >= this.getDuration()) return this.playFailed(), void 0;
  681. this._offset > 0 && (this.tag.currentTime = .001 * this._offset), -1 == this._remainingLoops && (this.tag.loop = !0), 0 != this._remainingLoops && (this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1), this.tag.loop = !0), this.tag.play()
  682. }
  683. }, b.pause = function() {
  684. return this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED || null == this.tag ? !1 : (this._paused = !0, this.tag.pause(), clearTimeout(this._delayTimeoutId), !0)
  685. }, b.resume = function() {
  686. return this._paused && null != this.tag ? (this._paused = !1, this.tag.play(), !0) : !1
  687. }, b.stop = function() {
  688. return this._offset = 0, this.pause(), this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), !0
  689. }, b.setMasterVolume = function() {
  690. return this._updateVolume(), !0
  691. }, b.setVolume = function(a) {
  692. return this.volume = a, !0
  693. }, b._updateVolume = function() {
  694. if (null != this.tag) {
  695. var a = this._muted || createjs.Sound._masterMute ? 0 : this._volume * createjs.Sound._masterVolume;
  696. return a != this.tag.volume && (this.tag.volume = a), !0
  697. }
  698. return !1
  699. }, b.getVolume = function() {
  700. return this.volume
  701. }, b.setMasterMute = function() {
  702. return this._updateVolume(), !0
  703. }, b.setMute = function(a) {
  704. return null == a || void 0 == a ? !1 : (this._muted = a, this._updateVolume(), !0)
  705. }, b.getMute = function() {
  706. return this._muted
  707. }, b.setPan = function() {
  708. return !1
  709. }, b.getPan = function() {
  710. return 0
  711. }, b.getPosition = function() {
  712. return null == this.tag ? this._offset : 1e3 * this.tag.currentTime
  713. }, b.setPosition = function(a) {
  714. if (null == this.tag) this._offset = a;
  715. else {
  716. this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
  717. try {
  718. this.tag.currentTime = .001 * a
  719. } catch (b) {
  720. return !1
  721. }
  722. this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1)
  723. }
  724. return !0
  725. }, b.getDuration = function() {
  726. return this._duration
  727. }, b._handleSoundComplete = function() {
  728. this._offset = 0, null != window.createjs && (this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), this._sendEvent("complete"))
  729. }, b.handleSoundLoop = function() {
  730. this._offset = 0, this._remainingLoops--, 0 == this._remainingLoops && (this.tag.loop = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1)), this._sendEvent("loop")
  731. }, b.playFailed = function() {
  732. null != window.createjs && (this.playState = createjs.Sound.PLAY_FAILED, this._cleanUp(), this._sendEvent("failed"))
  733. }, b.toString = function() {
  734. return "[HTMLAudioPlugin SoundInstance]"
  735. }, createjs.HTMLAudioPlugin.SoundInstance = a
  736. }(),
  737. function() {
  738. "use strict";
  739. function a(a, b) {
  740. this._init(a, b)
  741. }
  742. var b = a.prototype;
  743. b.src = null, b.tag = null, b.preloadTimer = null, b.loadedHandler = null, b._init = function(a, b) {
  744. if (this.src = a, this.tag = b, this.preloadTimer = setInterval(createjs.proxy(this.preloadTick, this), 200), this.loadedHandler = createjs.proxy(this.sendLoadedEvent, this), this.tag.addEventListener && this.tag.addEventListener("canplaythrough", this.loadedHandler), null == this.tag.onreadystatechange) this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this);
  745. else {
  746. var c = this.tag.onreadystatechange;
  747. this.tag.onreadystatechange = function() {
  748. c(), this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this)
  749. }
  750. }
  751. this.tag.preload = "auto", this.tag.load()
  752. }, b.preloadTick = function() {
  753. var a = this.tag.buffered,
  754. b = this.tag.duration;
  755. a.length > 0 && a.end(0) >= b - 1 && this.handleTagLoaded()
  756. }, b.handleTagLoaded = function() {
  757. clearInterval(this.preloadTimer)
  758. }, b.sendLoadedEvent = function() {
  759. this.tag.removeEventListener && this.tag.removeEventListener("canplaythrough", this.loadedHandler), this.tag.onreadystatechange = null, createjs.Sound._sendFileLoadEvent(this.src)
  760. }, b.toString = function() {
  761. return "[HTMLAudioPlugin Loader]"
  762. }, createjs.HTMLAudioPlugin.Loader = a
  763. }(),
  764. function() {
  765. "use strict";
  766. function a(a) {
  767. this._init(a)
  768. }
  769. var b = a;
  770. b.tags = {}, b.get = function(c) {
  771. var d = b.tags[c];
  772. return null == d && (d = b.tags[c] = new a(c)), d
  773. }, b.remove = function(a) {
  774. var c = b.tags[a];
  775. return null == c ? !1 : (c.removeAll(), delete b.tags[a], !0)
  776. }, b.removeAll = function() {
  777. for (var a in b.tags) b.tags[a].removeAll();
  778. b.tags = {}
  779. }, b.getInstance = function(a) {
  780. var c = b.tags[a];
  781. return null == c ? null : c.get()
  782. }, b.setInstance = function(a, c) {
  783. var d = b.tags[a];
  784. return null == d ? null : d.set(c)
  785. }, b.checkSrc = function(a) {
  786. var c = b.tags[a];
  787. return null == c ? null : (c.checkSrcChange(), void 0)
  788. };
  789. var c = a.prototype;
  790. c.src = null, c.length = 0, c.available = 0, c.tags = null, c._init = function(a) {
  791. this.src = a, this.tags = []
  792. }, c.add = function(a) {
  793. this.tags.push(a), this.length++, this.available++
  794. }, c.removeAll = function() {
  795. for (; this.length--;) delete this.tags[this.length];
  796. this.src = null, this.tags.length = 0
  797. }, c.get = function() {
  798. if (0 == this.tags.length) return null;
  799. this.available = this.tags.length;
  800. var a = this.tags.pop();
  801. return null == a.parentNode && document.body.appendChild(a), a
  802. }, c.set = function(a) {
  803. var b = createjs.indexOf(this.tags, a); - 1 == b && this.tags.push(a), this.available = this.tags.length
  804. }, c.checkSrcChange = function() {
  805. for (var a = this.tags.length - 1, b = this.tags[a].src; a--;) this.tags[a].src = b
  806. }, c.toString = function() {
  807. return "[HTMLAudioPlugin TagPool]"
  808. }, createjs.HTMLAudioPlugin.TagPool = a
  809. }();