Jump to content

Audio sprite loop gets broken?


SmartGames
 Share

Recommended Posts

Hey all,

 

i've noticed a weird behaviour from the soundManager. The loop of an audio sprite's marker gets broken after switching states.

 

So to further help explain my problem, this is how i am doing things:

 

// start preload state

this.load.audio("audioSprite", ["assets/audio/audioSprite.mp3", "assets/audio/audioSprite.ogg"]);

 

then when onLoadComplete gets called:

 

this.game.audioSprite = this.game.add.audio("audioSprite");
this.game.audioSprite.allowMultiple = true;
 
this.game.audioSprite.addMarker("themeSong", 0, 19.2, 1, true); //(key, startingPoint, duration, volume, loop)
and 7 more markers
//end preload state
 
//start menu state
this.game.audioSprite.play("themeSong");
//end menu state
 
As long as i do not switch states, the "themeSong" will continue to play and loop, but if i switch state to, say levelSelect,
the "themeSong" will continue to play to the end of the specified duration but will not loop!?
 
Any help is appreciated :)
 
 
Link to comment
Share on other sites

The problem was that i destroyed everything in the state i left when switching states by calling this.game.state.clearCurrentState().

But nevermind, i switched to Howler.js for audio, also because loading more than one audio file and then trying to play one of them was crashing Internet Explorer, even with audio sprites...

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...