Music Player

CarterGames.AudioManager.Runtime

CarterGames.Assets.AudioManager

Actions

Triggered whenever a new track is started on a track loops around to the start again.

Triggered whenever the track has ended.

Triggered whenever a track loops around back to the start.

Triggered whenever the user changes the active track.

Triggered whenever the active track transition has completed.

Properties

Returns bool
Gets whether or not there is a track currently playing?

Returns AudioClip
Gets the track that is currently being player by the music player script.

Returns float
Gets the current time in seconds that the track is at.

Returns AudioSource
Gets the audio source component that is playing the active track.

Returns bool
Gets/Sets whether or not the active track should loop.

Methods

MusicPlayer.SetVolume(float value);

Sets the volume of the music player to the entered value. Range is between 0-1.

MusicPlayer.SetVolume(.75f);
MusicPlayer.StopTrack();

Stops the active track from playing without any transition.

MusicPlayer.StopTrack();
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);