Jan 18 at 10:02 PM
Edited Jan 18 at 10:04 PM
|
Ok so I have one last question, I hope you dont mind:
so now I have a timer which update every 10 miliseconds, after the timer starts i do this :
waveOutDevice.Dispose();
SoundMixer.waveData.Clear();
SoundMixer.ClearMixer();
after I have intersection I add WaveStream data into global list which store all the sounds:
SoundMixer.waveData.Add(placeToPress.ChannelStream);
then I set the channelStream.Position = 0;
when I want to play it I use this :
SoundMixer.AddToMixer();
waveOutDevice.Init(SoundMixer.MixerPlay()); //this return SampleToWaveProvider
waveOutDevice.Play();// waveOutDevice is DirectSoundOut.
If I add Thread.Sleep(100); after the whole code I can hear sound,but before this I cant hear nothing, any idea how to do this working
without sleep method ?
|