[DllImport("winmm.dll", EntryPoint = "PlaySound")]
private static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound);
public const int SND_FILENAME = 0x00020000;
public const int SND_ASYNC = 0x0001;
//用API播放声音文件, 异步,覆盖播放(1,不会堵塞UI 2,播放第二个音效的时候,第一个音效自动停止)
void ReadSound(string WavFilePath)
{
PlaySound(WavFilePath, IntPtr.Zero, SND_FILENAME | SND_ASYNC);
}
C#音效播放PlaySound
于 2015-09-02 14:27:19 首次发布

459

被折叠的 条评论
为什么被折叠?



