public static void LoadSongs() { CLog.StartBenchmark(1, "Load Songs"); _SongsLoaded = false; _Songs.Clear(); CLog.StartBenchmark(2, "List Songs"); List <string> files = new List <string>(); foreach (string p in CConfig.SongFolder) { string path = p; files.AddRange(Helper.ListFiles(path, "*.txt", true, true)); files.AddRange(Helper.ListFiles(path, "*.txd", true, true)); } CLog.StopBenchmark(2, "List Songs"); CLog.StartBenchmark(2, "Read TXTs"); foreach (string file in files) { CSong Song = new CSong(); if (Song.ReadTXTSong(file)) { Song.ID = _Songs.Count; _Songs.Add(Song); } } CLog.StopBenchmark(2, "Read TXTs"); CLog.StartBenchmark(2, "Sort Songs"); Sort(CConfig.SongSorting); CLog.StopBenchmark(2, "Sort Songs"); Category = -1; _SongsLoaded = true; if (CConfig.Renderer != ERenderer.TR_CONFIG_SOFTWARE && CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) { CLog.StartBenchmark(2, "Load Cover"); for (int i = 0; i < _Songs.Count; i++) { CSong song = _Songs[i]; song.ReadNotes(); STexture texture = song.CoverTextureSmall; song.CoverTextureBig = texture; _CoverLoadIndex++; } _CoverLoaded = true; CDataBase.CommitCovers(); CLog.StopBenchmark(2, "Load Cover"); } CLog.StopBenchmark(1, "Load Songs "); }
private static void _LoadCover() { for (int i = 0; i < _Songs.Count; i++) { CSong song = _Songs[i]; song.ReadNotes(); STexture texture = song.CoverTextureSmall; song.CoverTextureBig = texture; _CoverLoadIndex++; } _CoverLoaded = true; CDataBase.CommitCovers(); }
private void LoadNextSong() { CGame.NextRound(); if (CGame.IsFinished()) { CGraphics.FadeTo(EScreens.ScreenScore); _FadeOut = true; return; } CSong song = CGame.GetSong(); if (song == null) { CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!"); return; } CloseSong(); if (!song.CoverSmallLoaded) { song.ReadNotes(); } string songname = song.Artist + " - " + song.Title; int rounds = CGame.GetNumSongs(); if (rounds > 1) { songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")"; } Texts[htTexts(TextSongName)].Text = songname; _CurrentStream = CSound.Load(song.GetMP3(), true); CSound.SetStreamVolume(_CurrentStream, _Volume); CSound.SetPosition(_CurrentStream, song.Start); _CurrentTime = song.Start; _FinishTime = song.Finish; _TimeToFirstNote = 0f; _TimeToFirstNoteDuet = 0f; CGame.ResetPlayer(); CDraw.RemoveTexture(ref _CurrentVideoTexture); if (song.VideoFileName != String.Empty) { _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); _VideoAspect = song.VideoAspect; } CDraw.RemoveTexture(ref _Background); if (song.BackgroundFileName != String.Empty) { _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); } SingNotes[htSingNotes(SingBars)].Reset(); bool LyricsOnTop = CGame.NumPlayer == 2 && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; if (song.IsDuet) { CGame.Player[1].LineNr = 1; Statics[htStatics(StaticLyricsDuet)].Visible = true; Lyrics[htLyrics(LyricMainDuet)].Visible = true; Lyrics[htLyrics(LyricSubDuet)].Visible = true; Lyrics[htLyrics(LyricMainTop)].Visible = false; Lyrics[htLyrics(LyricSubTop)].Visible = false; Statics[htStatics(StaticLyricsTop)].Visible = false; } else { Statics[htStatics(StaticLyricsDuet)].Visible = false; Lyrics[htLyrics(LyricMainDuet)].Visible = false; Lyrics[htLyrics(LyricSubDuet)].Visible = false; Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop; Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop; Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop; } for (int p = 0; p < CGame.NumPlayer; p++) { NoteLines[p] = SingNotes[htSingNotes(SingBars)].AddPlayer( SingNotes[htSingNotes(SingBars)].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); } /* * case 4: * NoteLines[0] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]); * NoteLines[1] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]); * NoteLines[2] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]); * NoteLines[3] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]); * break; */ _TimerSongText.Stop(); _TimerSongText.Reset(); if (song.Notes.Lines.Length != 2) { _TimerSongText.Start(); } StartSong(); }