phaser/v3/src/sound/WebAudioSound.js

22 lines
695 B
JavaScript
Raw Normal View History

2017-11-14 15:27:22 +00:00
var Class = require('../utils/Class');
var BaseSound = require('./BaseSound');
// Phaser.Sound.WebAudioSound
var WebAudioSound = new Class({
Extends: BaseSound,
initialize: function WebAudioSound(manager, key, config) {
/**
* [description]
*
* @property {AudioBuffer} audioBuffer
*/
this.audioBuffer = this.manager.game.cache.audio.get(key);
if (!this.audioBuffer) {
console.error('No audio loaded in cache with key: \'' + key + '\'!');
return;
}
config.duration = this.audioBuffer.duration;
2017-11-14 15:27:22 +00:00
BaseSound.call(this, manager, key, config);
}
});
module.exports = WebAudioSound;