internal static Music[] displayContents() { Music[] displayed = new Music[displayCount()]; for (int i=0, j=0; i<library.Length; i++) { if (library[i].selected) { displayed[j++] = library[i]; } } return displayed; }
// Controls ///////////////////////////////// internal static void play(Music m) { if (paused == 0) { Music.status = "loading"; double seconds = m == playing ? 0.3 : 2.5 ; Simulator.nextPlayStarted = Simulator.schedule(seconds); } else { Music.status = "playing"; Simulator.nextPlayComplete = Simulator.schedule(paused); paused = 0; } }
internal static Music parse(string text) { Music m = new Music(); string[] tokens = text.Split(new char[] {'\t'}); m.title = tokens[0]; m.artist = tokens[1]; m.album = tokens[2]; m.genre = tokens[3]; m.size = long.Parse(tokens[4]); m.seconds = int.Parse(tokens[5]); m.trackNumber = int.Parse(tokens[6]); m.trackCount = int.Parse(tokens[7]); m.year = int.Parse(tokens[8]); m.date = DateTime.Parse(tokens[9]); return m; }
internal static void select(Music m) { looking = m; }
// Events /////////////////////////////////// internal static void playStarted() { Music.status = "playing"; playing = MusicLibrary.looking; Simulator.nextPlayComplete = Simulator.schedule(playing.seconds); }
internal static void playComplete() { Music.status = "ready"; playing = null; }