public void AddSong(string Name) { BaseSong NewSong = MediaPlayer.Instance.NewSong(); int Index = Name.IndexOf("^"); String SongName, AristName; if (Index > 0) { SongName = Name.Substring(0, Index); AristName = Name.Substring(Index + 1, Name.Length - Index - 1); } else { SongName = Name; AristName = "Unknown artist"; } SongName = SongName.Replace('$', '\''); NewSong.FileName = Name; NewSong.Name = Name; NewSong.SongName = SongName; NewSong.ArtistName = AristName; NewSong.AlwaysLoaded = false; NewSong.LoadSong_IfNotLoaded(NewSong.FileName); SongList.Add(NewSong); }
/// <summary> /// Set the play list to a single song and start playing it. /// </summary> public void SetPlayList(BaseSong song) { List <BaseSong> list = new List <BaseSong>(); list.Add(song); SetPlayList(list); CurIndex = 0; }
public void Next(BaseSong song) { bool HoldSuppress = SuppressNextInfoDisplay; SuppressNextInfoDisplay = HoldSuppress; CurIndex = PlayList.IndexOf(song); if (CurIndex < 0) { CurIndex = 0; } SetSong(CurIndex); }
private static void LoadMusic() { SongWad.Wad = new SongWad(); SongWad.Wad.PlayerControl = SongWad.Wad.DisplayInfo = true; string path = Path.Combine(Content.RootDirectory, "Music"); string[] files = Directory.GetFiles(path); foreach (String file in files) { int i = file.IndexOf("Music") + 5 + 1; if (i < 0) { continue; } int j = file.IndexOf(".", i); if (j <= i) { continue; } String name = file.Substring(i, j - i); String extension = file.Substring(j + 1); if (extension == "xnb") { SongWad.Wad.AddSong(name); } } float ReduceAll = .8f; Song_MenuMusic = SongWad.Wad.FindByName("Menu-Music^Unknown"); Song_MenuMusic.Volume = .9f * ReduceAll; Song_Heavens = SongWad.Wad.FindByName("The_Heavens_Opened^Peacemaker"); Song_Heavens.Volume = 1f * ReduceAll; // Create the standard playlist SongList_Standard.AddRange(SongWad.Wad.SongList); SongList_Standard.Remove(Song_MenuMusic); }
public void DisplaySongInfo(BaseSong song) { if (!DisplayInfo) { return; } if (!song.DisplayInfo) { return; } string songname = song.SongName; songname = songname.Replace('_', ' '); string artistname = song.ArtistName; artistname = song.ArtistName.Replace('_', ' '); SongInfoText = songname + "\n" + artistname; DisplayingInfo = true; }
public void LoopSong(BaseSong song) { Stop(); SetPlayList(song); Start(true); }
public void SetSong(BaseSong song) { SetSong(PlayList.IndexOf(song)); }