public static int GetNextSongWithoutCover(ref CSong Song) { if (!SongsLoaded) return -1; if (_Songs.Count > _CoverLoadIndex + 1) { _CoverLoadIndex++; Song = _Songs[_CoverLoadIndex]; return _CoverLoadIndex; } return -2; }
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 "); }
public CSong(CSong song) { this._CoverTextureSmall = song._CoverTextureSmall; this._CoverTextureBig = song._CoverTextureBig; this.Medley = new SMedley(); this.Medley.Source = song.Medley.Source; this.Medley.StartBeat = song.Medley.StartBeat; this.Medley.EndBeat = song.Medley.EndBeat; this.Medley.FadeInTime = song.Medley.FadeInTime; this.Medley.FadeOutTime = song.Medley.FadeOutTime; this.CalculateMedley = song.CalculateMedley; this.PreviewStart = song.PreviewStart; this.ShortEnd = song.ShortEnd; this.DuetPart1 = song.DuetPart1; this.DuetPart2 = song.DuetPart2; this.Encoding = song.Encoding; this.Folder = song.Folder; this.FolderName = song.FolderName; this.FileName = song.FileName; this.Relative = song.Relative; this.MP3FileName = song.MP3FileName; this.CoverFileName = song.CoverFileName; this.BackgroundFileName = song.BackgroundFileName; this.VideoFileName = song.VideoFileName; this.VideoAspect = song.VideoAspect; this._CoverLoaded = song._CoverLoaded; this.CoverBigLoaded = song.CoverBigLoaded; this._NotesLoaded = song._NotesLoaded; this.Artist = song.Artist; this.Title = song.Title; this.Start = song.Start; this.Finish = song.Finish; this.BPM = song.BPM; this.Gap = song.Gap; this.VideoGap = song.VideoGap; this.Comment = new List <string>(); foreach (string value in song.Comment) { this.Comment.Add(value); } this.ID = song.ID; this.Visible = song.Visible; this.CatIndex = song.CatIndex; this.Selected = song.Selected; this.Edition = new List <string>(); foreach (string value in song.Edition) { this.Edition.Add(value); } this.Genre = new List <string>(); foreach (string value in song.Genre) { this.Genre.Add(value); } this.Year = song.Year; this.Language = new List <string>(); foreach (string value in song.Language) { this.Language.Add(value); } this.Notes = new CNotes(song.Notes); }
public virtual CSong GetSong() { if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count) { CSong song = CSongs.GetSong(_SongQueque[_CurrentSong].SongID); song = new CSong(song); switch (GetCurrentGameMode()) { case EGameMode.TR_GAMEMODE_MEDLEY: // set medley mode timings song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap; if (song.Start < 0f) song.Start = 0f; song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap; // set lines to medley mode song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat); break; case EGameMode.TR_GAMEMODE_SHORTSONG: song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap; // set lines to medley mode song.Notes.SetMedley(song.Notes.GetLines(0).Line[0].FirstNoteBeat, song.ShortEnd); break; } return song; } return null; }
public CSong(CSong song) { this._CoverTextureSmall = song._CoverTextureSmall; this._CoverTextureBig = song._CoverTextureBig; this.Medley = new SMedley(); this.Medley.Source = song.Medley.Source; this.Medley.StartBeat = song.Medley.StartBeat; this.Medley.EndBeat = song.Medley.EndBeat; this.Medley.FadeInTime = song.Medley.FadeInTime; this.Medley.FadeOutTime = song.Medley.FadeOutTime; this.CalculateMedley = song.CalculateMedley; this.PreviewStart = song.PreviewStart; this.ShortEnd = song.ShortEnd; this.DuetPart1 = song.DuetPart1; this.DuetPart2 = song.DuetPart2; this.Encoding = song.Encoding; this.Folder = song.Folder; this.FolderName = song.FolderName; this.FileName = song.FileName; this.Relative = song.Relative; this.MP3FileName = song.MP3FileName; this.CoverFileName = song.CoverFileName; this.BackgroundFileName = song.BackgroundFileName; this.VideoFileName = song.VideoFileName; this.VideoAspect = song.VideoAspect; this._CoverLoaded = song._CoverLoaded; this.CoverBigLoaded = song.CoverBigLoaded; this._NotesLoaded = song._NotesLoaded; this.Artist = song.Artist; this.Title = song.Title; this.Start = song.Start; this.Finish = song.Finish; this.BPM = song.BPM; this.Gap = song.Gap; this.VideoGap = song.VideoGap; this.Comment = new List<string>(); foreach (string value in song.Comment) { this.Comment.Add(value); } this.ID = song.ID; this.Visible = song.Visible; this.CatIndex = song.CatIndex; this.Selected = song.Selected; this.Edition = new List<string>(); foreach (string value in song.Edition) { this.Edition.Add(value); } this.Genre = new List<string>(); foreach (string value in song.Genre) { this.Genre.Add(value); } this.Year = song.Year; this.Language = new List<string>(); foreach (string value in song.Language) { this.Language.Add(value); } this.Notes = new CNotes(song.Notes); }
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; CLog.StopBenchmark(1, "Load Songs "); }
public static void LoadCover(long WaitTime) { if (!SongsLoaded) return; if (CoverLoaded) return; if (!_CoverLoadTimer.IsRunning) { _CoverLoadTimer.Reset(); _CoverLoadTimer.Start(); } STexture texture = new STexture(-1); if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime) { CSong song = new CSong(); int i = GetNextSongWithoutCover(ref song); if (i < 0) return; song.ReadNotes(); if (song.CoverFileName != String.Empty) { if (!CDataBase.GetCover(Path.Combine(song.Folder, song.CoverFileName), ref texture, CConfig.CoverSize)) texture = CCover.NoCover; } else texture = CCover.NoCover; SetCoverSmall(i, texture); SetCoverBig(i, texture); _CoverLoadTimer.Reset(); _CoverLoadTimer.Start(); } }
public static void LoadCover(long WaitTime, int NumLoads) { if (CConfig.Renderer != ERenderer.TR_CONFIG_SOFTWARE) return; //should be removed as soon as the other renderer are ready for queque if (!SongsLoaded) return; if (CoverLoaded) return; if (!_CoverLoadTimer.IsRunning) { _CoverLoadTimer.Reset(); _CoverLoadTimer.Start(); } STexture texture = new STexture(-1); if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime) { for (int i = 0; i < NumLoads; i++) { CSong song = new CSong(); int n = GetNextSongWithoutCover(ref song); if (n < 0) return; song.ReadNotes(); texture = song.CoverTextureSmall; SetCoverSmall(n, texture); SetCoverBig(n, texture); if (CoverLoaded) CDataBase.CommitCovers(); _CoverLoadTimer.Reset(); _CoverLoadTimer.Start(); } } }
public PlaylistElement(CSong song) { MusicFilePath = string.Empty; _SongID = song.ID; _Song = song; }