在使用System.Media.soundPlayer()时



我一直试图在声音文件当前播放时在控制台应用程序上显示文本,例如歌词。最好的方法是如何做的?

struct Music 
{
        public
            void PlaySong() {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = @"C:UsersMyPCMusicMoreMusicsongsample.wav";
            player.Load();
            player.PlaySync();
        }
}
class Program
{

        static public void Main(string[] args)
        {
            Music music;
            do
            {
                //Display Lyrics
            } while (true); //as the song progresses

         }
}

用play

替换游戏
    struct Music 
{
        public
            void PlaySong() {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = @"C:UsersMyPCMusicMoreMusicsongsample.wav";
            player.Load();
            player.Play();
        }
}

相关内容

  • 没有找到相关文章

最新更新