var com=com||{};com.eqela=com.eqela||{};com.eqela.libaudioclip=com.eqela.libaudioclip||{};com.eqela.libaudioclip.AudioClipManager=function(){eq.api.Object.call(this);{}};P=com.eqela.libaudioclip.AudioClipManager.prototype=(function(o){function F(){};F.prototype=o;return(new F());})(eq.api.Object.prototype);P._t={};P._t['eq.api.Object']=true;P._t['com.eqela.libaudioclip.AudioClipManager']=true;P.constructor=com.eqela.libaudioclip.AudioClipManager;com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_backend=null;com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips=null;com.eqela.libaudioclip.AudioClipManager.initialize=function(){if(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_backend===null){com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_backend=(new com.eqela.libaudioclip.HTML5AudioClipManager());}};com.eqela.libaudioclip.AudioClipManager.prepare=function(id){com.eqela.libaudioclip.AudioClipManager.initialize();if(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_backend===null){return;}var clip=com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_backend.create(id);if(clip===null){return;}if(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips===null){com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips=eq.api.HashTable.create();}if(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips!==null){eq.api.HashTable.prototype.set.call(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips,id,clip);}};com.eqela.libaudioclip.AudioClipManager.get=function(id){var _t185=null;if(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips===null){return(null);}return(((function(l,r){return(l!=null&&l._t[r]===true);})((_t185=eq.api.HashTable.prototype.get.call(com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips,id)),"com.eqela.libaudioclip.AudioClip")?_t185:null));};com.eqela.libaudioclip.AudioClipManager.play=function(id){var clip=com.eqela.libaudioclip.AudioClipManager.get(id);if(clip===null){return(false);}return(clip.play());};com.eqela.libaudioclip.AudioClipManager.clear=function(){com.eqela.libaudioclip.AudioClipManager.com_eqela_libaudioclip_AudioClipManager_clips=null;};com.eqela.libaudioclip.HTML5AudioClip=function(){eq.api.Object.call(this);this.com_eqela_libaudioclip_HTML5AudioClip_id=null;{}};P=com.eqela.libaudioclip.HTML5AudioClip.prototype=(function(o){function F(){};F.prototype=o;return(new F());})(eq.api.Object.prototype);P._t={};P._t['eq.api.Object']=true;P._t['com.eqela.libaudioclip.AudioClip']=true;P._t['com.eqela.libaudioclip.HTML5AudioClip']=true;P.constructor=com.eqela.libaudioclip.HTML5AudioClip;P.initialize=function(id){this.com_eqela_libaudioclip_HTML5AudioClip_id=id;return(this);};P.play=function(){var fn=eq.api.StringStatic.for_strptr("%s").printf().add(this.com_eqela_libaudioclip_HTML5AudioClip_id).to_string();var fnp=fn.to_strptr();var audio_element=null;var r=false; audio_element = document.createElement('audio');audio_element.setAttribute("preload", "auto");var src_mp3 = document.createElement('source');src_mp3.type = 'audio/mpeg';src_mp3.src = fnp + '.mp3';audio_element.appendChild(src_mp3);var src_ogg = document.createElement('source');src_ogg.type = 'audio/ogg';src_ogg.src = fnp + '.ogg';audio_element.appendChild(src_ogg);var src_m4a = document.createElement('source');src_m4a.type = 'audio/mp4';src_m4a.src = fnp + '.m4a';audio_element.appendChild(src_m4a);var src_wav = document.createElement('source');src_wav.type = 'audio/wav';src_wav.src = fnp + '.wav';audio_element.appendChild(src_wav);document.body.appendChild(audio_element);audio_element.load();try {audio_element.play();audio_element.addEventListener('ended', function() {audio_element.parentNode.removeChild(audio_element);audio_element = null;});r = true;}catch(e) {}return(r);};com.eqela.libaudioclip.HTML5AudioClipManager=function(){eq.api.Object.call(this);{}};P=com.eqela.libaudioclip.HTML5AudioClipManager.prototype=(function(o){function F(){};F.prototype=o;return(new F());})(eq.api.Object.prototype);P._t={};P._t['eq.api.Object']=true;P._t['com.eqela.libaudioclip.AudioClipManagerBackend']=true;P._t['com.eqela.libaudioclip.HTML5AudioClipManager']=true;P.constructor=com.eqela.libaudioclip.HTML5AudioClipManager;P.create=function(id){return(com.eqela.libaudioclip.HTML5AudioClip.prototype.initialize.call(new com.eqela.libaudioclip.HTML5AudioClip(),id));};