AudioManager
1.3.0
A simple way for programmers to manage and control their 2D game’s background music and sound effects
|
The manager of all things with regards to sound More...
Public Member Functions | |
void | PlayBGM (AudioClip clip, MusicTransition transition, float transition_duration, float volume, float pitch, float playback_position=0) |
Plays a background music. More... | |
void | PlayBGM (AudioClip clip, MusicTransition transition, float transition_duration, float volume) |
Plays a background music. More... | |
void | PlayBGM (AudioClip clip, MusicTransition transition, float transition_duration) |
Plays a background music. More... | |
void | PlayBGM (AudioClip clip, MusicTransition transition) |
Plays a background music. More... | |
void | PlayBGM (AudioClip clip) |
Plays a background music using the swift the transition mode. More... | |
void | PlayBGM (string clip_path, MusicTransition transition, float transition_duration, float volume, float pitch, float playback_position=0) |
Plays a background music. More... | |
void | PlayBGM (string clip_path, MusicTransition transition, float transition_duration, float volume) |
Plays a background music. More... | |
void | PlayBGM (string clip_path, MusicTransition transition, float transition_duration) |
Plays a background music. More... | |
void | PlayBGM (string clip_path, MusicTransition transition) |
Plays a background music. More... | |
void | PlayBGM (string clip_path) |
Plays a background music using the swift the transition mode. More... | |
void | StopBGM () |
Stops the playing background music More... | |
void | PauseBGM () |
Pauses the playing background music More... | |
void | ResumeBGM () |
Resumes the playing background music More... | |
int | IndexOfSoundFxPool (string name, bool singleton=false) |
Returns the index of a sound effect in pool if one exists. More... | |
AudioSource | PlaySFX (AudioClip clip, Vector2 location, float duration, float volume, bool singleton=false, float pitch=1f, Action callback=null) |
Plays a sound effect for a duration of time at a given location in world space and calls the specified callback function after the time is over. More... | |
AudioSource | PlaySFX (AudioClip clip, Vector2 location, float duration, bool singleton=false, Action callback=null) |
Plays a sound effect for a duration of time at a given location in world space and calls the specified callback function after the time is over More... | |
AudioSource | PlaySFX (AudioClip clip, float duration, bool singleton=false, Action callback=null) |
Plays a sound effect for a duration of time and calls the specified callback function after the time is over More... | |
AudioSource | RepeatSFX (AudioClip clip, Vector2 location, int repeat, float volume, bool singleton=false, float pitch=1f, Action callback=null) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over. More... | |
AudioSource | RepeatSFX (AudioClip clip, Vector2 location, int repeat, bool singleton=false, Action callback=null) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over. More... | |
AudioSource | RepeatSFX (AudioClip clip, int repeat, bool singleton=false, Action callback=null) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over. More... | |
AudioSource | PlayOneShot (AudioClip clip, Vector2 location, float volume, float pitch=1f, Action callback=null) |
Plays a sound effect once at a location in world space and calls the specified callback function after the sound is over More... | |
AudioSource | PlayOneShot (AudioClip clip, Vector2 location, Action callback=null) |
Plays a sound effect once at a location in world space More... | |
AudioSource | PlayOneShot (AudioClip clip, Action callback=null) |
Plays a sound effect once and calls the specified callback function after the sound is over More... | |
void | PauseAllSFX () |
Pauses all the sound effects in the game More... | |
void | ResumeAllSFX () |
Resumes all the sound effect in the game More... | |
void | StopAllSFX () |
Stops all the sound effects in the game More... | |
AudioClip | LoadClip (string path, bool add_to_playlist=false) |
Loads an AudioClip from the Resources folder More... | |
void | LoadClip (string path, AudioType audio_type, bool add_to_playlist, Action< AudioClip > callback) |
Loads an AudioClip from the specified url path. More... | |
void | SaveBGMPreferences () |
Stores the volume and the mute status of the background music to disk. More... | |
void | SaveSFXPreferences () |
Stores the volume and the mute status of the sound effect to disk. More... | |
void | ClearAllPreferences () |
Removes all key and value pertaining to sound options from disk More... | |
void | SaveAllPreferences () |
Writes all modified sound options or preferences to disk More... | |
void | EmptyPlaylist () |
Clear the list of audio clips More... | |
void | AddToPlaylist (AudioClip clip) |
Add a sound clip to list of audio clips More... | |
void | RemoveFromPlaylist (AudioClip clip) |
Add a sound clip to asset list pool More... | |
AudioClip | GetClipFromPlaylist (string clip_name) |
Gets the AudioClip reference from the name supplied More... | |
void | LoadPlaylist (string path, bool overwrite) |
Load all sound clips from the Resources folder path into the asset list pool More... | |
Properties | |
static AudioManager | Instance [get] |
Current and only running instance of the AudioManager More... | |
AudioClip | CurrentMusicClip [get] |
Gets the current music clip. More... | |
List< SoundEffect > | SoundFxPool [get] |
Current list or pool of the sound effects More... | |
List< AudioClip > | Playlist [get] |
List of audio clips attached to the AudioManager More... | |
bool | IsMusicPlaying [get] |
Is the AudioManager processing any background music More... | |
float | MusicVolume [get, set] |
Gets or sets the music volume. More... | |
float | SoundVolume [get, set] |
Gets or sets the sound volume. More... | |
bool | IsMusicOn [get, set] |
Gets or sets a value indicating whether the music is on. More... | |
bool | IsSoundOn [get, set] |
Gets or sets a value indicating whether the sound is on. More... | |
bool | IsMasterMute [get, set] |
Gets or sets a value indicating whether this instance is master mute. More... | |
The manager of all things with regards to sound
void Papae.UnitySDK.Managers.AudioManager.AddToPlaylist | ( | AudioClip | clip | ) |
Add a sound clip to list of audio clips
clip | Sound clip data |
void Papae.UnitySDK.Managers.AudioManager.ClearAllPreferences | ( | ) |
Removes all key and value pertaining to sound options from disk
void Papae.UnitySDK.Managers.AudioManager.EmptyPlaylist | ( | ) |
Clear the list of audio clips
AudioClip Papae.UnitySDK.Managers.AudioManager.GetClipFromPlaylist | ( | string | clip_name | ) |
Gets the AudioClip reference from the name supplied
clip_name | The name of the clip in the asset list pool |
int Papae.UnitySDK.Managers.AudioManager.IndexOfSoundFxPool | ( | string | name, |
bool | singleton = false |
||
) |
Returns the index of a sound effect in pool if one exists.
name | The name of the sound effect. |
singleton | Is the sound effect a singleton. |
AudioClip Papae.UnitySDK.Managers.AudioManager.LoadClip | ( | string | path, |
bool | add_to_playlist = false |
||
) |
Loads an AudioClip from the Resources folder
path | Path name of the target clip from the Resources folder |
add_to_playlist | Option to add loaded clip into the playlist for future reference |
void Papae.UnitySDK.Managers.AudioManager.LoadClip | ( | string | path, |
AudioType | audio_type, | ||
bool | add_to_playlist, | ||
Action< AudioClip > | callback | ||
) |
Loads an AudioClip from the specified url path.
path | The url path of the audio clip to download. For example: 'http://www.my-server.com/audio.ogg' |
audio_type | The type of audio encoding for the downloaded clip. See AudioType |
add_to_playlist | Option to add loaded clip into the playlist for future reference |
callback | Action callback to be invoked after clip has finished loading |
void Papae.UnitySDK.Managers.AudioManager.LoadPlaylist | ( | string | path, |
bool | overwrite | ||
) |
Load all sound clips from the Resources folder path into the asset list pool
path | Pathname of the target folder. When using the empty string (i.e, ""), the function will load the entire audio clip content(s) of the resource folder |
overwrite | Overwrites the current content(s) of the playlist. |
void Papae.UnitySDK.Managers.AudioManager.PauseAllSFX | ( | ) |
Pauses all the sound effects in the game
void Papae.UnitySDK.Managers.AudioManager.PauseBGM | ( | ) |
Pauses the playing background music
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | AudioClip | clip, |
MusicTransition | transition, | ||
float | transition_duration, | ||
float | volume, | ||
float | pitch, | ||
float | playback_position = 0 |
||
) |
Plays a background music.
Only one background music can be active at a time.
clip | The audio data to play |
transition | How should the music change from the current to the next |
transition_duration | Time in secs it takes to transition. |
volume | Playback volume. |
pitch | Pitch level of the clip. |
playback_position | Play position of the clip. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | AudioClip | clip, |
MusicTransition | transition, | ||
float | transition_duration, | ||
float | volume | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip | The audio data to play |
transition | How should the music change from the current to the next. |
transition_duration | Time in secs it takes to transition. |
volume | Playback volume. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | AudioClip | clip, |
MusicTransition | transition, | ||
float | transition_duration | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip | The audio data to play |
transition | How should the music change from the current to the next. |
transition_duration | Time in secs it takes to transition. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | AudioClip | clip, |
MusicTransition | transition | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip | The audio data to play |
transition | How should the music change from the current to the next. Use MusicTransition to specify type |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | AudioClip | clip | ) |
Plays a background music using the swift the transition mode.
Only one background music can be active at a time.
clip | The audio data to play |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | string | clip_path, |
MusicTransition | transition, | ||
float | transition_duration, | ||
float | volume, | ||
float | pitch, | ||
float | playback_position = 0 |
||
) |
Plays a background music.
Only one background music can be active at a time.
clip_path | Path name of the target clip from the Resources folder |
transition | How should the music change from the current to the next. |
transition_duration | Time in secs it takes to transition. |
volume | Playback volume. |
pitch | Pitch level of the clip. |
playback_position | Play position of the clip. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | string | clip_path, |
MusicTransition | transition, | ||
float | transition_duration, | ||
float | volume | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip_path | Path name of the target clip from the Resources folder |
transition | How should the music change from the current to the next. |
transition_duration | Time in secs it takes to transition. |
volume | Playback volume. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | string | clip_path, |
MusicTransition | transition, | ||
float | transition_duration | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip_path | Path name of the target clip from the Resources folder |
transition | How should the music change from the current to the next. |
transition_duration | Time in secs it takes to transition. |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | string | clip_path, |
MusicTransition | transition | ||
) |
Plays a background music.
Only one background music can be active at a time.
clip_path | Path name of the target clip from the Resources folder |
transition | How should the music change from the current to the next. Use MusicTransition to specify type |
void Papae.UnitySDK.Managers.AudioManager.PlayBGM | ( | string | clip_path | ) |
Plays a background music using the swift the transition mode.
Only one background music can be active at a time.
clip_path | Path name of the target clip from the Resources folder |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlayOneShot | ( | AudioClip | clip, |
Vector2 | location, | ||
float | volume, | ||
float | pitch = 1f , |
||
Action | callback = null |
||
) |
Plays a sound effect once at a location in world space and calls the specified callback function after the sound is over
clip | The audio data to play |
location | World location of the clip |
volume | Playback volume. |
pitch | Pitch level of the clip. |
callback | Action callback to be invoked after clip has finished playing |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlayOneShot | ( | AudioClip | clip, |
Vector2 | location, | ||
Action | callback = null |
||
) |
Plays a sound effect once at a location in world space
clip | The audio data to play |
location | World location of the clip |
callback | Action callback to be invoked after clip has finished playing |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlayOneShot | ( | AudioClip | clip, |
Action | callback = null |
||
) |
Plays a sound effect once and calls the specified callback function after the sound is over
clip | The audio data to play |
callback | Action callback to be invoked after clip has finished playing |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlaySFX | ( | AudioClip | clip, |
Vector2 | location, | ||
float | duration, | ||
float | volume, | ||
bool | singleton = false , |
||
float | pitch = 1f , |
||
Action | callback = null |
||
) |
Plays a sound effect for a duration of time at a given location in world space and calls the specified callback function after the time is over.
clip | The audio data to play |
location | World location of the clip |
duration | The length in time the clip should play |
volume | Playback volume. |
singleton | Is the sound effect a singleton. |
pitch | Pitch level of the clip. |
callback | Action callback to be invoked after the sound has finished. |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlaySFX | ( | AudioClip | clip, |
Vector2 | location, | ||
float | duration, | ||
bool | singleton = false , |
||
Action | callback = null |
||
) |
Plays a sound effect for a duration of time at a given location in world space and calls the specified callback function after the time is over
clip | The audio data to play |
location | World location of the clip |
duration | The length in time the clip should play |
singleton | Is the sound effect a singleton. |
callback | Action callback to be invoked after the sound has finished. |
AudioSource Papae.UnitySDK.Managers.AudioManager.PlaySFX | ( | AudioClip | clip, |
float | duration, | ||
bool | singleton = false , |
||
Action | callback = null |
||
) |
Plays a sound effect for a duration of time and calls the specified callback function after the time is over
clip | The audio data to play |
duration | The length in time the clip should play |
singleton | Is the sound effect a singleton. |
callback | Action callback to be invoked after the sound has finished. |
void Papae.UnitySDK.Managers.AudioManager.RemoveFromPlaylist | ( | AudioClip | clip | ) |
Add a sound clip to asset list pool
clip | Sound clip data |
AudioSource Papae.UnitySDK.Managers.AudioManager.RepeatSFX | ( | AudioClip | clip, |
Vector2 | location, | ||
int | repeat, | ||
float | volume, | ||
bool | singleton = false , |
||
float | pitch = 1f , |
||
Action | callback = null |
||
) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over.
clip | The audio data to play |
location | World location of the clip |
repeat | How many times in successions you want the clip to play. To loop forever, set as a negative number |
volume | Playback volume. |
singleton | Is the sound effect a singleton. |
pitch | Pitch level of the clip. |
callback | Action callback to be invoked after the sound has finished. |
AudioSource Papae.UnitySDK.Managers.AudioManager.RepeatSFX | ( | AudioClip | clip, |
Vector2 | location, | ||
int | repeat, | ||
bool | singleton = false , |
||
Action | callback = null |
||
) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over.
clip | The audio data to play |
location | World location of the clip |
repeat | How many times in successions you want the clip to play. To loop forever, set as a negative number |
singleton | Is the sound effect a singleton. |
callback | Action callback to be invoked after the sound has finished. |
AudioSource Papae.UnitySDK.Managers.AudioManager.RepeatSFX | ( | AudioClip | clip, |
int | repeat, | ||
bool | singleton = false , |
||
Action | callback = null |
||
) |
Repeats a sound effect for a specified amount of times at a given location in world space and calls the specified callback function after the sound is over.
clip | The audio data to play |
repeat | How many times in successions you want the clip to play. To loop forever, set as a negative number |
singleton | Is the sound effect a singleton. |
callback | Action callback to be invoked after the sound has finished. |
void Papae.UnitySDK.Managers.AudioManager.ResumeAllSFX | ( | ) |
Resumes all the sound effect in the game
void Papae.UnitySDK.Managers.AudioManager.ResumeBGM | ( | ) |
Resumes the playing background music
void Papae.UnitySDK.Managers.AudioManager.SaveAllPreferences | ( | ) |
Writes all modified sound options or preferences to disk
void Papae.UnitySDK.Managers.AudioManager.SaveBGMPreferences | ( | ) |
Stores the volume and the mute status of the background music to disk.
Note that all preferences would automatically get saved when this script gets destroyed
void Papae.UnitySDK.Managers.AudioManager.SaveSFXPreferences | ( | ) |
Stores the volume and the mute status of the sound effect to disk.
Note that all preferences would automatically get saved when this script gets destroyed
void Papae.UnitySDK.Managers.AudioManager.StopAllSFX | ( | ) |
Stops all the sound effects in the game
void Papae.UnitySDK.Managers.AudioManager.StopBGM | ( | ) |
Stops the playing background music
|
get |
Gets the current music clip.
The current music clip.
|
staticget |
Current and only running instance of the AudioManager
|
getset |
Gets or sets a value indicating whether this instance is master mute.
true
if this instance is master mute; otherwise, false
.
|
getset |
Gets or sets a value indicating whether the music is on.
true
if this instance is music on; otherwise, false
.
|
get |
Is the AudioManager processing any background music
|
getset |
Gets or sets a value indicating whether the sound is on.
true
if this instance is sound on; otherwise, false
.
|
getset |
Gets or sets the music volume.
The music volume.
|
get |
List of audio clips attached to the AudioManager
|
get |
Current list or pool of the sound effects
|
getset |
Gets or sets the sound volume.
The sound volume.