0

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

struct Music 
{
        public
            void PlaySong() {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
            player.Load();
            player.PlaySync();
        }
}

class Program
{


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


         }

}
4

1 回答 1

0

将 PlaySync 替换为 Play

    struct Music 
{
        public
            void PlaySong() {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
            player.Load();
            player.Play();
        }
}
于 2017-09-10T17:47:24.947 回答