WinForms Application Form "Shakes" When Audio Playing

Posted by ikurtz on Stack Overflow See other posts from Stack Overflow or by ikurtz
Published on 2010-03-24T19:05:37Z Indexed on 2010/03/24 19:23 UTC
Read the original article Hit count: 505

Filed under:
|
|

I have a C# game program that i'm developing. it uses sound samples and winsock.

when i test run the game most of the audio works fine but from time to time if it is multiple samples being played sequentially the application form shakes a little bit and then goes back to its old position.

how do i go about debugging this or present it to you folks in a manageable manner? i'm sure no one is going to want the whole app code in fear of virus attacks.

please guide me..

EDIT: i have not been able to pin down any code section that produces this result. it just does and i cannot explain it.

EDIT: no the x/y position are not changing. the window like shakes around a few pixels and then goes back to the position were it was before the shake.

if (audio)
{
    Stream stream;
    SoundPlayer player;

    stream = Properties.Resources.ResourceManager.GetStream("_home");
    player = new System.Media.SoundPlayer(stream);
    player.PlaySync();
    player.Dispose();

    string ShipID = fireResult.DestroyedShipType.ToString();
    stream = Properties.Resources.ResourceManager.GetStream("_" + ShipID);
    player = new System.Media.SoundPlayer(stream);
    player.PlaySync();
    player.Dispose();

    stream = Properties.Resources.ResourceManager.GetStream("_destroyed");
    player = new System.Media.SoundPlayer(stream);
    player.PlaySync();
    player.Dispose();
}

can you see anything in the above code that would produce this shake?

© Stack Overflow or respective owner

Related posts about c#

Related posts about shake