Skip to content

Commit 96e313e

Browse files
committed
If you paused a Sound object that is using audio markers and then resumed it, it wouldn't correctly calculate the resume duration - causing the sound to sometimes play into the marker that followed it (thanks @AnderbergE phaserjs#1669)
1 parent 483bb24 commit 96e313e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ We've rolled our own fixes into our version of Pixi, ensuring we keep it as bug-
224224
* Animations are now guarded allowing Sprites with animations to be destroyed from within onUpdate, onLoop or onComplete events (thanks @pnstickne #1685 #1679)
225225
* Text.lineSpacing can now accept negative values without cutting the bottom of the Text object off. The value can never be less than the height of a single line of text (thanks @anthonysapp #1690)
226226
* Text.lineSpacing is no longer applied to the first line of Text, which prevents text from being cut off further down the Text object.
227+
* If you paused a Sound object that is using audio markers and then resumed it, it wouldn't correctly calculate the resume duration - causing the sound to sometimes play into the marker that followed it (thanks @AnderbergE #1669)
227228

228229
### Pixi 2.2.8 Bug Fixes
229230

src/sound/Sound.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,14 +794,16 @@ Phaser.Sound.prototype = {
794794
this._sound.onended = this.onEndedHandler.bind(this);
795795
}
796796

797+
var duration = this.duration - (this.pausedPosition / 1000);
798+
797799
if (typeof this._sound.start === 'undefined')
798800
{
799-
this._sound.noteGrainOn(0, p, this.duration);
801+
this._sound.noteGrainOn(0, p, duration);
800802
//this._sound.noteOn(0); // the zero is vitally important, crashes iOS6 without it
801803
}
802804
else
803805
{
804-
this._sound.start(0, p, this.duration);
806+
this._sound.start(0, p, duration);
805807
}
806808
}
807809
else

0 commit comments

Comments
 (0)