Jacky's Simple Audio Manager
3.0.0-preview
A decentralized audio playing system for Unity, designed for simplicity and built to scale!
|
AudioManager singleton that manages all audio in the game More...
Public Member Functions | |
MusicChannelHelper | FadeMusicOut (MusicChannelHelper helper, float fadeOutTime) |
Fades music out provided a Music Channel Helper, don't use this unless you understand what you're doing More... | |
void | EstablishSingletonDominance () |
TODO: Make this more stable Ensures that the AudioManager you think you're referring to actually exists in this scene More... | |
Static Public Member Functions | |||
static SoundFileObject | GetSoundSafe< T > (T sound) | ||
static MusicFileObject | GetMusicSafe< T > (T music) | ||
static SoundChannelHelper | PlaySound< T > (T sound, Transform transform=null, SoundChannelHelper helper=null) | ||
Plays the specified sound using the settings provided in the Sound File Object More... | |||
static SoundChannelHelper | PlaySound< T > (T sound, Vector3 position, SoundChannelHelper helper=null) | ||
static SoundChannelHelper | PlaySound (SoundFileObject sound, Transform transform=null, SoundChannelHelper helper=null) | ||
static SoundChannelHelper | PlaySound (SoundFileObject sound, Vector3 position, SoundChannelHelper helper=null) | ||
static void | StopSound< T > (T sound, Transform transform=null, bool stopInstantly=true) | ||
Stops the first playing instance of the given sound immediately More... | |||
static void | StopSound< T > (T sound, Vector3 position, bool stopInstantly=true) | ||
static void | StopSound (SoundFileObject sound, Transform transform=null, bool stopInstantly=true) | ||
static void | StopSound (SoundFileObject sound, Vector3 position, bool stopInstantly=true) | ||
static void | StopAllSounds (bool stopInstantly=true) | ||
Stops all playing sounds maintained by AudioManager
| |||
static bool | StopSoundIfPlaying< T > (T sound, Transform transform=null, bool stopInstantly=true) | ||
A shorthand for wrapping StopSound in an IsSoundPlaying if-statement More... | |||
static bool | StopSoundIfPlaying< T > (T sound, Vector3 position, bool stopInstantly=true) | ||
static bool | StopSoundIfPlaying (SoundFileObject sound, Transform transform=null, bool stopInstantly=true) | ||
static bool | StopSoundIfPlaying (SoundFileObject sound, Vector3 position, bool stopInstantly=true) | ||
static bool | IsSoundPlaying< T > (T sound, Transform transform=null) | ||
static bool | IsSoundPlaying< T > (T sound, Vector3 position) | ||
static bool | IsSoundPlaying (SoundFileObject sound, Transform transform=null) | ||
static bool | IsSoundPlaying (SoundFileObject sound, Vector3 position) | ||
static bool | TryGetPlayingSound< T > (T sound, out SoundChannelHelper helper) | ||
Very similar use case as TryGetComponent More... | |||
static bool | TryGetPlayingSound (SoundFileObject sound, out SoundChannelHelper helper) | ||
Very similar use case as TryGetComponent More... | |||
static MusicChannelHelper | PlayMusic< T > (T music, bool isMainMusic) | ||
Play Music globally without spatialization Supports built-in music transition operations More... | |||
static MusicChannelHelper | PlayMusic (MusicFileObject music, bool isMainMusic) | ||
static MusicChannelHelper | PlayMusic< T > (T music, Transform transform=null, MusicChannelHelper helper=null) | ||
Plays the specified music using the settings provided in the Music File Object. More... | |||
static MusicChannelHelper | PlayMusic< T > (T music, Vector3 position, MusicChannelHelper helper=null) | ||
static MusicChannelHelper | PlayMusic (MusicFileObject music, Transform transform=null, MusicChannelHelper helper=null) | ||
static MusicChannelHelper | PlayMusic (MusicFileObject music, Vector3 position, MusicChannelHelper helper=null) | ||
static MusicChannelHelper | FadeMusicIn< T > (T music, float fadeInTime, bool isMainmusic=false) | ||
Play and fade in a new music More... | |||
static MusicChannelHelper | FadeMusicIn (MusicFileObject music, float fadeInTime, bool isMainmusic=false) | ||
Play and fade in a new music More... | |||
static MusicChannelHelper | FadeMainMusicOut (float fadeOutTime) | ||
Fades out the currently designated "Main Music" More... | |||
static MusicChannelHelper | FadeMusicOut< T > (T music, float fadeOutTime) | ||
Fades music out More... | |||
static bool | IsMusicPlaying< T > (T music) | ||
static bool | IsMusicPlaying (MusicFileObject music) | ||
static bool | TryGetPlayingMusic< T > (T music, out MusicChannelHelper helper) | ||
Very similar use case as TryGetComponent More... | |||
static bool | TryGetPlayingMusic (MusicFileObject music, out MusicChannelHelper helper) | ||
Very similar use case as TryGetComponent More... | |||
static MusicChannelHelper | StopMusic< T > (T music, Transform transform=null, bool stopInstantly=true) | ||
Instantly stops the playback of the specified playing music music More... | |||
static MusicChannelHelper | StopMusic< T > (T music, Vector3 position, bool stopInstantly=true) | ||
static MusicChannelHelper | StopMusic (MusicFileObject music, Transform transform=null, bool stopInstantly=true) | ||
static MusicChannelHelper | StopMusic (MusicFileObject music, Vector3 position, bool stopInstantly=true) | ||
static bool | StopMusicIfPlaying< T > (T music, Transform transform=null, bool stopInstantly=true) | ||
A shorthand for wrapping StopMusic in an IsMusicPlaying if-statement More... | |||
static bool | StopMusicIfPlaying< T > (T music, Vector3 position, bool stopInstantly=true) | ||
static bool | StopMusicIfPlaying (MusicFileObject music, Transform transform=null, bool stopInstantly=true) | ||
static bool | StopMusicIfPlaying (MusicFileObject music, Vector3 position, bool stopInstantly=true) | ||
static void | SetMasterVolume (float newVolume) | ||
static void | SetMusicVolume (float newVolume) | ||
static void | SetSoundVolume (float newVolume) | ||
static void | DebugLog (string consoleOutput) | ||
Called internally by AudioManager to output non-error console messages More... | |||
static void | DebugWarning (string consoleOutput) | ||
static void | DebugError (string consoleOutput) | ||
Static Public Attributes | |
static Action | OnAudioManagerInitialized |
Invoked when the AudioManager finishes setting up More... | |
static Action< SoundFileObject > | OnSoundPlayed |
static Action< MusicFileObject > | OnMusicPlayed |
static Action< float > | OnMasterVolumeChanged |
Invoked when the volume of the Music channel is changed. More... | |
static Action< float > | OnMusicVolumeChanged |
Invoked when the volume of the Music channel is changed. More... | |
static Action< float > | OnSoundVolumeChanged |
Invoked when the volume of the Sound channel is changed. More... | |
Properties | |
static AudioManager | Instance [get] |
AudioLibrary | Library [get] |
static AudioListener | AudioListener [get] |
bool | Initialized [get] |
True if AudioManager finishes setting up More... | |
static MusicChannelHelper | MainMusicHelper [get] |
static MusicFileObject | MainMusic [get] |
static int | MainMusicEnumAsInt [get] |
Returns the currently playing music as an integer for you to convert back into an enum. More... | |
static AudioManagerInternal | InternalInstance [get] |
static float | MasterVolume [get] |
Get the current overall volume as a normalized float from 0 to 1 More... | |
static bool??? | MasterMuted [get, set] |
static float | MusicVolume [get] |
Get the current volume of Music as a normalized float from 0 to 1 More... | |
static bool? | MusicMuted [get, set] |
static float | SoundVolume [get] |
Get the current volume of Sounds as a normalized float from 0 to 1 More... | |
static bool? | SoundMuted [get, set] |
AudioManager singleton that manages all audio in the game
|
static |
|
static |
Called internally by AudioManager to output non-error console messages
consoleOutput |
|
static |
void JSAM.AudioManager.EstablishSingletonDominance | ( | ) |
TODO: Make this more stable Ensures that the AudioManager you think you're referring to actually exists in this scene
|
static |
Fades out the currently designated "Main Music"
fadeOutTime | Amount of time in seconds the fade will last |
|
static |
Play and fade in a new music
T |
music | Enum value for the music to be played. You can find this in the AudioLibrary |
fadeInTime | Amount of time in seconds the fade will last |
isMainmusic | If true, defines the music as the "Main music", making future operations easier |
|
static |
Play and fade in a new music
T |
music | Enum value for the music to be played. You can find this in the AudioLibrary |
fadeInTime | Amount of time in seconds the fade will last |
isMainmusic | If true, defines the music as the "Main music", making future operations easier |
T | : | Enum |
MusicChannelHelper JSAM.AudioManager.FadeMusicOut | ( | MusicChannelHelper | helper, |
float | fadeOutTime | ||
) |
Fades music out provided a Music Channel Helper, don't use this unless you understand what you're doing
helper | Music Channel Helper to fade out |
fadeOutTime | Amount of time in seconds the fade will last |
|
static |
Fades music out
T |
music | |
fadeOutTime | Amount of time in seconds the fade will last |
T | : | Enum |
|
static |
T | : | Enum |
|
static |
T | : | Enum |
|
static |
music | The enum of the music in question, check AudioManager to see what enums you can use |
|
static |
music | The enum of the music in question, check AudioManager to see what enums you can use |
T | : | Enum | |
T | : | InternalInstance.IsMusicPlayingInternal | |
T | : | GetMusicSafe | |
T | : | music |
|
static |
sound | The enum value for the sound in question. Check AudioManager to see what Enum you should use |
transform | Optional: Only return true if the sound is playing from this transform |
|
static |
sound | The enum value for the sound in question. Check AudioManager to see what Enum you should use |
position | Only return true if the sound is played at this position |
|
static |
T |
sound | The enum value for the sound in question. Check AudioManager to see what Enum you should use |
transform | Optional: Only return true if the sound is playing from this transform |
T | : | Enum | |
T | : | InternalInstance.IsSoundPlayingInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | transform |
|
static |
T |
sound | The enum value for the sound in question. Check AudioManager to see what Enum you should use |
position | Only return true if the sound is played at this position |
T | : | Enum | |
T | : | InternalInstance.IsSoundPlayingInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | position |
|
static |
music | |
isMainMusic | If true, defines the music as the "Main music", making future operations easier |
|
static |
music | A reference to the Music File asset to play directly |
transform | Optional: The transform of the music's source |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only play a single music at any time
|
static |
music | A reference to the Music File asset to play directly |
position | The world position you want the music to play from |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only play a single music at any time
|
static |
Play Music globally without spatialization Supports built-in music transition operations
T |
music | Enum value for the music to be played. You can find this in the AudioLibrary |
isMainMusic | If true, defines the music as the "Main Music", making future operations easier |
T | : | Enum |
|
static |
Plays the specified music using the settings provided in the Music File Object.
Supports spatialization
T |
music | Enum value for the music to be played. You can find this in the AudioLibrary |
transform | Optional: The transform of the music's source |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only play a single music at any time
T | : | Enum |
|
static |
T |
music | Enum value for the music to be played. You can find this in the AudioLibrary |
position | The world position you want the music to play from |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only play a single music at any time
T | : | Enum |
|
static |
sound | A reference to the Sound File asset to play directly |
transform | Optional: The transform of the sound's source |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only emit one sound at any time
|
static |
sound | A reference to the Sound File asset to play directly |
position | The position you want to play the sound at |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only emit one sound at any time
|
static |
Plays the specified sound using the settings provided in the Sound File Object
T |
sound | The enum correlating with the audio file you wish to play |
transform | Optional: The transform of the sound's source |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only emit one sound at any time
T | : | Enum |
|
static |
T |
sound | The enum correlating with the audio file you wish to play |
position | Optional: The world position you want the sound to play from |
helper | Optional: The specific channel you want to play the sound from. |
Good if you want an entity to only emit one sound at any time
T | : | Enum |
|
static |
|
static |
|
static |
|
static |
Stops all playing sounds maintained by AudioManager
stopInstantly | Optional: If true, stop all sounds immediately |
|
static |
music | The enum corresponding to the music music |
transform | Optional: The transform of the music's source |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
|
static |
music | The enum corresponding to the music music |
position | The world position the music is playing from |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
|
static |
Instantly stops the playback of the specified playing music music
T |
music | The enum corresponding to the music music |
transform | Optional: The transform of the music's source |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
T | : | Enum |
|
static |
T |
music | The enum corresponding to the music music |
position | The world position the music is playing from |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
T | : | Enum |
|
static |
T |
music | The enum corresponding to the music music |
transform | Optional: The transform of the music's source |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
|
static |
T |
music | The enum corresponding to the music music |
position | The world position the music is playing from |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
|
static |
A shorthand for wrapping StopMusic in an IsMusicPlaying if-statement
T |
music | The enum corresponding to the music music |
transform | Optional: The transform of the music's source |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
T | : | Enum |
|
static |
T |
music | The enum corresponding to the music music |
position | The world position the music is playing from |
stopInstantly | Optional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback |
T | : | Enum | |
T | : | InternalInstance.StopMusicIfPlayingInternal | |
T | : | GetMusicSafe | |
T | : | music | |
T | : | position | |
T | : | stopInstantly |
|
static |
sound | A reference to the Sound File asset to play directly |
transform | Optional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
|
static |
sound | A reference to the Sound File asset to play directly |
position | The sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
|
static |
Stops the first playing instance of the given sound immediately
T |
sound | The sound to be stopped |
transform | Optional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
T | : | Enum | |
T | : | InternalInstance.StopSoundInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | transform | |
T | : | stopInstantly |
|
static |
T |
sound | The sound to be stopped |
position | The sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
T | : | Enum | |
T | : | InternalInstance.StopSoundInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | position | |
T | : | stopInstantly |
|
static |
T |
sound | A reference to the Sound File asset to stop directly |
transform | Optional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
|
static |
sound | A reference to the Sound File asset to stop directly |
position | The sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
|
static |
A shorthand for wrapping StopSound in an IsSoundPlaying if-statement
T |
sound | The sound to be stopped |
transform | Optional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
T | : | Enum | |
T | : | InternalInstance.StopSoundIfPlayingInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | transform | |
T | : | stopInstantly |
|
static |
sound | The sound to be stopped |
position | The sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position |
stopInstantly | Optional: If true, stop the sound immediately, you may want to leave this false for looping sounds |
T | : | Enum | |
T | : | InternalInstance.StopSoundIfPlayingInternal | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | position | |
T | : | stopInstantly |
|
static |
Very similar use case as TryGetComponent
music | The enum of the music in question, check AudioManager to see what enums you can use |
helper | This helper reference will be given a value if the method returns true |
|
static |
Very similar use case as TryGetComponent
T |
music | The enum of the music in question, check AudioManager to see what enums you can use |
helper | This helper reference will be given a value if the method returns true |
T | : | Enum | |
T | : | InternalInstance.TryGetPlayingMusic | |
T | : | GetMusicSafe | |
T | : | music | |
T | : | out | |
T | : | helper |
|
static |
Very similar use case as TryGetComponent
sound | The enum of the music in question, check AudioManager to see what enums you can use |
helper | This helper reference will be given a value if the method returns true |
|
static |
Very similar use case as TryGetComponent
T |
sound | The enum of the music in question, check AudioManager to see what enums you can use |
helper | This helper reference will be given a value if the method returns true |
T | : | Enum | |
T | : | InternalInstance.TryGetPlayingSound | |
T | : | GetSoundSafe | |
T | : | sound | |
T | : | out | |
T | : | helper |
|
static |
Invoked when the AudioManager finishes setting up
|
static |
Invoked when the volume of the Music channel is changed.
Passes the new volume as a normalized float value between 0 and 1
|
static |
|
static |
Invoked when the volume of the Music channel is changed.
Passes the new volume as a normalized float value between 0 and 1
|
static |
|
static |
Invoked when the volume of the Sound channel is changed.
Passes the new volume as a normalized float value between 0 and 1
|
staticget |
|
get |
True if AudioManager finishes setting up
|
staticget |
|
staticget |
|
get |
|
staticget |
|
staticget |
Returns the currently playing music as an integer for you to convert back into an enum.
This only works if the AudioManager in the current scene has the currently playing music registered in it's AudioLibrary
|
staticget |
|
staticgetset |
|
staticget |
Get the current overall volume as a normalized float from 0 to 1
|
staticgetset |
|
staticget |
Get the current volume of Music as a normalized float from 0 to 1
|
staticgetset |
|
staticget |
Get the current volume of Sounds as a normalized float from 0 to 1