Anderberg Posted February 9, 2015 Share Posted February 9, 2015 Like all other games I have music and sound effects. However, right now I only have one volume control which changes the game.sound.volume, of course impacting all sounds. I would like to divide this into one volume control for the music and one for the sound effects. Does anyone know if this is built into Phaser somewhere? Or should I keep track of what audio objects that are music and which ones are sound effects? Is it possible to have two sound managers, one for music and one for sfx and would that even be appropriate? I'm happy for your input on the matter Link to comment Share on other sites More sharing options...
trasheater Posted February 9, 2015 Share Posted February 9, 2015 I recently tried to find something slimier to this for phaser and I came up with nothing. To get around this I just two global volumes vars. One for Music and one for SFX. Then created two helper functions to call the sounds with their correct volumes. function playSFX(sound){ if(game.global.volumeSFX > 0){ sound.play('',0,game.global.volumeSFX); }}function playMusic(music){ if(game.global.volumeMusic > 0) music.play('',1,game.global.volumeMusic,true); }}Works well for me but I am not sure if there is a better way to do it. Anderberg 1 Link to comment Share on other sites More sharing options...
Anderberg Posted February 9, 2015 Author Share Posted February 9, 2015 I've been pondering a solutions like yours, maybe that is the way to go for med too.The music will probably always be a single audio file in my case, so that audio object could be saved individually in some variable. Then you iterate over all the sounds that isn't that one when changing sound effect volume. Link to comment Share on other sites More sharing options...
Recommended Posts