C# 播放声音

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.Play();
异步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.LoadAsync();
player.PlaySync();
循环播放:

 
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.PlayLooping();

 

注意,只支持wav格式的波形

posted @ 2013-01-06 16:55  dreamfly_cc  阅读(310)  评论(0编辑  收藏  举报