UnityEssentials
Small but useful tools and features for Unity
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
UnityEngine.AudioSourceManager Class Reference

Component to manage multiple AudioSources (or AudioClips) at the same time (or in the same component) More...

Collaboration diagram for UnityEngine.AudioSourceManager:
Collaboration graph

Public Member Functions

AudioSource PlayClip (AudioClip clip, float volume=1, bool loop=false, float pitch=1, float delay=0f, AudioMixerGroup audioMixerGroup=null)
 Plays the clip. More...
 
List< AudioSource > StopClip (AudioClip clipInAudioSource)
 Stops playing the clip in all AudioSources related to this AudioSoundManager that are playing it. More...
 
AudioSource GetAudioSource (int index)
 Returns the AudioSource with the given index from the list of managed audio sources of this AudioSourceManager. More...
 
void StopAllClips (bool fadeOut=false)
 Stops playing all clips i all AudioSources related to this AudioSourceManager. More...
 
AudioSource GetAudioSource (AudioClip clipInAudioSource)
 Returns an AudioSource that is playing the given clip. More...
 
List< AudioSource > GetAudioSources (AudioClip clipInAudioSource)
 Returns all AudioSources that are playing the given clip. More...
 

Private Member Functions

void Awake ()
 
AudioSource GetFreeAudioSource ()
 
AudioSource AddAudioSource ()
 
AudioSource ConfigureAudioSource (AudioSource audioSource, AudioClip clip, float volume=1, bool loop=false, float pitch=1, AudioMixerGroup audioMixerGroup=null)
 
void FadeOutAudioSource (AudioSource audioSource)
 

Static Private Member Functions

static IEnumerator LowerVolumeAndStopSounds (AudioSource audioSource)
 

Private Attributes

int minimumQuantityOfExistingAudioSources
 
List< AudioSource > audioSources
 

Detailed Description

Component to manage multiple AudioSources (or AudioClips) at the same time (or in the same component)

Definition at line 10 of file AudioSourceManager.cs.

Member Function Documentation

◆ AddAudioSource()

AudioSource UnityEngine.AudioSourceManager.AddAudioSource ( )
private

Definition at line 154 of file AudioSourceManager.cs.

Here is the caller graph for this function:

◆ Awake()

void UnityEngine.AudioSourceManager.Awake ( )
private

Definition at line 127 of file AudioSourceManager.cs.

Here is the call graph for this function:

◆ ConfigureAudioSource()

AudioSource UnityEngine.AudioSourceManager.ConfigureAudioSource ( AudioSource  audioSource,
AudioClip  clip,
float  volume = 1,
bool  loop = false,
float  pitch = 1,
AudioMixerGroup  audioMixerGroup = null 
)
private

Definition at line 163 of file AudioSourceManager.cs.

Here is the caller graph for this function:

◆ FadeOutAudioSource()

void UnityEngine.AudioSourceManager.FadeOutAudioSource ( AudioSource  audioSource)
private

Definition at line 174 of file AudioSourceManager.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAudioSource() [1/2]

AudioSource UnityEngine.AudioSourceManager.GetAudioSource ( AudioClip  clipInAudioSource)

Returns an AudioSource that is playing the given clip.

Parameters
clipInAudioSourceThe clip that must be playing the returned AudioSource.
Returns

Definition at line 89 of file AudioSourceManager.cs.

◆ GetAudioSource() [2/2]

AudioSource UnityEngine.AudioSourceManager.GetAudioSource ( int  index)

Returns the AudioSource with the given index from the list of managed audio sources of this AudioSourceManager.

Parameters
indexThe index of the AudioSource
Returns

Definition at line 60 of file AudioSourceManager.cs.

◆ GetAudioSources()

List<AudioSource> UnityEngine.AudioSourceManager.GetAudioSources ( AudioClip  clipInAudioSource)

Returns all AudioSources that are playing the given clip.

Parameters
clipInAudioSourceThe clip that all returned AudioSources must be playing.
Returns

Definition at line 109 of file AudioSourceManager.cs.

Here is the caller graph for this function:

◆ GetFreeAudioSource()

AudioSource UnityEngine.AudioSourceManager.GetFreeAudioSource ( )
private

Definition at line 141 of file AudioSourceManager.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LowerVolumeAndStopSounds()

static IEnumerator UnityEngine.AudioSourceManager.LowerVolumeAndStopSounds ( AudioSource  audioSource)
staticprivate

Definition at line 179 of file AudioSourceManager.cs.

Here is the caller graph for this function:

◆ PlayClip()

AudioSource UnityEngine.AudioSourceManager.PlayClip ( AudioClip  clip,
float  volume = 1,
bool  loop = false,
float  pitch = 1,
float  delay = 0f,
AudioMixerGroup  audioMixerGroup = null 
)

Plays the clip.

Parameters
clipThe AudioClip to play
volumeThe volume of the AudioSource playing the clip (0.0 to 1.0)
loopLoop the AudioClip?
pitchPitch shift of the AudioSource
delayThe volume of the AudioSource (0.0 to 1.0)
audioMixerGroupThe target group to which the AudioSource should route its signal
Returns

Definition at line 26 of file AudioSourceManager.cs.

Here is the call graph for this function:

◆ StopAllClips()

void UnityEngine.AudioSourceManager.StopAllClips ( bool  fadeOut = false)

Stops playing all clips i all AudioSources related to this AudioSourceManager.

Parameters
fadeOut

Definition at line 69 of file AudioSourceManager.cs.

Here is the call graph for this function:

◆ StopClip()

List<AudioSource> UnityEngine.AudioSourceManager.StopClip ( AudioClip  clipInAudioSource)

Stops playing the clip in all AudioSources related to this AudioSoundManager that are playing it.

Parameters
clipInAudioSourceThe AudioClip that must stop playing.
Returns

Definition at line 44 of file AudioSourceManager.cs.

Here is the call graph for this function:

Member Data Documentation

◆ audioSources

List<AudioSource> UnityEngine.AudioSourceManager.audioSources
private

Definition at line 14 of file AudioSourceManager.cs.

◆ minimumQuantityOfExistingAudioSources

int UnityEngine.AudioSourceManager.minimumQuantityOfExistingAudioSources
private

Definition at line 13 of file AudioSourceManager.cs.


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