想要声音停止播放新声音开始 [英] Would like sound to stop playing whem a new sound starts
问题描述
我正在制作一个简单的声卡作为我的第一个应用程序。 现在,当按下按钮以启动声音片段时,预剪辑会继续播放。 是否有办法在新声音开始时停止当前播放的声音?
I'm making a simple sound board as my first app. Right now when a button is press to start a sound clip, the pre clip keeps playing. Is thier a way to stop the sound that is currently playing when a new sound starts???
我的每个按钮的代码
;     private void image1_ImageFailed(object sender,ExceptionRoutedEventArgs e)
{
Stream s = TitleContainer.OpenStream(" sounds / bag.wav");
SoundEffect效果= SoundEffect.FromStream(s);
FrameworkDispatcher.Update();
effect.Play();
}
private void image1_ImageFailed(object sender, ExceptionRoutedEventArgs e)
{
Stream s = TitleContainer.OpenStream("sounds/bag.wav");
SoundEffect effect = SoundEffect.FromStream(s);
FrameworkDispatcher.Update();
effect.Play();
}
推荐答案
可以你改用SoundEffectInstance吗?
Can you use SoundEffectInstance instead?
这篇关于想要声音停止播放新声音开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!