# SFX and Music levels control in the game's sound options menu

**URL:** <https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525>\
**Category:** Unity\
**Created:** [June 8, 2016, 3:34pm UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525 "2016-06-08T15:34:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JavierZumer](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/javierzumer/32/1439_2.png) [@JavierZumer](https://qa.fmod.com/u/JavierZumer)\
**Post date:** [June 8, 2016, 3:34pm UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525/1 "2016-06-08T15:34:30Z")

</div>

Hello,

I’m working in a game that has diferentiated volume controls for sfx and music. This was already working before, when the game wasn’t using fmod.

Now that all the sound is managed from fmod I wanted to “link” the existing code concerning audio options to fmod’s buses or vcas.

I have been looking at tutorials, the manual and this Q&A site and the best I found was:

[http://www.fmod.org/documentation/#content/generated/FMOD\_Studio\_VCA\_SetFaderLevel.html](http://www.fmod.org/documentation/#content/generated/FMOD_Studio_VCA_SetFaderLevel.html)

Wich I think is the line of code I need, but I don’t understand how to use it. We are using C#. How do I specify which vca I want to change? Do I have to use the name or an ID? Do I have to declare something beforehand?

Just looking at code doing something similar would be enough for me to try to adapt it to my game but I don’t find anything.

Anyone with experience using vcas or busses with Unity?

Thanks.

---

<div class="post-metadata">

**Author:** ![JavierZumer](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/javierzumer/32/1439_2.png) [@JavierZumer](https://qa.fmod.com/u/JavierZumer)\
**Post date:** [June 8, 2016, 5:10pm UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525/2 "2016-06-08T17:10:49Z")

</div>

I answer myself with my findings in case this is helpful for anyone.

With the help of the programmer, we managed to make it work.  
The code we used is:

public void SetMusicMixerVolume(float value) {  
float dbVolume = (value \* 100f) - 80f;  
RuntimeManager.GetVCA(“vca:/music”).setFaderLevel(value);  
}  
public void SetSFXMixerVolume(float value) {  
float dbVolume = (value \* 100f) - 80f;  
RuntimeManager.GetVCA(“vca:/fx”).setFaderLevel(value);  
}

Hope it helps.

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [June 9, 2016, 12:46am UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525/3 "2016-06-09T00:46:31Z")

</div>

> [@](#):
>
> I answer myself with my findings in case this is helpful for anyone.
> 
> With the help of the programmer, we managed to make it work.  
> The code we used is:
> 
> public void SetMusicMixerVolume(float value) {  
> float dbVolume = (value \* 100f) - 80f;  
> RuntimeManager.GetVCA(“vca:/music”).setFaderLevel(value);  
> }  
> public void SetSFXMixerVolume(float value) {  
> float dbVolume = (value \* 100f) - 80f;  
> RuntimeManager.GetVCA(“vca:/fx”).setFaderLevel(value);  
> }
> 
> Hope it helps.

Just for correctness, linear to db looks like

float db = linear \> 0 ? 20.0f \* Mathf.Log10(linear \* Mathf.Sqrt(2.0f)) : -80.0f;

---

<div class="post-metadata">

**Author:** ![JavierZumer](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/javierzumer/32/1439_2.png) [@JavierZumer](https://qa.fmod.com/u/JavierZumer)\
**Post date:** [June 9, 2016, 10:10am UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525/4 "2016-06-09T10:10:12Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![orrinjones.jr](https://avatars.discourse-cdn.com/v4/letter/o/a88e57/32.png) [@orrinjones.jr](https://qa.fmod.com/u/orrinjones.jr)\
**Post date:** [May 17, 2017, 7:30pm UTC](https://qa.fmod.com/t/sfx-and-music-levels-control-in-the-games-sound-options-menu/12525/5 "2017-05-17T19:30:44Z")

</div>

Thank you very much Damm this was killing me almost a full hour of research before I found this.
