If I put all my SFX in one mixer channel how can I control the channel with a slider in unity?

In my game I have a menu an audio section and inside of that is a button to toggle audio on and off and a slider to adjust the level of the sound effects. Ideally I would like 100% on the slider to be at 0dB but I can’t wrap my head around how to script it. Any help please?

Edit: I’ve created a snapshot called SFXvol and a corresponding event to house it. Inside the snapshot it says I can automate the volume fader on the sfx channel but where do I go form here? I know how to connect the parameter to the slider in unity.

You could use a snapshot but adjusting the volume of the corresponding buses would be easier, especially when using the Unity GUI Sliders.

FMOD.Studio.Bus sfxBus;
Slider sfxSlider;

sfxBus = FMODUnity.RuntimeManager.GetBus(busName);
sfxBus.getFaderLevel/getVolume(out volume); // Depending on the version of FMOD
sxfSlider.value = volume;

Then you can setup functions for when the slider value changes.

void OnSFXValueChange()
{
volume = sfxSlider.value;
sfxBus.setFaderLever/setVolume(volume); // Depending on the version of FMOD
}

1 Like

Thanks for the help.
This is probably one of those things that will seem super easy to me in the near future but i’m struggling a little to understand at the moment.

first off,
sfxBus = FMODUnity.RuntimeManager.GetBus(busName);

I’m guessing this section all goes inside the awake/start function and where it says ‘(busname)’ I’m not sure what to put. Is it literally like calling a parameter in fmod and writing what I’ve called my bus in single quote marks?

Yep that’s exactly how you could do it.

The bus naming convention is similar to events and banks as well. (eg. “bus:/” is the master bus)

1 Like

I’ve tried some different versions of what you have said and can’t figure it out. I’m getting these as errors, any ideas?

GetBus() is expecting a string.
You will either need to use a string variable or use “bus:/SFX” (with quotation marks).

I’m still getting these errors, any ideas?
http://imgur.com/a/ptbhQ