我是Windows 8 Metro App(C#/ XAML):
如何触发相同的声音效果两次以便同时播放.
如何触发相同的声音效果两次以便同时播放.
第二场比赛应该在第一场比赛结束前开始.
相关问题是:
Playing two sounds simultaneously c#
和Play two sounds simultaneusly
我找到了XNA的这个类,它做了我想要的,但在Metro下不可用:
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.audio.soundeffectinstance.aspx
只需为每个声音效果创建一个单独的媒体元素.
原文链接:https://www.f2er.com/windows/371893.html(不确定我每次都需要重新定位文件)
public async void PlayLaserSound() { var package = Windows.ApplicationModel.Package.Current; var installedLocation = package.InstalledLocation; var storageFile = await installedLocation.GetFileAsync("Assets\\Sounds\\lazer.mp3"); if (storageFile != null) { var stream = await storageFile.OpenAsync(Windows.Storage.FileAccessMode.Read); MediaElement snd = new MediaElement(); snd.SetSource(stream,storageFile.ContentType); snd.Play(); } }