Class MixerGroupFader
Unity inspector class for pairing a
Namespace: OmiyaGames.Audio
Assembly: cs.temp.dll.dll
Syntax
public class MixerGroupFader
Remarks
Copyright (c) 2022 Omiya Games Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Revision | Description |
---|---|
Version: 1.0.0 Date: 6/26/2022 Author: Taro Omiya | Initial draft. |
Properties
Group
Gets this layer's
Declaration
public AudioMixerGroup Group { get; }
Property Value
Type | Description |
---|---|
AudioMixerGroup |
ParamName
Gets the Group's parameter name to adjust its volume.
Declaration
public string ParamName { get; }
Property Value
Type | Description |
---|---|
String |
Player
The audio player currently playing on Group.
Declaration
public BackgroundAudio.Player Player { get; set; }
Property Value
Type | Description |
---|---|
BackgroundAudio.Player |
VolumePercent
Sets the volume of Group.
Declaration
public float VolumePercent { get; set; }
Property Value
Type | Description |
---|---|
Single |
Methods
GetFadeProgressionPercent()
Calculates how far StartFadingVolume(Double, Double, Single, Action<MixerGroupFader>) progressed.
Declaration
public float GetFadeProgressionPercent()
Returns
Type | Description |
---|---|
Single | The progress the fading coroutine hase made,
as a percentage between |
Setup(MonoBehaviour, AnimationCurve)
Setup the member variables of this layer
Declaration
public void Setup(MonoBehaviour coroutineRunner, AnimationCurve percentToDbCurve)
Parameters
Type | Name | Description |
---|---|---|
MonoBehaviour | coroutineRunner | The script to run coroutines like StartFadingVolume(Double, Double, Single, Action<MixerGroupFader>). |
AnimationCurve | percentToDbCurve | The curve used to convert a fraction from |
StartFadingVolume(Double, Double, Single, Action<MixerGroupFader>)
Start the volume fading coroutine.
Declaration
public void StartFadingVolume(double startTime, double durationSeconds, float finalVolumePercent, Action<MixerGroupFader> afterFadeFinished = null)
Parameters
Type | Name | Description |
---|---|---|
Double | startTime | The |
Double | durationSeconds | The duration the fade will last, in seconds, normalised by
|
Single | finalVolumePercent | The volume to fade to. |
Action<MixerGroupFader> | afterFadeFinished | Invoked at the end of the |
StopFadingVolume()
Stops the volume fading coroutine.
Declaration
public void StopFadingVolume()