mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
ESLint fix
This commit is contained in:
parent
fcad5b12d2
commit
e9ef90da40
1 changed files with 1 additions and 33 deletions
|
@ -3,7 +3,6 @@
|
|||
* @copyright 2018 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var Class = require('../utils/Class');
|
||||
var EventEmitter = require('eventemitter3');
|
||||
var Extend = require('../utils/object/Extend');
|
||||
|
@ -25,12 +24,8 @@ var NOOP = require('../utils/NOOP');
|
|||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*/
|
||||
var BaseSound = new Class({
|
||||
|
||||
Extends: EventEmitter,
|
||||
|
||||
initialize:
|
||||
|
||||
function BaseSound (manager, key, config)
|
||||
initialize: function BaseSound (manager, key, config)
|
||||
{
|
||||
EventEmitter.call(this);
|
||||
|
||||
|
@ -259,14 +254,12 @@ var BaseSound = new Class({
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.markers[marker.name])
|
||||
{
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('addMarker - Marker with name \'' + marker.name + '\' already exists for sound \'' + this.key + '\'!');
|
||||
return false;
|
||||
}
|
||||
|
||||
marker = Extend(true, {
|
||||
name: '',
|
||||
start: 0,
|
||||
|
@ -281,9 +274,7 @@ var BaseSound = new Class({
|
|||
delay: 0
|
||||
}
|
||||
}, marker);
|
||||
|
||||
this.markers[marker.name] = marker;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -303,16 +294,13 @@ var BaseSound = new Class({
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.markers[marker.name])
|
||||
{
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('updateMarker - Marker with name \'' + marker.name + '\' does not exist for sound \'' + this.key + '\'!');
|
||||
return false;
|
||||
}
|
||||
|
||||
this.markers[marker.name] = Extend(true, this.markers[marker.name], marker);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -329,14 +317,11 @@ var BaseSound = new Class({
|
|||
removeMarker: function (markerName)
|
||||
{
|
||||
var marker = this.markers[markerName];
|
||||
|
||||
if (!marker)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.markers[markerName] = null;
|
||||
|
||||
return marker;
|
||||
},
|
||||
|
||||
|
@ -356,20 +341,17 @@ var BaseSound = new Class({
|
|||
play: function (markerName, config)
|
||||
{
|
||||
if (markerName === void 0) { markerName = ''; }
|
||||
|
||||
if (typeof markerName === 'object')
|
||||
{
|
||||
config = markerName;
|
||||
markerName = '';
|
||||
}
|
||||
|
||||
if (typeof markerName !== 'string')
|
||||
{
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Sound marker name has to be a string!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!markerName)
|
||||
{
|
||||
this.currentMarker = null;
|
||||
|
@ -384,17 +366,14 @@ var BaseSound = new Class({
|
|||
console.error('No marker with name \'' + markerName + '\' found for sound \'' + this.key + '\'!');
|
||||
return false;
|
||||
}
|
||||
|
||||
this.currentMarker = this.markers[markerName];
|
||||
this.currentConfig = this.currentMarker.config;
|
||||
this.duration = this.currentMarker.duration;
|
||||
}
|
||||
|
||||
this.resetConfig();
|
||||
this.currentConfig = Extend(this.currentConfig, config);
|
||||
this.isPlaying = true;
|
||||
this.isPaused = false;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -412,10 +391,8 @@ var BaseSound = new Class({
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.isPlaying = false;
|
||||
this.isPaused = true;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -433,10 +410,8 @@ var BaseSound = new Class({
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.isPlaying = true;
|
||||
this.isPaused = false;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -514,7 +489,6 @@ var BaseSound = new Class({
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pendingRemove = true;
|
||||
this.manager = null;
|
||||
this.key = '';
|
||||
|
@ -539,17 +513,14 @@ var BaseSound = new Class({
|
|||
var cent = 1.0005777895065548; // Math.pow(2, 1/1200);
|
||||
var totalDetune = this.currentConfig.detune + this.manager.detune;
|
||||
var detuneRate = Math.pow(cent, totalDetune);
|
||||
|
||||
this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(BaseSound.prototype, 'rate', {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.currentConfig.rate;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.currentConfig.rate = value;
|
||||
|
@ -564,12 +535,10 @@ Object.defineProperty(BaseSound.prototype, 'rate', {
|
|||
}
|
||||
});
|
||||
Object.defineProperty(BaseSound.prototype, 'detune', {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.currentConfig.detune;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.currentConfig.detune = value;
|
||||
|
@ -583,5 +552,4 @@ Object.defineProperty(BaseSound.prototype, 'detune', {
|
|||
this.emit('detune', this, value);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = BaseSound;
|
||||
|
|
Loading…
Reference in a new issue