Hi,
I assume you are using .NETCF v3.5 beta as prior versions don't have the
System.Media classes. The way this class works is it loads in the file
internally and plays from the local cache of data. PlaySound simply plays
directly from the given file path (or memory buffer). You can work around
this by calling the Load() or LoadAsync() methods elsewhere in your code
prior to needing the sound. If the load is already done Play should perform
much better. Currently Play is having to first load the file which explains
the delay.
Peter

Signature
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility
> Hello there,
>
[quoted text clipped - 14 lines]
> something wrong with the SoundPlayer.Play method, or am I doing something
> wrong?
Kingherc - 21 Aug 2007 17:22 GMT
Thanks Peter for your quick response,
& congrats for your MVP
Well, I had tried what you said, in two ways: loading the sound from a file,
and loading the sound from a MemoryStream. They presented glitches. But in
the end I found out what the real problem was: Not surprisingly, I was
running the program always through Visual Studio (which monitors the program
while debugging and imposes a certain load on it), and that was why the
SoundPlayer presented glitches. I ran the program by itself and everything
worked just fine. Thanks for your response.
I should comment that SoundPlayer was a very nice addition in v3.5.
> Hi,
>
[quoted text clipped - 27 lines]
> > something wrong with the SoundPlayer.Play method, or am I doing something
> > wrong?