Reputation: 451
I have timer with an interval of 20 ms in Visual C#.
public class Global
{
//Global Vars
public static System.Media.SoundPlayer sound = new System.Media.SoundPlayer(Project.Properties.Resources.tock);
}
private void timer1_Tick(object sender, EventArgs e)
{
Global.sound.PlaySync();
}
My tock.wav plays 70 ms. My Problem is that timer1_tick is waiting till the sound is played and I don't want to short my wav file. Is there any option to play the sound in the background? It might sounds not good, but I will give it a try.
Upvotes: 0
Views: 209
Reputation: 2002
To start the SoundPlayer in a separate thread, simply call Play()
instead of PlaySync()
.
See the documentation for reference.
Upvotes: 1