mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Default Phaser.Core.Config#audio; and refactor
This commit is contained in:
parent
efd15f9cde
commit
ae5182be7d
5 changed files with 10 additions and 10 deletions
|
@ -293,7 +293,7 @@ var Config = new Class({
|
|||
/**
|
||||
* @const {Phaser.Types.Core.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object.
|
||||
*/
|
||||
this.audio = GetValue(config, 'audio');
|
||||
this.audio = GetValue(config, 'audio', {});
|
||||
|
||||
// If you do: { banner: false } it won't display any banner at all
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ var DebugHeader = function (game)
|
|||
|
||||
var audioType;
|
||||
|
||||
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
|
||||
if (deviceAudio.webAudio && !audioConfig.disableWebAudio)
|
||||
{
|
||||
audioType = 'Web Audio';
|
||||
}
|
||||
else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
else if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
{
|
||||
audioType = 'No Audio';
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
|
|||
// https://developers.google.com/web/updates/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs
|
||||
// var stream = GetFastValue(config, 'stream', false);
|
||||
|
||||
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
|
||||
if (deviceAudio.webAudio && !audioConfig.disableWebAudio)
|
||||
{
|
||||
return new AudioFile(loader, key, urlConfig, xhrSettings, game.sound.context);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ FileTypesManager.register('audio', function (key, urls, config, xhrSettings)
|
|||
var audioConfig = game.config.audio;
|
||||
var deviceAudio = game.device.audio;
|
||||
|
||||
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
{
|
||||
// Sounds are disabled, so skip loading audio
|
||||
return this;
|
||||
|
|
|
@ -28,12 +28,12 @@ var SoundManagerCreator = {
|
|||
var audioConfig = game.config.audio;
|
||||
var deviceAudio = game.device.audio;
|
||||
|
||||
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
||||
{
|
||||
return new NoAudioSoundManager(game);
|
||||
}
|
||||
|
||||
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
|
||||
if (deviceAudio.webAudio && !audioConfig.disableWebAudio)
|
||||
{
|
||||
return new WebAudioSoundManager(game);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ var WebAudioSoundManager = new Class({
|
|||
{
|
||||
var audioConfig = game.config.audio;
|
||||
|
||||
if (audioConfig && audioConfig.context)
|
||||
if (audioConfig.context)
|
||||
{
|
||||
audioConfig.context.resume();
|
||||
|
||||
|
@ -355,7 +355,7 @@ var WebAudioSoundManager = new Class({
|
|||
this.masterMuteNode.disconnect();
|
||||
this.masterMuteNode = null;
|
||||
|
||||
if (this.game.config.audio && this.game.config.audio.context)
|
||||
if (this.game.config.audio.context)
|
||||
{
|
||||
this.context.suspend();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue