DemiLib
A collection of Demigiant's utility libraries for Unity (https://github.com/Demigiant/demilib)
DG.DeAudio.DeAudioManager Class Reference

Global AudioManager. Only use its static methods. More...

Inheritance diagram for DG.DeAudio.DeAudioManager:

Static Public Member Functions

static DeAudioSource Crossfade (DeAudioClipData clipData, float fadeDuration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades out then stops all sources in the given DeAudioClipData group, while starting the given DeAudioClipData with a fade-in effect. More...
 
static DeAudioSource Crossfade (DeAudioGroupId groupId, AudioClip clip, float volume=1, float pitch=1, bool loop=false, float fadeDuration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades out then stops all sources in the given group, while starting the given clip with a fade-in effect. More...
 
static void FadeIn (float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades in the global volume More...
 
static void FadeIn (DeAudioGroupId groupId, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades in the given group's volume More...
 
static void FadeIn (DeAudioGroupId groupId, AudioClip clip, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Starts playing the given clip with a fade-in volume effect More...
 
static void FadeIn (AudioClip clip, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Starts playing the given clip external to any group, with a fade-in volume effect More...
 
static void FadeIn (DeAudioClipData clipData, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Starts playing the given DeAudioClipData with a fade-in volume effect More...
 
static void FadeOut (float duration=1.5f, bool ignoreTimeScale=true, bool stopOnComplete=true, TweenCallback onComplete=null)
 Fades out the global volume More...
 
static void FadeOut (DeAudioGroupId groupId, float duration=1.5f, bool ignoreTimeScale=true, bool stopOnComplete=true, TweenCallback onComplete=null)
 Fades out the given group's volume More...
 
static void FadeOut (AudioClip clip, float duration=1.5f, bool ignoreTimeScale=true, bool stopOnComplete=true, TweenCallback onComplete=null)
 Fades out the given clip's volume More...
 
static void FadeSourcesIn (float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades in the volume of every source without touching global and group volumes More...
 
static void FadeSourcesIn (DeAudioGroupId groupId, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades in the volume of each source in the given group (not the given group's volume) More...
 
static void FadeSourcesOut (float duration=1.5f, bool ignoreTimeScale=true, bool stopOnComplete=true, TweenCallback onComplete=null)
 Fades out the volume of every source without touching global and group volumes More...
 
static void FadeSourcesOut (DeAudioGroupId groupId, float duration=1.5f, bool ignoreTimeScale=true, bool stopOnComplete=true, TweenCallback onComplete=null)
 Fades out the volume of each source in the given group (not the given group's volume) More...
 
static void FadeSourcesTo (float to, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades the volume of every source to the given value without touching global and group volumes More...
 
static void FadeSourcesTo (DeAudioGroupId groupId, float to, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades the volume of each source in the given group (not the given group's volume) to the given value More...
 
static void FadeTo (float to, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades the global volume to the given value More...
 
static void FadeTo (DeAudioGroupId groupId, float to, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades the given group's volume to the given value More...
 
static void FadeTo (AudioClip clip, float to, float duration=1.5f, bool ignoreTimeScale=true, TweenCallback onComplete=null)
 Fades the given clip's volume to the given value More...
 
static DeAudioGroup GetAudioGroup (DeAudioGroupId groupId)
 Returns the DeAudioGroup with the given ID, or NULL if there is none More...
 
static AudioMixerGroup GetMixerGroup (DeAudioGroupId groupId)
 Returns the AudioMixerGroup for DeAudioGroup with the given ID, or null if there is none More...
 
static bool Init ()
 Creates a DeAudioManager instance (if it's not present already) and sets it as DontDestroyOnLoad. Returns TRUE if the initialization is successful, FALSE otherwise. More...
 
static bool Init (string resourcePath)
 Instantiates the DeAudioManager prefab at the given Resources path (if it's not present already) and sets it as DontDestroyOnLoad. Returns TRUE if the initialization is successful, FALSE otherwise. More...
 
static bool Init (DeAudioGroup[] audioGroups)
 Creates a DeAudioManager instance (if it's not present already), sets it as DontDestroyOnLoad, and sets it with the given groups. Returns TRUE if the initialization is successful, FALSE otherwise. More...
 
static DeAudioSource Play (DeAudioClipData clipData)
 Plays the given DeAudioClipData on the stored group, with the stored volume, pitch and loop settings. A DeAudioGroup with the given ID must exist in order for the sound to actually play. More...
 
static DeAudioSource Play (DeAudioGroupId groupId, AudioClip clip, float volume=1, float pitch=1, bool loop=false)
 Plays the given sound with the given options and using the given group id. A DeAudioGroup with the given ID must exist in order for the sound to actually play. More...
 
static DeAudioSource Play (AudioClip clip, float volume=1, float pitch=1, bool loop=false)
 Plays the given sound external to any group, using the given options. More...
 
static void SetVolume (float volume)
 Sets the global volume (same as setting globalVolume directly More...
 
static void SetVolume (DeAudioGroupId groupId, float volume)
 Sets the volume for the given group More...
 
static void SetVolume (AudioClip clip, float volume)
 Sets the volume for the given clip More...
 
static void Stop ()
 Stops all sounds More...
 
static void Stop (DeAudioGroupId groupId)
 Stops all sounds for the given group More...
 
static void Stop (AudioClip clip)
 Stops all sounds for the given clip More...
 
static void Unlock ()
 Unlocks all DeAudioSource instances More...
 
static void Unlock (DeAudioGroupId groupId)
 Unlocks all DeAudioSource instances for the given group More...
 
static void Unlock (AudioClip clip)
 Unlocks all DeAudioSource instances for the given clip More...
 

Public Attributes

DeAudioGroup[] fooAudioGroups
 
float fooGlobalVolume = 1
 
int inspectorUpdater
 Used internally inside Unity Editor, as a trick to update DeAudioManager's inspector at every frame More...
 
bool logInfo = false
 
const string Version = "0.5.500"
 

Properties

static float globalVolume [get, set]
 

Detailed Description

Global AudioManager. Only use its static methods.

Must be instantiated only once per project (either manually or via code), and its GameObject is set automatically to DontDestroyOnLoad.

Member Function Documentation

static DeAudioSource DG.DeAudio.DeAudioManager.Crossfade ( DeAudioClipData  clipData,
float  fadeDuration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades out then stops all sources in the given DeAudioClipData group, while starting the given DeAudioClipData with a fade-in effect.

Returns the DeAudioSource instance used to play, or NULL if the clip couldn't be played

static DeAudioSource DG.DeAudio.DeAudioManager.Crossfade ( DeAudioGroupId  groupId,
AudioClip  clip,
float  volume = 1,
float  pitch = 1,
bool  loop = false,
float  fadeDuration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades out then stops all sources in the given group, while starting the given clip with a fade-in effect.

Returns the DeAudioSource instance used to play, or NULL if the clip couldn't be played

static void DG.DeAudio.DeAudioManager.FadeIn ( float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades in the global volume

static void DG.DeAudio.DeAudioManager.FadeIn ( DeAudioGroupId  groupId,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades in the given group's volume

static void DG.DeAudio.DeAudioManager.FadeIn ( DeAudioGroupId  groupId,
AudioClip  clip,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Starts playing the given clip with a fade-in volume effect

static void DG.DeAudio.DeAudioManager.FadeIn ( AudioClip  clip,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Starts playing the given clip external to any group, with a fade-in volume effect

static void DG.DeAudio.DeAudioManager.FadeIn ( DeAudioClipData  clipData,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Starts playing the given DeAudioClipData with a fade-in volume effect

static void DG.DeAudio.DeAudioManager.FadeOut ( float  duration = 1.5f,
bool  ignoreTimeScale = true,
bool  stopOnComplete = true,
TweenCallback  onComplete = null 
)
static

Fades out the global volume

static void DG.DeAudio.DeAudioManager.FadeOut ( DeAudioGroupId  groupId,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
bool  stopOnComplete = true,
TweenCallback  onComplete = null 
)
static

Fades out the given group's volume

static void DG.DeAudio.DeAudioManager.FadeOut ( AudioClip  clip,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
bool  stopOnComplete = true,
TweenCallback  onComplete = null 
)
static

Fades out the given clip's volume

static void DG.DeAudio.DeAudioManager.FadeSourcesIn ( float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades in the volume of every source without touching global and group volumes

static void DG.DeAudio.DeAudioManager.FadeSourcesIn ( DeAudioGroupId  groupId,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades in the volume of each source in the given group (not the given group's volume)

static void DG.DeAudio.DeAudioManager.FadeSourcesOut ( float  duration = 1.5f,
bool  ignoreTimeScale = true,
bool  stopOnComplete = true,
TweenCallback  onComplete = null 
)
static

Fades out the volume of every source without touching global and group volumes

static void DG.DeAudio.DeAudioManager.FadeSourcesOut ( DeAudioGroupId  groupId,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
bool  stopOnComplete = true,
TweenCallback  onComplete = null 
)
static

Fades out the volume of each source in the given group (not the given group's volume)

static void DG.DeAudio.DeAudioManager.FadeSourcesTo ( float  to,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades the volume of every source to the given value without touching global and group volumes

static void DG.DeAudio.DeAudioManager.FadeSourcesTo ( DeAudioGroupId  groupId,
float  to,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades the volume of each source in the given group (not the given group's volume) to the given value

static void DG.DeAudio.DeAudioManager.FadeTo ( float  to,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades the global volume to the given value

static void DG.DeAudio.DeAudioManager.FadeTo ( DeAudioGroupId  groupId,
float  to,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades the given group's volume to the given value

static void DG.DeAudio.DeAudioManager.FadeTo ( AudioClip  clip,
float  to,
float  duration = 1.5f,
bool  ignoreTimeScale = true,
TweenCallback  onComplete = null 
)
static

Fades the given clip's volume to the given value

static DeAudioGroup DG.DeAudio.DeAudioManager.GetAudioGroup ( DeAudioGroupId  groupId)
static

Returns the DeAudioGroup with the given ID, or NULL if there is none

static AudioMixerGroup DG.DeAudio.DeAudioManager.GetMixerGroup ( DeAudioGroupId  groupId)
static

Returns the AudioMixerGroup for DeAudioGroup with the given ID, or null if there is none

static bool DG.DeAudio.DeAudioManager.Init ( )
static

Creates a DeAudioManager instance (if it's not present already) and sets it as DontDestroyOnLoad. Returns TRUE if the initialization is successful, FALSE otherwise.

Use this method if you want to use DeAudioManager without setting up any DeAudioGroup. Though the recommended way is to create a prefab with the required settings and instantiate it once at startup.

static bool DG.DeAudio.DeAudioManager.Init ( string  resourcePath)
static

Instantiates the DeAudioManager prefab at the given Resources path (if it's not present already) and sets it as DontDestroyOnLoad. Returns TRUE if the initialization is successful, FALSE otherwise.

static bool DG.DeAudio.DeAudioManager.Init ( DeAudioGroup[]  audioGroups)
static

Creates a DeAudioManager instance (if it's not present already), sets it as DontDestroyOnLoad, and sets it with the given groups. Returns TRUE if the initialization is successful, FALSE otherwise.

static DeAudioSource DG.DeAudio.DeAudioManager.Play ( DeAudioClipData  clipData)
static

Plays the given DeAudioClipData on the stored group, with the stored volume, pitch and loop settings. A DeAudioGroup with the given ID must exist in order for the sound to actually play.

Returns the DeAudioSource instance used to play, or NULL if the clip couldn't be played

static DeAudioSource DG.DeAudio.DeAudioManager.Play ( DeAudioGroupId  groupId,
AudioClip  clip,
float  volume = 1,
float  pitch = 1,
bool  loop = false 
)
static

Plays the given sound with the given options and using the given group id. A DeAudioGroup with the given ID must exist in order for the sound to actually play.

Returns the DeAudioSource instance used to play, or NULL if the clip couldn't be played

static DeAudioSource DG.DeAudio.DeAudioManager.Play ( AudioClip  clip,
float  volume = 1,
float  pitch = 1,
bool  loop = false 
)
static

Plays the given sound external to any group, using the given options.

Returns the DeAudioSource instance used to play, or NULL if the clip couldn't be played

static void DG.DeAudio.DeAudioManager.SetVolume ( float  volume)
static

Sets the global volume (same as setting globalVolume directly

static void DG.DeAudio.DeAudioManager.SetVolume ( DeAudioGroupId  groupId,
float  volume 
)
static

Sets the volume for the given group

static void DG.DeAudio.DeAudioManager.SetVolume ( AudioClip  clip,
float  volume 
)
static

Sets the volume for the given clip

static void DG.DeAudio.DeAudioManager.Stop ( )
static

Stops all sounds

static void DG.DeAudio.DeAudioManager.Stop ( DeAudioGroupId  groupId)
static

Stops all sounds for the given group

static void DG.DeAudio.DeAudioManager.Stop ( AudioClip  clip)
static

Stops all sounds for the given clip

static void DG.DeAudio.DeAudioManager.Unlock ( )
static

Unlocks all DeAudioSource instances

static void DG.DeAudio.DeAudioManager.Unlock ( DeAudioGroupId  groupId)
static

Unlocks all DeAudioSource instances for the given group

static void DG.DeAudio.DeAudioManager.Unlock ( AudioClip  clip)
static

Unlocks all DeAudioSource instances for the given clip

Member Data Documentation

DeAudioGroup [] DG.DeAudio.DeAudioManager.fooAudioGroups
float DG.DeAudio.DeAudioManager.fooGlobalVolume = 1
int DG.DeAudio.DeAudioManager.inspectorUpdater

Used internally inside Unity Editor, as a trick to update DeAudioManager's inspector at every frame

bool DG.DeAudio.DeAudioManager.logInfo = false
const string DG.DeAudio.DeAudioManager.Version = "0.5.500"

Property Documentation

float DG.DeAudio.DeAudioManager.globalVolume
staticgetset

The documentation for this class was generated from the following file: