SmartGames Posted September 28, 2015 Share Posted September 28, 2015 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 statethis.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 statethis.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 georgejfrick 1 Link to comment Share on other sites More sharing options...
georgejfrick Posted September 29, 2015 Share Posted September 29, 2015 I believe when you switch states, everything is lost. The audio object should be gone and need to be re-added. I think the bug here is that the audio doesn't get stopped (what browser are you experiencing this in?) Link to comment Share on other sites More sharing options...
SmartGames Posted September 30, 2015 Author Share Posted September 30, 2015 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 More sharing options...
Recommended Posts