Search Unity

How to get a volume of a group?

Discussion in 'Audio & Video' started by e199, Aug 12, 2015.

  1. e199

    e199

    Joined:
    Mar 24, 2015
    Posts:
    101
    Hi, i want to make a inverted connection from volume of Explosion's group to Master's pitch (don't ask me why :D)
    for example:
    vol = -6 pitch= 25
    vol = -60 pitch = 100

    I exposed master's pitch, everything is changing properly, but i found no way to get a volume of a group.

    How to do it?
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Is it possible? I know the API is severely lacking (I wasn't able to tell whether a Group was muted or not for example).
     
  3. HuntKp

    HuntKp

    Joined:
    Jun 1, 2015
    Posts:
    2
    You could expose the Volume of that group, the volume within the Attenuation, and then just do
    GetFloat(string name, out float value);
    to get the volume

    example

    Code (CSharp):
    1. float masterVolume=0;
    2. audioMixer.GetFloat("MasterMixerVolume", out masterVolume);
    I hope that helps.
     
    Last edited: Aug 14, 2015