Bus volume is reversed?

Hey support,

using Unity 6000.0.33f1
using Fmod 2.02.20

I have an UI where I change the volumes of each mixer like master, music etc.
the respective UI sliders have values from 0 to 1 and I use this code to change the volume of the buses:

 private void OnChangeAudioMixerVolumeEvent(ChangeAudioMixerVolumeEvent obj)
        {
            Bus   bus    = default;
            float volume = Mathf.Log10(obj.VolumeSliderValue) * 20f;
            switch (obj.VolumeType)
            {
                case VolumeType.MASTER_VOLUME:
                    bus = RuntimeManager.GetBus("bus:/");
                    break;
                case VolumeType.MUSIC_VOLUME:
                    bus = RuntimeManager.GetBus("bus:/Music");
                    break;
                case VolumeType.SFX_VOLUME:
                    bus = RuntimeManager.GetBus("bus:/SFX_Gameplay");
                    break;
                case VolumeType.UI_SFX_VOLUME:
                    bus = RuntimeManager.GetBus("bus:/SFX_UI");
                    break;
                case VolumeType.VOICEOVER_VOLUME:
                    bus = RuntimeManager.GetBus("bus:/VoiceOver");
                    break;
            }

            bus.setVolume(volume);
            bus.getVolume(out float vol);
            Log.Info($"Volume now: {vol}");
        }

now the code works, but like when the slider value in the UI is set to 0 the music volume is at -80 which is correct, but it is super loud while when the ui slider is at 1 the music volume is at 0, which is correct, but the issue is that then it is totally quiet. The logs put out the correct values
But shouldnt it be the other way around? Where’s the mistake in my code? Or is maybe even the soundevents in fmod? They are all setup as default at 0db from what I can tell.

Hi,

Thank you for sharing the code snippet.

It looks like the issue may be caused by this line, as bus.setVolume is expects a linear value between 0.0 and 1.0, but this code converts the slider’s value to decibels, which would breaks the expected value range.

For example, when obj.VolumeSliderValue = 1, Mathf.Log10(1)*20 = 0, so you are passing 0 to .setVolume(), which in FMOD linear volume actually means mute.

Hope this helps! let me know if the issue persists.