2017-11-09 13:37:41 +00:00
|
|
|
var Class = require('../utils/Class');
|
2017-11-10 11:55:32 +00:00
|
|
|
var WebAudioSoundManager = require('./WebAudioSoundManager');
|
2017-11-09 13:37:41 +00:00
|
|
|
|
2017-11-10 12:05:29 +00:00
|
|
|
// Phaser.Loader.BaseSoundManager
|
2017-11-09 13:37:41 +00:00
|
|
|
|
2017-11-10 12:05:29 +00:00
|
|
|
var BaseSoundManager = new Class({
|
2017-11-09 13:37:41 +00:00
|
|
|
|
2017-11-10 11:55:32 +00:00
|
|
|
// TODO define sound manager interface
|
2017-11-09 13:37:41 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2017-11-10 12:05:29 +00:00
|
|
|
BaseSoundManager.create = function (game)
|
2017-11-09 13:37:41 +00:00
|
|
|
{
|
2017-11-10 12:36:13 +00:00
|
|
|
var audioConfig = game.config.audio;
|
|
|
|
var deviceAudio = game.device.Audio;
|
|
|
|
|
|
|
|
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
|
2017-11-09 13:37:41 +00:00
|
|
|
{
|
2017-11-10 12:05:29 +00:00
|
|
|
return new BaseSoundManager(game);
|
2017-11-09 13:37:41 +00:00
|
|
|
}
|
|
|
|
|
2017-11-10 12:36:13 +00:00
|
|
|
if(deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
|
2017-11-09 13:37:41 +00:00
|
|
|
{
|
2017-11-10 11:55:32 +00:00
|
|
|
return new WebAudioSoundManager(game);
|
2017-11-09 13:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO return HTML5 Audio sound manager
|
2017-11-10 12:05:29 +00:00
|
|
|
return new BaseSoundManager(game);
|
2017-11-09 13:37:41 +00:00
|
|
|
};
|
|
|
|
|
2017-11-10 12:05:29 +00:00
|
|
|
module.exports = BaseSoundManager;
|