Highroad Engine v1.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.Tools.MMPlaylist Class Reference

Use this class to play audiosources (usually background music but feel free to use that for anything) in sequence, with optional crossfade between songs More...

Inheritance diagram for MoreMountains.Tools.MMPlaylist:

Public Types

enum  PlaylistStates { Idle , Playing , Paused }
 the possible states this playlist can be in More...
 

Public Member Functions

virtual void Play ()
 Plays either the first song or resumes playing a paused one More...
 
virtual void PlayAtIndex (int songIndex)
 
virtual void Pause ()
 Pauses the current song More...
 
virtual void Stop ()
 Stops the playlist More...
 
virtual void PlayNextSong ()
 Plays the next song in the playlist More...
 
virtual void PlayPreviousSong ()
 Plays the previous song in the playlist More...
 

Public Attributes

int Channel = 0
 the channel on which to broadcast orders for this playlist More...
 
List< MMPlaylistSongSongs
 the songs that this playlist will play More...
 
bool RandomOrder = false
 whether this should play in random order or not More...
 
bool RandomizeOrderSeed = true
 if this is true, random seed will be randomized by the system clock More...
 
bool Endless = true
 whether this playlist should play and loop as a whole forever or not More...
 
bool PlayOnStart = true
 whether this playlist should auto play on start or not More...
 
float VolumeMultiplier = 1f
 a global volume multiplier to apply when playing a song More...
 
int CurrentlyPlayingIndex = -1
 the index we're currently playing More...
 
string CurrentSongName
 the name of the song that is currently playing More...
 
MMStateMachine< MMPlaylist.PlaylistStatesPlaylistState
 the current state of this playlist More...
 
bool PlayButton
 a play test button More...
 
bool PauseButton
 a pause test button More...
 
bool StopButton
 a stop test button More...
 
bool NextButton
 a next song test button More...
 
int TargetSongIndex = 0
 the index of the song to play when pressing the PlayTargetSong button More...
 
bool TargetSongButton
 a next song test button More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our playlist More...
 
virtual void Initialization ()
 On init we initialize our state machine and start playing if needed More...
 
virtual void PlayFirstSong ()
 Picks and plays the first song More...
 
virtual IEnumerator PlaySong (int index)
 Plays a new song in the playlist, and stops / fades the previous one More...
 
virtual IEnumerator Fade (int index, float duration, float initialVolume, float endVolume, bool stopAtTheEnd)
 Fades an audiosource in or out, optionnally stopping it at the end More...
 
virtual int PickNextIndex ()
 Picks the next song to play More...
 
virtual int PickPreviousIndex ()
 Picks the previous song to play More...
 
virtual void PlayTargetSong ()
 
virtual void OnPlayEvent (int channel)
 
virtual void OnPauseEvent (int channel)
 
virtual void OnStopEvent (int channel)
 
virtual void OnPlayNextEvent (int channel)
 
virtual void OnPlayPreviousEvent (int channel)
 
virtual void OnPlayIndexEvent (int channel, int index)
 
virtual void OnEnable ()
 On enable, starts listening for playlist events More...
 
virtual void OnDisable ()
 On disable, stops listening for playlist events More...
 
virtual void OnValidate ()
 On Validate, we check if our array has changed and if yes we initialize our new elements More...
 

Protected Attributes

int _songsPlayedSoFar = 0
 
int _songsPlayedThisCycle = 0
 
Coroutine _coroutine
 
bool _firstDeserialization = true
 
int _listCount = 0
 

Detailed Description

Use this class to play audiosources (usually background music but feel free to use that for anything) in sequence, with optional crossfade between songs

Member Enumeration Documentation

◆ PlaylistStates

the possible states this playlist can be in

Enumerator
Idle 
Playing 
Paused 

Member Function Documentation

◆ Fade()

virtual IEnumerator MoreMountains.Tools.MMPlaylist.Fade ( int  index,
float  duration,
float  initialVolume,
float  endVolume,
bool  stopAtTheEnd 
)
protectedvirtual

Fades an audiosource in or out, optionnally stopping it at the end

Parameters
source
duration
initialVolume
endVolume
stopAtTheEnd
Returns

◆ Initialization()

virtual void MoreMountains.Tools.MMPlaylist.Initialization ( )
protectedvirtual

On init we initialize our state machine and start playing if needed

◆ OnDisable()

virtual void MoreMountains.Tools.MMPlaylist.OnDisable ( )
protectedvirtual

On disable, stops listening for playlist events

◆ OnEnable()

virtual void MoreMountains.Tools.MMPlaylist.OnEnable ( )
protectedvirtual

On enable, starts listening for playlist events

◆ OnPauseEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnPauseEvent ( int  channel)
protectedvirtual

◆ OnPlayEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnPlayEvent ( int  channel)
protectedvirtual

◆ OnPlayIndexEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnPlayIndexEvent ( int  channel,
int  index 
)
protectedvirtual

◆ OnPlayNextEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnPlayNextEvent ( int  channel)
protectedvirtual

◆ OnPlayPreviousEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnPlayPreviousEvent ( int  channel)
protectedvirtual

◆ OnStopEvent()

virtual void MoreMountains.Tools.MMPlaylist.OnStopEvent ( int  channel)
protectedvirtual

◆ OnValidate()

virtual void MoreMountains.Tools.MMPlaylist.OnValidate ( )
protectedvirtual

On Validate, we check if our array has changed and if yes we initialize our new elements

◆ Pause()

virtual void MoreMountains.Tools.MMPlaylist.Pause ( )
virtual

Pauses the current song

◆ PickNextIndex()

virtual int MoreMountains.Tools.MMPlaylist.PickNextIndex ( )
protectedvirtual

Picks the next song to play

Returns

◆ PickPreviousIndex()

virtual int MoreMountains.Tools.MMPlaylist.PickPreviousIndex ( )
protectedvirtual

Picks the previous song to play

Returns

◆ Play()

virtual void MoreMountains.Tools.MMPlaylist.Play ( )
virtual

Plays either the first song or resumes playing a paused one

◆ PlayAtIndex()

virtual void MoreMountains.Tools.MMPlaylist.PlayAtIndex ( int  songIndex)
virtual

◆ PlayFirstSong()

virtual void MoreMountains.Tools.MMPlaylist.PlayFirstSong ( )
protectedvirtual

Picks and plays the first song

◆ PlayNextSong()

virtual void MoreMountains.Tools.MMPlaylist.PlayNextSong ( )
virtual

Plays the next song in the playlist

◆ PlayPreviousSong()

virtual void MoreMountains.Tools.MMPlaylist.PlayPreviousSong ( )
virtual

Plays the previous song in the playlist

◆ PlaySong()

virtual IEnumerator MoreMountains.Tools.MMPlaylist.PlaySong ( int  index)
protectedvirtual

Plays a new song in the playlist, and stops / fades the previous one

Parameters
index
Returns

◆ PlayTargetSong()

virtual void MoreMountains.Tools.MMPlaylist.PlayTargetSong ( )
protectedvirtual

◆ Start()

virtual void MoreMountains.Tools.MMPlaylist.Start ( )
protectedvirtual

On Start we initialize our playlist

◆ Stop()

virtual void MoreMountains.Tools.MMPlaylist.Stop ( )
virtual

Stops the playlist

Member Data Documentation

◆ _coroutine

Coroutine MoreMountains.Tools.MMPlaylist._coroutine
protected

◆ _firstDeserialization

bool MoreMountains.Tools.MMPlaylist._firstDeserialization = true
protected

◆ _listCount

int MoreMountains.Tools.MMPlaylist._listCount = 0
protected

◆ _songsPlayedSoFar

int MoreMountains.Tools.MMPlaylist._songsPlayedSoFar = 0
protected

◆ _songsPlayedThisCycle

int MoreMountains.Tools.MMPlaylist._songsPlayedThisCycle = 0
protected

◆ Channel

int MoreMountains.Tools.MMPlaylist.Channel = 0

the channel on which to broadcast orders for this playlist

◆ CurrentlyPlayingIndex

int MoreMountains.Tools.MMPlaylist.CurrentlyPlayingIndex = -1

the index we're currently playing

◆ CurrentSongName

string MoreMountains.Tools.MMPlaylist.CurrentSongName

the name of the song that is currently playing

◆ Endless

bool MoreMountains.Tools.MMPlaylist.Endless = true

whether this playlist should play and loop as a whole forever or not

◆ NextButton

bool MoreMountains.Tools.MMPlaylist.NextButton

a next song test button

◆ PauseButton

bool MoreMountains.Tools.MMPlaylist.PauseButton

a pause test button

◆ PlayButton

bool MoreMountains.Tools.MMPlaylist.PlayButton

a play test button

◆ PlaylistState

MMStateMachine<MMPlaylist.PlaylistStates> MoreMountains.Tools.MMPlaylist.PlaylistState

the current state of this playlist

◆ PlayOnStart

bool MoreMountains.Tools.MMPlaylist.PlayOnStart = true

whether this playlist should auto play on start or not

◆ RandomizeOrderSeed

bool MoreMountains.Tools.MMPlaylist.RandomizeOrderSeed = true

if this is true, random seed will be randomized by the system clock

◆ RandomOrder

bool MoreMountains.Tools.MMPlaylist.RandomOrder = false

whether this should play in random order or not

◆ Songs

List<MMPlaylistSong> MoreMountains.Tools.MMPlaylist.Songs

the songs that this playlist will play

◆ StopButton

bool MoreMountains.Tools.MMPlaylist.StopButton

a stop test button

◆ TargetSongButton

bool MoreMountains.Tools.MMPlaylist.TargetSongButton

a next song test button

◆ TargetSongIndex

int MoreMountains.Tools.MMPlaylist.TargetSongIndex = 0

the index of the song to play when pressing the PlayTargetSong button

◆ VolumeMultiplier

float MoreMountains.Tools.MMPlaylist.VolumeMultiplier = 1f

a global volume multiplier to apply when playing a song


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