Fixed issue in HTMLAudioSound where mute would get into a recursive loop.

This commit is contained in:
Richard Davey 2018-04-13 12:53:03 +01:00
parent 623df29522
commit c8bbea552d
4 changed files with 26 additions and 64 deletions

View file

@ -8,6 +8,11 @@
* DynamicBitmapText was missing the `letterSpacing` property, causing it to only render the first character in WebGL (thanks @Antriel)
* The Animation component didn't properly check for the animation state in its update, causing pause / resume to fail. Fix #3556 (thanks @Antriel @siolfyr)
* The Scene Manager would never reach an `isBooted` state if you didn't add any Scenes into the Game Config. Fix #3553 (thanks @rgk)
* Fixed issue in HTMLAudioSound where `mute` would get into a recursive loop.
### Updates
* Removed the following properties from BaseSound as they are no longer required. Each class that extends BaseSound implements them directly as getters: `mute`, `loop`, `seek` and `volume`.
### Examples, Documentation and TypeScript

View file

@ -144,51 +144,6 @@ var BaseSound = new Class({
this.config = Extend(this.config, config);
/**
* Boolean indicating whether the sound is muted or not.
* Gets or sets the muted state of this sound.
*
* @name Phaser.Sound.BaseSound#mute
* @type {boolean}
* @default false
* @since 3.0.0
*/
this.mute = false;
/**
* Gets or sets the volume of this sound,
* a value between 0 (silence) and 1 (full volume).
*
* @name Phaser.Sound.BaseSound#volume
* @type {number}
* @default 1
* @since 3.0.0
*/
this.volume = 1;
/**
* Property representing the position of playback for this sound, in seconds.
* Setting it to a specific value moves current playback to that position.
* The value given is clamped to the range 0 to current marker duration.
* Setting seek of a stopped sound has no effect.
*
* @name Phaser.Sound.BaseSound#seek
* @type {number}
* @default 0
* @since 3.0.0
*/
this.seek = 0;
/**
* Flag indicating whether or not the sound or current sound marker will loop.
*
* @name Phaser.Sound.BaseSound#loop
* @type {boolean}
* @default false
* @since 3.0.0
*/
this.loop = false;
/**
* Object containing markers definitions.
*
@ -290,7 +245,7 @@ var BaseSound = new Class({
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 + '\'!');
console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key);
return false;
}
@ -349,9 +304,6 @@ var BaseSound = new Class({
if (typeof markerName !== 'string')
{
// eslint-disable-next-line no-console
console.error('Sound marker name has to be a string!');
return false;
}
@ -366,7 +318,7 @@ var BaseSound = new Class({
if (!this.markers[markerName])
{
// eslint-disable-next-line no-console
console.error('No marker with name \'' + markerName + '\' found for sound \'' + this.key + '\'!');
console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key);
return false;
}

View file

@ -47,7 +47,7 @@ var HTML5AudioSound = new Class({
if (!this.tags)
{
// eslint-disable-next-line no-console
console.error('No audio loaded in cache with key: \'' + key + '\'!');
console.warn('Audio cache entry missing: ' + key);
return;
}
@ -119,6 +119,7 @@ var HTML5AudioSound = new Class({
{
return false;
}
if (!BaseSound.prototype.play.call(this, markerName, config))
{
return false;
@ -610,7 +611,8 @@ var HTML5AudioSound = new Class({
*/
/**
* [description]
* Boolean indicating whether the sound is muted or not.
* Gets or sets the muted state of this sound.
*
* @name Phaser.Sound.HTML5AudioSound#mute
* @type {boolean}
@ -633,8 +635,6 @@ var HTML5AudioSound = new Class({
return;
}
this.setMute();
this.emit('mute', this, value);
}
},
@ -664,7 +664,7 @@ var HTML5AudioSound = new Class({
*/
/**
* [description]
* Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume).
*
* @name Phaser.Sound.HTML5AudioSound#volume
* @type {number}
@ -687,8 +687,6 @@ var HTML5AudioSound = new Class({
return;
}
this.setVolume();
this.emit('volume', this, value);
}
},
@ -839,7 +837,10 @@ var HTML5AudioSound = new Class({
*/
/**
* [description]
* Property representing the position of playback for this sound, in seconds.
* Setting it to a specific value moves current playback to that position.
* The value given is clamped to the range 0 to current marker duration.
* Setting seek of a stopped sound has no effect.
*
* @name Phaser.Sound.HTML5AudioSound#seek
* @type {number}
@ -919,7 +920,7 @@ var HTML5AudioSound = new Class({
*/
/**
* [description]
* Flag indicating whether or not the sound or current sound marker will loop.
*
* @name Phaser.Sound.HTML5AudioSound#loop
* @type {boolean}

View file

@ -45,7 +45,7 @@ var WebAudioSound = new Class({
if (!this.audioBuffer)
{
// eslint-disable-next-line no-console
console.error('No audio loaded in cache with key: \'' + key + '\'!');
console.warn('Audio cache entry missing: ' + key);
return;
}
@ -727,7 +727,8 @@ var WebAudioSound = new Class({
*/
/**
* [description]
* Boolean indicating whether the sound is muted or not.
* Gets or sets the muted state of this sound.
*
* @name Phaser.Sound.WebAudioSound#mute
* @type {boolean}
@ -776,7 +777,7 @@ var WebAudioSound = new Class({
*/
/**
* [description]
* Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume).
*
* @name Phaser.Sound.WebAudioSound#volume
* @type {number}
@ -824,7 +825,10 @@ var WebAudioSound = new Class({
*/
/**
* [description]
* Property representing the position of playback for this sound, in seconds.
* Setting it to a specific value moves current playback to that position.
* The value given is clamped to the range 0 to current marker duration.
* Setting seek of a stopped sound has no effect.
*
* @name Phaser.Sound.WebAudioSound#seek
* @type {number}
@ -902,7 +906,7 @@ var WebAudioSound = new Class({
*/
/**
* [description]
* Flag indicating whether or not the sound or current sound marker will loop.
*
* @name Phaser.Sound.WebAudioSound#loop
* @type {boolean}