mirror of
https://github.com/photonstorm/phaser
synced 2025-02-26 04:17:08 +00:00
updated BaseSound fields docs
updated sound config initialization
This commit is contained in:
parent
f11dcf3979
commit
0363116383
1 changed files with 89 additions and 14 deletions
|
@ -5,32 +5,107 @@ var EventDispatcher = require('../events/EventDispatcher');
|
||||||
var BaseSound = new Class({
|
var BaseSound = new Class({
|
||||||
initialize: function BaseSound(manager, key, config) {
|
initialize: function BaseSound(manager, key, config) {
|
||||||
/**
|
/**
|
||||||
* Local reference to sound manager.
|
* Local reference to the sound manager.
|
||||||
|
*
|
||||||
* @property {Phaser.Sound.BaseSoundManager} manager
|
* @property {Phaser.Sound.BaseSoundManager} manager
|
||||||
*/
|
*/
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {string} key
|
||||||
|
*/
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.config = Extend({
|
/**
|
||||||
mute: false,
|
* [description]
|
||||||
volume: 1,
|
*
|
||||||
rate: 1,
|
* Duration set explicitly, rest of default values
|
||||||
seek: 0,
|
* will be set by other properties setters.
|
||||||
loop: false,
|
*
|
||||||
pan: 0,
|
* @property {ISoundConfig} config
|
||||||
duration: 0 // TODO set duration to correct value
|
*/
|
||||||
}, config);
|
this.config = {
|
||||||
this.isPlaying = false;
|
duration: 0
|
||||||
this.markers = {};
|
};
|
||||||
this.currentMarker = '';
|
/**
|
||||||
this.fadeTween = null; // TODO see how to use global tween
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {boolean} mute
|
||||||
|
*/
|
||||||
this.mute = false;
|
this.mute = false;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {number} volume
|
||||||
|
*/
|
||||||
this.volume = 1;
|
this.volume = 1;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {number} rate
|
||||||
|
*/
|
||||||
this.rate = 1;
|
this.rate = 1;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {number} seek
|
||||||
|
*/
|
||||||
this.seek = 0;
|
this.seek = 0;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {boolean} loop
|
||||||
|
*/
|
||||||
this.loop = false;
|
this.loop = false;
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {number} pan
|
||||||
|
*/
|
||||||
this.pan = 0;
|
this.pan = 0;
|
||||||
|
this.config = Extend(this.config, config);
|
||||||
|
/**
|
||||||
|
* Reference to the currently used config.
|
||||||
|
* It could be default config or marker config.
|
||||||
|
*
|
||||||
|
* @property {ISoundConfig} currentConfig
|
||||||
|
*/
|
||||||
|
this.currentConfig = this.config;
|
||||||
|
/**
|
||||||
|
* Flag indicating if sound is currently playing.
|
||||||
|
*
|
||||||
|
* @property {boolean} isPlaying
|
||||||
|
*/
|
||||||
|
this.isPlaying = false;
|
||||||
|
/**
|
||||||
|
* Object containing markers definitions.
|
||||||
|
*
|
||||||
|
* @property {{}} markers
|
||||||
|
*/
|
||||||
|
this.markers = {};
|
||||||
|
/**
|
||||||
|
* Name of the currently played marker.
|
||||||
|
* If no marker is played, but instead the whole sound
|
||||||
|
* the value is an empty string - ''.
|
||||||
|
*
|
||||||
|
* @property {string} currentMarker
|
||||||
|
*/
|
||||||
|
this.currentMarker = '';
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {Phaser.Tween}
|
||||||
|
*/
|
||||||
|
this.fadeTween = null; // TODO see how to use global tween
|
||||||
|
/**
|
||||||
|
* Event dispatches used to handle all sound instance
|
||||||
|
* relevant events.
|
||||||
|
*
|
||||||
|
* @property {Phaser.Events.EventDispatcher}
|
||||||
|
*/
|
||||||
this.events = new EventDispatcher();
|
this.events = new EventDispatcher();
|
||||||
},
|
},
|
||||||
|
// TODO set default methods to NOOP if not used
|
||||||
addMarker: function (marker) {
|
addMarker: function (marker) {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue