2017-11-10 18:05:26 +00:00
|
|
|
var BaseSoundManager = require('./BaseSoundManager');
|
2017-11-17 13:17:59 +00:00
|
|
|
var WebAudioSoundManager = require('./webaudio/WebAudioSoundManager');
|
2017-11-10 18:05:26 +00:00
|
|
|
|
|
|
|
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;
|