Skip to content

Commit cae01aa

Browse files
added add method to WebAudioSoundManager class, put super constructor call at the top
1 parent 2a5326f commit cae01aa

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
var Class = require('../utils/Class');
22
var BaseSoundManager = require('./BaseSoundManager');
3+
var WebAudioSound = require('./WebAudioSound');
34
// Phaser.Loader.WebAudioSoundManager
45
var WebAudioSoundManager = new Class({
56
Extends: BaseSoundManager,
67
initialize: function WebAudioSoundManager(game) {
8+
BaseSoundManager.call(this, game);
79
/**
810
* @property {AudioContext} context - The AudioContext being used for playback.
911
* @default
1012
*/
1113
this.context = this.createAudioContext();
12-
BaseSoundManager.call(this, game);
1314
},
1415
createAudioContext: function () {
1516
var audioConfig = this.game.config.audio;
1617
if (audioConfig && audioConfig.context) {
1718
return audioConfig.context;
1819
}
1920
return new (window['AudioContext'] || window['webkitAudioContext'])();
21+
},
22+
add: function (key, config) {
23+
var sound = new WebAudioSound(this, key, config);
24+
this.sounds.push(sound);
25+
return sound;
2026
}
2127
});
2228
module.exports = WebAudioSoundManager;

0 commit comments

Comments
 (0)