Playing same sound many times C# WPF

I'm trying to play the same overlapping sound whenever a button is pressed. I tried with MediaElement and SoundPlayer, but the music stops and starts again. I need to create a new instance, but creating new MediaElement() and adding to the Stage didn´t work too :-/

Thanks for your help


Check here: http://www.interact-sw.co.uk/iangblog/2008/01/25/wpf-concurrent-audio

Create multiple MediaPlayers in the CodeBehind.


我没有成功与MediaPlayers,但它的工作原理:

MediaElement mp = new MediaElement();
soundPanel.Children.Add(mp);
mp.Source = new Uri(key_sound, UriKind.RelativeOrAbsolute);
链接地址: http://www.djcxy.com/p/25988.html

上一篇: 控制台应用程序c#背景音乐

下一篇: 多次播放相同的声音C#WPF