|
1 | 1 | 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 |
5 | 5 | 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) { |
13 | 7 | /** |
14 | | - * @property {Phaser.Game} game - Local reference to game. |
| 8 | + * Local reference to game. |
| 9 | + * @property {Phaser.Game} game |
15 | 10 | */ |
16 | 11 | 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 |
19 | 61 | }); |
20 | | - |
21 | 62 | module.exports = BaseSoundManager; |
0 commit comments