Skip to content

Commit afbbd7a

Browse files
ESLint fix
1 parent 9af3992 commit afbbd7a

1 file changed

Lines changed: 1 addition & 38 deletions

File tree

src/sound/webaudio/WebAudioSound.js

Lines changed: 1 addition & 38 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 BaseSound = require('../BaseSound');
98

@@ -23,12 +22,8 @@ var BaseSound = require('../BaseSound');
2322
* @param {SoundConfig} [config={}] - An optional config object containing default sound settings.
2423
*/
2524
var WebAudioSound = new Class({
26-
2725
Extends: BaseSound,
28-
29-
initialize:
30-
31-
function WebAudioSound (manager, key, config)
26+
initialize: function WebAudioSound (manager, key, config)
3227
{
3328
if (config === void 0) { config = {}; }
3429

@@ -41,7 +36,6 @@ var WebAudioSound = new Class({
4136
* @since 3.0.0
4237
*/
4338
this.audioBuffer = manager.game.cache.audio.get(key);
44-
4539
if (!this.audioBuffer)
4640
{
4741
// eslint-disable-next-line no-console
@@ -163,13 +157,10 @@ var WebAudioSound = new Class({
163157
* @since 3.0.0
164158
*/
165159
this.hasLooped = false;
166-
167160
this.muteNode.connect(this.volumeNode);
168161
this.volumeNode.connect(manager.destination);
169-
170162
this.duration = this.audioBuffer.duration;
171163
this.totalDuration = this.audioBuffer.duration;
172-
173164
BaseSound.call(this, manager, key, config);
174165
},
175166

@@ -202,7 +193,6 @@ var WebAudioSound = new Class({
202193
* @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event.
203194
*/
204195
this.emit('play', this);
205-
206196
return true;
207197
},
208198

@@ -220,7 +210,6 @@ var WebAudioSound = new Class({
220210
{
221211
return false;
222212
}
223-
224213
if (!BaseSound.prototype.pause.call(this))
225214
{
226215
return false;
@@ -235,7 +224,6 @@ var WebAudioSound = new Class({
235224
* @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event.
236225
*/
237226
this.emit('pause', this);
238-
239227
return true;
240228
},
241229

@@ -253,7 +241,6 @@ var WebAudioSound = new Class({
253241
{
254242
return false;
255243
}
256-
257244
if (!BaseSound.prototype.resume.call(this))
258245
{
259246
return false;
@@ -267,7 +254,6 @@ var WebAudioSound = new Class({
267254
* @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event.
268255
*/
269256
this.emit('resume', this);
270-
271257
return true;
272258
},
273259

@@ -294,7 +280,6 @@ var WebAudioSound = new Class({
294280
* @param {Phaser.Sound.WebAudioSound} sound - Reference to the sound that emitted event.
295281
*/
296282
this.emit('stop', this);
297-
298283
return true;
299284
},
300285

@@ -350,11 +335,9 @@ var WebAudioSound = new Class({
350335
createBufferSource: function ()
351336
{
352337
var _this = this;
353-
354338
var source = this.manager.context.createBufferSource();
355339
source.buffer = this.audioBuffer;
356340
source.connect(this.muteNode);
357-
358341
source.onended = function (ev)
359342
{
360343
if (ev.target === _this.source)
@@ -372,7 +355,6 @@ var WebAudioSound = new Class({
372355

373356
// else was stopped
374357
};
375-
376358
return source;
377359
},
378360

@@ -391,7 +373,6 @@ var WebAudioSound = new Class({
391373
this.source.disconnect();
392374
this.source = null;
393375
}
394-
395376
this.playTime = 0;
396377
this.startTime = 0;
397378
this.stopAndRemoveLoopBufferSource();
@@ -412,7 +393,6 @@ var WebAudioSound = new Class({
412393
this.loopSource.disconnect();
413394
this.loopSource = null;
414395
}
415-
416396
this.loopTime = 0;
417397
},
418398

@@ -575,14 +555,11 @@ var WebAudioSound = new Class({
575555
+ (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate;
576556
}
577557
});
578-
579558
Object.defineProperty(WebAudioSound.prototype, 'mute', {
580-
581559
get: function ()
582560
{
583561
return this.muteNode.gain.value === 0;
584562
},
585-
586563
set: function (value)
587564
{
588565
this.currentConfig.mute = value;
@@ -595,16 +572,12 @@ Object.defineProperty(WebAudioSound.prototype, 'mute', {
595572
*/
596573
this.emit('mute', this, value);
597574
}
598-
599575
});
600-
601576
Object.defineProperty(WebAudioSound.prototype, 'volume', {
602-
603577
get: function ()
604578
{
605579
return this.volumeNode.gain.value;
606580
},
607-
608581
set: function (value)
609582
{
610583
this.currentConfig.volume = value;
@@ -617,11 +590,8 @@ Object.defineProperty(WebAudioSound.prototype, 'volume', {
617590
*/
618591
this.emit('volume', this, value);
619592
}
620-
621593
});
622-
623594
Object.defineProperty(WebAudioSound.prototype, 'seek', {
624-
625595
get: function ()
626596
{
627597
if (this.isPlaying)
@@ -641,7 +611,6 @@ Object.defineProperty(WebAudioSound.prototype, 'seek', {
641611
return 0;
642612
}
643613
},
644-
645614
set: function (value)
646615
{
647616
if (this.manager.context.currentTime < this.startTime)
@@ -666,16 +635,12 @@ Object.defineProperty(WebAudioSound.prototype, 'seek', {
666635
this.emit('seek', this, value);
667636
}
668637
}
669-
670638
});
671-
672639
Object.defineProperty(WebAudioSound.prototype, 'loop', {
673-
674640
get: function ()
675641
{
676642
return this.currentConfig.loop;
677643
},
678-
679644
set: function (value)
680645
{
681646
this.currentConfig.loop = value;
@@ -695,7 +660,5 @@ Object.defineProperty(WebAudioSound.prototype, 'loop', {
695660
*/
696661
this.emit('loop', this, value);
697662
}
698-
699663
});
700-
701664
module.exports = WebAudioSound;

0 commit comments

Comments
 (0)