【发布时间】:2014-11-01 11:31:55
【问题描述】:
我用 C# 编写了一个获胜轮盘。对于每个字段,它都会播放声音。从 200 毫秒到 1.5 秒。 (听起来像“滴答声”)。
这是我的代码(只有声音):
public class Global{
public static WMPLib.WindowsMediaPlayer tick_sound = new WMPLib.WindowsMediaPlayer();
}
private void timer1_Tick(object sender, EventArgs e){
Global.tick_sound.controls.stop();
Global.tick_sound.URL = @"\Resources\tick.mp3";
Global.tick_sound.controls.play();
}
它工作正常,但在这个计时器循环中声音听起来不太好。我猜 Windows Media Player 速度很慢。有没有其他方法可以更快更好地播放声音?
【问题讨论】: