Class PlayList

java.lang.Object
de.pottgames.tuningfork.jukebox.playlist.PlayList

public class PlayList extends Object
A PlayList is a collection of songs that can be fetched in order.
  • Field Details

    • logger

      protected final TuningForkLogger logger
    • songs

      protected final com.badlogic.gdx.utils.Array<Song> songs
    • songIndex

      protected int songIndex
    • playedThrough

      protected boolean playedThrough
    • loop

      protected boolean loop
    • shuffleAfterPlaytrough

      protected boolean shuffleAfterPlaytrough
  • Constructor Details

    • PlayList

      public PlayList()
  • Method Details

    • addSong

      public void addSong(Song song)
      Adds a song to the end of the list.
      Parameters:
      song - the song
    • nextSong

      public Song nextSong()
      Returns the next Song in the list. Starts over if the last song of the list is fetched.
      Returns:
      the next Song in the list
    • reset

      public void reset()
      Resets the index to 0, so the next call to nextSong() will return the first song in the list. isPlayedThrough() will return false afterwards.
    • isPlayedThrough

      public boolean isPlayedThrough()
      Returns true if the all Songs from the list have been fetched.
      Returns:
      true if all songs have been fetched
    • shuffle

      public void shuffle()
      Shuffles the internal list of Songs.
    • setShuffleAfterPlaytrough

      public void setShuffleAfterPlaytrough(boolean value)
      If set to true, the internal list of Songs is shuffled after a complete play through of this PlayList.
      Parameters:
      value - if set to true, the playlist will be shuffled after a complete play through
    • setLooping

      public void setLooping(boolean loop)
      If set to true, this PlayList indicates that it should be played on repeat.
      Parameters:
      loop - true for looped playback
    • isLoop

      public boolean isLoop()
      Returns true if this PlayList should be played on repeat.
      Returns:
      true for repeat
    • toString

      public String toString()
      Overrides:
      toString in class Object