Jacky's Simple Audio Manager  3.0.0-preview
A decentralized audio playing system for Unity, designed for simplicity and built to scale!
JSAM.AudioManager Class Reference

AudioManager singleton that manages all audio in the game More...

Inheritance diagram for JSAM.AudioManager:

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

Parameters
stopInstantlyOptional: If true, stop all sounds immediately
More...
 
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< SoundFileObjectOnSoundPlayed
 
static Action< MusicFileObjectOnMusicPlayed
 
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]
 

Detailed Description

AudioManager singleton that manages all audio in the game

Member Function Documentation

◆ DebugError()

static void JSAM.AudioManager.DebugError ( string  consoleOutput)
static

◆ DebugLog()

static void JSAM.AudioManager.DebugLog ( string  consoleOutput)
static

Called internally by AudioManager to output non-error console messages

Parameters
consoleOutput

◆ DebugWarning()

static void JSAM.AudioManager.DebugWarning ( string  consoleOutput)
static

◆ EstablishSingletonDominance()

void JSAM.AudioManager.EstablishSingletonDominance ( )

TODO: Make this more stable Ensures that the AudioManager you think you're referring to actually exists in this scene

◆ FadeMainMusicOut()

static MusicChannelHelper JSAM.AudioManager.FadeMainMusicOut ( float  fadeOutTime)
static

Fades out the currently designated "Main Music"

Parameters
fadeOutTimeAmount of time in seconds the fade will last
Returns

◆ FadeMusicIn()

static MusicChannelHelper JSAM.AudioManager.FadeMusicIn ( MusicFileObject  music,
float  fadeInTime,
bool  isMainmusic = false 
)
static

Play and fade in a new music

Template Parameters
T
Parameters
musicEnum value for the music to be played. You can find this in the AudioLibrary
fadeInTimeAmount of time in seconds the fade will last
isMainmusicIf true, defines the music as the "Main music", making future operations easier
Returns

◆ FadeMusicIn< T >()

static MusicChannelHelper JSAM.AudioManager.FadeMusicIn< T > ( music,
float  fadeInTime,
bool  isMainmusic = false 
)
static

Play and fade in a new music

Template Parameters
T
Parameters
musicEnum value for the music to be played. You can find this in the AudioLibrary
fadeInTimeAmount of time in seconds the fade will last
isMainmusicIf true, defines the music as the "Main music", making future operations easier
Returns
Type Constraints
T :Enum 

◆ FadeMusicOut()

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

Parameters
helperMusic Channel Helper to fade out
fadeOutTimeAmount of time in seconds the fade will last
Returns

◆ FadeMusicOut< T >()

static MusicChannelHelper JSAM.AudioManager.FadeMusicOut< T > ( music,
float  fadeOutTime 
)
static

Fades music out

Template Parameters
T
Parameters
music
fadeOutTimeAmount of time in seconds the fade will last
Returns
Type Constraints
T :Enum 

◆ GetMusicSafe< T >()

static MusicFileObject JSAM.AudioManager.GetMusicSafe< T > ( music)
static
Type Constraints
T :Enum 

◆ GetSoundSafe< T >()

static SoundFileObject JSAM.AudioManager.GetSoundSafe< T > ( sound)
static
Type Constraints
T :Enum 

◆ IsMusicPlaying()

static bool JSAM.AudioManager.IsMusicPlaying ( MusicFileObject  music)
static

Parameters
musicThe enum of the music in question, check AudioManager to see what enums you can use
Returns

◆ IsMusicPlaying< T >()

static bool JSAM.AudioManager.IsMusicPlaying< T > ( music)
static

Parameters
musicThe enum of the music in question, check AudioManager to see what enums you can use
Returns
True if music that was played through PlayMusic is currently playing
Type Constraints
T :Enum 
T :InternalInstance.IsMusicPlayingInternal 
T :GetMusicSafe 
T :music 

◆ IsSoundPlaying() [1/2]

static bool JSAM.AudioManager.IsSoundPlaying ( SoundFileObject  sound,
Transform  transform = null 
)
static

Parameters
soundThe enum value for the sound in question. Check AudioManager to see what Enum you should use
transformOptional: Only return true if the sound is playing from this transform
Returns

◆ IsSoundPlaying() [2/2]

static bool JSAM.AudioManager.IsSoundPlaying ( SoundFileObject  sound,
Vector3  position 
)
static

Parameters
soundThe enum value for the sound in question. Check AudioManager to see what Enum you should use
positionOnly return true if the sound is played at this position
Returns

◆ IsSoundPlaying< T >() [1/2]

static bool JSAM.AudioManager.IsSoundPlaying< T > ( sound,
Transform  transform = null 
)
static

Template Parameters
T
Parameters
soundThe enum value for the sound in question. Check AudioManager to see what Enum you should use
transformOptional: Only return true if the sound is playing from this transform
Returns
True if a sound that was played using PlaySound is currently playing
Type Constraints
T :Enum 
T :InternalInstance.IsSoundPlayingInternal 
T :GetSoundSafe 
T :sound 
T :transform 

◆ IsSoundPlaying< T >() [2/2]

static bool JSAM.AudioManager.IsSoundPlaying< T > ( sound,
Vector3  position 
)
static

Template Parameters
T
Parameters
soundThe enum value for the sound in question. Check AudioManager to see what Enum you should use
positionOnly return true if the sound is played at this position
Returns
Type Constraints
T :Enum 
T :InternalInstance.IsSoundPlayingInternal 
T :GetSoundSafe 
T :sound 
T :position 

◆ PlayMusic() [1/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic ( MusicFileObject  music,
bool  isMainMusic 
)
static

Parameters
music
isMainMusicIf true, defines the music as the "Main music", making future operations easier
Returns

◆ PlayMusic() [2/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic ( MusicFileObject  music,
Transform  transform = null,
MusicChannelHelper  helper = null 
)
static

Parameters
musicA reference to the Music File asset to play directly
transformOptional: The transform of the music's source
helperOptional: 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

Returns

◆ PlayMusic() [3/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic ( MusicFileObject  music,
Vector3  position,
MusicChannelHelper  helper = null 
)
static

Parameters
musicA reference to the Music File asset to play directly
positionThe world position you want the music to play from
helperOptional: 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

Returns

◆ PlayMusic< T >() [1/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic< T > ( music,
bool  isMainMusic 
)
static

Play Music globally without spatialization Supports built-in music transition operations

Template Parameters
T
Parameters
musicEnum value for the music to be played. You can find this in the AudioLibrary
isMainMusicIf true, defines the music as the "Main Music", making future operations easier
Returns
The Music Channel helper playing the sound, useful for transitions, like copying the playback position to the next music
Type Constraints
T :Enum 

◆ PlayMusic< T >() [2/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic< T > ( music,
Transform  transform = null,
MusicChannelHelper  helper = null 
)
static

Plays the specified music using the settings provided in the Music File Object.

Supports spatialization

Template Parameters
T
Parameters
musicEnum value for the music to be played. You can find this in the AudioLibrary
transformOptional: The transform of the music's source
helperOptional: 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

Returns
Type Constraints
T :Enum 

◆ PlayMusic< T >() [3/3]

static MusicChannelHelper JSAM.AudioManager.PlayMusic< T > ( music,
Vector3  position,
MusicChannelHelper  helper = null 
)
static

Template Parameters
T
Parameters
musicEnum value for the music to be played. You can find this in the AudioLibrary
positionThe world position you want the music to play from
helperOptional: 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

Returns
Type Constraints
T :Enum 

◆ PlaySound() [1/2]

static SoundChannelHelper JSAM.AudioManager.PlaySound ( SoundFileObject  sound,
Transform  transform = null,
SoundChannelHelper  helper = null 
)
static

Parameters
soundA reference to the Sound File asset to play directly
transformOptional: The transform of the sound's source
helperOptional: The specific channel you want to play the sound from.

Good if you want an entity to only emit one sound at any time

Returns

◆ PlaySound() [2/2]

static SoundChannelHelper JSAM.AudioManager.PlaySound ( SoundFileObject  sound,
Vector3  position,
SoundChannelHelper  helper = null 
)
static

Parameters
soundA reference to the Sound File asset to play directly
positionThe position you want to play the sound at
helperOptional: The specific channel you want to play the sound from.

Good if you want an entity to only emit one sound at any time

Returns

◆ PlaySound< T >() [1/2]

static SoundChannelHelper JSAM.AudioManager.PlaySound< T > ( sound,
Transform  transform = null,
SoundChannelHelper  helper = null 
)
static

Plays the specified sound using the settings provided in the Sound File Object

Template Parameters
T
Parameters
soundThe enum correlating with the audio file you wish to play
transformOptional: The transform of the sound's source
helperOptional: The specific channel you want to play the sound from.

Good if you want an entity to only emit one sound at any time

Returns
The Sound Channel Helper playing the sound
Type Constraints
T :Enum 

◆ PlaySound< T >() [2/2]

static SoundChannelHelper JSAM.AudioManager.PlaySound< T > ( sound,
Vector3  position,
SoundChannelHelper  helper = null 
)
static

Template Parameters
T
Parameters
soundThe enum correlating with the audio file you wish to play
positionOptional: The world position you want the sound to play from
helperOptional: The specific channel you want to play the sound from.

Good if you want an entity to only emit one sound at any time

Returns
Type Constraints
T :Enum 

◆ SetMasterVolume()

static void JSAM.AudioManager.SetMasterVolume ( float  newVolume)
static

◆ SetMusicVolume()

static void JSAM.AudioManager.SetMusicVolume ( float  newVolume)
static

◆ SetSoundVolume()

static void JSAM.AudioManager.SetSoundVolume ( float  newVolume)
static

◆ StopAllSounds()

static void JSAM.AudioManager.StopAllSounds ( bool  stopInstantly = true)
static

Stops all playing sounds maintained by AudioManager

Parameters
stopInstantlyOptional: If true, stop all sounds immediately

◆ StopMusic() [1/2]

static MusicChannelHelper JSAM.AudioManager.StopMusic ( MusicFileObject  music,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Parameters
musicThe enum corresponding to the music music
transformOptional: The transform of the music's source
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns

◆ StopMusic() [2/2]

static MusicChannelHelper JSAM.AudioManager.StopMusic ( MusicFileObject  music,
Vector3  position,
bool  stopInstantly = true 
)
static

Parameters
musicThe enum corresponding to the music music
positionThe world position the music is playing from
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns

◆ StopMusic< T >() [1/2]

static MusicChannelHelper JSAM.AudioManager.StopMusic< T > ( music,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Instantly stops the playback of the specified playing music music

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
transformOptional: The transform of the music's source
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns
The Music Channel helper playing the sound, useful for transitions, like copying the playback position to the next music
Type Constraints
T :Enum 

◆ StopMusic< T >() [2/2]

static MusicChannelHelper JSAM.AudioManager.StopMusic< T > ( music,
Vector3  position,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
positionThe world position the music is playing from
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns
Type Constraints
T :Enum 

◆ StopMusicIfPlaying() [1/2]

static bool JSAM.AudioManager.StopMusicIfPlaying ( MusicFileObject  music,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
transformOptional: The transform of the music's source
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns

◆ StopMusicIfPlaying() [2/2]

static bool JSAM.AudioManager.StopMusicIfPlaying ( MusicFileObject  music,
Vector3  position,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
positionThe world position the music is playing from
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns

◆ StopMusicIfPlaying< T >() [1/2]

static bool JSAM.AudioManager.StopMusicIfPlaying< T > ( music,
Transform  transform = null,
bool  stopInstantly = true 
)
static

A shorthand for wrapping StopMusic in an IsMusicPlaying if-statement

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
transformOptional: The transform of the music's source
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns
True if music was stopped successfully, false if music wasn't playing
Type Constraints
T :Enum 

◆ StopMusicIfPlaying< T >() [2/2]

static bool JSAM.AudioManager.StopMusicIfPlaying< T > ( music,
Vector3  position,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
musicThe enum corresponding to the music music
positionThe world position the music is playing from
stopInstantlyOptional: If false, will allow music to transition out using it's transition settings. Otherwise, will immediately end playback
Returns
Type Constraints
T :Enum 
T :InternalInstance.StopMusicIfPlayingInternal 
T :GetMusicSafe 
T :music 
T :position 
T :stopInstantly 

◆ StopSound() [1/2]

static void JSAM.AudioManager.StopSound ( SoundFileObject  sound,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Parameters
soundA reference to the Sound File asset to play directly
transformOptional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds

◆ StopSound() [2/2]

static void JSAM.AudioManager.StopSound ( SoundFileObject  sound,
Vector3  position,
bool  stopInstantly = true 
)
static

Parameters
soundA reference to the Sound File asset to play directly
positionThe sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds

◆ StopSound< T >() [1/2]

static void JSAM.AudioManager.StopSound< T > ( sound,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Stops the first playing instance of the given sound immediately

Template Parameters
T
Parameters
soundThe sound to be stopped
transformOptional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Type Constraints
T :Enum 
T :InternalInstance.StopSoundInternal 
T :GetSoundSafe 
T :sound 
T :transform 
T :stopInstantly 

◆ StopSound< T >() [2/2]

static void JSAM.AudioManager.StopSound< T > ( sound,
Vector3  position,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
soundThe sound to be stopped
positionThe sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Type Constraints
T :Enum 
T :InternalInstance.StopSoundInternal 
T :GetSoundSafe 
T :sound 
T :position 
T :stopInstantly 

◆ StopSoundIfPlaying() [1/2]

static bool JSAM.AudioManager.StopSoundIfPlaying ( SoundFileObject  sound,
Transform  transform = null,
bool  stopInstantly = true 
)
static

Template Parameters
T
Parameters
soundA reference to the Sound File asset to stop directly
transformOptional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Returns
True if sound was stopped successfully, false if sound wasn't playing

◆ StopSoundIfPlaying() [2/2]

static bool JSAM.AudioManager.StopSoundIfPlaying ( SoundFileObject  sound,
Vector3  position,
bool  stopInstantly = true 
)
static

Parameters
soundA reference to the Sound File asset to stop directly
positionThe sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Returns
True if sound was stopped successfully, false if sound wasn't playing

◆ StopSoundIfPlaying< T >() [1/2]

static bool JSAM.AudioManager.StopSoundIfPlaying< T > ( sound,
Transform  transform = null,
bool  stopInstantly = true 
)
static

A shorthand for wrapping StopSound in an IsSoundPlaying if-statement

Template Parameters
T
Parameters
soundThe sound to be stopped
transformOptional: If the sound was initially passed a reference to a transform in PlaySound, passing the same Transform reference will stop that specific playing instance
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Returns
True if sound was stopped successfully, false if sound wasn't playing
Type Constraints
T :Enum 
T :InternalInstance.StopSoundIfPlayingInternal 
T :GetSoundSafe 
T :sound 
T :transform 
T :stopInstantly 

◆ StopSoundIfPlaying< T >() [2/2]

static bool JSAM.AudioManager.StopSoundIfPlaying< T > ( sound,
Vector3  position,
bool  stopInstantly = true 
)
static

Parameters
soundThe sound to be stopped
positionThe sound's playback position in world space. Passing this property will limit playback stopping to only the sound playing at this specific position
stopInstantlyOptional: If true, stop the sound immediately, you may want to leave this false for looping sounds
Returns
True if sound was stopped successfully, false if sound wasn't playing
Type Constraints
T :Enum 
T :InternalInstance.StopSoundIfPlayingInternal 
T :GetSoundSafe 
T :sound 
T :position 
T :stopInstantly 

◆ TryGetPlayingMusic()

static bool JSAM.AudioManager.TryGetPlayingMusic ( MusicFileObject  music,
out MusicChannelHelper  helper 
)
static

Very similar use case as TryGetComponent

Parameters
musicThe enum of the music in question, check AudioManager to see what enums you can use
helperThis helper reference will be given a value if the method returns true
Returns
The first Music Helper that's currently playing the specified music

◆ TryGetPlayingMusic< T >()

static bool JSAM.AudioManager.TryGetPlayingMusic< T > ( music,
out MusicChannelHelper  helper 
)
static

Very similar use case as TryGetComponent

Template Parameters
T
Parameters
musicThe enum of the music in question, check AudioManager to see what enums you can use
helperThis helper reference will be given a value if the method returns true
Returns
The first Music Helper that's currently playing the specified music
Type Constraints
T :Enum 
T :InternalInstance.TryGetPlayingMusic 
T :GetMusicSafe 
T :music 
T :out 
T :helper 

◆ TryGetPlayingSound()

static bool JSAM.AudioManager.TryGetPlayingSound ( SoundFileObject  sound,
out SoundChannelHelper  helper 
)
static

Very similar use case as TryGetComponent

Parameters
soundThe enum of the music in question, check AudioManager to see what enums you can use
helperThis helper reference will be given a value if the method returns true
Returns
The first Sound Helper that's currently playing the specified music

◆ TryGetPlayingSound< T >()

static bool JSAM.AudioManager.TryGetPlayingSound< T > ( sound,
out SoundChannelHelper  helper 
)
static

Very similar use case as TryGetComponent

Template Parameters
T
Parameters
soundThe enum of the music in question, check AudioManager to see what enums you can use
helperThis helper reference will be given a value if the method returns true
Returns
The first Sound Helper that's currently playing the specified music
Type Constraints
T :Enum 
T :InternalInstance.TryGetPlayingSound 
T :GetSoundSafe 
T :sound 
T :out 
T :helper 

Member Data Documentation

◆ OnAudioManagerInitialized

Action JSAM.AudioManager.OnAudioManagerInitialized
static

Invoked when the AudioManager finishes setting up

◆ OnMasterVolumeChanged

Action<float> JSAM.AudioManager.OnMasterVolumeChanged
static

Invoked when the volume of the Music channel is changed.

Passes the new volume as a normalized float value between 0 and 1

◆ OnMusicPlayed

Action<MusicFileObject> JSAM.AudioManager.OnMusicPlayed
static

◆ OnMusicVolumeChanged

Action<float> JSAM.AudioManager.OnMusicVolumeChanged
static

Invoked when the volume of the Music channel is changed.

Passes the new volume as a normalized float value between 0 and 1

◆ OnSoundPlayed

Action<SoundFileObject> JSAM.AudioManager.OnSoundPlayed
static

◆ OnSoundVolumeChanged

Action<float> JSAM.AudioManager.OnSoundVolumeChanged
static

Invoked when the volume of the Sound channel is changed.

Passes the new volume as a normalized float value between 0 and 1

Property Documentation

◆ AudioListener

AudioListener JSAM.AudioManager.AudioListener
staticget

◆ Initialized

bool JSAM.AudioManager.Initialized
get

True if AudioManager finishes setting up

◆ Instance

AudioManager JSAM.AudioManager.Instance
staticget

◆ InternalInstance

AudioManagerInternal JSAM.AudioManager.InternalInstance
staticget

◆ Library

AudioLibrary JSAM.AudioManager.Library
get

◆ MainMusic

MusicFileObject JSAM.AudioManager.MainMusic
staticget

◆ MainMusicEnumAsInt

int JSAM.AudioManager.MainMusicEnumAsInt
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

◆ MainMusicHelper

MusicChannelHelper JSAM.AudioManager.MainMusicHelper
staticget

◆ MasterMuted

bool??? JSAM.AudioManager.MasterMuted
staticgetset

◆ MasterVolume

float JSAM.AudioManager.MasterVolume
staticget

Get the current overall volume as a normalized float from 0 to 1

◆ MusicMuted

bool? JSAM.AudioManager.MusicMuted
staticgetset

◆ MusicVolume

float JSAM.AudioManager.MusicVolume
staticget

Get the current volume of Music as a normalized float from 0 to 1

◆ SoundMuted

bool? JSAM.AudioManager.SoundMuted
staticgetset

◆ SoundVolume

float JSAM.AudioManager.SoundVolume
staticget

Get the current volume of Sounds as a normalized float from 0 to 1


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