private static void LoadLyricChange() { if (Lyrics.Count == 0) { return; } if (lyricpos >= Lyrics.Count || lyricpos < 0) { lyricpos = 0; } bool changed = false; if (Lyrics[lyricpos].LyricTime > Player.PlaybackSession.Position) //当感知到进度回溯时执行 { lyricpos = Lyrics.FindLastIndex(t => t.LyricTime <= Player.PlaybackSession.Position) - 1; if (lyricpos == -2) { lyricpos = -1; } changed = true; } try { if (lyricpos == 0) { changed = true; } while ((Lyrics.Count > lyricpos + 1 && Lyrics[lyricpos + 1].LyricTime <= Player.PlaybackSession.Position)) //正常的滚歌词 { lyricpos++; changed = true; } } catch { } if (changed) { Common.Invoke(() => OnLyricChange?.Invoke()); } }
private static void LoadLyricChange() { if (lyricpos >= Lyrics.Count || lyricpos < 0) { lyricpos = 0; } if (Lyrics[lyricpos].LyricTime > Player.PlaybackSession.Position) //当感知到进度回溯时执行 { lyricpos = Lyrics.FindLastIndex(t => t.LyricTime <= Player.PlaybackSession.Position) - 1; } if ((Lyrics.Count > lyricpos + 1 && Lyrics[lyricpos + 1].LyricTime <= Player.PlaybackSession.Position)) //正常的滚歌词 { lyricpos++; Invoke(() => OnLyricChange?.Invoke(Lyrics[lyricpos])); } }
private static void LoadLyricChange() { SongLyric songLyric = Lyrics.LastOrDefault((t => t.LyricTime < Player.PlaybackSession.Position)); Invoke(() => OnLyricChange?.Invoke(songLyric)); }