i used this method
Code:
public static extern int PlaySound( byte[] name, int hmod, int flags );
to play wav from resourse files like this
Code:
Resources.ResXResourceSet RRS = new Resources.ResXResourceSet(Application.StartupPath + FileName);
iCurrSound = 1;
while (!(RRS.GetObject((iCurrSound.ToString())) == null))
{
iCurrSound = iCurrSound + 1;
}
wav = Rnd(0, (iCurrSound - 1)) + 1;
object yy = RRS.GetObject((wav.ToString()));
byte[] bytSound = ((byte[])(yy));
RRS.Close();
PlaySound(bytSound, 0, SND_MEMORY / SND_ASYNC);
and some times it plays a wierd static noise after them....
what could go wrong?