org.qtunes.player
Interface Player

All Superinterfaces:
Service
All Known Implementing Classes:
PlayerImpl

public interface Player
extends Service

A Player plays tracks to one or more speakers which may be local speaker (probably a SourceDataLine), an Airtunes speaker or some other type (eg RTSP, uPnP etc.) Each player maintains it's own playlist and tracks may be cued, reordered, skipped and so on as you'd expect.


Method Summary
 void addSpeaker(Speaker speaker)
          Add a Speaker to the Player.
 java.util.Collection<Speaker> getAvailableSpeakers()
          Get the collection of speakers that could be used by this Player and that aren't currently in use elsewhere.
 Track getCurrentTrack()
          Get the Track currently being played by this Player, or null if it's not playing anything
 int getCurrentTrackIndex()
          Return the index in the list of tracks returned from getPlaylist() that is currently playing.
 java.lang.String getDisplayName()
          Return a nice name for this Player for display to the user
 ManualPlaylist getPlaylist()
          Return the Playlist in use by this Player
 long getRemaining()
          Return the number of milliseconds remaining in the playlist.
 int getRepeat()
          Get the repeat mode, as set by setRepeat(int)
 int getRevision()
          Return the revision number.
 boolean getShuffle()
          Get the shuffle mode, as set by setShuffle(boolean)
 java.util.Collection<Speaker> getSpeakers()
          Return the list of Speaker objects current in use by this Player
 int getTrackPosition()
          Return the number of milliseconds into the currently playing track.
 int getVolume()
          Return the current volume
 boolean isPaused()
          Return true if the player is paused, false if it's playing or stopped.
 void playNext()
          Skip to the next track in the playlist.
 void playPrevious()
          Skip to the previous track in the playlist.
 void removeSpeaker(Speaker speaker)
          Remove a Speaker to the Player.
 void seek(int ms)
          Seek to the specified millisecond value in the current track If the value is outsize the valid range this method does nothing
 void setCurrentTrackIndex(int ix)
          Set the currently playing track
 void setPaused(boolean paused)
          Set the player to be paused (true) or playing (false).
 void setRepeat(int repeat)
          Set the style of repeat - none (0), track only (1) or playlist (2)
 void setShuffle(boolean shuffle)
          Set whether to shuffle the playlist
 void setVolume(int volume)
          Set the current volume
 
Methods inherited from interface org.qtunes.core.Service
getContext, reportState, startService, stopService
 

Method Detail

getPlaylist

ManualPlaylist getPlaylist()
Return the Playlist in use by this Player


playNext

void playNext()
Skip to the next track in the playlist. If there are no more tracks in the queue, stop playing


playPrevious

void playPrevious()
Skip to the previous track in the playlist. If you are currently playing the first track, restart it.


setCurrentTrackIndex

void setCurrentTrackIndex(int ix)
Set the currently playing track


seek

void seek(int ms)
Seek to the specified millisecond value in the current track If the value is outsize the valid range this method does nothing


setPaused

void setPaused(boolean paused)
Set the player to be paused (true) or playing (false).


isPaused

boolean isPaused()
Return true if the player is paused, false if it's playing or stopped.


getTrackPosition

int getTrackPosition()
Return the number of milliseconds into the currently playing track.


getRemaining

long getRemaining()
Return the number of milliseconds remaining in the playlist.


setShuffle

void setShuffle(boolean shuffle)
Set whether to shuffle the playlist


setRepeat

void setRepeat(int repeat)
Set the style of repeat - none (0), track only (1) or playlist (2)


getRepeat

int getRepeat()
Get the repeat mode, as set by setRepeat(int)


getShuffle

boolean getShuffle()
Get the shuffle mode, as set by setShuffle(boolean)


getCurrentTrackIndex

int getCurrentTrackIndex()
Return the index in the list of tracks returned from getPlaylist() that is currently playing. If no track is playing return -1


setVolume

void setVolume(int volume)
Set the current volume

Parameters:
volume - the volume, between 0 and 100

getVolume

int getVolume()
Return the current volume

Returns:
the volume, between 0 and 100

getAvailableSpeakers

java.util.Collection<Speaker> getAvailableSpeakers()
Get the collection of speakers that could be used by this Player and that aren't currently in use elsewhere.


addSpeaker

void addSpeaker(Speaker speaker)
Add a Speaker to the Player. Should only be called by Speaker.setPlayer(org.qtunes.player.Player).


removeSpeaker

void removeSpeaker(Speaker speaker)
Remove a Speaker to the Player. Should only be called by Speaker.setPlayer(org.qtunes.player.Player).


getSpeakers

java.util.Collection<Speaker> getSpeakers()
Return the list of Speaker objects current in use by this Player


getCurrentTrack

Track getCurrentTrack()
Get the Track currently being played by this Player, or null if it's not playing anything


getRevision

int getRevision()
Return the revision number. This should be increased every time the Player's state is updated.


getDisplayName

java.lang.String getDisplayName()
Return a nice name for this Player for display to the user