How to play a .wav file subsequently without overlapping in Windows Mobile 6.0?
I am developing an app which requires to play .wav sound file one after the other.To play a sound, this is what I am doing.
Sound sound = ne开发者_Python百科w Sound(path); sound.Play();
If you are using .NET CF 3.5 you can use System.Media.SoundPlayer and play the sounds synchronously with the PlaySync() command.
For example:
string path = "\\Program Files\\SNAP.App.CE\\Content\\5LongLow.wav";
System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
player.PlaySync();
player.PlaySync();
This plays in the current thread, if you want you can also put it in its own thread to allow the UI thread to continue.
If you are using an older version of .NET CF the only way to do it is to play the sound, and then sleep on the thread for the "right" amount of time before submitting the next sound to play.
精彩评论