I am developing an aplication in which i play a sound in a loop. I want the loop to stop on either mouse click or key press and restart the loop. I am using c#, .net. Problem I am facing is loop continues to execute without capturing input from mouse/keyboard until it reaches to its maximum specified value. My code is
for(soundVolume = 0; soundVolume < 10; soundVolume++)
{
sound.Play();
if(mouseClick == true)
{
soundVolume = 0;
}
}