コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        public void Next(BaseSong song)
        {
            bool HoldSuppress = SuppressNextInfoDisplay;

            SuppressNextInfoDisplay = HoldSuppress;

            CurIndex = PlayList.IndexOf(song);
            if (CurIndex < 0)
            {
                CurIndex = 0;
            }

            SetSong(CurIndex);
        }
コード例 #4
0
ファイル: Assets.cs プロジェクト: JordanFisher/WAL
        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);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
 public void LoopSong(BaseSong song)
 {
     Stop();
     SetPlayList(song);
     Start(true);
 }
コード例 #7
0
 public void SetSong(BaseSong song)
 {
     SetSong(PlayList.IndexOf(song));
 }