Skip to content

Commit 52118be

Browse files
committed
Sound.onMarkerComplete event is now dispatched when a marker stops. See Sound.onLoop for a looping marker event (thanks registered99, fixes phaserjs#500)
1 parent 66bdf56 commit 52118be

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Bug Fixes:
194194
* Loader.replaceInFileList wouldn't over-write the previous entry correctly, which caused the Loader.image overwrite parameter to fail (thanks basoko, fixes #493)
195195
* If the game was set to NO_SCALE and you swapped orientation, it would pause and resize, then fail to resize when you swapped back (thanks starnut, fixes #258)
196196
* Device no longer things a Windows Phone or Windows Tablet are desktop devices (thanks wombatbuddy, fixes #506)
197+
* Sound.onMarkerComplete event is now dispatched when a marker stops. See Sound.onLoop for a looping marker event (thanks registered99, fixes #500)
197198

198199

199200
TO DO:

src/sound/Sound.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Phaser.Sound.prototype = {
341341

342342
if (this.currentTime >= this.durationMS)
343343
{
344-
console.log(this.currentMarker, 'has hit duration');
344+
// console.log(this.currentMarker, 'has hit duration');
345345
if (this.usingWebAudio)
346346
{
347347
if (this.loop)
@@ -359,6 +359,7 @@ Phaser.Sound.prototype = {
359359
else
360360
{
361361
// console.log('loop3');
362+
this.onMarkerComplete.dispatch(this.currentMarker, this);
362363
this.play(this.currentMarker, 0, this.volume, true, true);
363364
}
364365
}
@@ -709,6 +710,11 @@ Phaser.Sound.prototype = {
709710
this.isPlaying = false;
710711
var prevMarker = this.currentMarker;
711712

713+
if (this.currentMarker !== '')
714+
{
715+
this.onMarkerComplete.dispatch(this.currentMarker, this);
716+
}
717+
712718
this.currentMarker = '';
713719
this.onStop.dispatch(this, prevMarker);
714720

0 commit comments

Comments
 (0)