Master Audio - AAA Sound Solution!  v2022
The ultimate AAA audio config tool
DarkTonic.MasterAudio.PlaylistController Class Reference

This class is used to host and play Playlists. Contains cross-fading, ducking and more! More...

Inheritance diagram for DarkTonic.MasterAudio.PlaylistController:

Public Member Functions

delegate void SongChangedEventHandler (string newSongName, MusicSetting song)
 Used for the SongChanged event you can subscribe to More...
 
delegate void SongEndedEventHandler (string songName)
 Used for the SongEnded event you can subscribe to More...
 
delegate void SongLoopedEventHandler (string songName)
 Used for the SongLooped event you can subscribe to More...
 
delegate void PlaylistEndedEventHandler ()
 Used for the PlaylistEnded event you can subscribe to More...
 
bool IsSongPlaying (string songName)
 This method will tell you if the song you specify by name is playing or not. If it's the current song and paused, this will still return true. More...
 
void ClearQueue ()
 Call this method to clear all songs out of the queued songs list. More...
 
void ToggleMutePlaylist ()
 This method mutes the Playlist if it's not muted, and vice versa. More...
 
void MutePlaylist ()
 This method mutes the Playlist. More...
 
void UnmutePlaylist ()
 This method unmutes the Playlist. More...
 
void PausePlaylist ()
 This method will pause the Playlist. More...
 
bool UnpausePlaylist ()
 This method will unpause the Playlist. More...
 
void StopPlaylist (bool onlyFadingClip=false)
 This method will Stop the Playlist. More...
 
void FadeToVolume (float targetVolume, float fadeTime, System.Action callback=null)
 This method allows you to fade the Playlist to a specified volume over X seconds. More...
 
void PlayRandomSong ()
 This method will play a random song in the current Playlist. More...
 
void PlayNextSong ()
 This method will play the next song in the current Playlist. More...
 
void StopPlaylistAfterCurrentSong ()
 This method will end the looping of the current song and cancel any scheduled / queued songs. Also turns off auto-advance if it's on to accomplish this. More...
 
void StopLoopingCurrentSong ()
 This method will end the looping of the current song so the next can play when it's done. More...
 
void QueuePlaylistClip (string clipName, bool scheduleNow=true)
 This method will play the song in the current Playlist whose name you specify as soon as the currently playing song is done. The current song, if looping, will have loop turned off by this call. This requires auto-advance to work. More...
 
bool TriggerPlaylistClip (string clipName)
 This method will play the song in the current Playlist whose name you specify. More...
 
void UpdateMasterVolume ()
 This method is used to update state based on the Playlist Master Volume. More...
 
void StartPlaylist (string playlistName, string clipName=null)
 This method is used to start a Playlist whether it's already loaded and playing or not. More...
 
void ChangePlaylist (string playlistName, bool playFirstClip=true, string clipName=null)
 This method is used to change the current Playlist to a new one, and optionally start it playing. More...
 
void RestartPlaylist (string clipName=null)
 This method can be called to restart the current Playlist More...
 

Static Public Member Functions

static PlaylistController InstanceByName (string playlistControllerName, bool errorIfNotFound=true)
 This method returns a reference to the PlaylistController whose name you specify. This is necessary when you have more than one. More...
 

Properties

bool ControllerIsReady [get]
 This property returns true if the Playlist Controller has already run its Awake method. You should not call any PlaylistController method until it has done so. More...
 
FadeStatus CurrentFadeStatus [get]
 This returns the current fade status of a FadeToVolume call, if any is running. More...
 
PlaylistStates PlaylistState [get]
 This property returns the current state of the Playlist. Choices are: NotInScene, Stopped, Playing, Paused, Crossfading More...
 
AudioSource ActiveAudioSource [get]
 This property returns the active audio source for the PlaylistControllers in the Scene. During cross-fading, the one fading in is returned, not the one fading out. More...
 
static List< PlaylistControllerInstances [get, set]
 This property returns all the PlaylistControllers in the Scene. More...
 
GameObject PlaylistControllerGameObject [get]
 This property returns the GameObject for the PlaylistController's GameObject. More...
 
AudioSource CurrentPlaylistSource [get]
 This property returns the current Audio Source for the current Playlist song that is playing. More...
 
AudioClip CurrentPlaylistClip [get]
 This property returns the current Audio Clip for the current Playlist song that is playing. More...
 
AudioClip FadingPlaylistClip [get]
 This property returns the currently fading out Audio Clip for the Playlist (null if not during cross-fading). More...
 
AudioSource FadingSource [get]
 This property returns the currently fading out Audio Source for the Playlist (null if not during cross-fading). More...
 
bool IsCrossFading [get]
 This property returns whether or not the Playlist is currently cross-fading. More...
 
bool IsFading [get]
 This property returns whether or not the Playlist is currently cross-fading or doing another fade. More...
 
float PlaylistVolume [get, set]
 This property gets and sets the volume of the Playlist Controller with Master Playlist Volume taken into account. More...
 
MasterAudio.Playlist CurrentPlaylist [get]
 This property returns the current Playlist More...
 
bool HasPlaylist [get]
 This property returns whether you have a Playlist assigned to this controller or not. More...
 
string PlaylistName [get]
 This property returns the name of the current Playlist More...
 
MusicSetting CurrentSong [get]
 This returns the currently playing song. Do not set any fields on the MusicSetting returned. Consider them read-only. More...
 
int ClipsRemainingInCurrentPlaylist [get]
 This tells you how many clips still haven't been played in the Playlist. More...
 

Events

SongChangedEventHandler SongChanged
 This event will notify you when the Playlist song changes. More...
 
SongEndedEventHandler SongEnded
 This event will notify you when the Playlist song ends. More...
 
SongLoopedEventHandler SongLooped
 This event will notify you when a song loops (ends a loop and starts the same clip again via looping). More...
 
PlaylistEndedEventHandler PlaylistEnded
 This event will notify you when a Playlist stops after the last song plays. More...
 

Detailed Description

This class is used to host and play Playlists. Contains cross-fading, ducking and more!

Member Function Documentation

void DarkTonic.MasterAudio.PlaylistController.ChangePlaylist ( string  playlistName,
bool  playFirstClip = true,
string  clipName = null 
)

This method is used to change the current Playlist to a new one, and optionally start it playing.

Parameters
playlistNameThe name of the Playlist to start
playFirstClipDefaults to true. Whether to start the first song or not.
clipNameOptional - Name of the specific clip to play.
void DarkTonic.MasterAudio.PlaylistController.ClearQueue ( )

Call this method to clear all songs out of the queued songs list.

void DarkTonic.MasterAudio.PlaylistController.FadeToVolume ( float  targetVolume,
float  fadeTime,
System.Action  callback = null 
)

This method allows you to fade the Playlist to a specified volume over X seconds.

Parameters
targetVolumeThe volume to fade to.
fadeTimeThe amount of time to fully fade to the target volume.
callbackOptional callback method
static PlaylistController DarkTonic.MasterAudio.PlaylistController.InstanceByName ( string  playlistControllerName,
bool  errorIfNotFound = true 
)
static

This method returns a reference to the PlaylistController whose name you specify. This is necessary when you have more than one.

Parameters
playlistControllerNameName of Playlist Controller
errorIfNotFoundDefaults to true. Pass false if you don't want an error in the console when not found.
Returns
bool DarkTonic.MasterAudio.PlaylistController.IsSongPlaying ( string  songName)

This method will tell you if the song you specify by name is playing or not. If it's the current song and paused, this will still return true.

Returns
true if this instance is song playing the specified songName; otherwise, false.
Parameters
songNameSong name or alias. Here you pass the name of the clip or its alias to check.
void DarkTonic.MasterAudio.PlaylistController.MutePlaylist ( )

This method mutes the Playlist.

void DarkTonic.MasterAudio.PlaylistController.PausePlaylist ( )

This method will pause the Playlist.

delegate void DarkTonic.MasterAudio.PlaylistController.PlaylistEndedEventHandler ( )

Used for the PlaylistEnded event you can subscribe to

void DarkTonic.MasterAudio.PlaylistController.PlayNextSong ( )

This method will play the next song in the current Playlist.

void DarkTonic.MasterAudio.PlaylistController.PlayRandomSong ( )

This method will play a random song in the current Playlist.

void DarkTonic.MasterAudio.PlaylistController.QueuePlaylistClip ( string  clipName,
bool  scheduleNow = true 
)

This method will play the song in the current Playlist whose name you specify as soon as the currently playing song is done. The current song, if looping, will have loop turned off by this call. This requires auto-advance to work.

Parameters
clipNameThe name or alias of the song to play.
scheduleNowWhether the song should immediately be scheduled to play (when Gapless song transitions is enabled)
void DarkTonic.MasterAudio.PlaylistController.RestartPlaylist ( string  clipName = null)

This method can be called to restart the current Playlist

Parameters
clipNameOptional - The clip name to play
delegate void DarkTonic.MasterAudio.PlaylistController.SongChangedEventHandler ( string  newSongName,
MusicSetting  song 
)

Used for the SongChanged event you can subscribe to

delegate void DarkTonic.MasterAudio.PlaylistController.SongEndedEventHandler ( string  songName)

Used for the SongEnded event you can subscribe to

delegate void DarkTonic.MasterAudio.PlaylistController.SongLoopedEventHandler ( string  songName)

Used for the SongLooped event you can subscribe to

void DarkTonic.MasterAudio.PlaylistController.StartPlaylist ( string  playlistName,
string  clipName = null 
)

This method is used to start a Playlist whether it's already loaded and playing or not.

Parameters
playlistNameThe name of the Playlist to start
clipNameOptional - The name of the specific clip to play.
void DarkTonic.MasterAudio.PlaylistController.StopLoopingCurrentSong ( )

This method will end the looping of the current song so the next can play when it's done.

void DarkTonic.MasterAudio.PlaylistController.StopPlaylist ( bool  onlyFadingClip = false)

This method will Stop the Playlist.

void DarkTonic.MasterAudio.PlaylistController.StopPlaylistAfterCurrentSong ( )

This method will end the looping of the current song and cancel any scheduled / queued songs. Also turns off auto-advance if it's on to accomplish this.

void DarkTonic.MasterAudio.PlaylistController.ToggleMutePlaylist ( )

This method mutes the Playlist if it's not muted, and vice versa.

bool DarkTonic.MasterAudio.PlaylistController.TriggerPlaylistClip ( string  clipName)

This method will play the song in the current Playlist whose name you specify.

Parameters
clipNameThe name of the song to play.
Returns
bool - whether the song was played or not
void DarkTonic.MasterAudio.PlaylistController.UnmutePlaylist ( )

This method unmutes the Playlist.

bool DarkTonic.MasterAudio.PlaylistController.UnpausePlaylist ( )

This method will unpause the Playlist.

void DarkTonic.MasterAudio.PlaylistController.UpdateMasterVolume ( )

This method is used to update state based on the Playlist Master Volume.

Property Documentation

AudioSource DarkTonic.MasterAudio.PlaylistController.ActiveAudioSource
get

This property returns the active audio source for the PlaylistControllers in the Scene. During cross-fading, the one fading in is returned, not the one fading out.

int DarkTonic.MasterAudio.PlaylistController.ClipsRemainingInCurrentPlaylist
get

This tells you how many clips still haven't been played in the Playlist.

bool DarkTonic.MasterAudio.PlaylistController.ControllerIsReady
get

This property returns true if the Playlist Controller has already run its Awake method. You should not call any PlaylistController method until it has done so.

FadeStatus DarkTonic.MasterAudio.PlaylistController.CurrentFadeStatus
get

This returns the current fade status of a FadeToVolume call, if any is running.

MasterAudio.Playlist DarkTonic.MasterAudio.PlaylistController.CurrentPlaylist
get

This property returns the current Playlist

AudioClip DarkTonic.MasterAudio.PlaylistController.CurrentPlaylistClip
get

This property returns the current Audio Clip for the current Playlist song that is playing.

AudioSource DarkTonic.MasterAudio.PlaylistController.CurrentPlaylistSource
get

This property returns the current Audio Source for the current Playlist song that is playing.

MusicSetting DarkTonic.MasterAudio.PlaylistController.CurrentSong
get

This returns the currently playing song. Do not set any fields on the MusicSetting returned. Consider them read-only.

AudioClip DarkTonic.MasterAudio.PlaylistController.FadingPlaylistClip
get

This property returns the currently fading out Audio Clip for the Playlist (null if not during cross-fading).

AudioSource DarkTonic.MasterAudio.PlaylistController.FadingSource
get

This property returns the currently fading out Audio Source for the Playlist (null if not during cross-fading).

bool DarkTonic.MasterAudio.PlaylistController.HasPlaylist
get

This property returns whether you have a Playlist assigned to this controller or not.

List<PlaylistController> DarkTonic.MasterAudio.PlaylistController.Instances
staticgetset

This property returns all the PlaylistControllers in the Scene.

bool DarkTonic.MasterAudio.PlaylistController.IsCrossFading
get

This property returns whether or not the Playlist is currently cross-fading.

bool DarkTonic.MasterAudio.PlaylistController.IsFading
get

This property returns whether or not the Playlist is currently cross-fading or doing another fade.

GameObject DarkTonic.MasterAudio.PlaylistController.PlaylistControllerGameObject
get

This property returns the GameObject for the PlaylistController's GameObject.

string DarkTonic.MasterAudio.PlaylistController.PlaylistName
get

This property returns the name of the current Playlist

PlaylistStates DarkTonic.MasterAudio.PlaylistController.PlaylistState
get

This property returns the current state of the Playlist. Choices are: NotInScene, Stopped, Playing, Paused, Crossfading

float DarkTonic.MasterAudio.PlaylistController.PlaylistVolume
getset

This property gets and sets the volume of the Playlist Controller with Master Playlist Volume taken into account.

Event Documentation

PlaylistEndedEventHandler DarkTonic.MasterAudio.PlaylistController.PlaylistEnded

This event will notify you when a Playlist stops after the last song plays.

SongChangedEventHandler DarkTonic.MasterAudio.PlaylistController.SongChanged

This event will notify you when the Playlist song changes.

SongEndedEventHandler DarkTonic.MasterAudio.PlaylistController.SongEnded

This event will notify you when the Playlist song ends.

SongLoopedEventHandler DarkTonic.MasterAudio.PlaylistController.SongLooped

This event will notify you when a song loops (ends a loop and starts the same clip again via looping).


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