phaser/v3/src/sound/SoundManagerCreator.js
2017-11-17 14:17:59 +01:00

28 lines
814 B
JavaScript

var BaseSoundManager = require('./BaseSoundManager');
var WebAudioSoundManager = require('./webaudio/WebAudioSoundManager');
var SoundManagerCreator = {
create: function (game)
{
var audioConfig = game.config.audio;
var deviceAudio = game.device.Audio;
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
{
// TODO add no audio implementation of BaseSoundManager
return new BaseSoundManager(game);
}
if(deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
{
return new WebAudioSoundManager(game);
}
// TODO return HTML5 Audio sound manager
return new BaseSoundManager(game);
}
};
module.exports = SoundManagerCreator;