Greetings, I am trying to play some audio files without holding up the GUI. Below is a sample of the code:
if (audio)
{
if (ThreadPool.QueueUserWorkItem(new WaitCallback(CoordinateProc), fireResult))
{
}
else
{
MessageBox.Show("false");
}
}
if (audio)
{
if (ThreadPool.QueueUserWorkItem(new WaitCallback(FireProc), fireResult))
{
}
else
{
MessageBox.Show("false");
}
}
if (audio)
{
if (ThreadPool.QueueUserWorkItem(new WaitCallback(HitProc), fireResult))
{
}
else
{
MessageBox.Show("false");
}
}
The situation is the samples are not being played in order. some play before the other and I need to fix this so the samples are played one after another in order.
How do I implement this please?
Thank you.
EDIT: ThreadPool.QueueUserWorkItem(new WaitCallback(FireAttackProc), fireResult);
I have placed all my sound clips in FireAttackProc. What this does not do and I want is: wait until the thread stops running before starting a new thread so the samples dont overlap.