yc1224
using System.Media;
 
string szPath = Application.StartupPath + “\\SoundFile\\sound.wav”;
SoundPlayer soundplayer = new SoundPlayer();
声音文件路径:
soundplayer.SoundLocation = szPath;
播放方式:
①同步播放:
soundplayer.Load();
soundplayer.Play();
②异步播放:
soundplayer.LoadAsync();
soundplayer.PlaySync();
③循环播放:
soundplayer.Load();
soundplayer.PlayLooping();
④关闭://关闭时释放资源
soundplayer.Stop();
soundplayer.Dispose();

分类:

技术点:

相关文章:

  • 2021-08-15
  • 2021-11-06
  • 2022-01-01
  • 2021-07-31
  • 2021-11-27
  • 2021-11-04
  • 2021-10-02
猜你喜欢
  • 2021-08-07
  • 2021-11-05
  • 2021-11-17
  • 2021-12-05
  • 2021-12-29
  • 2021-12-18
  • 2020-04-30
相关资源
相似解决方案