diff --git a/TODOS b/TODOS index 53bf1b7..8de3722 100644 --- a/TODOS +++ b/TODOS @@ -1,8 +1,24 @@ -- Why's there a long pause between scene transitions? +- Why's there a long pause between scene transitions? // or is there with devtools OFF? - black out, then show END SCREEN (for newsletter, patreon, in meantime my other games) -- icons in the start +- if can contain code with { } regex + +- hp white out + +- drag through street for points + +- less long . . . post-Tinder + +- wait before hey human + +- shaking logo (& w/ outline) + +- if allows whitespace inside (space, but NOT newline) + +- not Warren but textbook (which you don't read) + +THANKS: +- Caeser js -- if can contain code with { } regex \ No newline at end of file diff --git a/index.html b/index.html index 984ef06..0e534e1 100644 --- a/index.html +++ b/index.html @@ -27,6 +27,7 @@ + @@ -34,6 +35,7 @@ + diff --git a/scenes/act1.md b/scenes/act1.md index 47862aa..da49297 100644 --- a/scenes/act1.md +++ b/scenes/act1.md @@ -164,7 +164,7 @@ n: FEAR OF *BEING UNLOVED* #alone# n: AND FEAR OF *BEING A BAD PERSON* #bad# -n: (PRO TIP: TRY PLAYING THE CHOICES THAT MOST HIT YOUR DEEPEST, DARKEST FEARS!) +n: (PRO TIP: TRY PLAYING THE CHOICES THAT MOST HIT YOUR DEEPEST DARKEST FEARS!) h: ... @@ -193,6 +193,8 @@ n: GOOD LUCK # act1c +`music('battle', 0.5)` + n: ROUND ONE: *FIGHT!* `bb({body:"normal", mouth:"normal", eyes:"normal"});` @@ -1043,7 +1045,8 @@ attack("30p", "harm"); ``` bb({body:"normal", mouth:"normal", eyes:"look"}); hong({body:"2_tired"}); -Game.OVERRIDE_TEXT_SPEED = 0.25; +Game.OVERRIDE_TEXT_SPEED = 0.5; +music(false); ``` h: ... @@ -1220,7 +1223,7 @@ b: .................. ``` hong({body:"3_defeated1"}); -attack("30p", "harm"); +attack("100p", "harm"); ``` (...2500) @@ -1231,7 +1234,7 @@ attack("30p", "harm"); ``` hong({body:"3_defeated1"}); -attack("30p", "alone"); +attack("100p", "alone"); ``` (...2500) @@ -1242,7 +1245,7 @@ attack("30p", "alone"); ``` hong({body:"3_defeated1"}); -attack("30p", "bad"); +attack("100p", "bad"); ``` (...2500) @@ -1251,7 +1254,10 @@ attack("30p", "bad"); # act1i -`bb({mouth:"smile_lock", eyes:"smile"});` +``` +bb({mouth:"smile_lock", eyes:"smile"}); +music('battle', 0.5); +``` n: CONGRATULATIONS @@ -1259,7 +1265,7 @@ n: YOU HAVE SUCCESSFULLY PROTECTED YOUR HUMAN n: LOOK HOW GRATEFUL THEY ARE -n: NOW THAT THEIR ENERGY IS ZERO, YOU CAN DIRECTLY CONTROL THEIR ACTIONS. +n: NOW THAT THEIR ENERGY IS ZERO, YOU CAN DIRECTLY CONTROL THEIR ACTIONS! `bb({mouth:"smile", eyes:"normal"});` diff --git a/scripts/act1/Act1_SceneSetup.js b/scripts/act1/Act1_SceneSetup.js index 0aa8bca..e12cd3f 100644 --- a/scripts/act1/Act1_SceneSetup.js +++ b/scripts/act1/Act1_SceneSetup.js @@ -17,7 +17,10 @@ SceneSetup.act1 = function(){ }; SceneSetup.act1_outro = function(){ + HP.hide(); clearText(); + music(false); + Game.resetScene(); // Background diff --git a/scripts/game/Game.js b/scripts/game/Game.js index 9810492..eb4df9d 100644 --- a/scripts/game/Game.js +++ b/scripts/game/Game.js @@ -111,12 +111,14 @@ Game.pausedDOM = $("#paused"); Game.pause = function(){ Game.paused = true; Game.pausedDOM.style.display = "block"; + Howler.mute(true); }; window.addEventListener("blur", Game.pause); Game.onUnpause = function(){ if(Game.paused){ Game.paused = false; Game.pausedDOM.style.display = "none"; + Howler.mute(false); } }; window.addEventListener("click", Game.onUnpause); @@ -320,12 +322,25 @@ Game.executeText = function(line){ if(i==dialogue.length-1 && chr=="-") break; // for scopin' - (function(index, interval){ + (function(index, interval, speaker){ Game.setTimeout(function(){ + + // Show it div.children[index].style.opacity = 1; - //div.innerHTML += chr; + + // And SOUND? + var chr = div.children[index].innerHTML; + if(chr!=" "){ + if(speaker=="h"){ + voice("hong", 0.3); + } + if(speaker=="b"){ + voice("beebee", 0.3); + } + } + }, interval); - })(i, interval); + })(i, interval, speaker); // Bigger interval if(i!=dialogue.length-1){ // NOT last @@ -400,11 +415,19 @@ Game.executeText = function(line){ var word = dialogueWords[i]; // for scopin' - (function(index, interval){ + (function(index, interval, word){ Game.setTimeout(function(){ + + // Show div.children[index].style.opacity = 1; + + // SOUND + var chr = word.slice(-1); + var isEmphasis = (chr=="*"); + voice(isEmphasis ? "narrator_emphasis" : "narrator"); + }, interval); - })(i, interval); + })(i, interval, word); // Interval interval += SPEED*6; diff --git a/scripts/game/HP.js b/scripts/game/HP.js index e3d036b..9298fe7 100644 --- a/scripts/game/HP.js +++ b/scripts/game/HP.js @@ -2,6 +2,12 @@ Loader.addImages([ { id:"hp", src:"sprites/ui/hp.png" } ]); +Loader.addSounds([ + { id:"hit", src:"sounds/sfx/hit.mp3" }, + { id:"hit_big", src:"sounds/sfx/hit_big.mp3" } +]); + + // The Class! function HitPoints(){ @@ -71,6 +77,13 @@ function HitPoints(){ self.rightShake = 30; } + // Sound + if(damage=="100p"){ // FULL! + sfx("hit_big"); + }else{ + sfx("hit"); + } + }); // Draw @@ -98,7 +111,7 @@ function HitPoints(){ // BLACK var sx=isRight ? 360 : 0, sy=0, sw=360, sh=150; - ctx.drawImage(self.image, sx,sy,sw,sh, sx/2,sy/2,sw/2,sh/2); // black + ctx.drawImage(self.image, sx,sy,sw,sh, sx/2,sy/2,sw/2,sh/2); // black // RED var hpRatio = (hp+32)/(100+32); // 100,0 => 1,0.3 diff --git a/scripts/game/Loader.js b/scripts/game/Loader.js index cd66d38..006bb4d 100644 --- a/scripts/game/Loader.js +++ b/scripts/game/Loader.js @@ -1,6 +1,7 @@ window.Loader = {}; window.Library = { - images: {} + images: {}, + sounds: {} }; Loader.load = function(){ return new RSVP.Promise(function(resolve){ @@ -17,6 +18,11 @@ Loader.load = function(){ loadPromises.push( Loader.loadImage(config) ); }); + // All sounds + Loader.soundConfigs.forEach(function(config){ + loadPromises.push( Loader.loadSound(config) ); + }); + // Go go go! RSVP.all(loadPromises).then(resolve); @@ -62,3 +68,24 @@ Loader.loadScene = function(src){ xhr.send(); }); }; + +///////////////////////////// +// SOUNDS /////////////////// +///////////////////////////// + +Loader.soundConfigs = []; +Loader.addSounds = function(soundConfigs){ + Loader.soundConfigs = Loader.soundConfigs.concat(soundConfigs); +}; +Loader.loadSound = function(soundConfig){ + return new RSVP.Promise(function(resolve){ + var sound = new Howl({ + src: [soundConfig.src] + }); + var id = soundConfig.id; + Library.sounds[id] = sound; // ADD TO LIBRARY + sound.once("load",function(){ + resolve(); + }); + }); +}; diff --git a/scripts/game/Sounds.js b/scripts/game/Sounds.js new file mode 100644 index 0000000..9bf57c6 --- /dev/null +++ b/scripts/game/Sounds.js @@ -0,0 +1,46 @@ +Loader.addSounds([ + { id:"music_battle", src:"sounds/music/battle.mp3" } +]); + +Loader.addSounds([ + { id:"voice_hong", src:"sounds/voices/hong.mp3" }, + { id:"voice_beebee", src:"sounds/voices/beebee.mp3" }, + { id:"voice_narrator", src:"sounds/voices/narrator.mp3" }, + { id:"voice_narrator_emphasis", src:"sounds/voices/narrator_emphasis.mp3" } +]); + +window.sfx = function(sound, volume, pan){ + + volume = volume===undefined ? 1 : volume; + pan = pan===undefined ? 0 : pan; + + var sfx = Library.sounds[sound]; + sfx.volume(volume); + sfx.stereo(pan); + sfx.play(); + +}; + +window.voice = function(name, volume, pan){ + sfx("voice_"+name, volume, pan); +} + +window.CURRENT_MUSIC = null; +window.music = function(song, volume){ + + if(!song){ + + window.CURRENT_MUSIC.stop(); + window.CURRENT_MUSIC = null; + + }else{ + + var song = Library.sounds["music_"+song]; + song.volume(volume); + song.loop(true); + song.play(); + window.CURRENT_MUSIC = song; + + } + +}; \ No newline at end of file diff --git a/scripts/intro/Intro_BG.js b/scripts/intro/Intro_BG.js index b29859d..0a9f959 100644 --- a/scripts/intro/Intro_BG.js +++ b/scripts/intro/Intro_BG.js @@ -100,6 +100,10 @@ function BG_Intro(){ // TICKER ticker += 1/60; + /*if(Math.random()<0.01){ + Library.sounds.test.play(); + }*/ + // CLOUD OFFSET OFFSETS[1] = -80 + ticker*3; diff --git a/scripts/lib/howler.min.js b/scripts/lib/howler.min.js new file mode 100644 index 0000000..fb1d970 --- /dev/null +++ b/scripts/lib/howler.min.js @@ -0,0 +1,4 @@ +/*! howler.js v2.1.2 | (c) 2013-2019, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator&&e._navigator.userAgent.match(/OPR\/([0-6].)/g),a=r&&parseInt(r[0].split("/")[1],10)<33;return e._codecs={mp3:!(a||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!o.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(var t=0;t0?i._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(i._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3,p=!(!i._loop&&!t._sprite[e][2]);i._sprite=e,i._ended=!1;var m=function(){i._paused=!1,i._seek=_,i._start=c,i._stop=f,i._loop=p};if(_>=f)return void t._ended(i);var v=i._node;if(t._webAudio){var h=function(){t._playLock=!1,m(),t._refreshBuffer(i);var e=i._muted||t._muted?0:i._volume;v.gain.setValueAtTime(e,n.ctx.currentTime),i._playStart=n.ctx.currentTime,void 0===v.bufferSource.start?i._loop?v.bufferSource.noteGrainOn(0,_,86400):v.bufferSource.noteGrainOn(0,_,s):i._loop?v.bufferSource.start(0,_,86400):v.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[i._id]=setTimeout(t._ended.bind(t,i),l)),o||setTimeout(function(){t._emit("play",i._id),t._loadQueue()},0)};"running"===n.state?h():(t._playLock=!0,t.once("resume",h),t._clearTimer(i._id))}else{var y=function(){v.currentTime=_,v.muted=i._muted||t._muted||n._muted||v.muted,v.volume=i._volume*n.volume(),v.playbackRate=i._rate;try{var r=v.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,m(),r.then(function(){t._playLock=!1,v._unlocked=!0,o||(t._emit("play",i._id),t._loadQueue())}).catch(function(){t._playLock=!1,t._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),i._ended=!0,i._paused=!0})):o||(t._playLock=!1,m(),t._emit("play",i._id),t._loadQueue()),v.playbackRate=i._rate,v.paused)return void t._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||i._loop?t._endTimers[i._id]=setTimeout(t._ended.bind(t,i),l):(t._endTimers[i._id]=function(){t._ended(i),v.removeEventListener("ended",t._endTimers[i._id],!1)},v.addEventListener("ended",t._endTimers[i._id],!1))}catch(e){t._emit("playerror",i._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===v.src&&(v.src=t._src,v.load());var g=window&&window.ejecta||!v.readyState&&n._navigator.isCocoonJS;if(v.readyState>=3||g)y();else{t._playLock=!0;var A=function(){y(),v.removeEventListener(n._canPlayEvent,A,!1)};v.addEventListener(n._canPlayEvent,A,!1),t._clearTimer(i._id)}}return i._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),i+=d*r,i=Math.max(0,i),i=Math.min(1,i),i=Math.round(100*i)/100,u._webAudio?e._volume=i:u.volume(i,e._id,!0),a&&(u._volume=i),(on&&i>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var i;if("number"!=typeof e)return i=t._soundById(o),i?i._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var d=0;d=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return t;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var i=t._soundById(o);if(i){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var d=t.playing(o)?n.ctx.currentTime-i._playStart:0,_=i._rateSeek?i._rateSeek-i._seek:0;return i._seek+(_+d*Math.abs(i._rate))}return i._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),i._seek=e,i._ended=!1,t._clearTimer(o),t._webAudio||!i._node||isNaN(i._node.duration)||(i._node.currentTime=e);var l=function(){t._emit("seek",o),s&&t.play(o,!0)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._node.src=o._src,e._node.preload="auto",e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void d(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,d(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},d=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());(n._navigator&&n._navigator.standalone&&!r||n._navigator&&!n._navigator.standalone&&!r)&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:1,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof window?(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t):"undefined"!=typeof global&&(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t)}(); +/*! Spatial Plugin */ +!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(t,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a