1 /*** 2 * Ambient - A music player for the Android platform 3 Copyright (C) 2007 Martin Vysny 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 package sk.baka.ambient; 20 21 import sk.baka.ambient.commons.Interval; 22 import sk.baka.ambient.playerservice.PlayerStateEnum; 23 import sk.baka.ambient.playlist.PlaylistItem; 24 import sk.baka.ambient.playlist.Random; 25 import sk.baka.ambient.playlist.Repeat; 26 27 /*** 28 * Listens for higher-level player and playlist events. All methods are invoked 29 * in the message loop handler. 30 * 31 * @author Martin Vysny 32 */ 33 public interface IPlaylistPlayerListener { 34 /*** 35 * The playback state was changed. 36 * 37 * @param state 38 * new playback state. 39 */ 40 void playbackStateChanged(final PlayerStateEnum state); 41 42 /*** 43 * A new track was selected in the playlist. 44 * 45 * @param track 46 * the new track, may be <code>null</code> - in this case the 47 * playback is stopped. 48 * @param play 49 * if <code>true</code> then the track is already being played 50 * (or is about to be played). 51 * @param positionMillis 52 * the starting playback position in milliseconds. 53 */ 54 void trackChanged(final PlaylistItem track, final boolean play, 55 final int positionMillis); 56 57 /*** 58 * <p> 59 * A position in the track was changed. This is only due to 60 * {@link PlaylistPlayer#seek(int)} - it is never invoked periodically as 61 * the playback progresses. This event is not invoked when a playback is 62 * started with non-zero start seek time. 63 * </p> 64 * <p> 65 * Note that the playback may be paused. 66 * </p> 67 * 68 * @param position 69 * the new position in milliseconds. 70 * @param playing 71 * if <code>true</code> then playback is activated, if 72 * <code>false</code> then the playback is paused. This event is 73 * not invoked when the playback is stopped. 74 */ 75 void trackPositionChanged(final int position, final boolean playing); 76 77 /*** 78 * The play mode was changed. 79 * 80 * @param repeat 81 * new repeat value, never <code>null</code>. 82 */ 83 void repeatChanged(final Repeat repeat); 84 85 /*** 86 * The play mode was changed. 87 * 88 * @param random 89 * new random value, never <code>null</code>. 90 */ 91 void randomChanged(final Random random); 92 93 /*** 94 * Fired when the playlist changes - by removing a track, reshuffling etc. 95 * 96 * @param target 97 * the "target" (or the product) of the operation - for example 98 * for copy/move operations this interval contains added items, 99 * for delete operation the interval is empty. May be 100 * <code>null</code> if the target is not known. Semantically, 101 * the target should contain tracks that were 'produced' by the 102 * operation and they should be the target of the next operation. 103 * This implies that the playlist view should make these tracks 104 * appear selected. 105 */ 106 void playlistChanged(final Interval target); 107 }