Sign in to follow this  
SmartGames

Audio sprite loop gets broken?

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 :)
 
 

Share this post


Link to post
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...

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.