I can set the volumes for sound and music, but how do I get their values later?

Started by ShiverMeSideways, Mon 05/09/2011 07:16:15

Previous topic - Next topic

ShiverMeSideways

Hello!

I have a short question about the sound volumes, if anyone would be so kind as to help me :)  So, basically, I have two sliders in-game in the options toolbar for music and sound effects. If the sliders change, I can set the volumes for overall music and overall sound effects all fine and dandy, and I've noticed that I can set them basically as defaults which will stay for all current and future play sessions. This is cool.

However, when another play session will be started, I have to set the sliders to the values that match the volumes that had been previously set. My question is: how do I do that?

I have searched around in the manual, and while there is a Game.SetAudioTypeVolume (which I'm using), there is no Game.GetAudioTypeVolume.

While thinking about a solution, I guess I could make my own separate config file and store in that the volumes, but is there a more elegant solution?

Thanks a lot! :)

Wyz

You could back it up manually by storing the value in a variable after it has changed, or using the save game event. There might be a way to retrieve the volume settings that I'm unaware of, in that case forget what I said. :)

So you are making a game huh? :D
Life is like an adventure without the pixel hunts.

monkey0506

The only way I'm currently aware of to check volumes is via the System.Volume for the overall master volume (except speech which has a separate volume) and then the individual volumes of each channel via AudioChannel.Volume (System.AudioChannels could be used to loop through them).

A way to get the default volume for a specific audio type would be useful IMO.

SMF spam blocked by CleanTalk