2017-09-04 28 views
0

我一直在试图在我的控制台应用程序上显示文本,同时正在播放声音文件,歌词作为示例。如何做到这一点?做...虽然System.Media.SoundPlayer()正在使用

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 


     } 

} 
+0

你想要的歌词流行起来,通过字同步同歌同戏词?或者只是一次? – Werdna

+0

使用歌词的例子,是的。随着歌曲的进展,歌词应该会弹出,也许在两者之间有定时,但我得到了这部分内容的窍门。 –

+0

https://www.codeproject.com/Articles/89845/MP-CDG-Karaoke-Player – Werdna

回答

0

与播放更换PlaySync

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(); 
     } 
}