View Javadoc

1   package org.musicontroller;
2   
3   import java.util.List;
4   
5   import org.musicontroller.core.Song;
6   import org.musicontroller.security.IUser;
7   import org.musicontroller.songselection.CandidateSelector;
8   import org.musicontroller.songselection.SongSelector;
9   
10  public interface DJ {
11  
12  	public void setMusiController(MusiController musicontroller);
13  	public MusiController getMusiController();
14  	public void setSongSelector(SongSelector selector);
15  	public SongSelector getSongSelector();
16  	public CandidateSelector getCandidateSelector();
17  	public void setCandidateSelector(CandidateSelector selector);
18  	public void setUser(IUser user);
19  	public IUser getUser();
20  	
21  	/**
22  	 * Requests a song.
23  	 * @param songid The Id of the Song.
24  	 */
25  	public void requestSong(long songid);
26  	
27  	/**
28  	 * Unrequests a previously requested Song. The Song will be marked 'skipped'.
29  	 * @param songid The Id of the Song.
30  	 */
31  	public void unrequestSong(long songid);
32  	
33  	/**
34  	 * Tells the DJ to skip the currently playing Song.
35  	 */
36  	public void skipSong();
37  	
38  	/**
39  	 * Tells the DJ to skip the currently playing Song, and start playing a new one.
40  	 * @param songid The Id of the new Song to be played.
41  	 */
42  	public void playSong(long songid);
43  	
44  	/**
45  	 * @return True, if skipSong was called, False otherwise.
46  	 */
47  	public boolean mustSkip();
48  	
49  	/**
50  	 * Call this when the currently playing Song has indeed be skipped.
51  	 * A skipped-event will be added to the Song. 
52  	 */
53  	public void confirmSkip();
54  	
55  	/**
56  	 * Call this when the currently playing Song has been played completely.
57  	 * A played-event will be added to the Song.
58  	 */
59  	public void confirmPlay();
60  	
61  	/**
62  	 * Sets the state of the DJ.
63  	 * @param playing Use True, if the DJ is playing or False otherwise.
64  	 */
65  	public void setPlaying(boolean playing);
66  	
67  	public List<Long> getRequests();
68  
69  	/**
70  	 * Lets the DJ choose a new Song to play, using the SongSelector to select 
71  	 * a song from the candidates generated by the CandidateSelector
72  	 * @return A new Song
73  	 */
74  	public Song choose();
75  	
76  	/**
77  	 * Takes a look into the future, and tells which Songs will be played next.
78  	 * This information is valid until new requests/unrequests are made.
79  	 * 
80  	 * Requests will always be in the resultset, followed by 'count' predicted
81  	 * songs.
82  	 * @param count The amount of Songs to predict (maxed at 15).
83  	 * @return A List of Song-ids that will be played next.
84  	 */
85  	public List<Long> peek(int count);
86  	
87  	/**
88  	 * @return The Song that is currently playing, or null is the DJ is not playing
89  	 * any Song.
90  	 */
91  	public Song getCurrentSong();
92  	
93  	/**
94  	 * To be used by the StreamService, to provide feedback to the DJ about
95  	 * the amount of milliseconds that have been played of the current ssong.
96  	 * @param millis The amount of milliseconds the current song has been played.
97  	 */
98  	public void setPlayingTime(int millis);
99  	
100 	/**
101 	 * @return The amount of milliseconds the current song has been played.
102 	 */
103 	public int getPlayingTime();
104 }