[英]how do i stop a looped sound effect from stopping when another sound is played c#
I am playing background music using我正在使用播放背景音乐
SoundPlayer bgMusic = new SoundPlayer(@"bgmusic.wav");
then然后
bgMusic.PlayLooping();
but if I try to play any other sounds the music stops, is there a way to keep it going without using another thread但是如果我尝试播放任何其他声音音乐会停止,有没有办法在不使用另一个线程的情况下继续播放
You ought not use SoundPlayer Class for this work;您不应该为此工作使用 SoundPlayer Class; SoundPlayer is a lightweight class for playing occasional incidental sounds in an application.
SoundPlayer 是一个轻量级的 class,用于在应用程序中播放偶尔出现的声音。 It will occasionally remove sounds if other things are going on in the audio subsystem (like a music playing).
如果音频子系统中发生其他事情(如音乐播放),它偶尔会删除声音。 (WaveOutPlayer) API solve your problem.
(WaveOutPlayer) API 解决你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.