pixi_sound 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 256bcbedc27ca61d1a272f717d731c391e4b5daebc5703110f6a003861986861
4
+ data.tar.gz: 92e6d0d380d4c7a1d51e856b50b07db95b66e2ce3754a2ac716b37f4e5ab0c99
5
+ SHA512:
6
+ metadata.gz: c1aa383984d9ae78d344c7703fbf9ebd3eb1f0ff1592e6f7b7cb4fd0aedf0c114e72239491193cdbfde3e02f93c745f17a82aeba819e345eefbc93e8896c5796
7
+ data.tar.gz: b3a7298c19bed4109edca63cb3f19b06953d5f107ca78542f5f65b667a8aeacdaffb2e68128b144114ad1f056449ae42b520a4d7bef74194e12f1226113280bf
Binary file
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 1.17.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in pixi_sound.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Chris Palmweaver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # PixiSound
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pixi_sound`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'pixi_sound'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install pixi_sound
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pixi_sound.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pixi_sound"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ require "pixi_sound/version"
2
+
3
+ module PixiSound
4
+ class Error < StandardError; end
5
+ class Engine < ::Rails::Engine;
6
+
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module PixiSound
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "pixi_sound/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pixi_sound"
8
+ spec.version = PixiSound::VERSION
9
+ spec.authors = ["Chris Scalf"]
10
+ spec.email = ["shrewdpixeldesign@gmail.com"]
11
+
12
+ spec.summary = %q{A gem for importing the pixi_lights.js canvas library into Rails projects.}
13
+ spec.homepage = "https://github.com/Palmweaver/pixi_sound"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.17"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ end
Binary file
Binary file
File without changes
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * pixi-sound - v2.1.0
3
+ * https://github.com/pixijs/pixi-sound
4
+ * Compiled Sun, 13 Jan 2019 22:28:48 UTC
5
+ *
6
+ * pixi-sound is licensed under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license
8
+ */
9
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).__pixiSound=e()}(this,function(){"use strict";if("undefined"==typeof PIXI)throw"PixiJS required";var t=setTimeout;function e(){}function n(t){if(!(this instanceof n))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],a(t,this)}function o(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,n._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var o;try{o=n(t._value)}catch(t){return void r(e.promise,t)}i(e.promise,o)}else(1===t._state?i:r)(e.promise,t._value)})):t._deferreds.push(e)}function i(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var o=e.then;if(e instanceof n)return t._state=3,t._value=e,void s(t);if("function"==typeof o)return void a((i=o,u=e,function(){i.apply(u,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){r(t,e)}var i,u}function r(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&n._immediateFn(function(){t._handled||n._unhandledRejectionFn(t._value)});for(var e=0,i=t._deferreds.length;e<i;e++)o(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function a(t,e){var n=!1;try{t(function(t){n||(n=!0,i(e,t))},function(t){n||(n=!0,r(e,t))})}catch(t){if(n)return;n=!0,r(e,t)}}n.prototype.catch=function(t){return this.then(null,t)},n.prototype.then=function(t,n){var i=new this.constructor(e);return o(this,new u(t,n,i)),i},n.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})},n.all=function(t){return new n(function(e,n){if(!t||void 0===t.length)throw new TypeError("Promise.all accepts an array");var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function r(t,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var u=s.then;if("function"==typeof u)return void u.call(s,function(e){r(t,e)},n)}o[t]=s,0==--i&&e(o)}catch(t){n(t)}}for(var s=0;s<o.length;s++)r(s,o[s])})},n.resolve=function(t){return t&&"object"==typeof t&&t.constructor===n?t:new n(function(e){e(t)})},n.reject=function(t){return new n(function(e,n){n(t)})},n.race=function(t){return new n(function(e,n){for(var o=0,i=t.length;o<i;o++)t[o].then(e,n)})},n._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(e){t(e,0)},n._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console};var c=function(){function t(t,e){this._output=e,this._input=t}return Object.defineProperty(t.prototype,"destination",{get:function(){return this._input},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filters",{get:function(){return this._filters},set:function(t){var e=this;if(this._filters&&(this._filters.forEach(function(t){t&&t.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();var n=null;t.forEach(function(t){null===n?e._input.connect(t.destination):n.connect(t.destination),n=t}),n.connect(this._output)}},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.filters=null,this._input=null,this._output=null},t}(),l=function(){function t(t,e){this.init(t,e)}return t.prototype.init=function(t,e){this.destination=t,this.source=e||t},t.prototype.connect=function(t){this.source.connect(t)},t.prototype.disconnect=function(){this.source.disconnect()},t.prototype.destroy=function(){this.disconnect(),this.destination=null,this.source=null},t}(),p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function h(t,e){function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var f,d=function(){return(d=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function _(){return f}var y=function(){function t(){}return t.setParamValue=function(t,e){if(t.setValueAtTime){var n=_().context;t.setValueAtTime(e,n.audioContext.currentTime)}else t.value=e;return e},t}(),m=0,g=function(t){function e(e){var n=t.call(this)||this;return n.id=m++,n._media=null,n._paused=!1,n._muted=!1,n._elapsed=0,n._updateListener=n._update.bind(n),n.init(e),n}return h(e,t),e.prototype.stop=function(){this._source&&(this._internalStop(),this.emit("stop"))},Object.defineProperty(e.prototype,"speed",{get:function(){return this._speed},set:function(t){this._speed=t,this.refresh(),this._update(!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(t){this._muted=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this.refresh()},enumerable:!0,configurable:!0}),e.prototype.refresh=function(){if(this._source){var t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;var n=t.volume*(t.muted?0:1),o=e.volume*(e.muted?0:1),i=this._volume*(this._muted?0:1);y.setParamValue(this._gain.gain,i*o*n),y.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed)}},e.prototype.refreshPaused=function(){var t=this._media.context,e=this._media.parent,n=this._paused||e.paused||t.paused;n!==this._pausedReal&&(this._pausedReal=n,n?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",n))},e.prototype.play=function(t){var e=t.start,n=t.end,o=t.speed,i=t.loop,r=t.volume,s=t.muted;this._paused=!1;var u=this._media.nodes.cloneBufferSource(),a=u.source,c=u.gain;this._source=a,this._gain=c,this._speed=o,this._volume=r,this._loop=!!i,this._muted=s,this.refresh();var l=this._source.buffer.duration;this._duration=l,this._end=n,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=n,this._source.loopStart=e,this._source.start(0,e)):n?this._source.start(0,e,n-e):this._source.start(0,e),this.emit("start"),this._update(!0),this._enabled=!0},e.prototype._toSec=function(t){return t>10&&(t/=1e3),t||0},Object.defineProperty(e.prototype,"_enabled",{set:function(t){var e=this._media.nodes.script;e.removeEventListener("audioprocess",this._updateListener),t&&e.addEventListener("audioprocess",this._updateListener)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"progress",{get:function(){return this._progress},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this._paused},set:function(t){this._paused=t,this.refreshPaused()},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.removeAllListeners(),this._internalStop(),this._source&&(this._source.disconnect(),this._source=null),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1},e.prototype.toString=function(){return"[WebAudioInstance id="+this.id+"]"},e.prototype._now=function(){return this._media.context.audioContext.currentTime},e.prototype._update=function(t){if(void 0===t&&(t=!1),this._source){var e=this._now(),n=e-this._lastUpdate;if(n>0||t){var o=this._source.playbackRate.value;this._elapsed+=n*o,this._lastUpdate=e;var i=this._duration,r=void 0;if(this._source.loopStart){var s=this._source.loopEnd-this._source.loopStart;r=(this._source.loopStart+this._elapsed%s)/i}else r=this._elapsed%i/i;this._progress=r,this.emit("progress",this._progress,i)}}},e.prototype.init=function(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)},e.prototype._internalStop=function(){this._source&&(this._enabled=!1,this._source.onended=null,this._source.stop(0),this._source=null)},e.prototype._onComplete=function(){this._source&&(this._enabled=!1,this._source.onended=null),this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)},e}(PIXI.utils.EventEmitter),b=function(t){function e(n){var o=this,i=n.audioContext,r=i.createBufferSource(),s=i.createScriptProcessor(e.BUFFER_SIZE),u=i.createGain(),a=i.createAnalyser();return r.connect(a),a.connect(u),u.connect(n.destination),s.connect(n.destination),(o=t.call(this,a,u)||this).context=n,o.bufferSource=r,o.script=s,o.gain=u,o.analyser=a,o}return h(e,t),e.prototype.destroy=function(){t.prototype.destroy.call(this),this.bufferSource.disconnect(),this.script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this.script=null,this.gain=null,this.analyser=null,this.context=null},e.prototype.cloneBufferSource=function(){var t=this.bufferSource,e=this.context.audioContext.createBufferSource();e.buffer=t.buffer,y.setParamValue(e.playbackRate,t.playbackRate.value),e.loop=t.loop;var n=this.context.audioContext.createGain();return e.connect(n),n.connect(this.destination),{source:e,gain:n}},e.BUFFER_SIZE=256,e}(c),v=function(){function t(){}return t.prototype.init=function(t){this.parent=t,this._nodes=new b(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source},t.prototype.destroy=function(){this.parent=null,this._nodes.destroy(),this._nodes=null,this._source=null,this.source=null},t.prototype.create=function(){return new g(this)},Object.defineProperty(t.prototype,"context",{get:function(){return this.parent.context},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPlayable",{get:function(){return!!this._source&&!!this._source.buffer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filters",{get:function(){return this._nodes.filters},set:function(t){this._nodes.filters=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this._source.buffer.duration},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buffer",{get:function(){return this._source.buffer},set:function(t){this._source.buffer=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodes",{get:function(){return this._nodes},enumerable:!0,configurable:!0}),t.prototype.load=function(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t&&t(new Error("sound.url or sound.source must be set"))},t.prototype._loadUrl=function(t){var e=this,n=new XMLHttpRequest,o=this.parent.url;n.open("GET",o,!0),n.responseType="arraybuffer",n.onload=function(){e.source=n.response,e._decode(n.response,t)},n.send()},t.prototype._decode=function(t,e){var n=this;this.parent.context.decode(t,function(t,o){if(t)e&&e(t);else{n.parent.isLoaded=!0,n.buffer=o;var i=n.parent.autoPlayStart();e&&e(null,n.parent,i)}})},t}(),P=function(t){function e(){var n=this,o=window,i=new e.AudioContext,r=i.createDynamicsCompressor(),s=i.createAnalyser();return s.connect(r),r.connect(i.destination),(n=t.call(this,s,r)||this)._ctx=i,n._offlineCtx=new e.OfflineAudioContext(1,2,o.OfflineAudioContext?i.sampleRate:44100),n._unlocked=!1,n.compressor=r,n.analyser=s,n.events=new PIXI.utils.EventEmitter,n.volume=1,n.speed=1,n.muted=!1,n.paused=!1,"running"!==i.state&&(n._unlock(),n._unlock=n._unlock.bind(n),document.addEventListener("mousedown",n._unlock,!0),document.addEventListener("touchstart",n._unlock,!0),document.addEventListener("touchend",n._unlock,!0)),n}return h(e,t),e.prototype._unlock=function(){this._unlocked||(this.playEmptySound(),"running"===this._ctx.state&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._unlocked=!0))},e.prototype.playEmptySound=function(){var t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),"suspended"===t.context.state&&t.context.resume()},Object.defineProperty(e,"AudioContext",{get:function(){var t=window;return t.AudioContext||t.webkitAudioContext||null},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OfflineAudioContext",{get:function(){var t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){t.prototype.destroy.call(this);var e=this._ctx;void 0!==e.close&&e.close(),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null},Object.defineProperty(e.prototype,"audioContext",{get:function(){return this._ctx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"offlineContext",{get:function(){return this._offlineCtx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this._paused},set:function(t){t&&"running"===this._ctx.state?this._ctx.suspend():t||"suspended"!==this._ctx.state||this._ctx.resume(),this._paused=t},enumerable:!0,configurable:!0}),e.prototype.refresh=function(){this.events.emit("refresh")},e.prototype.refreshPaused=function(){this.events.emit("refreshPaused")},e.prototype.toggleMute=function(){return this.muted=!this.muted,this.refresh(),this.muted},e.prototype.togglePause=function(){return this.paused=!this.paused,this.refreshPaused(),this._paused},e.prototype.decode=function(t,e){this._offlineCtx.decodeAudioData(t,function(t){e(null,t)},function(t){e(new Error(t.message||"Unable to decode file"))})},e}(c),x=Object.freeze({WebAudioMedia:v,WebAudioInstance:g,WebAudioNodes:b,WebAudioContext:P,WebAudioUtils:y}),O=function(t){function e(n,o,i,r,s,u,a,c,l,p){void 0===n&&(n=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===a&&(a=0),void 0===c&&(c=0),void 0===l&&(l=0),void 0===p&&(p=0);var h=this;if(!_().useLegacy){var f=[{f:e.F32,type:"lowshelf",gain:n},{f:e.F64,type:"peaking",gain:o},{f:e.F125,type:"peaking",gain:i},{f:e.F250,type:"peaking",gain:r},{f:e.F500,type:"peaking",gain:s},{f:e.F1K,type:"peaking",gain:u},{f:e.F2K,type:"peaking",gain:a},{f:e.F4K,type:"peaking",gain:c},{f:e.F8K,type:"peaking",gain:l},{f:e.F16K,type:"highshelf",gain:p}].map(function(t){var e=_().context.audioContext.createBiquadFilter();return e.type=t.type,y.setParamValue(e.Q,1),e.frequency.value=t.f,y.setParamValue(e.gain,t.gain),e});(h=t.call(this,f[0],f[f.length-1])||this).bands=f,h.bandsMap={};for(var d=0;d<h.bands.length;d++){var m=h.bands[d];d>0&&h.bands[d-1].connect(m),h.bandsMap[m.frequency.value]=m}return h}h=t.call(this,null)||this}return h(e,t),e.prototype.setGain=function(t,e){if(void 0===e&&(e=0),!this.bandsMap[t])throw new Error("No band found for frequency "+t);y.setParamValue(this.bandsMap[t].gain,e)},e.prototype.getGain=function(t){if(!this.bandsMap[t])throw new Error("No band found for frequency "+t);return this.bandsMap[t].gain.value},Object.defineProperty(e.prototype,"f32",{get:function(){return this.getGain(e.F32)},set:function(t){this.setGain(e.F32,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f64",{get:function(){return this.getGain(e.F64)},set:function(t){this.setGain(e.F64,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f125",{get:function(){return this.getGain(e.F125)},set:function(t){this.setGain(e.F125,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f250",{get:function(){return this.getGain(e.F250)},set:function(t){this.setGain(e.F250,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f500",{get:function(){return this.getGain(e.F500)},set:function(t){this.setGain(e.F500,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f1k",{get:function(){return this.getGain(e.F1K)},set:function(t){this.setGain(e.F1K,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f2k",{get:function(){return this.getGain(e.F2K)},set:function(t){this.setGain(e.F2K,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f4k",{get:function(){return this.getGain(e.F4K)},set:function(t){this.setGain(e.F4K,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f8k",{get:function(){return this.getGain(e.F8K)},set:function(t){this.setGain(e.F8K,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"f16k",{get:function(){return this.getGain(e.F16K)},set:function(t){this.setGain(e.F16K,t)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.bands.forEach(function(t){y.setParamValue(t.gain,0)})},e.prototype.destroy=function(){this.bands.forEach(function(t){t.disconnect()}),this.bands=null,this.bandsMap=null},e.F32=32,e.F64=64,e.F125=125,e.F250=250,e.F500=500,e.F1K=1e3,e.F2K=2e3,e.F4K=4e3,e.F8K=8e3,e.F16K=16e3,e}(l),j=function(t){function e(e){void 0===e&&(e=0);var n=this;if(!_().useLegacy){var o=_().context.audioContext.createWaveShaper();return(n=t.call(this,o)||this)._distortion=o,n.amount=e,n}n=t.call(this,null)||this}return h(e,t),Object.defineProperty(e.prototype,"amount",{get:function(){return this._amount},set:function(t){t*=1e3,this._amount=t;for(var e,n=new Float32Array(44100),o=Math.PI/180,i=0;i<44100;++i)e=2*i/44100-1,n[i]=(3+t)*e*20*o/(Math.PI+t*Math.abs(e));this._distortion.curve=n,this._distortion.oversample="4x"},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this._distortion=null,t.prototype.destroy.call(this)},e}(l),w=function(t){function e(e){void 0===e&&(e=0);var n=this;if(!_().useLegacy){var o,i,r,s=_().context.audioContext;return s.createStereoPanner?r=o=s.createStereoPanner():((i=s.createPanner()).panningModel="equalpower",r=i),(n=t.call(this,r)||this)._stereo=o,n._panner=i,n.pan=e,n}n=t.call(this,null)||this}return h(e,t),Object.defineProperty(e.prototype,"pan",{get:function(){return this._pan},set:function(t){this._pan=t,this._stereo?y.setParamValue(this._stereo.pan,t):this._panner.setPosition(t,0,1-Math.abs(t))},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){t.prototype.destroy.call(this),this._stereo=null,this._panner=null},e}(l),E=function(t){function e(e,n,o){void 0===e&&(e=3),void 0===n&&(n=2),void 0===o&&(o=!1);var i=this;if(!_().useLegacy)return(i=t.call(this,null)||this)._seconds=i._clamp(e,1,50),i._decay=i._clamp(n,0,100),i._reverse=o,i._rebuild(),i;i=t.call(this,null)||this}return h(e,t),e.prototype._clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},Object.defineProperty(e.prototype,"seconds",{get:function(){return this._seconds},set:function(t){this._seconds=this._clamp(t,1,50),this._rebuild()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"decay",{get:function(){return this._decay},set:function(t){this._decay=this._clamp(t,0,100),this._rebuild()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reverse",{get:function(){return this._reverse},set:function(t){this._reverse=t,this._rebuild()},enumerable:!0,configurable:!0}),e.prototype._rebuild=function(){for(var t,e=_().context.audioContext,n=e.sampleRate,o=n*this._seconds,i=e.createBuffer(2,o,n),r=i.getChannelData(0),s=i.getChannelData(1),u=0;u<o;u++)t=this._reverse?o-u:u,r[u]=(2*Math.random()-1)*Math.pow(1-t/o,this._decay),s[u]=(2*Math.random()-1)*Math.pow(1-t/o,this._decay);var a=_().context.audioContext.createConvolver();a.buffer=i,this.init(a)},e}(l),A=function(t){function e(){var e=this;if(!_().useLegacy){var n=_().context.audioContext,o=n.createChannelSplitter(),i=n.createChannelMerger();return i.connect(o),(e=t.call(this,i,o)||this)._merger=i,e}e=t.call(this,null)||this}return h(e,t),e.prototype.destroy=function(){this._merger.disconnect(),this._merger=null,t.prototype.destroy.call(this)},e}(l),F=function(t){function e(){if(!_().useLegacy){var e=_().context.audioContext,n=e.createBiquadFilter(),o=e.createBiquadFilter(),i=e.createBiquadFilter(),r=e.createBiquadFilter();return n.type="lowpass",y.setParamValue(n.frequency,2e3),o.type="lowpass",y.setParamValue(o.frequency,2e3),i.type="highpass",y.setParamValue(i.frequency,500),r.type="highpass",y.setParamValue(r.frequency,500),n.connect(o),o.connect(i),i.connect(r),t.call(this,n,r)||this}t.call(this,null)}return h(e,t),e}(l),I=Object.freeze({Filter:l,EqualizerFilter:O,DistortionFilter:j,StereoFilter:w,ReverbFilter:E,MonoFilter:A,TelephoneFilter:F}),S=0,L=function(t){function e(e){var n=t.call(this)||this;return n.id=S++,n.init(e),n}return h(e,t),Object.defineProperty(e.prototype,"progress",{get:function(){return this._source.currentTime/this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this._paused},set:function(t){this._paused=t,this.refreshPaused()},enumerable:!0,configurable:!0}),e.prototype._onPlay=function(){this._playing=!0},e.prototype._onPause=function(){this._playing=!1},e.prototype.init=function(t){this._playing=!1,this._duration=t.source.duration;var e=this._source=t.source.cloneNode(!1);e.src=t.parent.url,e.onplay=this._onPlay.bind(this),e.onpause=this._onPause.bind(this),t.context.on("refresh",this.refresh,this),t.context.on("refreshPaused",this.refreshPaused,this),this._media=t},e.prototype._internalStop=function(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())},e.prototype.stop=function(){this._internalStop(),this._source&&this.emit("stop")},Object.defineProperty(e.prototype,"speed",{get:function(){return this._speed},set:function(t){this._speed=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(t){this._muted=t,this.refresh()},enumerable:!0,configurable:!0}),e.prototype.refresh=function(){var t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;var n=t.volume*(t.muted?0:1),o=e.volume*(e.muted?0:1),i=this._volume*(this._muted?0:1);this._source.volume=i*n*o,this._source.playbackRate=this._speed*t.speed*e.speed},e.prototype.refreshPaused=function(){var t=this._media.context,e=this._media.parent,n=this._paused||e.paused||t.paused;n!==this._pausedReal&&(this._pausedReal=n,n?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",n))},e.prototype.play=function(t){var n=this,o=t.start,i=t.end,r=t.speed,s=t.loop,u=t.volume,a=t.muted;this._speed=r,this._volume=u,this._loop=!!s,this._muted=a,this.refresh(),this.loop&&null!==i&&(this.loop=!1),this._start=o,this._end=i||this._duration,this._start=Math.max(0,this._start-e.PADDING),this._end=Math.min(this._end+e.PADDING,this._duration),this._source.onloadedmetadata=function(){n._source&&(n._source.currentTime=o,n._source.onloadedmetadata=null,n.emit("progress",o,n._duration),PIXI.ticker.shared.add(n._onUpdate,n))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")},e.prototype._onUpdate=function(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()},e.prototype._onComplete=function(){PIXI.ticker.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)},e.prototype.destroy=function(){PIXI.ticker.shared.remove(this._onUpdate,this),this.removeAllListeners();var t=this._source;t&&(t.onended=null,t.onplay=null,t.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)},e.prototype.toString=function(){return"[HTMLAudioInstance id="+this.id+"]"},e.PADDING=.1,e}(PIXI.utils.EventEmitter),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.init=function(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)},e.prototype.create=function(){return new L(this)},Object.defineProperty(e.prototype,"isPlayable",{get:function(){return!!this._source&&4===this._source.readyState},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._source.duration},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"context",{get:function(){return this.parent.context},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filters",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),e.prototype.load=function(t){var e=this._source,n=this.parent;if(4!==e.readyState){if(!n.url)return t(new Error("sound.url or sound.source must be set"));e.src=n.url;var o=function(){e.removeEventListener("canplaythrough",i),e.removeEventListener("load",i),e.removeEventListener("abort",r),e.removeEventListener("error",s)},i=function(){o(),n.isLoaded=!0;var e=n.autoPlayStart();t&&t(null,n,e)},r=function(){o(),t&&t(new Error("Sound loading has been aborted"))},s=function(){o();var n="Failed to load audio element (code: "+e.error.code+")";t&&t(new Error(n))};e.addEventListener("canplaythrough",i,!1),e.addEventListener("load",i,!1),e.addEventListener("abort",r,!1),e.addEventListener("error",s,!1),e.load()}else{n.isLoaded=!0;var u=n.autoPlayStart();t&&setTimeout(function(){t(null,n,u)},0)}},e}(PIXI.utils.EventEmitter),M=function(t){function e(){var e=t.call(this)||this;return e.speed=1,e.volume=1,e.muted=!1,e.paused=!1,e}return h(e,t),e.prototype.refresh=function(){this.emit("refresh")},e.prototype.refreshPaused=function(){this.emit("refreshPaused")},Object.defineProperty(e.prototype,"filters",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"audioContext",{get:function(){return null},enumerable:!0,configurable:!0}),e.prototype.toggleMute=function(){return this.muted=!this.muted,this.refresh(),this.muted},e.prototype.togglePause=function(){return this.paused=!this.paused,this.refreshPaused(),this.paused},e.prototype.destroy=function(){this.removeAllListeners()},e}(PIXI.utils.EventEmitter),k=Object.freeze({HTMLAudioMedia:C,HTMLAudioInstance:L,HTMLAudioContext:M}),T=["mp3","ogg","oga","opus","mpeg","wav","m4a","mp4","aiff","wma","mid"];var R,G,X,K,B=(R={m4a:"mp4",oga:"ogg"},G=document.createElement("audio"),X={},K=/^no$/,T.forEach(function(t){var e=R[t]||t,n=G.canPlayType("audio/"+t).replace(K,""),o=G.canPlayType("audio/"+e).replace(K,"");X[t]=!!n||!!o}),Object.freeze(X)),D=/\.(\{([^\}]+)\})(\?.*)?$/;function q(t){var e=D,n="string"==typeof t?t:t.url;if(e.test(n)){for(var o=e.exec(n),i=o[2].split(","),r=i[i.length-1],s=0,u=i.length;s<u;s++){var a=i[s];if(B[a]){r=a;break}}var c=n.replace(o[1],r);return"string"!=typeof t&&(t.extension=r,t.url=c),c}return n}var U=function(){function t(){}return t.add=function(){t.legacy=_().useLegacy},Object.defineProperty(t,"legacy",{set:function(t){var e=PIXI.loaders.Resource,n=T;t?n.forEach(function(t){e.setExtensionXhrType(t,e.XHR_RESPONSE_TYPE.DEFAULT),e.setExtensionLoadType(t,e.LOAD_TYPE.AUDIO)}):n.forEach(function(t){e.setExtensionXhrType(t,e.XHR_RESPONSE_TYPE.BUFFER),e.setExtensionLoadType(t,e.LOAD_TYPE.XHR)})},enumerable:!0,configurable:!0}),t.pre=function(t,e){q(t),e()},t.use=function(t,e){t.data&&T.indexOf(t.extension)>-1?t.sound=_().add(t.name,{loaded:e,preload:!0,url:t.url,source:t.data}):e()},t}(),V=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.use(U.use),o.pre(U.pre),o}return h(e,t),e.addPixiMiddleware=function(e){t.addPixiMiddleware.call(this,e)},e}(PIXI.loaders.Loader),H=function(){function t(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start}return t.prototype.play=function(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})},t.prototype.destroy=function(){this.parent=null},t}(),N=function(){function t(t,e){this.media=t,this.options=e,this._instances=[],this._sprites={},this.media.init(this);var n=e.complete;this._autoPlayOptions=n?{complete:n}:null,this.isLoaded=!1,this.isPlaying=!1,this.autoPlay=e.autoPlay,this.singleInstance=e.singleInstance,this.preload=e.preload||this.autoPlay,this.url=e.url,this.speed=e.speed,this.volume=e.volume,this.loop=e.loop,e.sprites&&this.addSprites(e.sprites),this.preload&&this._preload(e.loaded)}return t.from=function(e){var n={};return"string"==typeof e?n.url=e:e instanceof ArrayBuffer||e instanceof HTMLAudioElement?n.source=e:n=e,(n=d({autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1},n)).url&&(n.url=q(n.url)),Object.freeze(n),new t(_().useLegacy?new C:new v,n)},Object.defineProperty(t.prototype,"context",{get:function(){return _().context},enumerable:!0,configurable:!0}),t.prototype.pause=function(){return this.isPlaying=!1,this.paused=!0,this},t.prototype.resume=function(){return this.isPlaying=this._instances.length>0,this.paused=!1,this},Object.defineProperty(t.prototype,"paused",{get:function(){return this._paused},set:function(t){this._paused=t,this.refreshPaused()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"speed",{get:function(){return this._speed},set:function(t){this._speed=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filters",{get:function(){return this.media.filters},set:function(t){this.media.filters=t},enumerable:!0,configurable:!0}),t.prototype.addSprites=function(t,e){if("object"==typeof t){var n={};for(var o in t)n[o]=this.addSprites(o,t[o]);return n}if("string"==typeof t){var i=new H(this,e);return this._sprites[t]=i,i}},t.prototype.destroy=function(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null},t.prototype.removeSprites=function(t){if(t){var e=this._sprites[t];void 0!==e&&(e.destroy(),delete this._sprites[t])}else for(var n in this._sprites)this.removeSprites(n);return this},Object.defineProperty(t.prototype,"isPlayable",{get:function(){return this.isLoaded&&this.media&&this.media.isPlayable},enumerable:!0,configurable:!0}),t.prototype.stop=function(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(var t=this._instances.length-1;t>=0;t--)this._instances[t].stop();return this},t.prototype.play=function(t,e){var n,o=this;"string"==typeof t?n={sprite:r=t,loop:this.loop,complete:e}:"function"==typeof t?(n={}).complete=t:n=t;if((n=d({complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1},n||{})).sprite){var i=n.sprite,r=this._sprites[i];n.start=r.start,n.end=r.end,n.speed=r.speed||1,n.loop=r.loop||n.loop,delete n.sprite}if(n.offset&&(n.start=n.offset),!this.isLoaded)return new Promise(function(t,e){o.autoPlay=!0,o._autoPlayOptions=n,o._preload(function(o,i,r){o?e(o):(n.loaded&&n.loaded(o,i,r),t(r))})});this.singleInstance&&this._removeInstances();var s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",function(){n.complete&&n.complete(o),o._onComplete(s)}),s.once("stop",function(){o._onComplete(s)}),s.play(n),s},t.prototype.refresh=function(){for(var t=this._instances.length,e=0;e<t;e++)this._instances[e].refresh()},t.prototype.refreshPaused=function(){for(var t=this._instances.length,e=0;e<t;e++)this._instances[e].refreshPaused()},Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"muted",{get:function(){return this._muted},set:function(t){this._muted=t,this.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this.refresh()},enumerable:!0,configurable:!0}),t.prototype._preload=function(t){this.media.load(t)},Object.defineProperty(t.prototype,"instances",{get:function(){return this._instances},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sprites",{get:function(){return this._sprites},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this.media.duration},enumerable:!0,configurable:!0}),t.prototype.autoPlayStart=function(){var t;return this.autoPlay&&(t=this.play(this._autoPlayOptions)),t},t.prototype._removeInstances=function(){for(var t=this._instances.length-1;t>=0;t--)this._poolInstance(this._instances[t]);this._instances.length=0},t.prototype._onComplete=function(t){if(this._instances){var e=this._instances.indexOf(t);e>-1&&this._instances.splice(e,1),this.isPlaying=this._instances.length>0}this._poolInstance(t)},t.prototype._createInstance=function(){if(t._pool.length>0){var e=t._pool.pop();return e.init(this.media),e}return this.media.create()},t.prototype._poolInstance=function(e){e.destroy(),t._pool.indexOf(e)<0&&t._pool.push(e)},t._pool=[],t}(),z=function(){function t(){this.init()}return t.prototype.init=function(){return this.supported&&(this._webAudioContext=new P),this._htmlAudioContext=new M,this._sounds={},this.useLegacy=!this.supported,this},Object.defineProperty(t.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filtersAll",{get:function(){return this.useLegacy?[]:this._context.filters},set:function(t){this.useLegacy||(this._context.filters=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"supported",{get:function(){return null!==P.AudioContext},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){if("object"==typeof t){var n={};for(var o in t){var i=this._getOptions(t[o],e);n[o]=this.add(o,i)}return n}if("string"==typeof t){if(e instanceof N)return this._sounds[t]=e,e;i=this._getOptions(e);var r=N.from(i);return this._sounds[t]=r,r}},t.prototype._getOptions=function(t,e){var n;return n="string"==typeof t?{url:t}:t instanceof ArrayBuffer||t instanceof HTMLAudioElement?{source:t}:t,n=d({},n,e||{})},Object.defineProperty(t.prototype,"useLegacy",{get:function(){return this._useLegacy},set:function(t){U.legacy=t,this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext},enumerable:!0,configurable:!0}),t.prototype.remove=function(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this},Object.defineProperty(t.prototype,"volumeAll",{get:function(){return this._context.volume},set:function(t){this._context.volume=t,this._context.refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"speedAll",{get:function(){return this._context.speed},set:function(t){this._context.speed=t,this._context.refresh()},enumerable:!0,configurable:!0}),t.prototype.togglePauseAll=function(){return this._context.togglePause()},t.prototype.pauseAll=function(){return this._context.paused=!0,this._context.refresh(),this},t.prototype.resumeAll=function(){return this._context.paused=!1,this._context.refresh(),this},t.prototype.toggleMuteAll=function(){return this._context.toggleMute()},t.prototype.muteAll=function(){return this._context.muted=!0,this._context.refresh(),this},t.prototype.unmuteAll=function(){return this._context.muted=!1,this._context.refresh(),this},t.prototype.removeAll=function(){for(var t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this},t.prototype.stopAll=function(){for(var t in this._sounds)this._sounds[t].stop();return this},t.prototype.exists=function(t,e){return void 0===e&&(e=!1),!!this._sounds[t]},t.prototype.find=function(t){return this.exists(t,!0),this._sounds[t]},t.prototype.play=function(t,e){return this.find(t).play(e)},t.prototype.stop=function(t){return this.find(t).stop()},t.prototype.pause=function(t){return this.find(t).pause()},t.prototype.resume=function(t){return this.find(t).resume()},t.prototype.volume=function(t,e){var n=this.find(t);return void 0!==e&&(n.volume=e),n.volume},t.prototype.speed=function(t,e){var n=this.find(t);return void 0!==e&&(n.speed=e),n.speed},t.prototype.duration=function(t){return this.find(t).duration},t.prototype.close=function(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this},t}(),W=0;var Y=Object.freeze({get PLAY_ID(){return W},playOnce:function(t,e){var n="alias"+W++;return _().add(n,{url:t,preload:!0,autoPlay:!0,loaded:function(t){t&&(_().remove(n),e&&e(t))},complete:function(){_().remove(n),e&&e(null)}}),n},render:function(t,e){var n=document.createElement("canvas");e=d({width:512,height:128,fill:"black"},e||{}),n.width=e.width,n.height=e.height;var o=PIXI.BaseTexture.fromCanvas(n);if(!(t.media instanceof v))return o;var i=t.media,r=n.getContext("2d");r.fillStyle=e.fill;for(var s=i.buffer.getChannelData(0),u=Math.ceil(s.length/e.width),a=e.height/2,c=0;c<e.width;c++){for(var l=1,p=-1,h=0;h<u;h++){var f=s[c*u+h];f<l&&(l=f),f>p&&(p=f)}r.fillRect(c,(1+l)*a,1,Math.max(1,(p-l)*a))}return o},resolveUrl:q,sineTone:function(t,e){void 0===t&&(t=200),void 0===e&&(e=1);var n=N.from({singleInstance:!0});if(!(n.media instanceof v))return n;for(var o=n.media,i=n.context.audioContext.createBuffer(1,48e3*e,48e3),r=i.getChannelData(0),s=0;s<r.length;s++){var u=t*(s/i.sampleRate)*Math.PI;r[s]=2*Math.sin(u)}return o.buffer=i,n.isLoaded=!0,n},extensions:T,supported:B}),Z=function(t){return f=t,t}(new z),$=window,J=PIXI;if("undefined"==typeof Promise&&($.Promise=n),void 0!==PIXI.loaders){var Q=parseInt(PIXI.VERSION.split(".")[0],10);4===Q?(PIXI.loaders.Loader=V,U.add(),PIXI.loader.use(U.use),PIXI.loader.pre(U.pre)):Q>=5&&J.Loader.registerPlugin(U)}return void 0===$.__pixiSound&&delete $.__pixiSound,J.sound||(Object.defineProperty(J,"sound",{get:function(){return Z}}),Object.defineProperties(Z,{Filterable:{get:function(){return c}},filters:{get:function(){return I}},htmlaudio:{get:function(){return k}},Sound:{get:function(){return N}},SoundLibrary:{get:function(){return z}},SoundSprite:{get:function(){return H}},utils:{get:function(){return Y}},webaudio:{get:function(){return x}},sound:{get:function(){return Z}}})),Z});
10
+ //# sourceMappingURL=pixi-sound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-sound.js","sources":["../node_modules/promise-polyfill/src/index.js","../node_modules/promise-polyfill/src/finally.js","../src/Filterable.ts","../src/filters/Filter.ts","../src/instance.ts","../src/webaudio/WebAudioUtils.ts","../src/webaudio/WebAudioInstance.ts","../src/webaudio/WebAudioNodes.ts","../src/webaudio/WebAudioMedia.ts","../src/webaudio/WebAudioContext.ts","../src/filters/EqualizerFilter.ts","../src/filters/DistortionFilter.ts","../src/filters/StereoFilter.ts","../src/filters/ReverbFilter.ts","../src/filters/MonoFilter.ts","../src/filters/TelephoneFilter.ts","../src/htmlaudio/HTMLAudioInstance.ts","../src/htmlaudio/HTMLAudioMedia.ts","../src/htmlaudio/HTMLAudioContext.ts","../src/utils/supported.ts","../src/utils/resolveUrl.ts","../src/loader/LoaderMiddleware.ts","../src/loader/Loader.ts","../src/sprites/SoundSprite.ts","../src/Sound.ts","../src/SoundLibrary.ts","../src/utils/playOnce.ts","../src/utils/render.ts","../src/utils/sineTone.ts","../src/index.ts"],"sourcesContent":["import promiseFinally from './finally';\n\n// Store setTimeout reference so promise-polyfill will be unaffected by\n// other code modifying setTimeout (like sinon.useFakeTimers())\nvar setTimeoutFunc = setTimeout;\n\nfunction noop() {}\n\n// Polyfill for Function.prototype.bind\nfunction bind(fn, thisArg) {\n return function() {\n fn.apply(thisArg, arguments);\n };\n}\n\n/**\n * @constructor\n * @param {Function} fn\n */\nfunction Promise(fn) {\n if (!(this instanceof Promise))\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n /** @type {!number} */\n this._state = 0;\n /** @type {!boolean} */\n this._handled = false;\n /** @type {Promise|undefined} */\n this._value = undefined;\n /** @type {!Array<!Function>} */\n this._deferreds = [];\n\n doResolve(fn, this);\n}\n\nfunction handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function() {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n}\n\nfunction resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n}\n\nfunction reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n}\n\nfunction finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n}\n\n/**\n * @constructor\n */\nfunction Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n // @ts-ignore\n var prom = new this.constructor(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n};\n\nPromise.prototype['finally'] = promiseFinally;\n\nPromise.all = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!arr || typeof arr.length === 'undefined')\n throw new TypeError('Promise.all accepts an array');\n var args = Array.prototype.slice.call(arr);\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(\n val,\n function(val) {\n res(i, val);\n },\n reject\n );\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.resolve = function(value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function(resolve) {\n resolve(value);\n });\n};\n\nPromise.reject = function(value) {\n return new Promise(function(resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function(values) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n};\n\n// Use polyfill for setImmediate for performance gains\nPromise._immediateFn =\n (typeof setImmediate === 'function' &&\n function(fn) {\n setImmediate(fn);\n }) ||\n function(fn) {\n setTimeoutFunc(fn, 0);\n };\n\nPromise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n};\n\nexport default Promise;\n","/**\n * @this {Promise}\n */\nfunction finallyConstructor(callback) {\n var constructor = this.constructor;\n return this.then(\n function(value) {\n return constructor.resolve(callback()).then(function() {\n return value;\n });\n },\n function(reason) {\n return constructor.resolve(callback()).then(function() {\n return constructor.reject(reason);\n });\n }\n );\n}\n\nexport default finallyConstructor;\n","import { Filter } from \"./filters/Filter\";\n\n/**\n * Abstract class which SoundNodes and SoundContext\n * both extend. This provides the functionality for adding\n * dynamic filters.\n * @class Filterable\n * @memberof PIXI.sound\n * @param {AudioNode} source The source audio node\n * @param {AudioNode} destination The output audio node\n * @private\n */\nexport class Filterable\n{\n /**\n * Get the gain node\n * @name PIXI.sound.Filterable#_input\n * @type {AudioNode}\n * @private\n */\n private _input: AudioNode;\n\n /**\n * The destination output audio node\n * @name PIXI.sound.Filterable#_output\n * @type {AudioNode}\n * @private\n */\n private _output: AudioNode;\n\n /**\n * Collection of filters.\n * @name PIXI.sound.Filterable#_filters\n * @type {PIXI.sound.filters.Filter[]}\n * @private\n */\n private _filters: Filter[];\n\n constructor(input: AudioNode, output: AudioNode)\n {\n this._output = output;\n this._input = input;\n }\n\n /**\n * The destination output audio node\n * @name PIXI.sound.Filterable#destination\n * @type {AudioNode}\n * @readonly\n */\n get destination(): AudioNode\n {\n return this._input;\n }\n\n /**\n * The collection of filters\n * @name PIXI.sound.Filterable#filters\n * @type {PIXI.sound.filters.Filter[]}\n */\n get filters(): Filter[]\n {\n return this._filters;\n }\n set filters(filters: Filter[])\n {\n if (this._filters)\n {\n this._filters.forEach((filter: Filter) => {\n if (filter)\n {\n filter.disconnect();\n }\n });\n this._filters = null;\n // Reconnect direct path\n this._input.connect(this._output);\n }\n\n if (filters && filters.length)\n {\n this._filters = filters.slice(0);\n\n // Disconnect direct path before inserting filters\n this._input.disconnect();\n\n // Connect each filter\n let prevFilter: Filter = null;\n filters.forEach((filter: Filter) => {\n if (prevFilter === null)\n {\n // first filter is the destination\n // for the analyser\n this._input.connect(filter.destination);\n }\n else\n {\n prevFilter.connect(filter.destination);\n }\n prevFilter = filter;\n });\n prevFilter.connect(this._output);\n }\n }\n\n /**\n * Cleans up.\n * @method PIXI.sound.Filterable#destroy\n */\n public destroy(): void\n {\n this.filters = null;\n this._input = null;\n this._output = null;\n }\n}\n","/**\n * Represents a single sound element. Can be used to play, pause, etc. sound instances.\n *\n * @class Filter\n * @memberof PIXI.sound.filters\n * @param {AudioNode} destination The audio node to use as the destination for the input AudioNode\n * @param {AudioNode} [source] Optional output node, defaults to destination node. This is useful\n * when creating filters which contains multiple AudioNode elements chained together.\n */\nexport class Filter\n{\n /**\n * The node to connect for the filter to the previous filter.\n * @name PIXI.sound.filters.Filter#destination\n * @type {AudioNode}\n */\n public destination: AudioNode;\n\n /**\n * The node to connect for the filter to the previous filter.\n * @name PIXI.sound.filters.Filter#source\n * @type {AudioNode}\n */\n public source: AudioNode;\n\n constructor(destination: AudioNode, source?: AudioNode)\n {\n this.init(destination, source);\n }\n\n /**\n * Reinitialize\n * @method PIXI.sound.filters.Filter#init\n * @private\n */\n protected init(destination: AudioNode, source?: AudioNode)\n {\n this.destination = destination;\n this.source = source || destination;\n }\n\n /**\n * Connect to the destination.\n * @method PIXI.sound.filters.Filter#connect\n * @param {AudioNode} destination The destination node to connect the output to\n */\n public connect(destination: AudioNode): void\n {\n this.source.connect(destination);\n }\n\n /**\n * Completely disconnect filter from destination and source nodes.\n * @method PIXI.sound.filters.Filter#disconnect\n */\n public disconnect(): void\n {\n this.source.disconnect();\n }\n\n /**\n * Destroy the filter and don't use after this.\n * @method PIXI.sound.filters.Filter#destroy\n */\n public destroy(): void\n {\n this.disconnect();\n this.destination = null;\n this.source = null;\n }\n}\n","import { SoundLibrary } from \"./SoundLibrary\";\n\n/**\n * Singletone instance of the SoundLibrary\n * @private\n */\nexport let instance: SoundLibrary;\n\n/**\n * Internal set function for the singleton instance.\n * @private\n * @param {PIXI.sound} sound - Sound library instance\n * @return {PIXI.sound}\n */\nexport function setInstance(sound: SoundLibrary) {\n instance = sound;\n return sound;\n}\n\n/**\n * Internal get function for the singleton instance.\n * @private\n * @return {PIXI.sound}\n */\nexport function getInstance(): SoundLibrary {\n return instance;\n}\n","import { getInstance } from \"../instance\";\nimport { WebAudioContext } from \"./WebAudioContext\";\n\n/**\n * Internal class for Web Audio abstractions and convenience methods.\n * @private\n * @class WebAudioUtils\n * @memberof PIXI.sound.webaudio\n */\nexport class WebAudioUtils\n{\n /**\n * Dezippering is removed in the future Web Audio API, instead\n * we use the `setValueAtTime` method, however, this is not available\n * in all environments (e.g., Android webview), so we fallback to the `value` setter.\n * @method PIXI.sound.webaudio.WebAudioUtils.setParamValue\n * @private\n * @param {AudioParam} param - AudioNode parameter object\n * @param {number} value - Value to set\n * @return {number} The value set\n */\n public static setParamValue(param: AudioParam, value: number): number\n {\n if (param.setValueAtTime)\n {\n const context = getInstance().context as WebAudioContext;\n param.setValueAtTime(value, context.audioContext.currentTime);\n }\n else\n {\n param.value = value;\n }\n return value;\n }\n}\n","import { IMediaInstance } from \"../interfaces\";\nimport { PlayOptions } from \"../Sound\";\nimport { WebAudioMedia } from \"./WebAudioMedia\";\nimport { WebAudioUtils } from \"./WebAudioUtils\";\n\nlet id = 0;\n\n/**\n * A single play instance that handles the AudioBufferSourceNode.\n * @private\n * @class WebAudioInstance\n * @memberof PIXI.sound.webaudio\n * @param {SoundNodes} source Reference to the SoundNodes.\n */\nexport class WebAudioInstance extends PIXI.utils.EventEmitter implements IMediaInstance\n{\n /**\n * The current unique ID for this instance.\n * @name PIXI.sound.webaudio.WebAudioInstance#id\n * @readonly\n */\n public id: number;\n\n /**\n * The source Sound.\n * @type {PIXI.sound.webaudio.WebAudioMedia}\n * @name PIXI.sound.webaudio.WebAudioInstance#_media\n * @private\n */\n private _media: WebAudioMedia;\n\n /**\n * true if paused.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioInstance#_paused\n * @private\n */\n private _paused: boolean;\n\n /**\n * true if muted.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioInstance#_muted\n * @private\n */\n private _muted: boolean;\n\n /**\n * true if paused.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioInstance#_pausedReal\n * @private\n */\n private _pausedReal: boolean;\n\n /**\n * The instance volume\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_volume\n * @private\n */\n private _volume: number;\n\n /**\n * Last update frame number.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_lastUpdate\n * @private\n */\n private _lastUpdate: number;\n\n /**\n * The total number of seconds elapsed in playback.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_elapsed\n * @private\n */\n private _elapsed: number;\n\n /**\n * Playback rate, where 1 is 100%.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_speed\n * @private\n */\n private _speed: number;\n\n /**\n * Playback rate, where 1 is 100%.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_end\n * @private\n */\n private _end: number;\n\n /**\n * `true` if should be looping.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioInstance#_loop\n * @private\n */\n private _loop: boolean;\n\n /**\n * Gain node for controlling volume of instance\n * @type {GainNode}\n * @name PIXI.sound.webaudio.WebAudioInstance#_gain\n * @private\n */\n private _gain: GainNode;\n\n /**\n * Length of the sound in seconds.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_duration\n * @private\n */\n private _duration: number;\n\n /**\n * The progress of the sound from 0 to 1.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#_progress\n * @private\n */\n private _progress: number;\n\n /**\n * Callback for update listener\n * @type {EventListener}\n * @name PIXI.sound.webaudio.WebAudioInstance#_updateListener\n * @private\n */\n private _updateListener: EventListener;\n\n /**\n * Audio buffer source clone from Sound object.\n * @type {AudioBufferSourceNode}\n * @name PIXI.sound.webaudio.WebAudioInstance#_source\n * @private\n */\n private _source: AudioBufferSourceNode;\n\n constructor(media: WebAudioMedia)\n {\n super();\n\n this.id = id++;\n this._media = null;\n this._paused = false;\n this._muted = false;\n this._elapsed = 0;\n this._updateListener = this._update.bind(this) as EventListener;\n\n // Initialize\n this.init(media);\n }\n\n /**\n * Stops the instance, don't use after this.\n * @method PIXI.sound.webaudio.WebAudioInstance#stop\n */\n public stop(): void\n {\n if (this._source)\n {\n this._internalStop();\n\n /**\n * The sound is stopped. Don't use after this is called.\n * @event PIXI.sound.webaudio.WebAudioInstance#stop\n */\n this.emit(\"stop\");\n }\n }\n\n /**\n * Set the instance speed from 0 to 1\n * @member {number} PIXI.sound.htmlaudio.HTMLAudioInstance#speed\n */\n public get speed(): number\n {\n return this._speed;\n }\n public set speed(speed: number)\n {\n this._speed = speed;\n this.refresh();\n this._update(true); // update progress\n }\n\n /**\n * Get the set the volume for this instance from 0 to 1\n * @member {number} PIXI.sound.htmlaudio.HTMLAudioInstance#volume\n */\n public get volume(): number\n {\n return this._volume;\n }\n public set volume(volume: number)\n {\n this._volume = volume;\n this.refresh();\n }\n\n /**\n * `true` if the sound is muted\n * @member {boolean} PIXI.sound.htmlaudio.HTMLAudioInstance#muted\n */\n public get muted(): boolean\n {\n return this._muted;\n }\n public set muted(muted: boolean)\n {\n this._muted = muted;\n this.refresh();\n }\n\n /**\n * If the sound instance should loop playback\n * @member {boolean} PIXI.sound.htmlaudio.HTMLAudioInstance#loop\n */\n public get loop(): boolean\n {\n return this._loop;\n }\n public set loop(loop: boolean)\n {\n this._loop = loop;\n this.refresh();\n }\n\n /**\n * Refresh loop, volume and speed based on changes to parent\n * @method PIXI.sound.webaudio.WebAudioInstance#refresh\n */\n public refresh(): void\n {\n // Sound could be paused\n if (!this._source) {\n return;\n }\n const global = this._media.context;\n const sound = this._media.parent;\n\n // Updating looping\n this._source.loop = this._loop || sound.loop;\n\n // Update the volume\n const globalVolume = global.volume * (global.muted ? 0 : 1);\n const soundVolume = sound.volume * (sound.muted ? 0 : 1);\n const instanceVolume = this._volume * (this._muted ? 0 : 1);\n WebAudioUtils.setParamValue(this._gain.gain, instanceVolume * soundVolume * globalVolume);\n\n // Update the speed\n WebAudioUtils.setParamValue(this._source.playbackRate, this._speed * sound.speed * global.speed);\n }\n\n /**\n * Handle changes in paused state, either globally or sound or instance\n * @method PIXI.sound.webaudio.WebAudioInstance#refreshPaused\n */\n public refreshPaused(): void\n {\n const global = this._media.context;\n const sound = this._media.parent;\n\n // Consider global and sound paused\n const pausedReal = this._paused || sound.paused || global.paused;\n\n if (pausedReal !== this._pausedReal)\n {\n this._pausedReal = pausedReal;\n\n if (pausedReal)\n {\n // pause the sounds\n this._internalStop();\n\n /**\n * The sound is paused.\n * @event PIXI.sound.webaudio.WebAudioInstance#paused\n */\n this.emit(\"paused\");\n }\n else\n {\n /**\n * The sound is unpaused.\n * @event PIXI.sound.webaudio.WebAudioInstance#resumed\n */\n this.emit(\"resumed\");\n\n // resume the playing with offset\n this.play({\n start: this._elapsed % this._duration,\n end: this._end,\n speed: this._speed,\n loop: this._loop,\n volume: this._volume,\n });\n }\n\n /**\n * The sound is paused or unpaused.\n * @event PIXI.sound.webaudio.WebAudioInstance#pause\n * @property {boolean} paused If the instance was paused or not.\n */\n this.emit(\"pause\", pausedReal);\n }\n }\n\n /**\n * Plays the sound.\n * @method PIXI.sound.webaudio.WebAudioInstance#play\n * @param {Object} options Play options\n * @param {number} options.start The position to start playing, in seconds.\n * @param {number} options.end The ending position in seconds.\n * @param {number} options.speed Speed for the instance\n * @param {boolean} options.loop If the instance is looping, defaults to sound loop\n * @param {number} options.volume Volume of the instance\n * @param {boolean} options.muted Muted state of instance\n */\n public play(options: PlayOptions): void\n {\n const {start, end, speed, loop, volume, muted} = options;\n\n if (end)\n {\n console.assert(end > start, \"End time is before start time\");\n }\n this._paused = false;\n const {source, gain} = this._media.nodes.cloneBufferSource();\n\n this._source = source;\n this._gain = gain;\n this._speed = speed;\n this._volume = volume;\n this._loop = !!loop;\n this._muted = muted;\n this.refresh();\n\n const duration: number = this._source.buffer.duration;\n this._duration = duration;\n this._end = end;\n this._lastUpdate = this._now();\n this._elapsed = start;\n this._source.onended = this._onComplete.bind(this);\n\n if (this._loop)\n {\n this._source.loopEnd = end;\n this._source.loopStart = start;\n this._source.start(0, start);\n }\n else if (end)\n {\n this._source.start(0, start, end - start);\n }\n else\n {\n this._source.start(0, start);\n }\n\n /**\n * The sound is started.\n * @event PIXI.sound.webaudio.WebAudioInstance#start\n */\n this.emit(\"start\");\n\n // Do an update for the initial progress\n this._update(true);\n\n // Start handling internal ticks\n this._enabled = true;\n }\n\n /**\n * Utility to convert time in millseconds or seconds\n * @method PIXI.sound.webaudio.WebAudioInstance#_toSec\n * @private\n * @param {number} [time] Time in either ms or sec\n * @return {number} Time in seconds\n */\n private _toSec(time?: number): number\n {\n if (time > 10)\n {\n time /= 1000;\n }\n return time || 0;\n }\n\n /**\n * Start the update progress.\n * @name PIXI.sound.webaudio.WebAudioInstance#_enabled\n * @type {boolean}\n * @private\n */\n private set _enabled(enabled: boolean)\n {\n const script = this._media.nodes.script;\n\n script.removeEventListener(\"audioprocess\", this._updateListener);\n\n if (enabled)\n {\n script.addEventListener(\"audioprocess\", this._updateListener);\n }\n }\n\n /**\n * The current playback progress from 0 to 1.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioInstance#progress\n */\n public get progress(): number\n {\n return this._progress;\n }\n\n /**\n * Pauses the sound.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioInstance#paused\n */\n public get paused(): boolean\n {\n return this._paused;\n }\n\n public set paused(paused: boolean)\n {\n this._paused = paused;\n this.refreshPaused();\n }\n\n /**\n * Don't use after this.\n * @method PIXI.sound.webaudio.WebAudioInstance#destroy\n */\n public destroy(): void\n {\n this.removeAllListeners();\n this._internalStop();\n if (this._source)\n {\n this._source.disconnect();\n this._source = null;\n }\n if (this._gain)\n {\n this._gain.disconnect();\n this._gain = null;\n }\n if (this._media)\n {\n this._media.context.events.off(\"refresh\", this.refresh, this);\n this._media.context.events.off(\"refreshPaused\", this.refreshPaused, this);\n this._media = null;\n }\n this._end = null;\n this._speed = 1;\n this._volume = 1;\n this._loop = false;\n this._elapsed = 0;\n this._duration = 0;\n this._paused = false;\n this._muted = false;\n this._pausedReal = false;\n }\n\n /**\n * To string method for instance.\n * @method PIXI.sound.webaudio.WebAudioInstance#toString\n * @return {string} The string representation of instance.\n * @private\n */\n public toString(): string\n {\n return \"[WebAudioInstance id=\" + this.id + \"]\";\n }\n\n /**\n * Get the current time in seconds.\n * @method PIXI.sound.webaudio.WebAudioInstance#_now\n * @private\n * @return {number} Seconds since start of context\n */\n private _now(): number\n {\n return this._media.context.audioContext.currentTime;\n }\n\n /**\n * Internal update the progress.\n * @method PIXI.sound.webaudio.WebAudioInstance#_update\n * @private\n */\n private _update(force: boolean = false): void\n {\n if (this._source)\n {\n const now: number = this._now();\n const delta: number = now - this._lastUpdate;\n\n if (delta > 0 || force)\n {\n const speed: number = this._source.playbackRate.value;\n this._elapsed += delta * speed;\n this._lastUpdate = now;\n const duration: number = this._duration;\n let progress: number;\n if (this._source.loopStart)\n {\n const soundLength = this._source.loopEnd - this._source.loopStart;\n progress = (this._source.loopStart + this._elapsed % soundLength) / duration;\n }\n else\n {\n progress = (this._elapsed % duration) / duration;\n }\n\n // Update the progress\n this._progress = progress;\n\n /**\n * The sound progress is updated.\n * @event PIXI.sound.webaudio.WebAudioInstance#progress\n * @property {number} progress Amount progressed from 0 to 1\n * @property {number} duration The total playback in seconds\n */\n this.emit(\"progress\", this._progress, duration);\n }\n }\n }\n\n /**\n * Initializes the instance.\n * @method PIXI.sound.webaudio.WebAudioInstance#init\n */\n public init(media: WebAudioMedia): void\n {\n this._media = media;\n media.context.events.on(\"refresh\", this.refresh, this);\n media.context.events.on(\"refreshPaused\", this.refreshPaused, this);\n }\n\n /**\n * Stops the instance.\n * @method PIXI.sound.webaudio.WebAudioInstance#_internalStop\n * @private\n */\n private _internalStop(): void\n {\n if (this._source)\n {\n this._enabled = false;\n this._source.onended = null;\n this._source.stop(0); // param needed for iOS 8 bug\n this._source = null;\n }\n }\n\n /**\n * Callback when completed.\n * @method PIXI.sound.webaudio.WebAudioInstance#_onComplete\n * @private\n */\n private _onComplete(): void\n {\n if (this._source)\n {\n this._enabled = false;\n this._source.onended = null;\n }\n this._source = null;\n this._progress = 1;\n this.emit(\"progress\", 1, this._duration);\n /**\n * The sound ends, don't use after this\n * @event PIXI.sound.webaudio.WebAudioInstance#end\n */\n this.emit(\"end\", this);\n }\n}\n","import { Filterable } from \"../Filterable\";\nimport { Filter } from \"../filters/Filter\";\nimport { WebAudioContext } from \"./WebAudioContext\";\nimport { WebAudioUtils } from \"./WebAudioUtils\";\n\n/**\n * Output for cloneing node\n * @interface PIXI.sound.SoundNodes~SourceClone\n * @property {AudioBufferSourceNode} source Cloned audio buffer source\n * @property {GainNode} gain Independent volume control\n */\nexport interface SourceClone {\n source: AudioBufferSourceNode;\n gain: GainNode;\n}\n\n/**\n * @private\n * @class WebAudioNodes\n * @extends PIXI.sound.Filterable\n * @private\n * @memberof PIXI.sound.webaudio\n * @param {PIXI.sound.webaudio.WebAudioContext} audioContext The audio context.\n */\nexport class WebAudioNodes extends Filterable\n{\n /**\n * The buffer size for script processor\n * @name PIXI.sound.SoundNodes.BUFFER_SIZE\n * @type {number}\n * @default 256\n */\n public static BUFFER_SIZE: number = 256;\n\n /**\n * Get the buffer source node\n * @name PIXI.sound.SoundNodes#bufferSource\n * @type {AudioBufferSourceNode}\n * @readonly\n */\n public bufferSource: AudioBufferSourceNode;\n\n /**\n * Get the script processor node.\n * @name PIXI.sound.SoundNodes#script\n * @type {ScriptProcessorNode}\n * @readonly\n */\n public script: ScriptProcessorNode;\n\n /**\n * Get the gain node\n * @name PIXI.sound.SoundNodes#gain\n * @type {GainNode}\n * @readonly\n */\n public gain: GainNode;\n\n /**\n * Get the analyser node\n * @name PIXI.sound.SoundNodes#analyser\n * @type {AnalyserNode}\n * @readonly\n */\n public analyser: AnalyserNode;\n\n /**\n * Reference to the SoundContext\n * @name PIXI.sound.SoundNodes#context\n * @type {PIXI.sound.webaudio.WebAudioContext}\n * @readonly\n */\n public context: WebAudioContext;\n\n constructor(context: WebAudioContext)\n {\n const audioContext: AudioContext = context.audioContext;\n\n const bufferSource: AudioBufferSourceNode = audioContext.createBufferSource();\n const script: ScriptProcessorNode = audioContext.createScriptProcessor(WebAudioNodes.BUFFER_SIZE);\n const gain: GainNode = audioContext.createGain();\n const analyser: AnalyserNode = audioContext.createAnalyser();\n\n bufferSource.connect(analyser);\n analyser.connect(gain);\n gain.connect(context.destination);\n script.connect(context.destination);\n\n super(analyser, gain);\n\n this.context = context;\n this.bufferSource = bufferSource;\n this.script = script;\n this.gain = gain;\n this.analyser = analyser;\n }\n\n /**\n * Cleans up.\n * @method PIXI.sound.SoundNodes#destroy\n */\n public destroy(): void\n {\n super.destroy();\n\n this.bufferSource.disconnect();\n this.script.disconnect();\n this.gain.disconnect();\n this.analyser.disconnect();\n\n this.bufferSource = null;\n this.script = null;\n this.gain = null;\n this.analyser = null;\n\n this.context = null;\n }\n\n /**\n * Clones the bufferSource. Used just before playing a sound.\n * @method PIXI.sound.SoundNodes#cloneBufferSource\n * @returns {PIXI.sound.SoundNodes~SourceClone} The clone AudioBufferSourceNode.\n */\n public cloneBufferSource(): SourceClone\n {\n const orig: AudioBufferSourceNode = this.bufferSource;\n const source: AudioBufferSourceNode = this.context.audioContext.createBufferSource();\n source.buffer = orig.buffer;\n WebAudioUtils.setParamValue(source.playbackRate, orig.playbackRate.value);\n source.loop = orig.loop;\n\n const gain: GainNode = this.context.audioContext.createGain();\n source.connect(gain);\n gain.connect(this.destination);\n return { source, gain };\n }\n}\n","import * as path from \"path\";\nimport { Filter } from \"../filters\";\nimport { IMedia } from \"../interfaces\";\nimport { CompleteCallback, LoadedCallback, Options, PlayOptions, Sound } from \"../Sound\";\nimport { SoundSprite, SoundSpriteData, SoundSprites } from \"../sprites\";\nimport { WebAudioContext } from \"./WebAudioContext\";\nimport { WebAudioInstance } from \"./WebAudioInstance\";\nimport { WebAudioNodes } from \"./WebAudioNodes\";\n\n/**\n * Represents a single sound element. Can be used to play, pause, etc. sound instances.\n * @private\n * @class WebAudioMedia\n * @memberof PIXI.sound.webaudio\n * @param {PIXI.sound.Sound} parent - Instance of parent Sound container\n */\nexport class WebAudioMedia implements IMedia\n{\n /**\n * Reference to the parent Sound container.\n * @name PIXI.sound.webaudio.WebAudioMedia#parent\n * @type {PIXI.sound.Sound}\n * @readonly\n */\n public parent: Sound;\n\n /**\n * The file buffer to load.\n * @name PIXI.sound.webaudio.WebAudioMedia#source\n * @type {ArrayBuffer}\n * @readonly\n */\n public source: ArrayBuffer;\n\n /**\n * Instance of the chain builder.\n * @name PIXI.sound.webaudio.WebAudioMedia#_nodes\n * @type {PIXI.sound.webaudio.WebAudioNodes}\n * @private\n */\n private _nodes: WebAudioNodes;\n\n /**\n * Instance of the source node.\n * @name PIXI.sound.webaudio.WebAudioMedia#_source\n * @type {AudioBufferSourceNode}\n * @private\n */\n private _source: AudioBufferSourceNode;\n\n public init(parent: Sound): void\n {\n this.parent = parent;\n this._nodes = new WebAudioNodes(this.context);\n this._source = this._nodes.bufferSource;\n this.source = parent.options.source as ArrayBuffer;\n }\n\n /**\n * Destructor, safer to use `SoundLibrary.remove(alias)` to remove this sound.\n * @private\n * @method PIXI.sound.webaudio.WebAudioMedia#destroy\n */\n public destroy(): void\n {\n this.parent = null;\n this._nodes.destroy();\n this._nodes = null;\n this._source = null;\n this.source = null;\n }\n\n // Implement create\n public create(): WebAudioInstance\n {\n return new WebAudioInstance(this);\n }\n\n // Implement context\n public get context(): WebAudioContext\n {\n return this.parent.context as WebAudioContext;\n }\n\n // Implement isPlayable\n public get isPlayable(): boolean\n {\n return !!this._source && !!this._source.buffer;\n }\n\n // Implement filters\n public get filters(): Filter[]\n {\n return this._nodes.filters;\n }\n public set filters(filters: Filter[])\n {\n this._nodes.filters = filters;\n }\n\n // Implements duration\n public get duration(): number\n {\n console.assert(this.isPlayable, \"Sound not yet playable, no duration\");\n return this._source.buffer.duration;\n }\n\n /**\n * Gets and sets the buffer.\n * @name PIXI.sound.webaudio.WebAudioMedia#buffer\n * @type {AudioBuffer}\n */\n public get buffer(): AudioBuffer\n {\n return this._source.buffer;\n }\n public set buffer(buffer: AudioBuffer)\n {\n this._source.buffer = buffer;\n }\n\n /**\n * Get the current chained nodes object\n * @private\n * @name PIXI.sound.webaudio.WebAudioMedia#nodes\n * @type {PIXI.sound.webaudio.WebAudioNodes}\n */\n public get nodes(): WebAudioNodes\n {\n return this._nodes;\n }\n\n // Implements load\n public load(callback?: LoadedCallback): void\n {\n // Load from the arraybuffer, incase it was loaded outside\n if (this.source)\n {\n this._decode(this.source, callback);\n }\n // Load from the file path\n else if (this.parent.url)\n {\n this._loadUrl(callback);\n }\n else if (callback)\n {\n callback(new Error(\"sound.url or sound.source must be set\"));\n }\n else\n {\n console.error(\"sound.url or sound.source must be set\");\n }\n }\n\n /**\n * Loads a sound using XHMLHttpRequest object.\n * @method PIXI.sound.webaudio.WebAudioMedia#_loadUrl\n * @private\n */\n private _loadUrl(callback?: LoadedCallback): void\n {\n const request = new XMLHttpRequest();\n const url: string = this.parent.url;\n request.open(\"GET\", url, true);\n request.responseType = \"arraybuffer\";\n\n // Decode asynchronously\n request.onload = () => {\n this.source = request.response as ArrayBuffer;\n this._decode(request.response, callback);\n };\n\n // actually start the request\n request.send();\n }\n\n /**\n * Decodes the array buffer.\n * @method PIXI.sound.webaudio.WebAudioMedia#decode\n * @param {ArrayBuffer} arrayBuffer From load.\n * @private\n */\n private _decode(arrayBuffer: ArrayBuffer, callback?: LoadedCallback): void\n {\n const context = this.parent.context as WebAudioContext;\n context.decode(arrayBuffer, (err: Error, buffer: AudioBuffer) =>\n {\n if (err)\n {\n if (callback)\n {\n callback(err);\n }\n }\n else\n {\n this.parent.isLoaded = true;\n this.buffer = buffer;\n const instance = this.parent.autoPlayStart();\n if (callback)\n {\n callback(null, this.parent, instance);\n }\n }\n });\n }\n}\n","import { Filterable } from \"../Filterable\";\nimport { IMediaContext } from \"../interfaces\";\n\n/**\n * Main class to handle WebAudio API. There's a simple chain\n * of AudioNode elements: analyser > compressor > context.destination.\n * any filters that are added are inserted between the analyser and compressor nodes\n * @private\n * @class WebAudioContext\n * @extends PIXI.sound.Filterable\n * @memberof PIXI.sound.webaudio\n */\nexport class WebAudioContext extends Filterable implements IMediaContext\n{\n /**\n * Context Compressor node\n * @name PIXI.sound.webaudio.WebAudioContext#compressor\n * @type {DynamicsCompressorNode}\n * @readonly\n */\n public compressor: DynamicsCompressorNode;\n\n /**\n * Context Analyser node\n * @name PIXI.sound.webaudio.WebAudioContext#analyser\n * @type {AnalyserNode}\n * @readonly\n */\n public analyser: AnalyserNode;\n\n /**\n * Global speed of all sounds\n * @name PIXI.sound.webaudio.WebAudioContext#speed\n * @type {number}\n * @readonly\n */\n public speed: number;\n\n /**\n * Sets the muted state.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioContext#muted\n * @default false\n */\n public muted: boolean;\n\n /**\n * Sets the volume from 0 to 1.\n * @type {number}\n * @name PIXI.sound.webaudio.WebAudioContext#volume\n * @default 1\n */\n public volume: number;\n\n /**\n * Handle global events\n * @type {PIXI.utils.EventEmitter}\n * @name PIXI.sound.webaudio.WebAudioContext#events\n * @default 1\n */\n public events: PIXI.utils.EventEmitter;\n\n /**\n * The instance of the AudioContext for WebAudio API.\n * @name PIXI.sound.webaudio.WebAudioContext#_ctx\n * @type {AudioContext}\n * @private\n */\n private _ctx: AudioContext;\n\n /**\n * The instance of the OfflineAudioContext for fast decoding audio.\n * @name PIXI.sound.webaudio.WebAudioContext#_offlineCtx\n * @type {OfflineAudioContext}\n * @private\n */\n private _offlineCtx: OfflineAudioContext;\n\n /**\n * Current paused status\n * @name PIXI.sound.webaudio.WebAudioContext#_paused\n * @type {boolean}\n * @private\n * @default false\n */\n private _paused: boolean;\n\n /**\n * Indicated whether audio on iOS has been unlocked, which requires a touchend/mousedown event that plays an\n * empty sound.\n * @name PIXI.sound.webaudio.WebAudioContext#_unlocked\n * @type {boolean}\n * @private\n */\n private _unlocked: boolean;\n\n constructor()\n {\n const win: any = window as any;\n const ctx = new WebAudioContext.AudioContext();\n const compressor: DynamicsCompressorNode = ctx.createDynamicsCompressor();\n const analyser: AnalyserNode = ctx.createAnalyser();\n\n // setup the end of the node chain\n analyser.connect(compressor);\n compressor.connect(ctx.destination);\n\n super(analyser, compressor);\n\n this._ctx = ctx;\n // ios11 safari's webkitOfflineAudioContext allows only 44100 Hz sample rate\n this._offlineCtx = new WebAudioContext.OfflineAudioContext(1, 2,\n (win.OfflineAudioContext) ? ctx.sampleRate : 44100);\n this._unlocked = false;\n\n this.compressor = compressor;\n this.analyser = analyser;\n this.events = new PIXI.utils.EventEmitter();\n\n // Set the defaults\n this.volume = 1;\n this.speed = 1;\n this.muted = false;\n this.paused = false;\n\n // Listen for document level clicks to unlock WebAudio. See the _unlock method.\n if (ctx.state !== \"running\")\n {\n this._unlock(); // When played inside of a touch event, this will enable audio on iOS immediately.\n this._unlock = this._unlock.bind(this);\n document.addEventListener(\"mousedown\", this._unlock, true);\n document.addEventListener(\"touchstart\", this._unlock, true);\n document.addEventListener(\"touchend\", this._unlock, true);\n }\n }\n\n /**\n * Try to unlock audio on iOS. This is triggered from either WebAudio plugin setup (which will work if inside of\n * a `mousedown` or `touchend` event stack), or the first document touchend/mousedown event. If it fails (touchend\n * will fail if the user presses for too long, indicating a scroll event instead of a click event.\n *\n * Note that earlier versions of iOS supported `touchstart` for this, but iOS9 removed this functionality. Adding\n * a `touchstart` event to support older platforms may preclude a `mousedown` even from getting fired on iOS9, so we\n * stick with `mousedown` and `touchend`.\n * @method PIXI.sound.webaudio.WebAudioContext#_unlock\n * @private\n */\n private _unlock(): void\n {\n if (this._unlocked)\n {\n return;\n }\n this.playEmptySound();\n if (this._ctx.state === \"running\")\n {\n document.removeEventListener(\"mousedown\", this._unlock, true);\n document.removeEventListener(\"touchend\", this._unlock, true);\n document.removeEventListener(\"touchstart\", this._unlock, true);\n this._unlocked = true;\n }\n }\n\n /**\n * Plays an empty sound in the web audio context. This is used to enable web audio on iOS devices, as they\n * require the first sound to be played inside of a user initiated event (touch/click).\n * @method PIXI.sound.webaudio.WebAudioContext#playEmptySound\n */\n public playEmptySound(): void\n {\n const source = this._ctx.createBufferSource();\n source.buffer = this._ctx.createBuffer(1, 1, 22050);\n source.connect(this._ctx.destination);\n source.start(0, 0, 0);\n if (source.context.state === \"suspended\")\n {\n source.context.resume();\n }\n }\n\n /**\n * Get AudioContext class, if not supported returns `null`\n * @name PIXI.sound.webaudio.WebAudioContext.AudioContext\n * @type {Function}\n * @static\n */\n public static get AudioContext(): typeof AudioContext\n {\n const win: any = window as any;\n return (\n win.AudioContext ||\n win.webkitAudioContext ||\n null\n );\n }\n\n /**\n * Get OfflineAudioContext class, if not supported returns `null`\n * @name PIXI.sound.webaudio.WebAudioContext.OfflineAudioContext\n * @type {Function}\n * @static\n */\n public static get OfflineAudioContext(): typeof OfflineAudioContext\n {\n const win: any = window as any;\n return (\n win.OfflineAudioContext ||\n win.webkitOfflineAudioContext ||\n null\n );\n }\n\n /**\n * Destroy this context.\n * @method PIXI.sound.webaudio.WebAudioContext#destroy\n */\n public destroy()\n {\n super.destroy();\n\n const ctx: any = this._ctx as any;\n // check if browser supports AudioContext.close()\n if (typeof ctx.close !== \"undefined\")\n {\n ctx.close();\n }\n this.events.removeAllListeners();\n this.analyser.disconnect();\n this.compressor.disconnect();\n this.analyser = null;\n this.compressor = null;\n this.events = null;\n this._offlineCtx = null;\n this._ctx = null;\n }\n\n /**\n * The WebAudio API AudioContext object.\n * @name PIXI.sound.webaudio.WebAudioContext#audioContext\n * @type {AudioContext}\n * @readonly\n */\n public get audioContext(): AudioContext\n {\n return this._ctx;\n }\n\n /**\n * The WebAudio API OfflineAudioContext object.\n * @name PIXI.sound.webaudio.WebAudioContext#offlineContext\n * @type {OfflineAudioContext}\n * @readonly\n */\n public get offlineContext(): OfflineAudioContext\n {\n return this._offlineCtx;\n }\n\n /**\n * Pauses all sounds, even though we handle this at the instance\n * level, we'll also pause the audioContext so that the\n * time used to compute progress isn't messed up.\n * @type {boolean}\n * @name PIXI.sound.webaudio.WebAudioContext#paused\n * @default false\n */\n public set paused(paused: boolean)\n {\n if (paused && this._ctx.state === \"running\")\n {\n (this._ctx as any).suspend();\n }\n else if (!paused && this._ctx.state === \"suspended\")\n {\n (this._ctx as any).resume();\n }\n this._paused = paused;\n }\n public get paused(): boolean\n {\n return this._paused;\n }\n\n /**\n * Emit event when muted, volume or speed changes\n * @method PIXI.sound.webaudio.WebAudioContext#refresh\n * @private\n */\n public refresh(): void\n {\n this.events.emit(\"refresh\");\n }\n\n /**\n * Emit event when muted, volume or speed changes\n * @method PIXI.sound.webaudio.WebAudioContext#refreshPaused\n * @private\n */\n public refreshPaused(): void\n {\n this.events.emit(\"refreshPaused\");\n }\n\n /**\n * Toggles the muted state.\n * @method PIXI.sound.webaudio.WebAudioContext#toggleMute\n * @return {boolean} The current muted state.\n */\n public toggleMute(): boolean\n {\n this.muted = !this.muted;\n this.refresh();\n return this.muted;\n }\n\n /**\n * Toggles the paused state.\n * @method PIXI.sound.webaudio.WebAudioContext#togglePause\n * @return {boolean} The current muted state.\n */\n public togglePause(): boolean\n {\n this.paused = !this.paused;\n this.refreshPaused();\n return this._paused;\n }\n\n /**\n * Decode the audio data\n * @method PIXI.sound.webaudio.WebAudioContext#decode\n * @param {ArrayBuffer} arrayBuffer Buffer from loader\n * @param {Function} callback When completed, error and audioBuffer are parameters.\n */\n public decode(arrayBuffer: ArrayBuffer, callback: (err?: Error, buffer?: AudioBuffer) => void): void\n {\n this._offlineCtx.decodeAudioData(\n arrayBuffer, (buffer: AudioBuffer) => {\n callback(null, buffer);\n },\n (err) => {\n callback(new Error(err.message || \"Unable to decode file\"));\n },\n );\n }\n}\n","import { getInstance } from \"../instance\";\nimport { WebAudioUtils } from \"../webaudio\";\nimport { Filter } from \"./Filter\";\n\ninterface Band {\n f: number;\n type: string;\n gain: number;\n}\n\n/**\n * Filter for adding equalizer bands.\n *\n * @class EqualizerFilter\n * @memberof PIXI.sound.filters\n * @param {number} [f32=0] Default gain for 32 Hz\n * @param {number} [f64=0] Default gain for 64 Hz\n * @param {number} [f125=0] Default gain for 125 Hz\n * @param {number} [f250=0] Default gain for 250 Hz\n * @param {number} [f500=0] Default gain for 500 Hz\n * @param {number} [f1k=0] Default gain for 1000 Hz\n * @param {number} [f2k=0] Default gain for 2000 Hz\n * @param {number} [f4k=0] Default gain for 4000 Hz\n * @param {number} [f8k=0] Default gain for 8000 Hz\n * @param {number} [f16k=0] Default gain for 16000 Hz\n */\nexport class EqualizerFilter extends Filter\n{\n /**\n * Band at 32 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F32\n * @type {number}\n * @readonly\n */\n public static F32: number = 32;\n\n /**\n * Band at 64 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F64\n * @type {number}\n * @readonly\n */\n public static F64: number = 64;\n\n /**\n * Band at 125 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F125\n * @type {number}\n * @readonly\n */\n public static F125: number = 125;\n\n /**\n * Band at 250 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F250\n * @type {number}\n * @readonly\n */\n public static F250: number = 250;\n\n /**\n * Band at 500 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F500\n * @type {number}\n * @readonly\n */\n public static F500: number = 500;\n\n /**\n * Band at 1000 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F1K\n * @type {number}\n * @readonly\n */\n public static F1K: number = 1000;\n\n /**\n * Band at 2000 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F2K\n * @type {number}\n * @readonly\n */\n public static F2K: number = 2000;\n\n /**\n * Band at 4000 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F4K\n * @type {number}\n * @readonly\n */\n public static F4K: number = 4000;\n\n /**\n * Band at 8000 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F8K\n * @type {number}\n * @readonly\n */\n public static F8K: number = 8000;\n\n /**\n * Band at 16000 Hz\n * @name PIXI.sound.filters.EqualizerFilter.F16K\n * @type {number}\n * @readonly\n */\n public static F16K: number = 16000;\n\n /**\n * The list of bands\n * @name PIXI.sounds.filters.EqualizerFilter#bands\n * @type {BiquadFilterNode[]}\n * @readonly\n */\n public bands: BiquadFilterNode[];\n\n /**\n * The map of bands to frequency\n * @name PIXI.sounds.filters.EqualizerFilter#bandsMap\n * @type {Object}\n * @readonly\n */\n public bandsMap: {[id: number]: BiquadFilterNode};\n\n constructor(f32: number = 0, f64: number = 0, f125: number = 0, f250: number = 0, f500: number = 0,\n f1k: number = 0, f2k: number = 0, f4k: number = 0, f8k: number = 0, f16k: number = 0)\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n\n const equalizerBands: Band[] = [\n {\n f: EqualizerFilter.F32,\n type: \"lowshelf\",\n gain: f32,\n },\n {\n f: EqualizerFilter.F64,\n type: \"peaking\",\n gain: f64,\n },\n {\n f: EqualizerFilter.F125,\n type: \"peaking\",\n gain: f125,\n },\n {\n f: EqualizerFilter.F250,\n type: \"peaking\",\n gain: f250,\n },\n {\n f: EqualizerFilter.F500,\n type: \"peaking\",\n gain: f500,\n },\n {\n f: EqualizerFilter.F1K,\n type: \"peaking\",\n gain: f1k,\n },\n {\n f: EqualizerFilter.F2K,\n type: \"peaking\",\n gain: f2k,\n },\n {\n f: EqualizerFilter.F4K,\n type: \"peaking\",\n gain: f4k,\n },\n {\n f: EqualizerFilter.F8K,\n type: \"peaking\",\n gain: f8k,\n },\n {\n f: EqualizerFilter.F16K,\n type: \"highshelf\",\n gain: f16k,\n },\n ];\n\n const bands: BiquadFilterNode[] = equalizerBands.map((band: Band) =>\n {\n const node: BiquadFilterNode = getInstance().context.audioContext.createBiquadFilter();\n node.type = band.type as BiquadFilterType;\n WebAudioUtils.setParamValue(node.Q, 1);\n node.frequency.value = band.f; // WebAudioUtils.setParamValue(filter.frequency, band.f);\n WebAudioUtils.setParamValue(node.gain, band.gain);\n return node;\n });\n\n // Setup the constructor AudioNode, where first is the input, and last is the output\n super(bands[0], bands[bands.length - 1]);\n\n // Manipulate the bands\n this.bands = bands;\n\n // Create a map\n this.bandsMap = {};\n\n for (let i = 0; i < this.bands.length; i++)\n {\n const node: BiquadFilterNode = this.bands[i];\n\n // Connect the previous band to the current one\n if (i > 0)\n {\n this.bands[i - 1].connect(node);\n }\n this.bandsMap[node.frequency.value] = node;\n }\n }\n\n /**\n * Set gain on a specific frequency.\n * @method PIXI.sound.filters.EqualizerFilter#setGain\n * @param {number} frequency The frequency, see EqualizerFilter.F* for bands\n * @param {number} [gain=0] Recommended -40 to 40.\n */\n public setGain(frequency: number, gain: number = 0): void\n {\n if (!this.bandsMap[frequency])\n {\n throw new Error(\"No band found for frequency \" + frequency);\n }\n WebAudioUtils.setParamValue(this.bandsMap[frequency].gain, gain);\n }\n\n /**\n * Get gain amount on a specific frequency.\n * @method PIXI.sound.filters.EqualizerFilter#getGain\n * @return {number} The amount of gain set.\n */\n public getGain(frequency: number): number\n {\n if (!this.bandsMap[frequency])\n {\n throw new Error(\"No band found for frequency \" + frequency);\n }\n return this.bandsMap[frequency].gain.value;\n }\n\n /**\n * Gain at 32 Hz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f32\n * @type {number}\n * @default 0\n */\n public set f32(value: number)\n {\n this.setGain(EqualizerFilter.F32, value);\n }\n public get f32(): number\n {\n return this.getGain(EqualizerFilter.F32);\n }\n\n /**\n * Gain at 64 Hz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f64\n * @type {number}\n * @default 0\n */\n public set f64(value: number)\n {\n this.setGain(EqualizerFilter.F64, value);\n }\n public get f64(): number\n {\n return this.getGain(EqualizerFilter.F64);\n }\n\n /**\n * Gain at 125 Hz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f125\n * @type {number}\n * @default 0\n */\n public set f125(value: number)\n {\n this.setGain(EqualizerFilter.F125, value);\n }\n public get f125(): number\n {\n return this.getGain(EqualizerFilter.F125);\n }\n\n /**\n * Gain at 250 Hz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f250\n * @type {number}\n * @default 0\n */\n public set f250(value: number)\n {\n this.setGain(EqualizerFilter.F250, value);\n }\n public get f250(): number\n {\n return this.getGain(EqualizerFilter.F250);\n }\n\n /**\n * Gain at 500 Hz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f500\n * @type {number}\n * @default 0\n */\n public set f500(value: number)\n {\n this.setGain(EqualizerFilter.F500, value);\n }\n public get f500(): number\n {\n return this.getGain(EqualizerFilter.F500);\n }\n\n /**\n * Gain at 1 KHz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f1k\n * @type {number}\n * @default 0\n */\n public set f1k(value: number)\n {\n this.setGain(EqualizerFilter.F1K, value);\n }\n public get f1k(): number\n {\n return this.getGain(EqualizerFilter.F1K);\n }\n\n /**\n * Gain at 2 KHz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f2k\n * @type {number}\n * @default 0\n */\n public set f2k(value: number)\n {\n this.setGain(EqualizerFilter.F2K, value);\n }\n public get f2k(): number\n {\n return this.getGain(EqualizerFilter.F2K);\n }\n\n /**\n * Gain at 4 KHz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f4k\n * @type {number}\n * @default 0\n */\n public set f4k(value: number)\n {\n this.setGain(EqualizerFilter.F4K, value);\n }\n public get f4k(): number\n {\n return this.getGain(EqualizerFilter.F4K);\n }\n\n /**\n * Gain at 8 KHz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f8k\n * @type {number}\n * @default 0\n */\n public set f8k(value: number)\n {\n this.setGain(EqualizerFilter.F8K, value);\n }\n public get f8k(): number\n {\n return this.getGain(EqualizerFilter.F8K);\n }\n\n /**\n * Gain at 16 KHz frequencey.\n * @name PIXI.sound.filters.EqualizerFilter#f16k\n * @type {number}\n * @default 0\n */\n public set f16k(value: number)\n {\n this.setGain(EqualizerFilter.F16K, value);\n }\n public get f16k(): number\n {\n return this.getGain(EqualizerFilter.F16K);\n }\n\n /**\n * Reset all frequency bands to have gain of 0\n * @method PIXI.sound.filters.EqualizerFilter#reset\n */\n public reset(): void\n {\n this.bands.forEach((band: BiquadFilterNode) => {\n WebAudioUtils.setParamValue(band.gain, 0);\n });\n }\n\n public destroy(): void\n {\n this.bands.forEach((band: BiquadFilterNode) => {\n band.disconnect();\n });\n this.bands = null;\n this.bandsMap = null;\n }\n}\n","import { getInstance } from \"../instance\";\nimport { Filter } from \"./Filter\";\n\n/**\n * Filter for adding adding delaynode.\n *\n * @class DistortionFilter\n * @memberof PIXI.sound.filters\n * @param {number} [amount=0] The amount of distoration from 0 to 1.\n */\nexport class DistortionFilter extends Filter\n{\n /**\n * The Wave shape node use to distort\n * @name PIXI.sound.filters.DistortionFilter#_distortion\n * @type {WaveShaperNode}\n * @private\n */\n private _distortion: WaveShaperNode;\n\n /**\n * The amount of distoration\n * @name PIXI.sound.filters.DistortionFilter#_amount\n * @type {number}\n * @private\n */\n private _amount: number;\n\n constructor(amount: number = 0)\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n\n const {context} = getInstance();\n const distortion: WaveShaperNode = context.audioContext.createWaveShaper();\n\n super(distortion);\n\n this._distortion = distortion;\n\n this.amount = amount;\n }\n\n /**\n * @name PIXI.sound.filters.Distoration#amount\n * @type {number}\n */\n set amount(value: number)\n {\n value *= 1000;\n this._amount = value;\n const samples: number = 44100;\n const curve: Float32Array = new Float32Array(samples);\n const deg: number = Math.PI / 180;\n\n let i: number = 0;\n let x: number;\n\n for (; i < samples; ++i)\n {\n x = i * 2 / samples - 1;\n curve[i] = (3 + value) * x * 20 * deg / (Math.PI + value * Math.abs(x));\n }\n this._distortion.curve = curve;\n this._distortion.oversample = \"4x\";\n }\n get amount(): number\n {\n return this._amount;\n }\n\n public destroy(): void\n {\n this._distortion = null;\n super.destroy();\n }\n}\n","import { getInstance } from \"../instance\";\nimport { WebAudioUtils } from \"../webaudio\";\nimport { Filter } from \"./Filter\";\n\n/**\n * Filter for adding Stereo panning.\n *\n * @class StereoFilter\n * @memberof PIXI.sound.filters\n * @param {number} [pan=0] The amount of panning, -1 is left, 1 is right, 0 is centered.\n */\nexport class StereoFilter extends Filter\n{\n /**\n * The stereo panning node\n * @name PIXI.sound.filters.StereoFilter#_stereo\n * @type {StereoPannerNode}\n * @private\n */\n private _stereo: StereoPannerNode;\n\n /**\n * The stereo panning node\n * @name PIXI.sound.filters.StereoFilter#_panner\n * @type {PannerNode}\n * @private\n */\n private _panner: PannerNode;\n\n /**\n * The amount of panning, -1 is left, 1 is right, 0 is centered\n * @name PIXI.sound.filters.StereoFilter#_pan\n * @type {number}\n * @private\n */\n private _pan: number;\n\n constructor(pan: number = 0)\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n\n let stereo: StereoPannerNode;\n let panner: PannerNode;\n let destination: AudioNode;\n const {audioContext} = getInstance().context;\n\n if (audioContext.createStereoPanner)\n {\n stereo = audioContext.createStereoPanner();\n destination = stereo;\n }\n else\n {\n panner = audioContext.createPanner();\n panner.panningModel = \"equalpower\";\n destination = panner;\n }\n\n super(destination);\n\n this._stereo = stereo;\n this._panner = panner;\n\n this.pan = pan;\n }\n\n /**\n * Set the amount of panning, where -1 is left, 1 is right, and 0 is centered\n * @name PIXI.sound.filters.StereoFilter#pan\n * @type {number}\n */\n set pan(value: number)\n {\n this._pan = value;\n if (this._stereo)\n {\n WebAudioUtils.setParamValue(this._stereo.pan, value);\n }\n else\n {\n this._panner.setPosition(value, 0, 1 - Math.abs(value));\n }\n }\n get pan(): number\n {\n return this._pan;\n }\n\n public destroy(): void\n {\n super.destroy();\n this._stereo = null;\n this._panner = null;\n }\n}\n","import { getInstance } from \"../instance\";\nimport { Filter } from \"./Filter\";\n\n/**\n * Filter for adding reverb. Refactored from\n * https://github.com/web-audio-components/simple-reverb/\n *\n * @class ReverbFilter\n * @memberof PIXI.sound.filters\n * @param {number} [seconds=3] Seconds for reverb\n * @param {number} [decay=2] The decay length\n * @param {boolean} [reverse=false] Reverse reverb\n */\nexport class ReverbFilter extends Filter\n{\n /**\n * @name PIXI.sound.filters.ReverbFilter#_seconds\n * @type {number}\n * @private\n */\n private _seconds: number;\n\n /**\n * @name PIXI.sound.filters.ReverbFilter#_decay\n * @type {number}\n * @private\n */\n private _decay: number;\n\n /**\n * @name PIXI.sound.filters.ReverbFilter#_reverse\n * @type {number}\n * @private\n */\n private _reverse: boolean;\n\n constructor(seconds: number = 3, decay: number = 2, reverse: boolean = false)\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n\n super(null);\n\n this._seconds = this._clamp(seconds, 1, 50);\n this._decay = this._clamp(decay, 0, 100);\n this._reverse = reverse;\n this._rebuild();\n }\n\n /**\n * Clamp a value\n * @method PIXI.sound.filters.ReverbFilter#_clamp\n * @private\n * @param {number} value\n * @param {number} min Minimum value\n * @param {number} max Maximum value\n * @return {number} Clamped number\n */\n private _clamp(value: number, min: number, max: number): number\n {\n return Math.min(max, Math.max(min, value));\n }\n\n /**\n * Length of reverb in seconds from 1 to 50\n * @name PIXI.sound.filters.ReverbFilter#decay\n * @type {number}\n * @default 3\n */\n get seconds(): number\n {\n return this._seconds;\n }\n set seconds(seconds: number)\n {\n this._seconds = this._clamp(seconds, 1, 50);\n this._rebuild();\n }\n\n /**\n * Decay value from 0 to 100\n * @name PIXI.sound.filters.ReverbFilter#decay\n * @type {number}\n * @default 2\n */\n get decay(): number\n {\n return this._decay;\n }\n set decay(decay: number)\n {\n this._decay = this._clamp(decay, 0, 100);\n this._rebuild();\n }\n\n /**\n * Reverse value from 0 to 1\n * @name PIXI.sound.filters.ReverbFilter#reverse\n * @type {boolean}\n * @default false\n */\n get reverse(): boolean\n {\n return this._reverse;\n }\n set reverse(reverse: boolean)\n {\n this._reverse = reverse;\n this._rebuild();\n }\n\n /**\n * Utility function for building an impulse response\n * from the module parameters.\n * @method PIXI.sound.filters.ReverbFilter#_rebuild\n * @private\n */\n private _rebuild(): void\n {\n const context = getInstance().context.audioContext;\n const rate: number = context.sampleRate;\n const length: number = rate * this._seconds;\n const impulse: AudioBuffer = context.createBuffer(2, length, rate);\n const impulseL: Float32Array = impulse.getChannelData(0);\n const impulseR: Float32Array = impulse.getChannelData(1);\n let n: number;\n\n for (let i: number = 0; i < length; i++)\n {\n n = this._reverse ? length - i : i;\n impulseL[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, this._decay);\n impulseR[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, this._decay);\n }\n const convolver = getInstance().context.audioContext.createConvolver();\n convolver.buffer = impulse;\n this.init(convolver);\n }\n}\n","import { getInstance } from \"../instance\";\nimport { Filter } from \"./Filter\";\n\n/**\n * Combine all channels into mono channel.\n *\n * @class MonoFilter\n * @memberof PIXI.sound.filters\n */\nexport class MonoFilter extends Filter\n{\n /**\n * Merger node\n * @name PIXI.sound.filters.MonoFilter#_merge\n * @type {ChannelMergerNode}\n * @private\n */\n private _merger: ChannelMergerNode;\n\n constructor()\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n const audioContext: AudioContext = getInstance().context.audioContext;\n const splitter: ChannelSplitterNode = audioContext.createChannelSplitter();\n const merger: ChannelMergerNode = audioContext.createChannelMerger();\n merger.connect(splitter);\n super(merger, splitter);\n this._merger = merger;\n }\n\n public destroy(): void\n {\n this._merger.disconnect();\n this._merger = null;\n super.destroy();\n }\n}\n","import { getInstance } from \"../instance\";\nimport { WebAudioUtils } from \"../webaudio\";\nimport { Filter } from \"./Filter\";\n\n/**\n * Creates a telephone-sound filter.\n *\n * @class TelephoneFilter\n * @memberof PIXI.sound.filters\n */\nexport class TelephoneFilter extends Filter\n{\n constructor()\n {\n if (getInstance().useLegacy)\n {\n super(null);\n return;\n }\n\n const {audioContext} = getInstance().context;\n const lpf1 = audioContext.createBiquadFilter();\n const lpf2 = audioContext.createBiquadFilter();\n const hpf1 = audioContext.createBiquadFilter();\n const hpf2 = audioContext.createBiquadFilter();\n\n lpf1.type = \"lowpass\";\n WebAudioUtils.setParamValue(lpf1.frequency, 2000.0);\n\n lpf2.type = \"lowpass\";\n WebAudioUtils.setParamValue(lpf2.frequency, 2000.0);\n\n hpf1.type = \"highpass\";\n WebAudioUtils.setParamValue(hpf1.frequency, 500.0);\n\n hpf2.type = \"highpass\";\n WebAudioUtils.setParamValue(hpf2.frequency, 500.0);\n\n lpf1.connect(lpf2);\n lpf2.connect(hpf1);\n hpf1.connect(hpf2);\n\n super(lpf1, hpf2);\n }\n}\n","import { IMediaInstance } from \"../interfaces/IMediaInstance\";\nimport { PlayOptions } from \"../Sound\";\nimport { HTMLAudioMedia } from \"./HTMLAudioMedia\";\n\nlet id = 0;\n\n/**\n * Instance which wraps the `<audio>` element playback.\n * @private\n * @class HTMLAudioInstance\n * @memberof PIXI.sound.htmlaudio\n */\nexport class HTMLAudioInstance extends PIXI.utils.EventEmitter implements IMediaInstance\n{\n /**\n * Extra padding, in seconds, to deal with low-latecy of HTMLAudio.\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance.PADDING\n * @readonly\n * @default 0.1\n */\n public static PADDING: number = 0.1;\n\n /**\n * The current unique ID for this instance.\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#id\n * @readonly\n */\n public id: number;\n\n /**\n * The instance of the Audio element.\n * @type {HTMLAudioElement}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_source\n * @private\n */\n private _source: HTMLAudioElement;\n\n /**\n * The instance of the Audio media element.\n * @type {PIXI.sound.htmlaudio.HTMLAudioMedia}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_media\n * @private\n */\n private _media: HTMLAudioMedia;\n\n /**\n * Playback rate, where 1 is 100%.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_end\n * @private\n */\n private _end: number;\n\n /**\n * Current instance paused state.\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_paused\n * @private\n */\n private _paused: boolean;\n\n /**\n * Current instance muted state.\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_muted\n * @private\n */\n private _muted: boolean;\n\n /**\n * Current actual paused state.\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_pausedReal\n * @private\n */\n private _pausedReal: boolean;\n\n /**\n * Total length of the audio.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_duration\n * @private\n */\n private _duration: number;\n\n /**\n * Playback rate, where 1 is 100%.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_start\n * @private\n */\n private _start: number;\n\n /**\n * `true` if the audio is actually playing.\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_playing\n * @private\n */\n private _playing: boolean;\n\n /**\n * Volume for the instance.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_volume\n * @private\n */\n private _volume: number;\n\n /**\n * Speed for the instance.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_speed\n * @private\n */\n private _speed: number;\n\n /**\n * `true` for looping the playback\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#_loop\n * @private\n */\n private _loop: boolean;\n\n constructor(parent: HTMLAudioMedia)\n {\n super();\n\n this.id = id++;\n\n this.init(parent);\n }\n\n /**\n * The current playback progress from 0 to 1.\n * @type {number}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#progress\n */\n public get progress(): number\n {\n const {currentTime} = this._source;\n return currentTime / this._duration;\n }\n\n /**\n * Pauses the sound.\n * @type {boolean}\n * @name PIXI.sound.htmlaudio.HTMLAudioInstance#paused\n */\n public get paused(): boolean\n {\n return this._paused;\n }\n public set paused(paused: boolean)\n {\n this._paused = paused;\n this.refreshPaused();\n }\n\n /**\n * Reference: http://stackoverflow.com/a/40370077\n */\n private _onPlay(): void\n {\n this._playing = true;\n }\n\n /**\n * Reference: http://stackoverflow.com/a/40370077\n */\n private _onPause(): void\n {\n this._playing = false;\n }\n\n /**\n * Initialize the instance.\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#init\n * @param {PIXI.sound.htmlaudio.HTMLAudioMedia} media\n */\n public init(media: HTMLAudioMedia): void\n {\n this._playing = false;\n this._duration = media.source.duration;\n const source = this._source = media.source.cloneNode(false) as HTMLAudioElement;\n source.src = media.parent.url;\n source.onplay = this._onPlay.bind(this);\n source.onpause = this._onPause.bind(this);\n media.context.on(\"refresh\", this.refresh, this);\n media.context.on(\"refreshPaused\", this.refreshPaused, this);\n this._media = media;\n }\n\n /**\n * Stop the sound playing\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#_internalStop\n * @private\n */\n private _internalStop(): void\n {\n if (this._source && this._playing)\n {\n this._source.onended = null;\n this._source.pause();\n }\n }\n\n /**\n * Stop the sound playing\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#stop\n */\n public stop(): void\n {\n this._internalStop();\n\n if (this._source)\n {\n this.emit(\"stop\");\n }\n }\n\n /**\n * Set the instance speed from 0 to 1\n * @member {number} PIXI.sound.htmlaudio.HTMLAudioInstance#speed\n */\n public get speed(): number\n {\n return this._speed;\n }\n public set speed(speed: number)\n {\n this._speed = speed;\n this.refresh();\n }\n\n /**\n * Get the set the volume for this instance from 0 to 1\n * @member {number} PIXI.sound.htmlaudio.HTMLAudioInstance#volume\n */\n public get volume(): number\n {\n return this._volume;\n }\n public set volume(volume: number)\n {\n this._volume = volume;\n this.refresh();\n }\n\n /**\n * If the sound instance should loop playback\n * @member {boolean} PIXI.sound.htmlaudio.HTMLAudioInstance#loop\n */\n public get loop(): boolean\n {\n return this._loop;\n }\n public set loop(loop: boolean)\n {\n this._loop = loop;\n this.refresh();\n }\n\n /**\n * `true` if the sound is muted\n * @member {boolean} PIXI.sound.htmlaudio.HTMLAudioInstance#muted\n */\n public get muted(): boolean\n {\n return this._muted;\n }\n public set muted(muted: boolean)\n {\n this._muted = muted;\n this.refresh();\n }\n\n /**\n * Call whenever the loop, speed or volume changes\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#refresh\n */\n public refresh(): void\n {\n const global = this._media.context;\n const sound = this._media.parent;\n\n // Update the looping\n this._source.loop = this._loop || sound.loop;\n\n // Update the volume\n const globalVolume = global.volume * (global.muted ? 0 : 1);\n const soundVolume = sound.volume * (sound.muted ? 0 : 1);\n const instanceVolume = this._volume * (this._muted ? 0 : 1);\n this._source.volume = instanceVolume * globalVolume * soundVolume;\n\n // Update the speed\n this._source.playbackRate = this._speed * global.speed * sound.speed;\n }\n\n /**\n * Handle changes in paused state, either globally or sound or instance\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#refreshPaused\n */\n public refreshPaused(): void\n {\n const global = this._media.context;\n const sound = this._media.parent;\n\n // Handle the paused state\n const pausedReal = this._paused || sound.paused || global.paused;\n\n if (pausedReal !== this._pausedReal)\n {\n this._pausedReal = pausedReal;\n\n if (pausedReal)\n {\n this._internalStop();\n\n /**\n * The sound is paused.\n * @event PIXI.sound.htmlaudio.HTMLAudioInstance#paused\n */\n this.emit(\"paused\");\n }\n else\n {\n /**\n * The sound is unpaused.\n * @event PIXI.sound.htmlaudio.HTMLAudioInstance#resumed\n */\n this.emit(\"resumed\");\n\n // resume the playing with offset\n this.play({\n start: this._source.currentTime,\n end: this._end,\n volume: this._volume,\n speed: this._speed,\n loop: this._loop,\n });\n }\n\n /**\n * The sound is paused or unpaused.\n * @event PIXI.sound.htmlaudio.HTMLAudioInstance#pause\n * @property {boolean} paused If the instance was paused or not.\n */\n this.emit(\"pause\", pausedReal);\n }\n }\n\n /**\n * Start playing the sound/\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#play\n */\n public play(options: PlayOptions): void\n {\n const {start, end, speed, loop, volume, muted} = options;\n\n if (end)\n {\n console.assert(end > start, \"End time is before start time\");\n }\n\n this._speed = speed;\n this._volume = volume;\n this._loop = !!loop;\n this._muted = muted;\n this.refresh();\n\n // WebAudio doesn't support looping when a duration is set\n // we'll set this just for the heck of it\n if (this.loop && end !== null)\n {\n console.warn('Looping not support when specifying an \"end\" time');\n this.loop = false;\n }\n\n this._start = start;\n this._end = end || this._duration;\n\n // Lets expand the start and end a little\n // to deal with the low-latecy of playing audio this way\n // this is a little fudge-factor\n this._start = Math.max(0, this._start - HTMLAudioInstance.PADDING);\n this._end = Math.min(this._end + HTMLAudioInstance.PADDING, this._duration);\n\n this._source.onloadedmetadata = () => {\n if (this._source)\n {\n this._source.currentTime = start;\n this._source.onloadedmetadata = null;\n this.emit(\"progress\", start, this._duration);\n PIXI.ticker.shared.add(this._onUpdate, this);\n }\n };\n this._source.onended = this._onComplete.bind(this);\n this._source.play();\n\n /**\n * The sound is started.\n * @event PIXI.sound.htmlaudio.HTMLAudioInstance#start\n */\n this.emit(\"start\");\n }\n\n /**\n * Handle time update on sound.\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#_onUpdate\n * @private\n */\n private _onUpdate(): void\n {\n this.emit(\"progress\", this.progress, this._duration);\n if (this._source.currentTime >= this._end && !this._source.loop)\n {\n this._onComplete();\n }\n }\n\n /**\n * Callback when completed.\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#_onComplete\n * @private\n */\n private _onComplete(): void\n {\n PIXI.ticker.shared.remove(this._onUpdate, this);\n this._internalStop();\n this.emit(\"progress\", 1, this._duration);\n /**\n * The sound ends, don't use after this\n * @event PIXI.sound.htmlaudio.HTMLAudioInstance#end\n */\n this.emit(\"end\", this);\n }\n\n /**\n * Don't use after this.\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#destroy\n */\n public destroy(): void\n {\n PIXI.ticker.shared.remove(this._onUpdate, this);\n this.removeAllListeners();\n\n const source = this._source;\n\n if (source)\n {\n // Remove the listeners\n source.onended = null;\n source.onplay = null;\n source.onpause = null;\n\n this._internalStop();\n }\n\n this._source = null;\n this._speed = 1;\n this._volume = 1;\n this._loop = false;\n this._end = null;\n this._start = 0;\n this._duration = 0;\n this._playing = false;\n this._pausedReal = false;\n this._paused = false;\n this._muted = false;\n\n if (this._media)\n {\n this._media.context.off(\"refresh\", this.refresh, this);\n this._media.context.off(\"refreshPaused\", this.refreshPaused, this);\n this._media = null;\n }\n }\n\n /**\n * To string method for instance.\n * @method PIXI.sound.htmlaudio.HTMLAudioInstance#toString\n * @return {String} The string representation of instance.\n * @private\n */\n public toString(): string\n {\n return \"[HTMLAudioInstance id=\" + this.id + \"]\";\n }\n}\n","import { Filter } from \"../filters/Filter\";\nimport { IMedia } from \"../interfaces/IMedia\";\nimport { CompleteCallback, LoadedCallback, Options, PlayOptions, Sound } from \"../Sound\";\nimport { SoundSpriteData, SoundSprites } from \"../sprites\";\nimport { HTMLAudioContext } from \"./HTMLAudioContext\";\nimport { HTMLAudioInstance } from \"./HTMLAudioInstance\";\n\n/**\n * The fallback version of Sound which uses `<audio>` instead of WebAudio API.\n * @private\n * @class HTMLAudioMedia\n * @memberof PIXI.sound.htmlaudio\n * @param {HTMLAudioElement|String|Object} options Either the path or url to the source file.\n * or the object of options to use. See {@link PIXI.sound.Sound.from}\n */\nexport class HTMLAudioMedia extends PIXI.utils.EventEmitter implements IMedia\n{\n public parent: Sound;\n private _source: HTMLAudioElement;\n\n public init(parent: Sound): void\n {\n this.parent = parent;\n this._source = parent.options.source as HTMLAudioElement || new Audio();\n if (parent.url)\n {\n this._source.src = parent.url;\n }\n }\n\n // Implement create\n public create(): HTMLAudioInstance\n {\n return new HTMLAudioInstance(this);\n }\n\n // Implement isPlayable\n public get isPlayable(): boolean\n {\n return !!this._source && this._source.readyState === 4;\n }\n\n // Implement duration\n public get duration(): number\n {\n return this._source.duration;\n }\n\n // Implement context\n public get context(): HTMLAudioContext\n {\n return this.parent.context as HTMLAudioContext;\n }\n\n // Implement filters\n public get filters(): Filter[]\n {\n return null;\n }\n public set filters(filters: Filter[])\n {\n console.warn(\"HTML Audio does not support filters\");\n }\n\n // Override the destroy\n public destroy(): void\n {\n this.removeAllListeners();\n\n this.parent = null;\n\n if (this._source)\n {\n this._source.src = \"\";\n this._source.load();\n this._source = null;\n }\n }\n\n /**\n * Get the audio source element.\n * @name PIXI.sound.legacy.LegacySound#source\n * @type {HTMLAudioElement}\n * @readonly\n */\n public get source(): HTMLAudioElement\n {\n return this._source;\n }\n\n // Implement the method to being preloading\n public load(callback?: LoadedCallback): void\n {\n const source = this._source;\n const sound = this.parent;\n\n // See if the source is already loaded\n if (source.readyState === 4)\n {\n sound.isLoaded = true;\n const instance = sound.autoPlayStart();\n if (callback)\n {\n setTimeout(() =>\n {\n callback(null, sound, instance);\n }, 0);\n }\n return;\n }\n\n // If there's no source, we cannot load\n if (!sound.url)\n {\n return callback(new Error(\"sound.url or sound.source must be set\"));\n }\n\n // Set the source\n source.src = sound.url;\n\n // Remove all event listeners\n const removeListeners = () =>\n {\n // Listen for callback\n source.removeEventListener(\"canplaythrough\", onLoad);\n source.removeEventListener(\"load\", onLoad);\n source.removeEventListener(\"abort\", onAbort);\n source.removeEventListener(\"error\", onError);\n };\n\n const onLoad = () =>\n {\n removeListeners();\n sound.isLoaded = true;\n const instance = sound.autoPlayStart();\n if (callback)\n {\n callback(null, sound, instance);\n }\n };\n\n const onAbort = () =>\n {\n removeListeners();\n if (callback)\n {\n callback(new Error(\"Sound loading has been aborted\"));\n }\n };\n\n const onError = () =>\n {\n removeListeners();\n const message = `Failed to load audio element (code: ${source.error.code})`;\n if (callback)\n {\n callback(new Error(message));\n }\n else\n {\n console.error(message);\n }\n };\n\n // Listen for callback\n source.addEventListener(\"canplaythrough\", onLoad, false);\n source.addEventListener(\"load\", onLoad, false);\n source.addEventListener(\"abort\", onAbort, false);\n source.addEventListener(\"error\", onError, false);\n\n // Begin the loading\n source.load();\n }\n}\n","import { Filter } from \"../filters/Filter\";\nimport { IMediaContext } from \"../interfaces/IMediaContext\";\n\n/**\n * The fallback version of WebAudioContext which uses `<audio>` instead of WebAudio API.\n * @private\n * @class HTMLAudioContext\n * @extends PIXI.util.EventEmitter\n * @memberof PIXI.sound.htmlaudio\n */\nexport class HTMLAudioContext extends PIXI.utils.EventEmitter implements IMediaContext\n{\n /**\n * Current global speed from 0 to 1\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#speed\n * @type {number}\n * @default 1\n */\n public speed: number;\n\n /**\n * Current muted status of the context\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#muted\n * @type {boolean}\n * @default false\n */\n public muted: boolean;\n\n /**\n * Current volume from 0 to 1\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#volume\n * @type {number}\n * @default 1\n */\n public volume: number;\n\n /**\n * Current paused status\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#paused\n * @type {boolean}\n * @default false\n */\n public paused: boolean;\n\n constructor()\n {\n super();\n\n this.speed = 1;\n this.volume = 1;\n this.muted = false;\n this.paused = false;\n }\n\n /**\n * Internal trigger when volume, mute or speed changes\n * @method PIXI.sound.htmlaudio.HTMLAudioContext#refresh\n * @private\n */\n public refresh(): void\n {\n this.emit(\"refresh\");\n }\n\n /**\n * Internal trigger paused changes\n * @method PIXI.sound.htmlaudio.HTMLAudioContext#refreshPaused\n * @private\n */\n public refreshPaused(): void\n {\n this.emit(\"refreshPaused\");\n }\n\n /**\n * HTML Audio does not support filters, this is non-functional API.\n * @type {Array<PIXI.sound.filters.Filter>}\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#filters\n * @default null\n */\n public get filters(): Filter[]\n {\n console.warn(\"HTML Audio does not support filters\");\n return null;\n }\n public set filters(filters: Filter[])\n {\n console.warn(\"HTML Audio does not support filters\");\n }\n\n /**\n * HTML Audio does not support `audioContext`\n * @type {null}\n * @name PIXI.sound.htmlaudio.HTMLAudioContext#audioContext\n * @default null\n * @readonly\n */\n public get audioContext(): AudioContext\n {\n console.warn(\"HTML Audio does not support audioContext\");\n return null;\n }\n\n /**\n * Toggles the muted state.\n * @method PIXI.sound.htmlaudio.HTMLAudioContext#toggleMute\n * @return {boolean} The current muted state.\n */\n public toggleMute(): boolean\n {\n this.muted = !this.muted;\n this.refresh();\n return this.muted;\n }\n\n /**\n * Toggles the paused state.\n * @method PIXI.sound.htmlaudio.HTMLAudioContext#togglePause\n * @return {boolean} The current paused state.\n */\n public togglePause(): boolean\n {\n this.paused = !this.paused;\n this.refreshPaused();\n return this.paused;\n }\n\n /**\n * Destroy and don't use after this\n * @method PIXI.sound.htmlaudio.HTMLAudioContext#destroy\n */\n public destroy(): void\n {\n this.removeAllListeners();\n }\n}\n","export type ExtensionMap = {[key: string]: boolean};\n\n/**\n * The list of extensions that can be played.\n * @readonly\n * @static\n * @member {string[]} PIXI.sound.utils.extensions\n */\nexport const extensions: string[] = [\n \"mp3\",\n \"ogg\",\n \"oga\",\n \"opus\",\n \"mpeg\",\n \"wav\",\n \"m4a\",\n \"mp4\",\n \"aiff\",\n \"wma\",\n \"mid\",\n];\n\n/**\n * Internal function to validate file type formats\n * @private\n * @return {object} map of support by type\n */\nfunction validateFormats(): ExtensionMap {\n const types: {[key: string]: string} = {\n m4a: \"mp4\",\n oga: \"ogg\",\n };\n const audio = document.createElement(\"audio\");\n const formats: ExtensionMap = {};\n const no = /^no$/;\n extensions.forEach((ext) => {\n const type = types[ext] || ext;\n const canByExt = audio.canPlayType(`audio/${ext}`).replace(no, \"\");\n const canByType = audio.canPlayType(`audio/${type}`).replace(no, \"\");\n formats[ext] = !!canByExt || !!canByType;\n });\n return Object.freeze(formats);\n}\n\n/**\n * The list of browser supported audio formats.\n * @readonly\n * @static\n * @member {Object} PIXI.sound.utils.supported\n * @property {boolean} mp3 - `true` if file-type is supported\n * @property {boolean} ogg - `true` if file-type is supported\n * @property {boolean} oga - `true` if file-type is supported\n * @property {boolean} opus - `true` if file-type is supported\n * @property {boolean} mpeg - `true` if file-type is supported\n * @property {boolean} wav - `true` if file-type is supported\n * @property {boolean} mp4 - `true` if file-type is supported\n * @property {boolean} aiff - `true` if file-type is supported\n * @property {boolean} wma - `true` if file-type is supported\n * @property {boolean} mid - `true` if file-type is supported\n */\nexport const supported = validateFormats();\n","import { supported } from \"./supported\";\n\n/**\n * RegExp for looking for format patterns.\n * @static\n * @private\n */\nconst FORMAT_PATTERN = /\\.(\\{([^\\}]+)\\})(\\?.*)?$/;\n\n/**\n * Resolve a URL with different formats in glob pattern to\n * a path based on the supported browser format. For instance:\n * \"sounds/music.{ogg,mp3}\", would resolve to \"sounds/music.ogg\"\n * if \"ogg\" support is found, otherwise, fallback to \"sounds.music.mp3\"\n * @method PIXI.sound.utils.resolveUrl\n * @static\n * @param {string|PIXI.loaders.Resource} source - Path to resolve or Resource, if\n * a Resource object is provided, automatically updates the extension and url\n * of that object.\n * @return {string} The format to resolve to\n */\nexport function resolveUrl(source: string | PIXI.loaders.Resource): string\n{\n // search for patterns like \".{mp3,ogg}\"\"\n const glob = FORMAT_PATTERN;\n const url: string = typeof source === \"string\" ? source : source.url;\n\n if (!glob.test(url))\n {\n return url;\n }\n else\n {\n const match = glob.exec(url);\n const exts = match[2].split(\",\");\n let replace = exts[exts.length - 1]; // fallback to last ext\n for (let i = 0, len = exts.length; i < len; i++)\n {\n const ext = exts[i];\n if (supported[ext])\n {\n replace = ext;\n break;\n }\n }\n const resolved = url.replace(match[1], replace);\n if (!(typeof source === \"string\"))\n {\n source.extension = replace;\n source.url = resolved;\n }\n return resolved;\n }\n}\n","import { getInstance } from \"../instance\";\nimport { resolveUrl } from \"../utils/resolveUrl\";\nimport { extensions } from \"../utils/supported\";\n\n/**\n * Sound middleware installation utilities for PIXI.loaders.Loader\n * @class\n * @private\n */\nexport class LoaderMiddleware\n{\n /**\n * Install the middleware\n * @method PIXI.sound.loader.add\n * @param {PIXI.sound.SoundLibrary} sound - Instance of sound library\n */\n public static add()\n {\n LoaderMiddleware.legacy = getInstance().useLegacy;\n }\n\n /**\n * Set the legacy mode\n * @name PIXI.sound.loader.legacy\n * @type {boolean}\n * @private\n */\n static set legacy(legacy: boolean)\n {\n // Configure PIXI Loader to handle audio files correctly\n const Resource = PIXI.loaders.Resource;\n const exts = extensions;\n\n // Make sure we support webaudio\n if (!legacy)\n {\n // Load all audio files as ArrayBuffers\n exts.forEach((ext) => {\n Resource.setExtensionXhrType(ext, Resource.XHR_RESPONSE_TYPE.BUFFER);\n Resource.setExtensionLoadType(ext, Resource.LOAD_TYPE.XHR);\n });\n }\n else\n {\n // Fall back to loading as <audio> elements\n exts.forEach((ext) => {\n Resource.setExtensionXhrType(ext, Resource.XHR_RESPONSE_TYPE.DEFAULT);\n Resource.setExtensionLoadType(ext, Resource.LOAD_TYPE.AUDIO);\n });\n }\n }\n\n /**\n * Handle the preprocessing of file paths\n */\n public static pre(resource: PIXI.loaders.Resource, next: () => void): void\n {\n resolveUrl(resource);\n next();\n }\n\n /**\n * Actual resource-loader middleware for sound class\n */\n public static use(resource: PIXI.loaders.Resource, next: () => void): void\n {\n if (resource.data && extensions.indexOf(resource.extension) > -1)\n {\n (resource as any).sound = getInstance().add(resource.name, {\n loaded: next,\n preload: true,\n url: resource.url,\n source: resource.data,\n });\n }\n else\n {\n next();\n }\n }\n}\n","import { LoaderMiddleware } from \"./LoaderMiddleware\";\n\n/**\n * Loader to replace the default PIXI Loader, this will\n * provide support for auto-install `pre`, currently only the `addPixiMiddleware`\n * method only support's **resource-loader's** `use` method.\n * @namespace PIXI.sound.loader\n * @class\n * @private\n */\nexport class Loader extends PIXI.loaders.Loader\n{\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl?: string, concurrency?: number)\n {\n super(baseUrl, concurrency);\n\n this.use(LoaderMiddleware.use);\n this.pre(LoaderMiddleware.pre);\n }\n\n /**\n * Adds a default middleware to the PixiJS loader.\n *\n * @static\n * @param {Function} fn - The middleware to add.\n */\n public static addPixiMiddleware(fn: () => void): void\n {\n super.addPixiMiddleware(fn);\n }\n}\n","import { IMediaInstance } from \"../interfaces\";\nimport { CompleteCallback, Sound } from \"../Sound\";\n\n// Sound sprite data setup\nexport interface SoundSpriteData {\n start: number;\n end: number;\n speed?: number;\n}\n\n// Collection of sound sprites\nexport type SoundSprites = {[id: string]: SoundSprite};\n\n/**\n * Object that represents a single Sound's sprite.\n * @class SoundSprite\n * @memberof PIXI.sound\n * @param {PIXI.sound.Sound} parent The parent sound\n * @param {Object} options Data associated with object.\n * @param {number} options.start The start time in seconds.\n * @param {number} options.end The end time in seconds.\n * @param {number} [options.speed] The optional speed, if not speed, uses\n * the default speed of the parent.\n */\nexport class SoundSprite\n{\n /**\n * The reference sound\n * @name PIXI.sound.SoundSprite#parent\n * @type {PIXI.sound.Sound}\n * @readonly\n */\n public parent: Sound;\n\n /**\n * The starting location in seconds.\n * @name PIXI.sound.SoundSprite#start\n * @type {number}\n * @readonly\n */\n public start: number;\n\n /**\n * The ending location in seconds\n * @name PIXI.sound.SoundSprite#end\n * @type {number}\n * @readonly\n */\n public end: number;\n\n /**\n * The speed override where 1 is 100% speed playback.\n * @name PIXI.sound.SoundSprite#speed\n * @type {number}\n * @readonly\n */\n public speed: number;\n\n /**\n * The duration of the sound in seconds.\n * @name PIXI.sound.SoundSprite#duration\n * @type {number}\n * @readonly\n */\n public duration: number;\n\n /**\n * Whether to loop the sound sprite.\n * @name PIXI.sound.SoundSprite#loop\n * @type {boolean}\n * @readonly\n */\n public loop: boolean;\n\n /**\n * Constructor\n */\n constructor(parent: Sound, options: SoundSpriteData)\n {\n this.parent = parent;\n Object.assign(this, options);\n this.duration = this.end - this.start;\n\n console.assert(this.duration > 0, \"End time must be after start time\");\n }\n\n /**\n * Play the sound sprite.\n * @method PIXI.sound.SoundSprite#play\n * @param {PIXI.sound.Sound~completeCallback} [complete] Function call when complete\n * @return {PIXI.sound.IMediaInstance|Promise<PIXI.sound.IMediaInstance>} Sound instance being played.\n */\n public play(complete?: CompleteCallback): IMediaInstance | Promise<IMediaInstance>\n {\n return this.parent.play({\n complete,\n speed: this.speed || this.parent.speed,\n end: this.end,\n start: this.start,\n loop: this.loop});\n }\n\n /**\n * Destroy and don't use after this\n * @method PIXI.sound.SoundSprite#destroy\n */\n public destroy(): void\n {\n this.parent = null;\n }\n}\n","import { Filter } from \"./filters\";\nimport { HTMLAudioMedia } from \"./htmlaudio\";\nimport { getInstance } from \"./instance\";\nimport { IMedia, IMediaContext, IMediaInstance } from \"./interfaces\";\nimport { SoundSprite, SoundSpriteData, SoundSprites } from \"./sprites\";\nimport { resolveUrl } from \"./utils/resolveUrl\";\nimport { WebAudioMedia } from \"./webaudio\";\n\n// Constructor options\nexport interface Options {\n autoPlay?: boolean;\n preaload?: boolean;\n singleInstance?: boolean;\n volume?: number;\n speed?: number;\n complete?: CompleteCallback;\n loaded?: LoadedCallback;\n preload?: boolean;\n loop?: boolean;\n url?: string;\n source?: ArrayBuffer | HTMLAudioElement;\n sprites?: {[id: string]: SoundSpriteData};\n}\n\n// Interface for play options\nexport interface PlayOptions {\n start?: number;\n end?: number;\n speed?: number;\n loop?: boolean;\n volume?: number;\n sprite?: string;\n muted?: boolean;\n complete?: CompleteCallback;\n loaded?: LoadedCallback;\n}\n\n/**\n * Callback when sound is loaded.\n * @callback PIXI.sound.Sound~loadedCallback\n * @param {Error} err The callback error.\n * @param {PIXI.sound.Sound} sound The instance of new sound.\n * @param {PIXI.sound.IMediaInstance} instance The instance of auto-played sound.\n */\nexport declare type LoadedCallback = (err: Error, sound?: Sound, instance?: IMediaInstance) => void;\n\n/**\n * Callback when sound is completed.\n * @callback PIXI.sound.Sound~completeCallback\n * @param {PIXI.sound.Sound} sound The instance of sound.\n */\nexport declare type CompleteCallback = (sound: Sound) => void;\n\n/**\n * Sound represents a single piece of loaded media. When playing a sound {@link PIXI.sound.IMediaInstance} objects\n * are created. Properties such a `volume`, `pause`, `mute`, `speed`, etc will have an effect on all instances.\n * @class Sound\n * @memberof PIXI.sound\n */\nexport class Sound\n{\n /**\n * Pool of instances\n * @name PIXI.sound.Sound#_pool\n * @type {Array<IMediaInstance>}\n * @private\n */\n private static _pool: IMediaInstance[] = [];\n\n /**\n * `true` if the buffer is loaded.\n * @name PIXI.sound.Sound#isLoaded\n * @type {boolean}\n * @default false\n */\n public isLoaded: boolean;\n\n /**\n * `true` if the sound is currently being played.\n * @name PIXI.sound.Sound#isPlaying\n * @type {boolean}\n * @default false\n * @readonly\n */\n public isPlaying: boolean;\n\n /**\n * true to start playing immediate after load.\n * @name PIXI.sound.Sound#autoPlay\n * @type {boolean}\n * @default false\n * @readonly\n */\n public autoPlay: boolean;\n\n /**\n * `true` to disallow playing multiple layered instances at once.\n * @name PIXI.sound.Sound#singleInstance\n * @type {boolean}\n * @default false\n */\n public singleInstance: boolean;\n\n /**\n * `true` to immediately start preloading.\n * @name PIXI.sound.Sound#preload\n * @type {boolean}\n * @default false\n * @readonly\n */\n public preload: boolean;\n\n /**\n * The file source to load.\n * @name PIXI.sound.Sound#url\n * @type {String}\n * @readonly\n */\n public url: string;\n\n /**\n * The constructor options.\n * @name PIXI.sound.Sound#options\n * @type {Object}\n * @readonly\n */\n public options: Options;\n\n /**\n * The audio source\n * @name PIXI.sound.Sound#media\n * @type {PIXI.sound.IMedia}\n * @private\n */\n public media: IMedia;\n\n /**\n * The collection of instances being played.\n * @name PIXI.sound.Sound#_instances\n * @type {Array<IMediaInstance>}\n * @private\n */\n private _instances: IMediaInstance[];\n\n /**\n * Reference to the sound context.\n * @name PIXI.sound.Sound#_sprites\n * @type {SoundContext}\n * @private\n */\n private _sprites: SoundSprites;\n\n /**\n * The options when auto-playing.\n * @name PIXI.sound.Sound#_autoPlayOptions\n * @type {PlayOptions}\n * @private\n */\n private _autoPlayOptions: PlayOptions;\n\n /**\n * The internal volume.\n * @name PIXI.sound.Sound#_volume\n * @type {number}\n * @private\n */\n private _volume: number;\n\n /**\n * The internal paused state.\n * @name PIXI.sound.Sound#_paused\n * @type {boolean}\n * @private\n */\n private _paused: boolean;\n\n /**\n * The internal muted state.\n * @name PIXI.sound.Sound#_muted\n * @type {boolean}\n * @private\n */\n private _muted: boolean;\n\n /**\n * The internal volume.\n * @name PIXI.sound.Sound#_loop\n * @type {boolean}\n * @private\n */\n private _loop: boolean;\n\n /**\n * The internal playbackRate\n * @name PIXI.sound.Sound#_speed\n * @type {number}\n * @private\n */\n private _speed: number;\n\n /**\n * Create a new sound instance from source.\n * @method PIXI.sound.Sound.from\n * @param {ArrayBuffer|String|Object|HTMLAudioElement} options Either the path or url to the source file.\n * or the object of options to use.\n * @param {String} [options.url] If `options` is an object, the source of file.\n * @param {HTMLAudioElement|ArrayBuffer} [options.source] The source, if already preloaded.\n * @param {boolean} [options.autoPlay=false] true to play after loading.\n * @param {boolean} [options.preload=false] true to immediately start preloading.\n * @param {boolean} [options.singleInstance=false] `true` to disallow playing multiple layered instances at once.\n * @param {number} [options.volume=1] The amount of volume 1 = 100%.\n * @param {number} [options.speed=1] The playback rate where 1 is 100% speed.\n * @param {Object} [options.sprites] The map of sprite data. Where a sprite is an object\n * with a `start` and `end`, which are the times in seconds. Optionally, can include\n * a `speed` amount where 1 is 100% speed.\n * @param {PIXI.sound.Sound~completeCallback} [options.complete=null] Global complete callback\n * when play is finished.\n * @param {PIXI.sound.Sound~loadedCallback} [options.loaded=null] Call when finished loading.\n * @param {boolean} [options.loop=false] true to loop the audio playback.\n * @return {PIXI.sound.Sound} Created sound instance.\n */\n public static from(source: string | Options | ArrayBuffer | HTMLAudioElement): Sound\n {\n let options: Options = {};\n\n if (typeof source === \"string\")\n {\n options.url = source as string;\n }\n else if (source instanceof ArrayBuffer || source instanceof HTMLAudioElement)\n {\n options.source = source;\n }\n else\n {\n options = source;\n }\n\n // Default settings\n options = {\n autoPlay: false,\n singleInstance: false,\n url: null,\n source: null,\n preload: false,\n volume: 1,\n speed: 1,\n complete: null,\n loaded: null,\n loop: false, ...options};\n\n // Resolve url in-case it has a special format\n if (options.url)\n {\n options.url = resolveUrl(options.url);\n }\n\n Object.freeze(options);\n\n const media: IMedia = getInstance().useLegacy ?\n new HTMLAudioMedia() :\n new WebAudioMedia();\n\n return new Sound(media, options);\n }\n\n /**\n * Constructor, use `PIXI.sound.Sound.from`\n * @private\n */\n constructor(media: IMedia, options: Options)\n {\n this.media = media;\n this.options = options;\n this._instances = [];\n this._sprites = {};\n\n this.media.init(this);\n\n const complete = options.complete;\n this._autoPlayOptions = complete ? { complete } : null;\n this.isLoaded = false;\n this.isPlaying = false;\n this.autoPlay = options.autoPlay;\n this.singleInstance = options.singleInstance;\n this.preload = options.preload || this.autoPlay;\n this.url = options.url;\n this.speed = options.speed;\n this.volume = options.volume;\n this.loop = options.loop;\n\n if (options.sprites)\n {\n this.addSprites(options.sprites);\n }\n\n if (this.preload)\n {\n this._preload(options.loaded);\n }\n }\n\n /**\n * Instance of the media context\n * @name PIXI.sound.Sound#context\n * @type {PIXI.sound.IMediaContext}\n * @readonly\n */\n public get context(): IMediaContext\n {\n return getInstance().context;\n }\n\n /**\n * Stops all the instances of this sound from playing.\n * @method PIXI.sound.Sound#pause\n * @return {PIXI.sound.Sound} Instance of this sound.\n */\n public pause(): Sound\n {\n this.isPlaying = false;\n this.paused = true;\n return this;\n }\n\n /**\n * Resuming all the instances of this sound from playing\n * @method PIXI.sound.Sound#resume\n * @return {PIXI.sound.Sound} Instance of this sound.\n */\n public resume(): Sound\n {\n this.isPlaying = this._instances.length > 0;\n this.paused = false;\n return this;\n }\n\n /**\n * Stops all the instances of this sound from playing.\n * @name PIXI.sound.Sound#paused\n * @type {boolean}\n * @readonly\n */\n public get paused(): boolean\n {\n return this._paused;\n }\n public set paused(paused: boolean)\n {\n this._paused = paused;\n this.refreshPaused();\n }\n\n /**\n * The playback rate\n * @name PIXI.sound.Sound#speed\n * @type {number}\n */\n public get speed(): number\n {\n return this._speed;\n }\n public set speed(speed: number)\n {\n this._speed = speed;\n this.refresh();\n }\n\n /**\n * Set the filters. Only supported with WebAudio.\n * @name PIXI.sound.Sound#filters\n * @type {Array<PIXI.sound.filters.Filter>}\n */\n public get filters(): Filter[]\n {\n return this.media.filters;\n }\n public set filters(filters: Filter[])\n {\n this.media.filters = filters;\n }\n\n /**\n * Add a sound sprite, which is a saved instance of a longer sound.\n * Similar to an image spritesheet.\n * @method PIXI.sound.Sound#addSprites\n * @param {String} alias The unique name of the sound sprite.\n * @param {object} data Either completed function or play options.\n * @param {number} data.start Time when to play the sound in seconds.\n * @param {number} data.end Time to end playing in seconds.\n * @param {number} [data.speed] Override default speed, default to the Sound's speed setting.\n * @return {PIXI.sound.SoundSprite} Sound sprite result.\n */\n public addSprites(alias: string, data: SoundSpriteData): SoundSprite;\n\n /**\n * Convenience method to add more than one sprite add a time.\n * @method PIXI.sound.Sound#addSprites\n * @param {Object} data Map of sounds to add where the key is the alias,\n * and the data are configuration options, see {@PIXI.sound.Sound#addSprite} for info on data.\n * @return {Object} The map of sound sprites added.\n */\n public addSprites(sprites: {[id: string]: SoundSpriteData}): SoundSprites;\n\n // Actual implementation\n public addSprites(\n source: string | {[id: string]: SoundSpriteData},\n data?: SoundSpriteData): SoundSprite | SoundSprites\n {\n if (typeof source === \"object\")\n {\n const results: SoundSprites = {};\n for (const alias in source)\n {\n results[alias] = this.addSprites(alias, source[alias]);\n }\n return results;\n }\n else if (typeof source === \"string\")\n {\n // tslint:disable-next-line no-console\n console.assert(!this._sprites[source], `Alias ${source} is already taken`);\n const sprite = new SoundSprite(this, data);\n this._sprites[source] = sprite;\n return sprite;\n }\n }\n\n /**\n * Destructor, safer to use `SoundLibrary.remove(alias)` to remove this sound.\n * @method PIXI.sound.Sound#destroy\n */\n public destroy(): void\n {\n this._removeInstances();\n this.removeSprites();\n this.media.destroy();\n this.media = null;\n this._sprites = null;\n this._instances = null;\n }\n\n /**\n * Remove all sound sprites.\n * @method PIXI.sound.Sound#removeSprites\n * @return {PIXI.sound.Sound} Sound instance for chaining.\n */\n\n /**\n * Remove a sound sprite.\n * @method PIXI.sound.Sound#removeSprites\n * @param {String} alias The unique name of the sound sprite.\n * @return {PIXI.sound.Sound} Sound instance for chaining.\n */\n public removeSprites(alias?: string): Sound\n {\n if (!alias)\n {\n for (const name in this._sprites)\n {\n this.removeSprites(name);\n }\n }\n else\n {\n const sprite: SoundSprite = this._sprites[alias];\n\n if (sprite !== undefined)\n {\n sprite.destroy();\n delete this._sprites[alias];\n }\n }\n return this;\n }\n\n /**\n * If the current sound is playable (loaded).\n * @name PIXI.sound.Sound#isPlayable\n * @type {boolean}\n * @readonly\n */\n public get isPlayable(): boolean\n {\n return this.isLoaded && this.media && this.media.isPlayable;\n }\n\n /**\n * Stops all the instances of this sound from playing.\n * @method PIXI.sound.Sound#stop\n * @return {PIXI.sound.Sound} Instance of this sound.\n */\n public stop(): Sound\n {\n if (!this.isPlayable)\n {\n this.autoPlay = false;\n this._autoPlayOptions = null;\n return this;\n }\n this.isPlaying = false;\n\n // Go in reverse order so we don't skip items\n for (let i = this._instances.length - 1; i >= 0; i--)\n {\n this._instances[i].stop();\n }\n return this;\n }\n\n /**\n * Play a sound sprite, which is a saved instance of a longer sound.\n * Similar to an image spritesheet.\n * @method PIXI.sound.Sound#play\n * @param {String} alias The unique name of the sound sprite.\n * @param {object} data Either completed function or play options.\n * @param {number} data.start Time when to play the sound in seconds.\n * @param {number} data.end Time to end playing in seconds.\n * @param {number} [data.speed] Override default speed, default to the Sound's speed setting.\n * @param {PIXI.sound.Sound~completeCallback} [callback] Callback when completed.\n * @return {PIXI.sound.IMediaInstance|Promise<PIXI.sound.IMediaInstance>} The sound instance,\n * this cannot be reused after it is done playing. Returns a Promise if the sound\n * has not yet loaded.\n */\n public play(alias: string, callback?: CompleteCallback): IMediaInstance | Promise<IMediaInstance>;\n\n /**\n * Plays the sound.\n * @method PIXI.sound.Sound#play\n * @param {PIXI.sound.Sound~completeCallback|object} options Either completed function or play options.\n * @param {number} [options.start=0] Time when to play the sound in seconds.\n * @param {number} [options.end] Time to end playing in seconds.\n * @param {String} [options.sprite] Play a named sprite. Will override end, start and speed options.\n * @param {number} [options.speed] Override default speed, default to the Sound's speed setting.\n * @param {number} [options.volume] Current volume amount for instance.\n * @param {boolean} [options.muted] Override default muted, default to the Sound's muted setting.\n * @param {boolean} [options.loop] Override default loop, default to the Sound's loop setting.\n * @param {PIXI.sound.Sound~completeCallback} [options.complete] Callback when complete.\n * @param {PIXI.sound.Sound~loadedCallback} [options.loaded] If the sound isn't already preloaded, callback when\n * the audio has completely finished loading and decoded.\n * @return {PIXI.sound.IMediaInstance|Promise<PIXI.sound.IMediaInstance>} The sound instance,\n * this cannot be reused after it is done playing. Returns a Promise if the sound\n * has not yet loaded.\n */\n public play(source?: string | PlayOptions | CompleteCallback,\n callback?: CompleteCallback): IMediaInstance | Promise<IMediaInstance>;\n\n // Overloaded function\n public play(source?: any, complete?: CompleteCallback): IMediaInstance | Promise<IMediaInstance>\n {\n let options: PlayOptions;\n\n if (typeof source === \"string\")\n {\n const sprite: string = source as string;\n options = { sprite, loop: this.loop, complete };\n }\n else if (typeof source === \"function\")\n {\n options = {};\n options.complete = source as CompleteCallback;\n }\n else\n {\n options = source as PlayOptions;\n }\n\n options = {\n complete: null,\n loaded: null,\n sprite: null,\n end: null,\n start: 0,\n volume: 1,\n speed: 1,\n muted: false,\n loop: false, ...(options || {})};\n\n // A sprite is specified, add the options\n if (options.sprite)\n {\n const alias: string = options.sprite;\n // tslint:disable-next-line no-console\n console.assert(!!this._sprites[alias], `Alias ${alias} is not available`);\n const sprite: SoundSprite = this._sprites[alias];\n options.start = sprite.start;\n options.end = sprite.end;\n options.speed = sprite.speed || 1;\n options.loop = sprite.loop || options.loop;\n delete options.sprite;\n }\n\n // @deprecated offset option\n if ((options as any).offset) {\n options.start = (options as any).offset as number;\n }\n\n // if not yet playable, ignore\n // - usefull when the sound download isnt yet completed\n if (!this.isLoaded)\n {\n return new Promise<IMediaInstance>((resolve, reject) =>\n {\n this.autoPlay = true;\n this._autoPlayOptions = options;\n this._preload((err: Error, sound: Sound, media: IMediaInstance) =>\n {\n if (err)\n {\n reject(err);\n }\n else\n {\n if (options.loaded)\n {\n options.loaded(err, sound, media);\n }\n resolve(media);\n }\n });\n });\n }\n\n // Stop all sounds\n if (this.singleInstance)\n {\n this._removeInstances();\n }\n\n // clone the bufferSource\n const instance = this._createInstance();\n this._instances.push(instance);\n this.isPlaying = true;\n instance.once(\"end\", () => {\n if (options.complete)\n {\n options.complete(this);\n }\n this._onComplete(instance);\n });\n instance.once(\"stop\", () => {\n this._onComplete(instance);\n });\n\n instance.play(options);\n\n return instance;\n }\n\n /**\n * Internal only, speed, loop, volume change occured.\n * @method refresh\n * @private\n */\n public refresh(): void\n {\n const len = this._instances.length;\n for (let i = 0; i < len; i++)\n {\n this._instances[i].refresh();\n }\n }\n\n /**\n * Handle changes in paused state. Internal only.\n * @method refreshPaused\n * @private\n */\n public refreshPaused(): void\n {\n const len = this._instances.length;\n for (let i = 0; i < len; i++)\n {\n this._instances[i].refreshPaused();\n }\n }\n\n /**\n * Gets and sets the volume.\n * @name PIXI.sound.Sound#volume\n * @type {number}\n */\n public get volume(): number\n {\n return this._volume;\n }\n public set volume(volume: number)\n {\n this._volume = volume;\n this.refresh();\n }\n\n /**\n * Gets and sets the muted flag.\n * @name PIXI.sound.Sound#muted\n * @type {number}\n */\n public get muted(): boolean\n {\n return this._muted;\n }\n public set muted(muted: boolean)\n {\n this._muted = muted;\n this.refresh();\n }\n\n /**\n * Gets and sets the looping.\n * @name PIXI.sound.Sound#loop\n * @type {boolean}\n */\n public get loop(): boolean\n {\n return this._loop;\n }\n public set loop(loop: boolean)\n {\n this._loop = loop;\n this.refresh();\n }\n\n /**\n * Starts the preloading of sound.\n * @method PIXI.sound.Sound#_preload\n * @private\n */\n private _preload(callback?: LoadedCallback): void\n {\n this.media.load(callback);\n }\n\n /**\n * Gets the list of instances that are currently being played of this sound.\n * @name PIXI.sound.Sound#instances\n * @type {Array<PIXI.sound.IMediaInstance>}\n * @readonly\n */\n public get instances(): IMediaInstance[]\n {\n return this._instances;\n }\n\n /**\n * Get the map of sprites.\n * @name PIXI.sound.Sound#sprites\n * @type {Object}\n * @readonly\n */\n public get sprites(): SoundSprites\n {\n return this._sprites;\n }\n\n /**\n * Get the duration of the audio in seconds.\n * @name PIXI.sound.Sound#duration\n * @type {number}\n */\n public get duration(): number\n {\n return this.media.duration;\n }\n\n /**\n * Auto play the first instance.\n * @method PIXI.sound.Sound#autoPlayStart\n * @private\n */\n public autoPlayStart(): IMediaInstance\n {\n let instance: IMediaInstance;\n if (this.autoPlay)\n {\n instance = this.play(this._autoPlayOptions) as IMediaInstance;\n }\n return instance;\n }\n\n /**\n * Removes all instances.\n * @method PIXI.sound.Sound#_removeInstances\n * @private\n */\n private _removeInstances(): void\n {\n // destroying also stops\n for (let i = this._instances.length - 1; i >= 0; i--)\n {\n this._poolInstance(this._instances[i]);\n }\n this._instances.length = 0;\n }\n\n /**\n * Sound instance completed.\n * @method PIXI.sound.Sound#_onComplete\n * @private\n * @param {PIXI.sound.IMediaInstance} instance\n */\n private _onComplete(instance: IMediaInstance): void\n {\n if (this._instances)\n {\n const index = this._instances.indexOf(instance);\n if (index > -1)\n {\n this._instances.splice(index, 1);\n }\n this.isPlaying = this._instances.length > 0;\n }\n this._poolInstance(instance);\n }\n\n /**\n * Create a new instance.\n * @method PIXI.sound.Sound#_createInstance\n * @private\n * @return {PIXI.sound.IMediaInstance} New instance to use\n */\n private _createInstance(): IMediaInstance\n {\n if (Sound._pool.length > 0)\n {\n const instance: IMediaInstance = Sound._pool.pop();\n instance.init(this.media);\n return instance;\n }\n return this.media.create();\n }\n\n /**\n * Destroy/recycling the instance object.\n * @method PIXI.sound.Sound#_poolInstance\n * @private\n * @param {PIXI.sound.IMediaInstance} instance - Instance to recycle\n */\n private _poolInstance(instance: IMediaInstance): void\n {\n instance.destroy();\n // Add it if it isn't already added\n if (Sound._pool.indexOf(instance) < 0)\n {\n Sound._pool.push(instance);\n }\n }\n}\n","import { Filterable } from \"./Filterable\";\nimport { Filter } from \"./filters\";\nimport * as htmlaudio from \"./htmlaudio\";\nimport { getInstance } from \"./instance\";\nimport { IMediaContext, IMediaInstance } from \"./interfaces\";\nimport { LoaderMiddleware } from \"./loader\";\nimport { CompleteCallback, Options, PlayOptions, Sound } from \"./Sound\";\nimport * as webaudio from \"./webaudio\";\n\nexport type SoundMap = {[id: string]: Options | string | ArrayBuffer | HTMLAudioElement};\n\n/**\n * Contains all of the functionality for using the **pixi-sound** library.\n * This is deisnged to play audio with WebAudio and fallback to HTML5.\n * @namespace PIXI.sound\n */\n\n/**\n * @description Manages the playback of sounds.\n * @class SoundLibrary\n * @memberof PIXI.sound\n * @private\n */\nexport class SoundLibrary\n{\n /**\n * For legacy approach for Audio. Instead of using WebAudio API\n * for playback of sounds, it will use HTML5 `<audio>` element.\n * @name PIXI.sound#_useLegacy\n * @type {boolean}\n * @default false\n * @private\n */\n private _useLegacy: boolean;\n\n /**\n * The global context to use.\n * @name PIXI.sound#_context\n * @type {PIXI.sound.webaudio.WebAudioContext}\n * @private\n */\n private _context: IMediaContext;\n\n /**\n * The WebAudio specific context\n * @name PIXI.sound#_webAudioContext\n * @type {PIXI.sound.webaudio.WebAudioContext}\n * @private\n */\n private _webAudioContext: webaudio.WebAudioContext;\n\n /**\n * The HTML Audio (legacy) context.\n * @name PIXI.sound#_htmlAudioContext\n * @type {PIXI.sound.webaudio.WebAudioContext}\n * @private\n */\n private _htmlAudioContext: htmlaudio.HTMLAudioContext;\n\n /**\n * The map of all sounds by alias.\n * @name PIXI.sound#_sounds\n * @type {Object}\n * @private\n */\n private _sounds: {[id: string]: Sound};\n\n constructor()\n {\n this.init();\n }\n\n /**\n * Re-initialize the sound library, this will\n * recreate the AudioContext. If there's a hardware-failure\n * call `close` and then `init`.\n * @method PIXI.sound#init\n * @return {PIXI.sound} Sound instance\n */\n public init(): SoundLibrary\n {\n if (this.supported)\n {\n this._webAudioContext = new webaudio.WebAudioContext();\n }\n this._htmlAudioContext = new htmlaudio.HTMLAudioContext();\n this._sounds = {};\n this.useLegacy = !this.supported;\n return this;\n }\n\n /**\n * The global context to use.\n * @name PIXI.sound#context\n * @readonly\n * @type {PIXI.sound.IMediaContext}\n */\n public get context(): IMediaContext\n {\n return this._context;\n }\n\n /**\n * Apply filters to all sounds. Can be useful\n * for setting global planning or global effects.\n * **Only supported with WebAudio.**\n * @example\n * // Adds a filter to pan all output left\n * PIXI.sound.filtersAll = [\n * new PIXI.sound.filters.StereoFilter(-1)\n * ];\n * @name PIXI.sound#filtersAll\n * @type {PIXI.sound.filters.Filter[]}\n */\n public get filtersAll(): Filter[]\n {\n if (!this.useLegacy)\n {\n return this._context.filters;\n }\n return [];\n }\n public set filtersAll(filtersAll: Filter[])\n {\n if (!this.useLegacy)\n {\n this._context.filters = filtersAll;\n }\n }\n\n /**\n * `true` if WebAudio is supported on the current browser.\n * @name PIXI.sound#supported\n * @readonly\n * @type {boolean}\n */\n public get supported(): boolean\n {\n return webaudio.WebAudioContext.AudioContext !== null;\n }\n\n /**\n * Register an existing sound with the library cache.\n * @method PIXI.sound#add\n * @param {String} alias The sound alias reference.\n * @param {PIXI.sound.Sound} sound Sound reference to use.\n * @return {PIXI.sound.Sound} Instance of the Sound object.\n */\n\n /**\n * Adds a new sound by alias.\n * @method PIXI.sound#add\n * @param {String} alias The sound alias reference.\n * @param {ArrayBuffer|String|Object|HTMLAudioElement} options Either the path or url to the source file.\n * or the object of options to use.\n * @param {String} [options.url] If `options` is an object, the source of file.\n * @param {ArrayBuffer|HTMLAudioElement} [options.source] If sound is already preloaded, available.\n * @param {boolean} [options.autoPlay=false] true to play after loading.\n * @param {boolean} [options.preload=false] true to immediately start preloading.\n * @param {boolean} [options.singleInstance=false] `true` to disallow playing multiple layered instances at once.\n * @param {number} [options.volume=1] The amount of volume 1 = 100%.\n * @param {number} [options.speed=1] The playback rate where 1 is 100% speed.\n * @param {Object} [options.sprites] The map of sprite data. Where a sprite is an object\n * with a `start` and `end`, which are the times in seconds. Optionally, can include\n * a `speed` amount where 1 is 100% speed.\n * @param {PIXI.sound.Sound~completeCallback} [options.complete=null] Global complete callback when\n * play is finished.\n * @param {PIXI.sound.Sound~loadedCallback} [options.loaded=null] Call when finished loading.\n * @return {PIXI.sound.Sound} Instance of the Sound object.\n */\n public add(alias: string, options: Options | string | ArrayBuffer | HTMLAudioElement | Sound): Sound;\n\n /**\n * Adds multiple sounds at once.\n * @method PIXI.sound#add\n * @param {Object} map Map of sounds to add, the key is the alias, the value is the\n * `string`, `ArrayBuffer`, `HTMLAudioElement` or the list of options\n * (see {@link PIXI.sound.add} for options).\n * @param {Object} globalOptions The default options for all sounds.\n * if a property is defined, it will use the local property instead.\n * @return {PIXI.sound.Sound} Instance to the Sound object.\n */\n public add(map: SoundMap, globalOptions?: Options): {[id: string]: Sound};\n\n // Actual method\n public add(source: string | SoundMap, sourceOptions?: Options | string | ArrayBuffer | HTMLAudioElement | Sound):\n {[id: string]: Sound} | Sound\n {\n if (typeof source === \"object\")\n {\n const results: {[id: string]: Sound} = {};\n\n for (const alias in source)\n {\n const options: Options = this._getOptions(\n source[alias],\n sourceOptions as Options,\n );\n results[alias] = this.add(alias, options);\n }\n return results;\n }\n else if (typeof source === \"string\")\n {\n // tslint:disable-next-line no-console\n console.assert(!this._sounds[source], `Sound with alias ${source} already exists.`);\n\n if (sourceOptions instanceof Sound)\n {\n this._sounds[source] = sourceOptions;\n return sourceOptions;\n }\n else\n {\n const options: Options = this._getOptions(sourceOptions);\n const sound: Sound = Sound.from(options);\n this._sounds[source] = sound;\n return sound;\n }\n }\n }\n\n /**\n * Internal methods for getting the options object\n * @method PIXI.sound#_getOptions\n * @private\n * @param {string|ArrayBuffer|HTMLAudioElement|Object} source The source options\n * @param {Object} [overrides] Override default options\n * @return {Object} The construction options\n */\n private _getOptions(source: string | ArrayBuffer | HTMLAudioElement | Options, overrides?: Options): Options\n {\n let options: Options;\n\n if (typeof source === \"string\")\n {\n options = { url: source };\n }\n else if (source instanceof ArrayBuffer || source instanceof HTMLAudioElement)\n {\n options = { source };\n }\n else\n {\n options = source as Options;\n }\n options = {...options, ...(overrides || {})};\n\n return options;\n }\n\n /**\n * Do not use WebAudio, force the use of legacy. This **must** be called before loading any files.\n * @name PIXI.sound#useLegacy\n * @type {boolean}\n */\n public get useLegacy(): boolean\n {\n return this._useLegacy;\n }\n public set useLegacy(legacy: boolean)\n {\n LoaderMiddleware.legacy = legacy;\n this._useLegacy = legacy;\n\n // Set the context to use\n this._context = (!legacy && this.supported) ?\n this._webAudioContext :\n this._htmlAudioContext;\n }\n\n /**\n * Removes a sound by alias.\n * @method PIXI.sound#remove\n * @param {String} alias The sound alias reference.\n * @return {PIXI.sound} Instance for chaining.\n */\n public remove(alias: string): SoundLibrary\n {\n this.exists(alias, true);\n this._sounds[alias].destroy();\n delete this._sounds[alias];\n return this;\n }\n\n /**\n * Set the global volume for all sounds. To set per-sound volume see {@link PIXI.sound#volume}.\n * @name PIXI.sound#volumeAll\n * @type {number}\n */\n public get volumeAll(): number\n {\n return this._context.volume;\n }\n public set volumeAll(volume: number)\n {\n this._context.volume = volume;\n this._context.refresh();\n }\n\n /**\n * Set the global speed for all sounds. To set per-sound speed see {@link PIXI.sound#speed}.\n * @name PIXI.sound#speedAll\n * @type {number}\n */\n public get speedAll(): number\n {\n return this._context.speed;\n }\n public set speedAll(speed: number)\n {\n this._context.speed = speed;\n this._context.refresh();\n }\n\n /**\n * Toggle paused property for all sounds.\n * @method PIXI.sound#togglePauseAll\n * @return {boolean} `true` if all sounds are paused.\n */\n public togglePauseAll(): boolean\n {\n return this._context.togglePause();\n }\n\n /**\n * Pauses any playing sounds.\n * @method PIXI.sound#pauseAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public pauseAll(): SoundLibrary\n {\n this._context.paused = true;\n this._context.refresh();\n return this;\n }\n\n /**\n * Resumes any sounds.\n * @method PIXI.sound#resumeAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public resumeAll(): SoundLibrary\n {\n this._context.paused = false;\n this._context.refresh();\n return this;\n }\n\n /**\n * Toggle muted property for all sounds.\n * @method PIXI.sound#toggleMuteAll\n * @return {boolean} `true` if all sounds are muted.\n */\n public toggleMuteAll(): boolean\n {\n return this._context.toggleMute();\n }\n\n /**\n * Mutes all playing sounds.\n * @method PIXI.sound#muteAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public muteAll(): SoundLibrary\n {\n this._context.muted = true;\n this._context.refresh();\n return this;\n }\n\n /**\n * Unmutes all playing sounds.\n * @method PIXI.sound#unmuteAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public unmuteAll(): SoundLibrary\n {\n this._context.muted = false;\n this._context.refresh();\n return this;\n }\n\n /**\n * Stops and removes all sounds. They cannot be used after this.\n * @method PIXI.sound#removeAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public removeAll(): SoundLibrary\n {\n for (const alias in this._sounds)\n {\n this._sounds[alias].destroy();\n delete this._sounds[alias];\n }\n return this;\n }\n\n /**\n * Stops all sounds.\n * @method PIXI.sound#stopAll\n * @return {PIXI.sound} Instance for chaining.\n */\n public stopAll(): SoundLibrary\n {\n for (const alias in this._sounds)\n {\n this._sounds[alias].stop();\n }\n return this;\n }\n\n /**\n * Checks if a sound by alias exists.\n * @method PIXI.sound#exists\n * @param {String} alias Check for alias.\n * @return {boolean} true if the sound exists.\n */\n public exists(alias: string, assert: boolean= false): boolean\n {\n const exists = !!this._sounds[alias];\n if (assert)\n {\n // tslint:disable-next-line no-console\n console.assert(exists, `No sound matching alias '${alias}'.`);\n }\n return exists;\n }\n\n /**\n * Find a sound by alias.\n * @method PIXI.sound#find\n * @param {String} alias The sound alias reference.\n * @return {PIXI.sound.Sound} Sound object.\n */\n public find(alias: string): Sound\n {\n this.exists(alias, true);\n return this._sounds[alias];\n }\n\n /**\n * Plays a sound.\n * @method PIXI.sound#play\n * @param {String} alias The sound alias reference.\n * @param {String} sprite The alias of the sprite to play.\n * @return {PIXI.sound.IMediaInstance|null} The sound instance, this cannot be reused\n * after it is done playing. Returns `null` if the sound has not yet loaded.\n */\n\n /**\n * Plays a sound.\n * @method PIXI.sound#play\n * @param {String} alias The sound alias reference.\n * @param {Object|Function} options The options or callback when done.\n * @param {Function} [options.complete] When completed.\n * @param {Function} [options.loaded] If not already preloaded, callback when finishes load.\n * @param {number} [options.start=0] Start time offset.\n * @param {number} [options.end] End time offset.\n * @param {number} [options.speed] Override default speed, default to the Sound's speed setting.\n * @param {boolean} [options.loop] Override default loop, default to the Sound's loop setting.\n * @return {PIXI.sound.IMediaInstance|Promise<PIXI.sound.IMediaInstance>} The sound instance,\n * this cannot be reused after it is done playing. Returns a Promise if the sound\n * has not yet loaded.\n */\n public play(\n alias: string,\n options?: PlayOptions | CompleteCallback | string): IMediaInstance | Promise<IMediaInstance>\n {\n return this.find(alias).play(options);\n }\n\n /**\n * Stops a sound.\n * @method PIXI.sound#stop\n * @param {String} alias The sound alias reference.\n * @return {PIXI.sound.Sound} Sound object.\n */\n public stop(alias: string): Sound\n {\n return this.find(alias).stop();\n }\n\n /**\n * Pauses a sound.\n * @method PIXI.sound#pause\n * @param {String} alias The sound alias reference.\n * @return {PIXI.sound.Sound} Sound object.\n */\n public pause(alias: string): Sound\n {\n return this.find(alias).pause();\n }\n\n /**\n * Resumes a sound.\n * @method PIXI.sound#resume\n * @param {String} alias The sound alias reference.\n * @return {PIXI.sound} Instance for chaining.\n */\n public resume(alias: string): Sound\n {\n return this.find(alias).resume();\n }\n\n /**\n * Get or set the volume for a sound.\n * @method PIXI.sound#volume\n * @param {String} alias The sound alias reference.\n * @param {number} [volume] Optional current volume to set.\n * @return {number} The current volume.\n */\n public volume(alias: string, volume?: number): number\n {\n const sound = this.find(alias);\n if (volume !== undefined) {\n sound.volume = volume;\n }\n return sound.volume;\n }\n\n /**\n * Get or set the speed for a sound.\n * @method PIXI.sound#speed\n * @param {String} alias The sound alias reference.\n * @param {number} [speed] Optional current speed to set.\n * @return {number} The current speed.\n */\n public speed(alias: string, speed?: number): number\n {\n const sound = this.find(alias);\n if (speed !== undefined) {\n sound.speed = speed;\n }\n return sound.speed;\n }\n\n /**\n * Get the length of a sound in seconds.\n * @method PIXI.sound#duration\n * @param {String} alias The sound alias reference.\n * @return {number} The current duration in seconds.\n */\n public duration(alias: string): number\n {\n return this.find(alias).duration;\n }\n\n /**\n * Closes the sound library. This will release/destroy\n * the AudioContext(s). Can be used safely if you want to\n * initialize the sound library later. Use `init` method.\n * @method PIXI.sound#close\n * @return {PIXI.sound}\n */\n public close(): SoundLibrary\n {\n this.removeAll();\n this._sounds = null;\n if (this._webAudioContext)\n {\n this._webAudioContext.destroy();\n this._webAudioContext = null;\n }\n if (this._htmlAudioContext)\n {\n this._htmlAudioContext.destroy();\n this._htmlAudioContext = null;\n }\n this._context = null;\n return this;\n }\n}\n","import { getInstance } from \"../instance\";\n\n/**\n * Increment the alias for play once\n * @static\n * @private\n * @default 0\n */\nexport let PLAY_ID = 0;\n\n/**\n * Create a new \"Audio\" stream based on given audio path and project uri; returns the audio object.\n * @method PIXI.sound.utils.playOnce\n * @static\n * @param {String} fileName Full path of the file to play.\n * @param {Function} callback Callback when complete.\n * @return {string} New audio element alias.\n */\nexport function playOnce(url: string, callback?: (err?: Error) => void): string\n{\n const alias = `alias${PLAY_ID++}`;\n\n getInstance().add(alias, {\n url,\n preload: true,\n autoPlay: true,\n loaded: (err: Error) => {\n if (err)\n {\n console.error(err);\n getInstance().remove(alias);\n if (callback)\n {\n callback(err);\n }\n }\n },\n complete: () => {\n getInstance().remove(alias);\n if (callback)\n {\n callback(null);\n }\n },\n });\n return alias;\n}\n","import { Sound } from \"../Sound\";\nimport { WebAudioContext, WebAudioMedia } from \"../webaudio\";\n\nexport interface RenderOptions {\n width?: number;\n height?: number;\n fill?: string | CanvasPattern | CanvasGradient;\n}\n\n/**\n * Render image as Texture. **Only supported with WebAudio**\n * @method PIXI.sound.utils.render\n * @param {PIXI.sound.Sound} sound Instance of sound to render\n * @param {Object} [options] Custom rendering options\n * @param {number} [options.width=512] Width of the render\n * @param {number} [options.height=128] Height of the render\n * @param {string|CanvasPattern|CanvasGradient} [options.fill='black'] Fill style for waveform\n * @return {PIXI.Texture} Result texture\n */\nexport function render(sound: Sound, options?: RenderOptions): PIXI.BaseTexture\n{\n const canvas: HTMLCanvasElement = document.createElement(\"canvas\");\n\n options = {\n width: 512,\n height: 128,\n fill: \"black\", ...(options || {})};\n\n canvas.width = options.width;\n canvas.height = options.height;\n\n const baseTexture = PIXI.BaseTexture.fromCanvas(canvas);\n\n if (!(sound.media instanceof WebAudioMedia))\n {\n return baseTexture;\n }\n\n const media: WebAudioMedia = sound.media as WebAudioMedia;\n // tslint:disable-next-line no-console\n console.assert(!!media.buffer, \"No buffer found, load first\");\n\n const context: CanvasRenderingContext2D = canvas.getContext(\"2d\");\n context.fillStyle = options.fill;\n const data: Float32Array = media.buffer.getChannelData(0);\n const step: number = Math.ceil(data.length / options.width);\n const amp: number = options.height / 2;\n\n for (let i: number = 0; i < options.width; i++)\n {\n let min: number = 1.0;\n let max: number = -1.0;\n\n for (let j: number = 0; j < step; j++)\n {\n const datum: number = data[(i * step) + j];\n\n if (datum < min)\n {\n min = datum;\n }\n if (datum > max)\n {\n max = datum;\n }\n }\n context.fillRect(i, (1 + min) * amp, 1, Math.max(1, (max - min) * amp));\n }\n return baseTexture;\n}\n","import { Sound } from \"../Sound\";\nimport { WebAudioContext, WebAudioMedia } from \"../webaudio\";\n\n/**\n * Create a new sound for a sine wave-based tone. **Only supported with WebAudio**\n * @method PIXI.sound.utils.sineTone\n * @param {number} [hertz=200] Frequency of sound.\n * @param {number} [seconds=1] Duration of sound in seconds.\n * @return {PIXI.sound.Sound} New sound.\n */\nexport function sineTone(hertz: number = 200, seconds: number = 1): Sound\n{\n const sound = Sound.from({\n singleInstance: true,\n });\n\n if (!(sound.media instanceof WebAudioMedia))\n {\n return sound;\n }\n\n const media = sound.media as WebAudioMedia;\n const context = sound.context as WebAudioContext;\n\n // set default value\n const nChannels = 1;\n const sampleRate = 48000;\n const amplitude = 2;\n\n // create the buffer\n const buffer = context.audioContext.createBuffer(\n nChannels,\n seconds * sampleRate,\n sampleRate,\n );\n const fArray = buffer.getChannelData(0);\n\n // fill the buffer\n for (let i = 0; i < fArray.length; i++)\n {\n const time = i / buffer.sampleRate;\n const angle = hertz * time * Math.PI;\n fArray[i] = Math.sin(angle) * amplitude;\n }\n\n // set the buffer\n media.buffer = buffer;\n sound.isLoaded = true;\n return sound;\n}\n","/**\n * Global namespace provided by the PixiJS project.\n * @namespace PIXI\n * @see https://github.com/pixijs/pixi.js\n */\nimport PromisePolyfill from \"promise-polyfill\";\nimport { Filterable } from \"./Filterable\";\nimport * as filters from \"./filters\";\nimport * as htmlaudio from \"./htmlaudio\";\nimport { getInstance, setInstance } from \"./instance\";\nimport { Loader, LoaderMiddleware } from \"./loader\";\nimport { Sound } from \"./Sound\";\nimport { SoundLibrary } from \"./SoundLibrary\";\nimport { SoundSprite } from \"./sprites\";\nimport * as utils from \"./utils\";\nimport * as webaudio from \"./webaudio\";\n\n// Create the singleton instance of library\nconst sound = setInstance(new SoundLibrary());\nconst win = window as any;\n\n// Expose to PIXI.sound to the window PIXI object\nconst PIXI_UNTYPED = PIXI as any;\n\n// Check for environments without promises\nif (typeof Promise === \"undefined\")\n{\n win.Promise = PromisePolyfill;\n}\n\n// In some cases loaders can be not included\n// the the bundle for PixiJS, custom builds\nif (typeof PIXI.loaders !== \"undefined\")\n{\n const majorVersion = parseInt(PIXI.VERSION.split(\".\")[0], 10);\n\n // Hack for version 4.x of PixiJS to support in future loaders\n // as well as the existing default shared loader\n if (majorVersion === 4)\n {\n // Replace the PIXI.loaders.Loader class\n // to support using the resolve loader middleware\n PIXI.loaders.Loader = Loader;\n\n // Install middleware on the default loader\n LoaderMiddleware.add();\n PIXI.loader.use(LoaderMiddleware.use);\n PIXI.loader.pre(LoaderMiddleware.pre);\n }\n else if (majorVersion >= 5)\n {\n PIXI_UNTYPED.Loader.registerPlugin(LoaderMiddleware);\n }\n}\n\n// Remove the global namespace created by rollup\n// makes it possible for users to opt-in to exposing\n// the library globally\nif (typeof win.__pixiSound === \"undefined\")\n{\n delete win.__pixiSound;\n}\n\n// Check incase sound has already used\nif (!PIXI_UNTYPED.sound)\n{\n Object.defineProperty(PIXI_UNTYPED, \"sound\",\n {\n get() { return sound; },\n });\n\n Object.defineProperties(sound,\n {\n Filterable: { get() { return Filterable; } },\n filters: { get() { return filters; } },\n htmlaudio: { get() { return htmlaudio; } },\n Sound: { get() { return Sound; } },\n SoundLibrary: { get() { return SoundLibrary; } },\n SoundSprite: { get() { return SoundSprite; } },\n utils: { get() { return utils; } },\n webaudio: { get() { return webaudio; } },\n sound: { get() { return sound; } },\n });\n}\n\nexport default sound;\n"],"names":["setTimeoutFunc","setTimeout","noop","Promise","fn","this","TypeError","_state","_handled","_value","undefined","_deferreds","doResolve","handle","self","deferred","_immediateFn","cb","onFulfilled","onRejected","ret","e","reject","promise","resolve","push","newValue","then","finale","thisArg","apply","arguments","length","_unhandledRejectionFn","i","len","Handler","done","value","reason","ex","prototype","prom","constructor","callback","all","arr","args","Array","slice","call","remaining","res","val","race","values","setImmediate","err","console","input","output","_output","_input","Object","Filterable","_filters","filters","forEach","filter","disconnect","connect","prevFilter_1","_this","destination","source","init","Filter","instance","getInstance","WebAudioUtils","param","setValueAtTime","context","audioContext","currentTime","id","media","_super","_media","_paused","_muted","_elapsed","_updateListener","_update","bind","tslib_1.__extends","WebAudioInstance","_source","_internalStop","emit","_speed","speed","refresh","_volume","volume","muted","_loop","loop","global","sound","parent","globalVolume","soundVolume","instanceVolume","setParamValue","_gain","gain","playbackRate","pausedReal","paused","_pausedReal","play","start","_duration","end","_end","options","_a","duration","buffer","_lastUpdate","_now","onended","_onComplete","loopEnd","loopStart","_enabled","time","enabled","script","nodes","removeEventListener","addEventListener","_progress","refreshPaused","removeAllListeners","events","off","force","now","delta","progress","soundLength","on","stop","PIXI","utils","EventEmitter","bufferSource","createBufferSource","createScriptProcessor","WebAudioNodes","BUFFER_SIZE","createGain","analyser","createAnalyser","destroy","orig","WebAudioMedia","_nodes","_decode","url","_loadUrl","Error","request","XMLHttpRequest","open","responseType","onload","response","send","arrayBuffer","decode","isLoaded","autoPlayStart","win","window","ctx","WebAudioContext","AudioContext","compressor","createDynamicsCompressor","_ctx","_offlineCtx","OfflineAudioContext","sampleRate","_unlocked","state","_unlock","document","playEmptySound","createBuffer","resume","webkitAudioContext","webkitOfflineAudioContext","close","suspend","decodeAudioData","message","f32","f64","f125","f250","f500","f1k","f2k","f4k","f8k","f16k","useLegacy","bands","f","EqualizerFilter","F32","type","F64","F125","F250","F500","F1K","F2K","F4K","F8K","F16K","map","band","node","createBiquadFilter","Q","frequency","bandsMap","getGain","setGain","amount","distortion","createWaveShaper","_distortion","DistortionFilter","_amount","x","curve","Float32Array","deg","Math","PI","abs","oversample","pan","stereo","panner","createStereoPanner","createPanner","panningModel","_stereo","_panner","StereoFilter","_pan","setPosition","seconds","decay","reverse","_seconds","_clamp","_decay","_reverse","_rebuild","ReverbFilter","min","max","n","rate","impulse","impulseL","getChannelData","impulseR","random","pow","convolver","createConvolver","splitter","createChannelSplitter","merger","createChannelMerger","_merger","MonoFilter","lpf1","lpf2","hpf1","hpf2","HTMLAudioInstance","_playing","cloneNode","src","onplay","_onPlay","onpause","_onPause","pause","_start","PADDING","onloadedmetadata","ticker","shared","add","_onUpdate","remove","HTMLAudioMedia","Audio","readyState","load","removeListeners","onLoad","onAbort","onError","error","code","instance_1","HTMLAudioContext","extensions","types","audio","formats","no","supported","m4a","oga","createElement","ext","canByExt","canPlayType","replace","canByType","freeze","FORMAT_PATTERN","resolveUrl","glob","test","match","exec","exts","split","resolved","extension","LoaderMiddleware","legacy","Resource","loaders","setExtensionXhrType","XHR_RESPONSE_TYPE","DEFAULT","setExtensionLoadType","LOAD_TYPE","AUDIO","BUFFER","XHR","resource","next","data","indexOf","name","loaded","preload","baseUrl","concurrency","use","pre","Loader","addPixiMiddleware","assign","SoundSprite","complete","_instances","_sprites","_autoPlayOptions","isPlaying","autoPlay","singleInstance","sprites","addSprites","_preload","Sound","ArrayBuffer","HTMLAudioElement","results","alias","sprite","_removeInstances","removeSprites","isPlayable","offset","_createInstance","once","_poolInstance","index","splice","_pool","pop","create","SoundLibrary","_webAudioContext","webaudio.WebAudioContext","_htmlAudioContext","htmlaudio.HTMLAudioContext","_sounds","_context","filtersAll","sourceOptions","_getOptions","from","overrides","_useLegacy","exists","togglePause","toggleMute","assert","find","removeAll","PLAY_ID","canvas","width","height","fill","baseTexture","BaseTexture","fromCanvas","getContext","fillStyle","step","ceil","amp","j","datum","fillRect","hertz","fArray","angle","sin","setInstance","PIXI_UNTYPED","PromisePolyfill","majorVersion","parseInt","VERSION","loader","registerPlugin","__pixiSound","defineProperty","get","defineProperties","htmlaudio","webaudio"],"mappings":";;;;;;;;oPA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GACxB/N,EAAMC,OAGNsQ,EAAerS,KAUrB,GAPuB,oBAAZxJ,UAEPsL,EAAItL,QAAU8b,QAKU,IAAjBtS,KAAKyM,QAChB,CACI,IAAM8F,EAAeC,SAASxS,KAAKyS,QAAQtG,MAAM,KAAK,GAAI,IAIrC,IAAjBoG,GAIAvS,KAAKyM,QAAQoB,OAASA,EAGtBvB,EAAiBxC,MACjB9J,KAAK0S,OAAO/E,IAAIrB,EAAiBqB,KACjC3N,KAAK0S,OAAO9E,IAAItB,EAAiBsB,MAE5B2E,GAAgB,GAErBF,EAAaxE,OAAO8E,eAAerG,eAOZ,IAApBxK,EAAI8Q,oBAEJ9Q,EAAI8Q,YAIVP,EAAanV,QAEd9C,OAAOyY,eAAeR,EAAc,QACpC,CACIS,eAAQ,OAAO5V,KAGnB9C,OAAO2Y,iBAAiB7V,EACxB,CACI7C,WAAY,CAAEyY,eAAQ,OAAOzY,IAC7BE,QAAS,CAAEuY,eAAQ,OAAOvY,IAC1ByY,UAAW,CAAEF,eAAQ,OAAOE,IAC5BrE,MAAO,CAAEmE,eAAQ,OAAOnE,IACxBkB,aAAc,CAAEiD,eAAQ,OAAOjD,IAC/B7B,YAAa,CAAE8E,eAAQ,OAAO9E,IAC9B/N,MAAO,CAAE6S,eAAQ,OAAO7S,IACxBgT,SAAU,CAAEH,eAAQ,OAAOG,IAC3B/V,MAAO,CAAE4V,eAAQ,OAAO5V"}
File without changes
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pixi_sound
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Scalf
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - shrewdpixeldesign@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".DS_Store"
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/pixi_sound.rb
73
+ - lib/pixi_sound/version.rb
74
+ - pixi_sound.gemspec
75
+ - vendor/.DS_Store
76
+ - vendor/assets/.DS_Store
77
+ - vendor/assets/javascripts/.DS_Store
78
+ - vendor/assets/javascripts/.keep
79
+ - vendor/assets/javascripts/pixi-sound.js
80
+ - vendor/assets/javascripts/pixi-sound.js.map
81
+ - vendor/assets/stylesheets/.keep
82
+ homepage: https://github.com/Palmweaver/pixi_sound
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.0.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: A gem for importing the pixi_lights.js canvas library into Rails projects.
105
+ test_files: []