custom max sound volume or music relative to slider value

Started by rmonic79, Wed 19/04/2017 23:19:41

Previous topic - Next topic

rmonic79

Hi guys we have a big issue with our game. We are trying to keep the volume of sounds and music in relation to each other when we raise or lower the value of the slider. To be clear if i assigns a sound to an audio channel at volume 80 when the slider is at its maximum (let's say it's 100), lowering the slider to 80 i would like to have the sound at 64 (which is 80% of 80) while now it wiil be 100%.
We are using percentage of slider in rep exc Always but is very tediuos and there's a lot of code to write room by room and sound by sound.
Anyone know a better solution for this?

Snarky

CW sketches a solution here: http://www.adventuregamestudio.co.uk/forums/index.php?topic=54251.msg636549532#msg636549532

The problem is that the only volume information stored is the actual currently playing volume of each audio channel. Whether that's been set especially for a particular clip or is a global slider setting (or some combination) doesn't make a difference to AGS.

So one solution is to make an array to store the "basic" volume of each currently playing clip (i.e. for each audio channel). You also have an overall volume value based on the volume slider. Every time you play a clip, you store the "basic" volume in the array, but actually play it at a volume calculated by multiplying the volume slider value and the basic volume value together. Then whenever you change the volume slider, call a function applyVolume() that goes through each currently playing clip (i.e. each audio channel) and recalculates the volumes.

SMF spam blocked by CleanTalk