mirror of
https://github.com/photonstorm/phaser
synced 2024-12-28 05:53:49 +00:00
0fe8757054
moved setting local game reference from WebAudioSoundManager class to BaseSoundManager class constructor fixed bug with audio context creation condition in WebAudioSoundManager class
37 lines
836 B
JavaScript
37 lines
836 B
JavaScript
var Class = require('../utils/Class');
|
|
var BaseSoundManager = require('./BaseSoundManager');
|
|
|
|
// Phaser.Loader.WebAudioSoundManager
|
|
|
|
var WebAudioSoundManager = new Class({
|
|
|
|
Extends: BaseSoundManager,
|
|
|
|
initialize:
|
|
|
|
function WebAudioSoundManager (game)
|
|
{
|
|
BaseSoundManager.call(this, game);
|
|
|
|
/**
|
|
* @property {AudioContext} context - The AudioContext being used for playback.
|
|
* @default
|
|
*/
|
|
this.context = this.createAudioContext();
|
|
},
|
|
|
|
createAudioContext: function ()
|
|
{
|
|
var audioConfig = this.game.config.audio;
|
|
|
|
if (audioConfig && audioConfig.context)
|
|
{
|
|
return audioConfig.context;
|
|
}
|
|
|
|
return new (window['AudioContext'] || window['webkitAudioContext'])();
|
|
}
|
|
|
|
});
|
|
|
|
module.exports = WebAudioSoundManager;
|