Skip to content

Commit d43eb0d

Browse files
added basic methods and properties to the BaseSoundManager class
1 parent 812638a commit d43eb0d

1 file changed

Lines changed: 55 additions & 14 deletions

File tree

v3/src/sound/BaseSoundManager.js

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,62 @@
11
var Class = require('../utils/Class');
2-
3-
// Phaser.Loader.BaseSoundManager
4-
2+
var NOOP = require('../utils/NOOP');
3+
var EventDispatcher = require('../events/EventDispatcher');
4+
// Phaser.Sound.BaseSoundManager
55
var BaseSoundManager = new Class({
6-
7-
// TODO define sound manager interface
8-
9-
initialize:
10-
11-
function BaseSoundManager (game)
12-
{
6+
initialize: function BaseSoundManager(game) {
137
/**
14-
* @property {Phaser.Game} game - Local reference to game.
8+
* Local reference to game.
9+
* @property {Phaser.Game} game
1510
*/
1611
this.game = game;
17-
}
18-
12+
/**
13+
* Global mute setting.
14+
* @property {boolean} mute
15+
*/
16+
this.mute = false;
17+
/**
18+
* Global volume setting.
19+
* @property {number} volume
20+
*/
21+
this.volume = 1;
22+
/**
23+
* Global playback rate at which the audio asset will be played.
24+
* Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
25+
* and 2.0 doubles the audio's playback speed.
26+
* @property {number} rate
27+
*/
28+
this.rate = 1;
29+
/**
30+
* Global amount of panning to apply.
31+
* The value can range between -1 (full left pan) and 1 (full right pan).
32+
* @property {number} pan
33+
*/
34+
this.pan = 0;
35+
// TODO add fields for global spatialization options
36+
/**
37+
* Set to true to have all sound muted when the Phaser game
38+
* pauses (such as on loss of focus), or set to false to keep audio playing, regardless of
39+
* the game pause state. You may need to do this should you wish to control audio muting
40+
* via external DOM buttons or similar.
41+
* @property {boolean} muteOnPause
42+
*/
43+
this.muteOnPause = true;
44+
/**
45+
* [description]
46+
*
47+
* @property {Phaser.Events.EventDispatcher} events
48+
*/
49+
this.events = new EventDispatcher();
50+
},
51+
add: NOOP,
52+
addAudioSprite: NOOP,
53+
addOscillator: NOOP,
54+
remove: NOOP,
55+
removeByKey: NOOP,
56+
pauseAll: NOOP,
57+
resumeAll: NOOP,
58+
stopAll: NOOP,
59+
update: NOOP,
60+
destroy: NOOP
1961
});
20-
2162
module.exports = BaseSoundManager;

0 commit comments

Comments
 (0)