Class VolumeBinder
Generic way to edit and bind the volume of a channel (AudioMixerGroup) to the local storage
Namespace: GGL.Audio
Assembly: GGL.dll
Syntax
[HelpURL("https://ggl.yoannhaffner.com/articles/audio.html#interaction")]
public class VolumeBinder : MonoBehaviour
Examples
VolumeSlider is a good example of what you can do.
Fields
| Edit this page View SourceMAX_VOLUME
Declaration
protected const float MAX_VOLUME = 1
Field Value
Type | Description |
---|---|
float | Maximal value used for setting volume. |
MIN_VOLUME
Declaration
protected const float MIN_VOLUME = 0.0001
Field Value
Type | Description |
---|---|
float | Minimal value used for setting volume. |
channel
Declaration
[SerializeField]
protected AudioChannel channel
Field Value
Type | Description |
---|---|
AudioChannel | The channel to bind and edit. |
Properties
| Edit this page View SourceValue
Declaration
protected float Value { get; }
Property Value
Type | Description |
---|---|
float | The current volume in range [0;1]. |
Methods
| Edit this page View SourceInit()
Read the local storage to initialize the channel volume. This method is called once the component is enabled.
Declaration
public virtual void Init()
Remarks
If not enabled, do not forget to call this method once the scene is loaded.
Set(float)
Set a new volume to channel and local storage
Declaration
public virtual void Set(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | Volume in range ]0;1] |