diff --git a/ajax/libs/SoundJS/0.5.0/soundjs.min.js b/ajax/libs/SoundJS/0.5.0/soundjs.min.js new file mode 100644 index 000000000..48343a3b5 --- /dev/null +++ b/ajax/libs/SoundJS/0.5.0/soundjs.min.js @@ -0,0 +1,18 @@ +/*! +* @license SoundJS +* Visit http://createjs.com/ for documentation, updates and examples. +* +* Copyright (c) 2011-2013 gskinner.com, inc. +* +* Distributed under the terms of the MIT license. +* http://www.opensource.org/licenses/mit-license.html +* +* This notice shall be included in all copies or substantial portions of the Software. +*/ + +/**! + * SoundJS FlashPlugin also includes swfobject (http://code.google.com/p/swfobject/) + */ + +this.createjs=this.createjs||{},function(){var a=createjs.SoundJS=createjs.SoundJS||{};a.version="0.5.0",a.buildDate="Wed, 25 Sep 2013 17:09:35 GMT"}(),this.createjs=this.createjs||{},function(){"use strict";var a=function(){},b=a.prototype;a.initialize=function(a){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},b._listeners=null,b._captureListeners=null,b.initialize=function(){},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a,b){if("string"==typeof a){var c=this._listeners;if(!c||!c[a])return!1;a=new createjs.Event(a)}if(a.target=b||this,a.bubbles&&this.parent){for(var d=this,e=[d];d.parent;)e.push(d=d.parent);var f,g=e.length;for(f=g-1;f>=0&&!a.propagationStopped;f--)e[f]._dispatchEvent(a,1+(0==f));for(f=1;g>f&&!a.propagationStopped;f++)e[f]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;a.currentTarget=this,a.eventPhase=b,a.removed=!1,e=e.slice();for(var f=0;c>f&&!a.immediatePropagationStopped;f++){var g=e[f];g.handleEvent?g.handleEvent(a):g(a),a.removed&&(this.off(a.type,g,1==b),a.removed=!1)}}},createjs.EventDispatcher=a}(),this.createjs=this.createjs||{},function(){"use strict";var a=function(a,b,c){this.initialize(a,b,c)},b=a.prototype;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){this.type=a,this.bubbles=b,this.cancelable=c,this.timeStamp=(new Date).getTime()},b.preventDefault=function(){this.defaultPrevented=!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";createjs.indexOf=function(a,b){for(var c=0,d=a.length;d>c;c++)if(b===a[c])return c;return-1}}(),this.createjs=this.createjs||{},function(){"use strict";createjs.proxy=function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,Array.prototype.slice.call(arguments,0).concat(c))}}}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"Sound cannot be instantiated"}function b(a,b){this.init(a,b)}function c(){this.isDefault=!0,this.addEventListener=this.removeEventListener=this.removeAllEventListener=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=function(){return!1},this.getVolume=this.getPan=this.getDuration=function(){return 0},this.playState=a.PLAY_FAILED,this.toString=function(){return"[Sound Default Sound Instance]"}}function d(){}var e=a;e.DELIMITER="|",e.AUDIO_TIMEOUT=8e3,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={m4a:"mp4"},e.FILE_PATTERN=/^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/,e.defaultInterruptBehavior=e.INTERRUPT_NONE,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){if(e.preloadHash[a])for(var b=0,c=e.preloadHash[a].length;c>b;b++){var d=e.preloadHash[a][b];if(e.preloadHash[a][b]=!0,e.hasEventListener("fileload")){var f=new createjs.Event("fileload");f.src=d.src,f.id=d.id,f.data=d.data,e.dispatchEvent(f)}}},e.getPreloadHandlers=function(){return{callback:createjs.proxy(e.initLoad,e),types:["sound"],extensions:e.SUPPORTED_EXTENSIONS}},e.registerPlugin=function(a){return e.pluginsRegistered=!0,null==a?!1:a.isSupported()?(e.activePlugin=new a,!0):!1},e.registerPlugins=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];if(e.registerPlugin(d))return!0}return!1},e.initializeDefaultPlugins=function(){return null!=e.activePlugin?!0:e.pluginsRegistered?!1:e.registerPlugins([createjs.WebAudioPlugin,createjs.HTMLAudioPlugin])?!0:!1},e.isReady=function(){return null!=e.activePlugin},e.getCapabilities=function(){return null==e.activePlugin?null:e.activePlugin.capabilities},e.getCapability=function(a){return null==e.activePlugin?null:e.activePlugin.capabilities[a]},e.initLoad=function(a,b,c,d,f){var g=e.registerSound(a,c,d,!1,f);return null==g?!1:g},e.registerSound=function(a,c,d,f,g){if(!e.initializeDefaultPlugins())return!1;a instanceof Object&&(g=c,c=a.id,d=a.data,a=a.src);var h=e.parsePath(a,"sound",c,d);if(null==h)return!1;null!=c&&(e.idHash[c]=h.src);var i=null;null!=d&&(isNaN(d.channels)?isNaN(d)||(i=parseInt(d)):i=parseInt(d.channels));var j=e.activePlugin.register(h.src,i);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)if(e.preloadHash[h.src]||(e.preloadHash[h.src]=[]),e.preloadHash[h.src].push({src:a,id:c,data:d}),1==e.preloadHash[h.src].length)null==g&&(g=""),e.activePlugin.preload(h.src,j,g);else if(1==e.preloadHash[h.src][0])return!0;return h},e.registerManifest=function(a,b){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);return c},e.removeSound=function(a){if(null==e.activePlugin)return!1;a instanceof Object&&(a=a.src),a=e.getSrcById(a);var c=e.parsePath(a);if(null==c)return!1;a=c.src;for(var d in e.idHash)e.idHash[d]==a&&delete e.idHash[d];return b.removeSrc(a),delete e.preloadHash[a],e.activePlugin.removeSound(a),!0},e.removeManifest=function(a){for(var b=[],c=0,d=a.length;d>c;c++)b[c]=createjs.Sound.removeSound(a[c].src);return b},e.removeAllSounds=function(){e.idHash={},e.preloadHash={},b.removeAll(),e.activePlugin.removeAllSounds()},e.loadComplete=function(a){var b=e.parsePath(a,"sound");return a=b?e.getSrcById(b.src):e.getSrcById(a),1==e.preloadHash[a][0]},e.parsePath=function(a,b,c,d){"string"!=typeof a&&(a=a.toString());for(var f=a.split(e.DELIMITER),g={type:b||"sound",id:c,data:d},h=e.getCapabilities(),i=0,j=f.length;j>i;i++){var k=f[i],l=k.match(e.FILE_PATTERN);if(null==l)return!1;var m=l[4],n=l[5];if(h[n]&&createjs.indexOf(e.SUPPORTED_EXTENSIONS,n)>-1)return g.name=m,g.src=k,g.extension=n,g}return null},e.play=function(a,b,c,d,f,g,h){var i=e.createInstance(a),j=e.playInstance(i,b,c,d,f,g,h);return j||i.playFailed(),i},e.createInstance=function(c){if(!e.initializeDefaultPlugins())return e.defaultSoundInstance;c=e.getSrcById(c);var d=e.parsePath(c,"sound"),f=null;return null!=d&&null!=d.src?(b.create(d.src),f=e.activePlugin.create(d.src)):f=a.defaultSoundInstance,f.uniqueId=e.lastId++,f},e.setVolume=function(a){if(null==Number(a))return!1;if(a=Math.max(0,Math.min(1,a)),e.masterVolume=a,!this.activePlugin||!this.activePlugin.setVolume||!this.activePlugin.setVolume(a))for(var b=this.instances,c=0,d=b.length;d>c;c++)b[c].setMasterVolume(a)},e.getVolume=function(){return e.masterVolume},e.setMute=function(a){if(null==a||void 0==a)return!1;if(this.masterMute=a,!this.activePlugin||!this.activePlugin.setMute||!this.activePlugin.setMute(a))for(var b=this.instances,c=0,d=b.length;d>c;c++)b[c].setMasterMute(a);return!0},e.getMute=function(){return this.masterMute},e.stop=function(){for(var a=this.instances,b=a.length;b--;)a[b].stop()},e.playInstance=function(a,b,c,d,f,g,h){if(b instanceof Object&&(c=b.delay,d=b.offset,f=b.loop,g=b.volume,h=b.pan),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){var i=e.beginPlaying(a,b,d,f,g,h);if(!i)return!1}else{var j=setTimeout(function(){e.beginPlaying(a,b,d,f,g,h)},c);a.delayTimeoutId=j}return this.instances.push(a),!0},e.beginPlaying=function(a,c,d,e,f,g){if(!b.add(a,c))return!1;var h=a.beginPlaying(d,e,f,g);if(!h){var i=createjs.indexOf(this.instances,a);return i>-1&&this.instances.splice(i,1),!1}return!0},e.getSrcById=function(a){return null==e.idHash||null==e.idHash[a]?a:e.idHash[a]},e.playFinished=function(a){b.remove(a);var c=createjs.indexOf(this.instances,a);c>-1&&this.instances.splice(c,1)},createjs.Sound=a,b.channels={},b.create=function(a,c){var d=b.get(a);return null==d?(b.channels[a]=new b(a,c),!0):!1},b.removeSrc=function(a){var c=b.get(a);return null==c?!1:(c.removeAll(),delete b.channels[a],!0)},b.removeAll=function(){for(var a in b.channels)b.channels[a].removeAll();b.channels={}},b.add=function(a,c){var d=b.get(a.src);return null==d?!1:d.add(a,c)},b.remove=function(a){var c=b.get(a.src);return null==c?!1:(c.remove(a),!0)},b.maxPerChannel=function(){return f.maxDefault},b.get=function(a){return b.channels[a]};var f=b.prototype;f.src=null,f.max=null,f.maxDefault=100,f.length=0,f.init=function(a,b){this.src=a,this.max=b||this.maxDefault,-1==this.max&&this.max==this.maxDefault,this.instances=[]},f.get=function(a){return this.instances[a]},f.add=function(a,b){return this.getSlot(b,a)?(this.instances.push(a),this.length++,!0):!1},f.remove=function(a){var b=createjs.indexOf(this.instances,a);return-1==b?!1:(this.instances.splice(b,1),this.length--,!0)},f.removeAll=function(){for(var a=this.length-1;a>=0;a--)this.instances[a].stop()},f.getSlot=function(b){for(var c,d,e=0,f=this.max;f>e;e++){if(c=this.get(e),null==c)return!0;(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())&&(d=c):d=c)}return null!=d?(d.interrupt(),this.remove(d),!0):!1},f.toString=function(){return"[Sound SoundChannel]"},a.defaultSoundInstance=new c,null==createjs.proxy&&(createjs.proxy=function(){throw"Proxy has been moved to an external file, and must be included separately."}),d.init=function(){var a=window.navigator.userAgent;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},d.init(),createjs.Sound.BrowserDetect=d}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this.init()}var b=a;b.capabilities=null,b.isSupported=function(){var a=createjs.Sound.BrowserDetect.isIOS||createjs.Sound.BrowserDetect.isAndroid||createjs.Sound.BrowserDetect.isBlackberry;return"file:"!=location.protocol||a||this.isFileXHRSupported()?(b.generateCapabilities(),null==b.context?!1:!0):!1},b.isFileXHRSupported=function(){var a=!0,b=new XMLHttpRequest;try{b.open("GET","fail.fail",!1)}catch(c){return a=!1}b.onerror=function(){a=!1},b.onload=function(){a=404==this.status||200==this.status||0==this.status&&""!=this.response};try{b.send()}catch(c){a=!1}return a},b.generateCapabilities=function(){if(null==b.capabilities){var a=document.createElement("audio");if(null==a.canPlayType)return null;if(window.webkitAudioContext)b.context=new webkitAudioContext;else{if(!window.AudioContext)return null;b.context=new AudioContext}b.compatibilitySetUp(),b.playEmptySound(),b.capabilities={panning:!0,volume:!0,tracks:-1};for(var c=createjs.Sound.SUPPORTED_EXTENSIONS,d=createjs.Sound.EXTENSION_MAP,e=0,f=c.length;f>e;e++){var g=c[e],h=d[g]||g;b.capabilities[g]="no"!=a.canPlayType("audio/"+g)&&""!=a.canPlayType("audio/"+g)||"no"!=a.canPlayType("audio/"+h)&&""!=a.canPlayType("audio/"+h)}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)}},b.compatibilitySetUp=function(){if(!b.context.createGain){b.context.createGain=b.context.createGainNode;var a=b.context.createBufferSource();a.__proto__.start=a.__proto__.noteGrainOn,a.__proto__.stop=a.__proto__.noteOff,this.panningModel=0}},b.playEmptySound=function(){var a=this.context.createBuffer(1,1,22050),b=this.context.createBufferSource();b.buffer=a,b.connect(this.context.destination),b.start(0,0,0)};var c=a.prototype;c.capabilities=null,c.volume=1,c.context=null,c.panningModel="equalpower",c.dynamicsCompressorNode=null,c.gainNode=null,c.arrayBuffers=null,c.init=function(){this.capabilities=b.capabilities,this.arrayBuffers={},this.context=b.context,this.gainNode=b.gainNode,this.dynamicsCompressorNode=b.dynamicsCompressorNode},c.register=function(a){this.arrayBuffers[a]=!0;var b=new createjs.WebAudioPlugin.Loader(a,this);return{tag:b}},c.isPreloadStarted=function(a){return null!=this.arrayBuffers[a]},c.isPreloadComplete=function(a){return!(null==this.arrayBuffers[a]||1==this.arrayBuffers[a])},c.removeFromPreload=function(a){delete this.arrayBuffers[a]},c.removeSound=function(a){delete this.arrayBuffers[a]},c.removeAllSounds=function(){this.arrayBuffers={}},c.addPreloadResults=function(a,b){this.arrayBuffers[a]=b},c.handlePreloadComplete=function(){createjs.Sound.sendFileLoadEvent(this.src)},c.preload=function(a,b,c){this.arrayBuffers[a]=!0;var d=new createjs.WebAudioPlugin.Loader(a,this);d.onload=this.handlePreloadComplete,null!=c&&(d.src=c+d.src),d.load()},c.create=function(a){return this.isPreloadStarted(a)||this.preload(a),new createjs.WebAudioPlugin.SoundInstance(a,this)},c.setVolume=function(a){return this.volume=a,this.updateVolume(),!0},c.updateVolume=function(){var a=createjs.Sound.masterMute?0:this.volume;a!=this.gainNode.gain.value&&(this.gainNode.gain.value=a)},c.getVolume=function(){return this.volume},c.setMute=function(){return this.updateVolume(),!0},c.toString=function(){return"[WebAudioPlugin]"},createjs.WebAudioPlugin=a}(),function(){"use strict";function a(a,b){this.init(a,b)}var b=a.prototype;b.src=null,b.uniqueId=-1,b.playState=null,b.owner=null,b.offset=0,b.delay=0,b._volume=1,Object.defineProperty(b,"volume",{get:function(){return this._volume},set:function(a){return null==Number(a)?!1:(a=Math.max(0,Math.min(1,a)),this._volume=a,this.updateVolume(),void 0)}}),b._pan=0,Object.defineProperty(b,"pan",{get:function(){return this._pan},set:function(a){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}}),b.duration=0,b.remainingLoops=0,b.delayTimeoutId=null,b.soundCompleteTimeout=null,b.panNode=null,b.gainNode=null,b.sourceNode=null,b.sourceNodeNext=null,b.muted=!1,b.paused=!1,b.startTime=0,b.addEventListener=null,b.removeEventListener=null,b.removeAllEventListeners=null,b.dispatchEvent=null,b.hasEventListener=null,b._listeners=null,b.endedHandler=null,b.readyHandler=null,b.stalledHandler=null,b.sendEvent=function(a){var b=new createjs.Event(a);this.dispatchEvent(b)},b.init=function(a,b){this.owner=b,this.src=a,this.panNode=this.owner.context.createPanner(),this.panNode.panningModel=this.owner.panningModel,this.gainNode=this.owner.context.createGain(),this.gainNode.connect(this.panNode),this.owner.isPreloadComplete(this.src)&&(this.duration=1e3*this.owner.arrayBuffers[this.src].duration),this.endedHandler=createjs.proxy(this.handleSoundComplete,this),this.readyHandler=createjs.proxy(this.handleSoundReady,this),this.stalledHandler=createjs.proxy(this.handleSoundStalled,this)},b.cleanUp=function(){this.sourceNode&&this.sourceNode.playbackState!=this.sourceNode.UNSCHEDULED_STATE&&(this.sourceNode=this.cleanUpAudioNode(this.sourceNode),this.sourceNodeNext=this.cleanUpAudioNode(this.sourceNodeNext)),0!=this.panNode.numberOfOutputs&&this.panNode.disconnect(0),clearTimeout(this.delayTimeoutId),clearTimeout(this.soundCompleteTimeout),this.startTime=0,null!=window.createjs&&createjs.Sound.playFinished(this)},b.cleanUpAudioNode=function(a){return a&&(a.stop(0),a.disconnect(this.gainNode),a=null),a},b.interrupt=function(){this.playState=createjs.Sound.PLAY_INTERRUPTED,this.cleanUp(),this.paused=!1,this.sendEvent("interrupted")},b.handleSoundStalled=function(){this.sendEvent("failed")},b.handleSoundReady=function(){if(null!=window.createjs){if(1e3*this.offset>this.getDuration())return this.playFailed(),void 0;this.offset<0&&(this.offset=0),this.playState=createjs.Sound.PLAY_SUCCEEDED,this.paused=!1,this.panNode.connect(this.owner.gainNode);var a=this.owner.arrayBuffers[this.src].duration;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))}},b.createAndPlayAudioNode=function(a,b){var c=this.owner.context.createBufferSource();return c.buffer=this.owner.arrayBuffers[this.src],c.connect(this.gainNode),this.owner.context.currentTime,c.startTime=a+c.buffer.duration,c.start(c.startTime,b,c.buffer.duration-b),c},b.play=function(a,b,c,d,e,f){this.cleanUp(),createjs.Sound.playInstance(this,a,b,c,d,e,f)},b.beginPlaying=function(a,b,c,d){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},b.pause=function(){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.panNode.numberOfOutputs&&this.panNode.disconnect(),clearTimeout(this.delayTimeoutId),clearTimeout(this.soundCompleteTimeout),!0)},b.resume=function(){return this.paused?(this.handleSoundReady(null),!0):!1},b.stop=function(){return this.playState=createjs.Sound.PLAY_FINISHED,this.cleanUp(),this.offset=0,!0},b.setVolume=function(a){return this.volume=a,!0},b.updateVolume=function(){var a=this.muted?0:this._volume;return a!=this.gainNode.gain.value?(this.gainNode.gain.value=a,!0):!1},b.getVolume=function(){return this.volume},b.setMute=function(a){return null==a||void 0==a?!1:(this.muted=a,this.updateVolume(),!0)},b.getMute=function(){return this.muted},b.setPan=function(a){return this.pan=a,this.pan!=a?!1:void 0},b.getPan=function(){return this.pan},b.getPosition=function(){if(this.paused||null==this.sourceNode)var a=this.offset;else var a=this.owner.context.currentTime-this.startTime;return 1e3*a},b.setPosition=function(a){return this.offset=a/1e3,this.sourceNode&&this.sourceNode.playbackState!=this.sourceNode.UNSCHEDULED_STATE&&(this.cleanUpAudioNode(this.sourceNode),this.cleanUpAudioNode(this.sourceNodeNext),clearTimeout(this.soundCompleteTimeout)),this.paused||this.playState!=createjs.Sound.PLAY_SUCCEEDED||this.handleSoundReady(null),!0},b.getDuration=function(){return this.duration},b.handleSoundComplete=function(){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.playState=createjs.Sound.PLAY_FINISHED,this.cleanUp(),this.sendEvent("complete")),void 0)},b.playFailed=function(){null!=window.createjs&&(this.playState=createjs.Sound.PLAY_FAILED,this.cleanUp(),this.sendEvent("failed"))},b.toString=function(){return"[WebAudioPlugin SoundInstance]"},createjs.EventDispatcher.initialize(a.prototype),createjs.WebAudioPlugin.SoundInstance=a}(),function(){"use strict";function a(a,b){this.init(a,b)}var b=a.prototype;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){this.src=a,this.originalSrc=a,this.owner=b},b.load=function(a){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()},b.handleProgress=function(a,b){this.progress=a/b,null!=this.onprogress&&this.onprogress({loaded:a,total:b,progress:this.progress})},b.handleLoad=function(){this.owner.context.decodeAudioData(this.request.response,createjs.proxy(this.handleAudioDecoded,this),createjs.proxy(this.handleError,this))},b.handleAudioDecoded=function(a){this.progress=1,this.result=a,this.src=this.originalSrc,this.owner.addPreloadResults(this.src,this.result),this.onload&&this.onload()},b.handleError=function(a){this.owner.removeSound(this.src),this.onerror&&this.onerror(a)},b.toString=function(){return"[WebAudioPlugin Loader]"},createjs.WebAudioPlugin.Loader=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this.init()}var b=a;b.MAX_INSTANCES=30,b.capabilities=null,b.AUDIO_READY="canplaythrough",b.AUDIO_ENDED="ended",b.AUDIO_SEEKED="seeked",b.AUDIO_ERROR="error",b.AUDIO_STALLED="stalled",b.enableIOS=!1,b.isSupported=function(){if(createjs.Sound.BrowserDetect.isIOS&&!b.enableIOS)return!1;b.generateCapabilities();var a=b.tag;return null==a||null==b.capabilities?!1:!0},b.generateCapabilities=function(){if(null==b.capabilities){var a=b.tag=document.createElement("audio");if(null==a.canPlayType)return null;b.capabilities={panning:!0,volume:!0,tracks:-1};for(var c=createjs.Sound.SUPPORTED_EXTENSIONS,d=createjs.Sound.EXTENSION_MAP,e=0,f=c.length;f>e;e++){var g=c[e],h=d[g]||g;b.capabilities[g]="no"!=a.canPlayType("audio/"+g)&&""!=a.canPlayType("audio/"+g)||"no"!=a.canPlayType("audio/"+h)&&""!=a.canPlayType("audio/"+h)}}};var c=a.prototype;c.capabilities=null,c.audioSources=null,c.defaultNumChannels=2,c.loadedHandler=null,c.init=function(){this.capabilities=b.capabilities,this.audioSources={}},c.register=function(a,b){this.audioSources[a]=!0;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);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;else{var g=d.onreadystatechange;d.onreadystatechange=function(){g(),this.loadedHandler()}}return{tag:d,numChannels:e}},c.handleTagLoad=function(a){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)},c.createTag=function(a){var b=document.createElement("audio");return b.autoplay=!1,b.preload="none",b.src=a,b},c.removeSound=function(a){delete this.audioSources[a],createjs.HTMLAudioPlugin.TagPool.remove(a)},c.removeAllSounds=function(){this.audioSources={},createjs.HTMLAudioPlugin.TagPool.removeAll()},c.create=function(a){if(!this.isPreloadStarted(a)){var b=createjs.HTMLAudioPlugin.TagPool.get(a),c=this.createTag(a);c.id=a,b.add(c),this.preload(a,{tag:c})}return new createjs.HTMLAudioPlugin.SoundInstance(a,this)},c.isPreloadStarted=function(a){return null!=this.audioSources[a]},c.preload=function(a,b,c){this.audioSources[a]=!0,null!=c&&(b.tag.src=c+a),new createjs.HTMLAudioPlugin.Loader(a,b.tag)},c.toString=function(){return"[HTMLAudioPlugin]"},createjs.HTMLAudioPlugin=a}(),function(){"use strict";function a(a,b){this.init(a,b)}var b=a.prototype;b.src=null,b.uniqueId=-1,b.playState=null,b.owner=null,b.loaded=!1,b.offset=0,b.delay=0,b._volume=1,Object.defineProperty(b,"volume",{get:function(){return this._volume},set:function(a){null!=Number(a)&&(a=Math.max(0,Math.min(1,a)),this._volume=a,this.updateVolume())}}),b.pan=0,b.duration=0,b.remainingLoops=0,b.delayTimeoutId=null,b.tag=null,b.muted=!1,b.paused=!1,b.addEventListener=null,b.removeEventListener=null,b.removeAllEventListeners=null,b.dispatchEvent=null,b.hasEventListener=null,b._listeners=null,b.endedHandler=null,b.readyHandler=null,b.stalledHandler=null,b.loopHandler=null,b.init=function(a,b){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)},b.sendEvent=function(a){var b=new createjs.Event(a);this.dispatchEvent(b)},b.cleanUp=function(){var a=this.tag;if(null!=a){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);try{a.currentTime=0}catch(b){}createjs.HTMLAudioPlugin.TagPool.setInstance(this.src,a),this.tag=null}clearTimeout(this.delayTimeoutId),null!=window.createjs&&createjs.Sound.playFinished(this)},b.interrupt=function(){null!=this.tag&&(this.playState=createjs.Sound.PLAY_INTERRUPTED,this.cleanUp(),this.paused=!1,this.sendEvent("interrupted"))},b.play=function(a,b,c,d,e,f){this.cleanUp(),createjs.Sound.playInstance(this,a,b,c,d,e,f)},b.beginPlaying=function(a,b,c,d){if(null==window.createjs)return-1;var e=this.tag=createjs.HTMLAudioPlugin.TagPool.getInstance(this.src);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)},b.handleSoundStalled=function(){this.cleanUp(),this.sendEvent("failed")},b.handleSoundReady=function(){if(null!=window.createjs){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;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()}},b.pause=function(){return this.paused||this.playState!=createjs.Sound.PLAY_SUCCEEDED||null==this.tag?!1:(this.paused=!0,this.tag.pause(),clearTimeout(this.delayTimeoutId),!0)},b.resume=function(){return this.paused&&null!=this.tag?(this.paused=!1,this.tag.play(),!0):!1},b.stop=function(){return this.offset=0,this.pause(),this.playState=createjs.Sound.PLAY_FINISHED,this.cleanUp(),!0},b.setMasterVolume=function(){return this.updateVolume(),!0},b.setVolume=function(a){return this.volume=a,!0},b.updateVolume=function(){if(null!=this.tag){var a=this.muted||createjs.Sound.masterMute?0:this._volume*createjs.Sound.masterVolume;return a!=this.tag.volume&&(this.tag.volume=a),!0}return!1},b.getVolume=function(){return this.volume},b.setMasterMute=function(){return this.updateVolume(),!0},b.setMute=function(a){return null==a||void 0==a?!1:(this.muted=a,this.updateVolume(),!0)},b.getMute=function(){return this.muted},b.setPan=function(){return!1},b.getPan=function(){return 0},b.getPosition=function(){return null==this.tag?this.offset:1e3*this.tag.currentTime},b.setPosition=function(a){if(null==this.tag)this.offset=a;else{this.tag.removeEventListener(createjs.HTMLAudioPlugin.AUDIO_SEEKED,this.loopHandler,!1);try{this.tag.currentTime=.001*a}catch(b){return!1}this.tag.addEventListener(createjs.HTMLAudioPlugin.AUDIO_SEEKED,this.loopHandler,!1)}return!0},b.getDuration=function(){return this.duration},b.handleSoundComplete=function(){this.offset=0,null!=window.createjs&&(this.playState=createjs.Sound.PLAY_FINISHED,this.cleanUp(),this.sendEvent("complete"))},b.handleSoundLoop=function(){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")},b.playFailed=function(){null!=window.createjs&&(this.playState=createjs.Sound.PLAY_FAILED,this.cleanUp(),this.sendEvent("failed"))},b.toString=function(){return"[HTMLAudioPlugin SoundInstance]"},createjs.EventDispatcher.initialize(a.prototype),createjs.HTMLAudioPlugin.SoundInstance=a}(),function(){"use strict";function a(a,b){this.init(a,b)}var b=a.prototype;b.src=null,b.tag=null,b.preloadTimer=null,b.loadedHandler=null,b.init=function(a,b){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);else{var c=this.tag.onreadystatechange;this.tag.onreadystatechange=function(){c(),this.tag.onreadystatechange=createjs.proxy(this.sendLoadedEvent,this)}}this.tag.preload="auto",this.tag.load()},b.preloadTick=function(){var a=this.tag.buffered,b=this.tag.duration;a.length>0&&a.end(0)>=b-1&&this.handleTagLoaded()},b.handleTagLoaded=function(){clearInterval(this.preloadTimer)},b.sendLoadedEvent=function(){this.tag.removeEventListener&&this.tag.removeEventListener("canplaythrough",this.loadedHandler),this.tag.onreadystatechange=null,createjs.Sound.sendFileLoadEvent(this.src)},b.toString=function(){return"[HTMLAudioPlugin Loader]"},createjs.HTMLAudioPlugin.Loader=a}(),function(){"use strict";function a(a){this.init(a)}var b=a;b.tags={},b.get=function(c){var d=b.tags[c];return null==d&&(d=b.tags[c]=new a(c)),d},b.remove=function(a){var c=b.tags[a];return null==c?!1:(c.removeAll(),delete b.tags[a],!0) +},b.removeAll=function(){for(var a in b.tags)b.tags[a].removeAll();b.tags={}},b.getInstance=function(a){var c=b.tags[a];return null==c?null:c.get()},b.setInstance=function(a,c){var d=b.tags[a];return null==d?null:d.set(c)},b.checkSrc=function(a){var c=b.tags[a];return null==c?null:(c.checkSrcChange(),void 0)};var c=a.prototype;c.src=null,c.length=0,c.available=0,c.tags=null,c.init=function(a){this.src=a,this.tags=[]},c.add=function(a){this.tags.push(a),this.length++,this.available++},c.removeAll=function(){for(;this.length--;)delete this.tags[this.length];this.src=null,this.tags.length=0},c.get=function(){if(0==this.tags.length)return null;this.available=this.tags.length;var a=this.tags.pop();return null==a.parentNode&&document.body.appendChild(a),a},c.set=function(a){var b=createjs.indexOf(this.tags,a);-1==b&&this.tags.push(a),this.available=this.tags.length},c.checkSrcChange=function(){for(var a=this.tags.length-1,b=this.tags[a].src;a--;)this.tags[a].src=b},c.toString=function(){return"[HTMLAudioPlugin TagPool]"},createjs.HTMLAudioPlugin.TagPool=a}(); \ No newline at end of file diff --git a/ajax/libs/SoundJS/package.json b/ajax/libs/SoundJS/package.json index 4c643f48e..a28beb9bd 100644 --- a/ajax/libs/SoundJS/package.json +++ b/ajax/libs/SoundJS/package.json @@ -1,7 +1,7 @@ { "name": "SoundJS", "filename": "soundjs.min.js", - "version": "0.4.1", + "version": "0.5.0", "description": "A Javascript library that provides a simple API, and powerful features to make working with audio a breeze.", "homepage": "http://www.createjs.com/#!/SoundJS", "keywords": [