CarterGames.AudioManager.Runtime
CarterGames.Assets.AudioManager
Actions
Action OnTrackStarted
Triggered whenever a new track is started on a track loops around to the start again.
Action OnTrackEnded
Triggered whenever the track has ended.
Action OnTrackLooped
Triggered whenever a track loops around back to the start.
Action OnTrackChanged
Triggered whenever the user changes the active track.
Action OnTrackTransitionComplete
Triggered whenever the active track transition has completed.
Properties
bool IsTrackPlaying
Returns bool
Gets whether or not there is a track currently playing?
AudioClip GetActiveTrack
Returns AudioClip
Gets the track that is currently being player by the music player script.
float GetTrackPosition
Returns float
Gets the current time in seconds that the track is at.
AudioSource GetActiveSource
Returns AudioSource
Gets the audio source component that is playing the active track.
bool ShouldLoop
Returns bool
Gets/Sets whether or not the active track should loop.
Methods
void SetVolume()
MusicPlayer.SetVolume(float value);
Sets the volume of the music player to the entered value. Range is between 0-1.
MusicPlayer.SetVolume(.75f);
void StopTrack()
MusicPlayer.StopTrack();
Stops the active track from playing without any transition.
MusicPlayer.StopTrack();
void PlayTrack()
MusicPlayer.instance.PlayTrack(AudioClip track)
MusicPlayer.instance.PlayTrack(AudioClip track, TransitionType transitionType)
MusicPlayer.instance.PlayTrack(AudioClip track, TransitionType transitionType, float transitionDuration)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime, TransitionType transitionType)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime, TransitionType transitionType, float transitionDuration)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime, float endTime)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime, float endTime, TransitionType transitionType)
MusicPlayer.instance.PlayTrack(AudioClip track, float startTime, float endTime, TransitionType transitionType, float transitionDuration)
Plays the track requested on the music player script. There are several overloads for this method that allow for additional options. If just using the audioclip param the transition will stay as the last one used in the inspector, the start time will be set to 0 and the end time will be set to the track length.
AudioManager.instance.Play("MyClip");
AudioManager.instance.Play("MyClip", mixer);
AudioManager.instance.Play("MyClip", mixerID);
AudioManager.instance.Play("MyClip", args);