Skip to main content

Playback.Playlist

Methods


CurrentBeat

  • Return Type: float

  • Description: Retrieves the current beat value of the playlist's track.

  • Example:

    float beat = Playback.Playlist.CurrentBeat();

TempoBpm

  • Return Type: float

  • Description: Retrieves the tempo (in BPM) of the track in the playlist.

  • Example:

    float bpm = Playback.Playlist.TempoBpm();

GetTrackID

  • Return Type: int

  • Description: Retrieves the ID of the current track in the playlist.

  • Example:

    int trackID = Playback.Playlist.GetTrackID();

GetCurrentTrackMetadata

  • Return Type: json string

  • Description: Dumps some data on the current track, such as artist, title bpm, duration etc.

  • Example:

    Debug.Log(Reactional.Playback.Playlist.GetCurrentTrackMetadata())

GetCurrentTrackInfo

  • Return Type: TrackInfo

  • Description: Return a TrackInfo object on the current selected track.

  • Example:

    TrackInfo selectedTrack = Reactional.Playback.Playlist.GetCurrentTrackInfo()

GetSelectedTrackIndex

  • Return Type: int

  • Description: Retrieves the index of the track currently selected/playing, from the Loaded Tracks list.

  • Example:

    int selectedTrack = Playback.Playlist.GetSelectedTrackIndex();

IsLoaded

  • Return Type: bool

  • Description: Checks if a track is currently loaded in the playlist.

  • Example:

    bool isLoaded = Playback.Playlist.IsLoaded();

PlayTrack

  • Return Type: void

  • Overloads:

    PlayTrack(TrackInfo ti, float fadeintime = 0, float fadeouttime = 0.1f)
    PlayTrack(int loadedTrackIndex, float fadeintime = 0, float fadeouttime = 0.1f)
    PlayTrack(string trackName, float fadeintime = 0, float fadeouttime = 0.1f)
  • Description: Start Playback of the chosen Track.

  • Example:

    Playback.Playlist.PlayTrack();

PlayTrackByID

  • Return Type: async void

  • Description: Play a track based on the music system assigned ID.

  • Example:

    Playback.Playlist.PlayTrackByID(int ID);

Next

  • Return Type: void

  • Parameters: float fadeouttime = 0.1f, float fadeintime = 0f, bool autoplay = true

  • Description: Moves to the next track in the playlist.

  • Example:

    Playback.Playlist.Next();

Prev

  • Return Type: void

  • Parameters: float fadeouttime = 0.1f, float fadeintime = 0f, bool autoplay = true

  • Description: Moves to the previous track in the playlist.

  • Example:

    Playback.Playlist.Prev();

Random

  • Return Type: void

  • Parameters: float fadeouttime = 0.1f, float fadeintime = 0f, bool autoplay = true

  • Description: Loads a random track from the playlist.

  • Example:

    Playback.Playlist.Random();

GetState

  • Return Type: void

  • Description: Retrieves the current state of the playlist's playback as a MusicSystem.PlaybackState

  • Example:

    MusicSystem.PlaybackState state = Playback.Playlist.GetState();
    if (state == Playing) then ...

Stop

  • Return Type: void

  • Parameters: float fadeout = 0

  • Description: Stops the playback of the track in the playlist.

  • Example:

    Playback.Playlist.Stop(0.5f);

Play

  • Return Type: void

  • Description: Starts playback of the current track in the playlist. If no track is specified, it attempts to load a default track or the first available track.

  • Example:

    Playback.Playlist.Play();

FadeOut

  • Return Type: void

  • Parameters: float fadeout

  • Description: Fades out the current playing track.

  • Example:

    Playback.Playlist.FadeOut(1f);

FadeIn

  • Return Type: void

  • Parameters: float fadein

  • Description: Fades in the current playing track.

  • Example:

    Playback.Playlist.FadeIn(1f);

GetNumParts

  • Return Type: int

  • Description: Retrieves the number of parts in theme.

  • Example:

    int numOfParts = Playback.Playlist.GetNumParts();

GetCurrentPart

  • Return Type: int

  • Description: Retrieves the current part in track.

  • Example:

    int part = Playback.Playlist.GetCurrentPart();

GetPartName

  • Return Type: string

  • Parameters: int part

  • Description: Retrieves the name of the part with the correlated id.

  • Example:

    string partName = Playback.Playlist.GetPartName(0);

GetPartOffset

  • Return Type: float

  • Parameters: int part

  • Description: Retrieves the offset of the part with the correlated id.

  • Example:

    float offset = Playback.Playlist.GetPartOffset(0);

GetPartDuration

  • Return Type: float

  • Parameters: int part

  • Description: Retrieves the duration of the part with the correlated id.

  • Example:

    float duration = Playback.Playlist.GetPartDuration();

GetNumBars

  • Return Type: int

  • Description: Retrieves the numbers of bars in the loaded track.

  • Example:

    int numBars = Playback.Playlist.GetNumBars();

GetCurrentBar

  • Return Type: int

  • Description: Retrieves the current bars in the loaded track.

  • Example:

    int currentBar = Playback.Playlist.GetCurrentBar();

GetBarOffset

  • Return Type: float

  • Parameters: int bar

  • Description: Retrieves the offset of the bar with the id of variable 'bar' in the loaded track.

  • Example:

    int currentBar = Playback.Playlist.GetCurrentBar();
    float offset = Playback.Playlist.GetBarOffset(currentBar);

GetBarDuration

  • Return Type: float

  • Parameters: int bar

  • Description: Retrieves the duration of the bar with the id of variable 'bar' in the loaded track.

  • Example:

    int currentBar = Playback.Playlist.GetCurrentBar();
    float duration = Playback.Playlist.GetBarDuration(currentBar);

Properties

Volume

  • Type: float

  • Description: Get or set the volume (gain) for the track in the playlist.

  • Example:

    // Setting the volume
    Playback.Playlist.Volume = 0.5f;

    // Getting the volume
    float volume = Playback.Playlist.Volume;

IsPlaying

  • Type: boolean

  • Description: Returns true if a track is playing.

  • Example:

    if (Reactional.Playback.Playlist.IsPlaying) then ...

State

  • Return Type: int

  • Description: Retrieves the current state of the playlist's playback.

  • Example:

    int state = Playback.Playlist.State;