I have a SoundPlayer in my form which plays under specific KeyDown conditions. On my Windows 8.1 computer, if the key is held down, the sound repetitively plays (sometimes not even finishing before it plays again) but on all the other computers I have tried it on, which are Windows 7, the SoundPlayer only plays once, and usually not even until after the key is up. Is this supposed to happen or am I missing something in my code? The Windows 8.1 behaviour is my desired behaviour on all systems. Here is my code:
SoundPlayer blip = new SoundPlayer(Properties.Resources.Blip);
public void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Down || e.KeyCode == Keys.S)
{
Blip();
}
}
public void Blip()
{
blip.Play();
}