Skip to content

Commit 9af3992

Browse files
Updated sounds property docs, ESLint fix
1 parent e9ef90d commit 9af3992

1 file changed

Lines changed: 2 additions & 34 deletions

File tree

src/sound/BaseSoundManager.js

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @copyright 2018 Photon Storm Ltd.
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
6-
76
var Class = require('../utils/Class');
87
var EventEmitter = require('eventemitter3');
98
var NOOP = require('../utils/NOOP');
@@ -25,12 +24,8 @@ var NOOP = require('../utils/NOOP');
2524
* @param {Phaser.Game} game - Reference to the current game instance.
2625
*/
2726
var BaseSoundManager = new Class({
28-
2927
Extends: EventEmitter,
30-
31-
initialize:
32-
33-
function BaseSoundManager (game)
28+
initialize: function BaseSoundManager (game)
3429
{
3530
EventEmitter.call(this);
3631

@@ -48,7 +43,7 @@ var BaseSoundManager = new Class({
4843
* An array containing all added sounds.
4944
*
5045
* @name Phaser.Sound.BaseSoundManager#sounds
51-
* @type {array}
46+
* @type {Phaser.Sound.BaseSound[]}
5247
* @default []
5348
* @private
5449
* @since 3.0.0
@@ -108,23 +103,20 @@ var BaseSoundManager = new Class({
108103
* @since 3.0.0
109104
*/
110105
this.pauseOnBlur = true;
111-
112106
game.events.on('blur', function ()
113107
{
114108
if (this.pauseOnBlur)
115109
{
116110
this.onBlur();
117111
}
118112
}, this);
119-
120113
game.events.on('focus', function ()
121114
{
122115
if (this.pauseOnBlur)
123116
{
124117
this.onFocus();
125118
}
126119
}, this);
127-
128120
game.events.once('destroy', this.destroy, this);
129121

130122
/**
@@ -172,7 +164,6 @@ var BaseSoundManager = new Class({
172164
* @since 3.0.0
173165
*/
174166
this.unlocked = false;
175-
176167
if (this.locked)
177168
{
178169
this.unlock();
@@ -200,7 +191,6 @@ var BaseSoundManager = new Class({
200191
*
201192
* @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
202193
*/
203-
204194
/**
205195
* Adds a new audio sprite sound into the sound manager.
206196
*
@@ -215,26 +205,21 @@ var BaseSoundManager = new Class({
215205
addAudioSprite: function (key, config)
216206
{
217207
var sound = this.add(key, config);
218-
219208
sound.spritemap = this.game.cache.json.get(key).spritemap;
220-
221209
for (var markerName in sound.spritemap)
222210
{
223211
if (!sound.spritemap.hasOwnProperty(markerName))
224212
{
225213
continue;
226214
}
227-
228215
var marker = sound.spritemap[markerName];
229-
230216
sound.addMarker({
231217
name: markerName,
232218
start: marker.start,
233219
duration: marker.end - marker.start,
234220
config: config
235221
});
236222
}
237-
238223
return sound;
239224
},
240225

@@ -253,9 +238,7 @@ var BaseSoundManager = new Class({
253238
play: function (key, extra)
254239
{
255240
var sound = this.add(key);
256-
257241
sound.once('ended', sound.destroy, sound);
258-
259242
if (extra)
260243
{
261244
if (extra.name)
@@ -290,9 +273,7 @@ var BaseSoundManager = new Class({
290273
playAudioSprite: function (key, spriteName, config)
291274
{
292275
var sound = this.addAudioSprite(key);
293-
294276
sound.once('ended', sound.destroy, sound);
295-
296277
return sound.play(spriteName, config);
297278
},
298279

@@ -465,15 +446,13 @@ var BaseSoundManager = new Class({
465446
*/
466447
this.emit('unlocked', this);
467448
}
468-
469449
for (var i = this.sounds.length - 1; i >= 0; i--)
470450
{
471451
if (this.sounds[i].pendingRemove)
472452
{
473453
this.sounds.splice(i, 1);
474454
}
475455
}
476-
477456
this.sounds.forEach(function (sound)
478457
{
479458
sound.update(time, delta);
@@ -489,12 +468,10 @@ var BaseSoundManager = new Class({
489468
destroy: function ()
490469
{
491470
this.removeAllListeners();
492-
493471
this.forEachActiveSound(function (sound)
494472
{
495473
sound.destroy();
496474
});
497-
498475
this.sounds.length = 0;
499476
this.sounds = null;
500477
this.game = null;
@@ -513,7 +490,6 @@ var BaseSoundManager = new Class({
513490
forEachActiveSound: function (callbackfn, scope)
514491
{
515492
var _this = this;
516-
517493
this.sounds.forEach(function (sound, index)
518494
{
519495
if (!sound.pendingRemove)
@@ -522,15 +498,12 @@ var BaseSoundManager = new Class({
522498
}
523499
});
524500
}
525-
526501
});
527502
Object.defineProperty(BaseSoundManager.prototype, 'rate', {
528-
529503
get: function ()
530504
{
531505
return this._rate;
532506
},
533-
534507
set: function (value)
535508
{
536509
this._rate = value;
@@ -546,15 +519,12 @@ Object.defineProperty(BaseSoundManager.prototype, 'rate', {
546519
*/
547520
this.emit('rate', this, value);
548521
}
549-
550522
});
551523
Object.defineProperty(BaseSoundManager.prototype, 'detune', {
552-
553524
get: function ()
554525
{
555526
return this._detune;
556527
},
557-
558528
set: function (value)
559529
{
560530
this._detune = value;
@@ -570,7 +540,5 @@ Object.defineProperty(BaseSoundManager.prototype, 'detune', {
570540
*/
571541
this.emit('detune', this, value);
572542
}
573-
574543
});
575-
576544
module.exports = BaseSoundManager;

0 commit comments

Comments
 (0)