Project Arrhythmia
A video game developed by Vitamin Games.
Loading...
Searching...
No Matches
AudioManager Class Reference

This class manages the audio in the game. More...

+ Inheritance diagram for AudioManager:

Public Member Functions

override void OnAwake ()
 
void Start ()
 
void SetMusicTimeWithDelay (float _time, float _delay)
 
void SetMusicTime (float _time)
 
bool PlayMusic (string _musicName, bool _loop=true)
 
bool PlayMusic (AudioClip _clip, bool _loop=true)
 
bool ForcePlayMusic (AudioClip _clip, bool _loop=true, bool _immediate=false)
 
void StopAllMusic (float _fade=FadeTime)
 Stop playing all the music.
 
void SetAllMusicLevels (float _volume)
 Stop playing all the music.
 
void ApplyLowPass (float _attack=0.1f, float _hold=0.1f, float _decay=0.1f)
 
void ApplyLowPassResonance (float _attack=0.1f, float _hold=0.1f, float _decay=0.1f)
 
void PlaySound (string _soundName, float _volume=1f)
 
- Public Member Functions inherited from SingletonBase< AudioManager >
virtual void Awake ()
 

Public Attributes

bool debug = false
 
string currentSongGroup = ""
 
int activeSource = 0
 
List< string > currentlyPlayingSFX
 
AudioSource sfxSource
 
AudioSource[] musicSources
 
Tween[] musicSourcesTweens
 
AudioMixer audioMixer
 
- Public Attributes inherited from SingletonBase< AudioManager >
bool DestroySingleton
 

Properties

float TimeScaleMulti [get, set]
 
AudioSource CurrentAudioSource [get]
 
AudioClip CurrentAudioClip [get]
 
float AudioPlaybackSpeed [get, set]
 
bool IsPlaying [get]
 
- Properties inherited from SingletonBase< AudioManager >
static T Inst [get]
 

Private Member Functions

void FixedUpdate ()
 
float EvaluateVolume (float _volume)
 
void UpdateAudioMixer ()
 
bool PlayMusic (string _name, AudioClip _clip, bool _loop, bool _force=false, bool _immediate=false)
 
void PlaySound (string _soundName, string _group="SFX", float _volume=1f)
 
IEnumerator DestroySFXSource (string _soundName, AudioSource _audioSource, float delay)
 

Private Attributes

AnimationCurve VolumeCurve
 
float timeScaleMulti = 1
 
SoundLibrary library
 
Tween[] StopMusicTween = new Tween[4]
 

Static Private Attributes

const string className = "[<color=#2196F3>AudioManager</color>] \n"
 
const float LowVolume = -80f
 
const float FadeTime = 1
 

Detailed Description

This class manages the audio in the game.

It is responsible for playing music and sound effects, applying audio effects, and controlling the audio mixer. The class provides functions to play a sound effect by name, and to destroy a sound effect source after it has finished playing. It also contains a coroutine to apply a low pass filter to the music.

The class inherits from SingletonBase<AudioManager> to ensure that only one instance of the AudioManager exists. It uses the [RequireComponent] attribute to automatically add required components when the script is added to a GameObject.

The class contains several public and private fields for managing audio, including arrays of AudioSource and Tween objects, an AudioMixer, a SoundLibrary, and various other fields for managing audio state and settings.

The class provides several public methods for controlling audio playback, including methods to play, stop, and adjust the volume of music, and to play sound effects. It also provides methods to apply a low pass filter to the music, and to set the time of the music with a delay.

The class also contains several private methods for playing sound effects and destroying sound effect sources after they have finished playing.

Member Function Documentation

◆ OnAwake()

override void AudioManager.OnAwake ( )
virtual

Reimplemented from SingletonBase< AudioManager >.


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