Multiple sounds in c# using .NET Compact Framework

  • Thread starter Thread starter Rob Collins
  • Start date Start date
R

Rob Collins

I have been trying for 3 weeks now to make multiple sounds
at once using C# targetted to a pocket PC using visual
studio 2003. I have been blocked at every turn - mostly
because of the mismatch between the managed code model of
c# and the underlying CE API and its c++ flavour.

All I want to do is play more than one wav file at once. I
can't think why playSound was not designed to allow this.
However, using the various 'wave' functions is also very
difficult. I tried to translate the code at
http://www.pocketpcdn.com/articles/multiplewaves.html into
c# and failed. I tried using the OpenNetCF wrapper and
failed.

The wave functions want nice pointers to blocks of memoery
containing the data and c# just hates doing this! For
example, the OpenNetCF wrapper exepects an IntPtr
parameter as a pointer to a function. C# wants it to be a
delegate - but I can find no method of converting one to
the other! I know that secretly the delegate is a function
pointer - but can I pass it as a parameter to the wave
functions? No way? So I can't make it do a callback.

Please, somebody smart show me that it is really easy to
make multiple sounds at once using c# .NET . Show me that
I really can call low level wave functions. Tell me how to
convert a delegate to an IntPtr. Anything in fact that
helps me overcome the barrier between managed code and the
rest of the facilties on my little pocket pc!

Regards

Rob
 
-----Original Message-----
I have been trying for 3 weeks now to make multiple sounds
at once using C# targetted to a pocket PC using visual
studio 2003. I have been blocked at every turn - mostly
because of the mismatch between the managed code model of
c# and the underlying CE API and its c++ flavour.

All I want to do is play more than one wav file at once. I
can't think why playSound was not designed to allow this.
However, using the various 'wave' functions is also very
difficult. I tried to translate the code at
http://www.pocketpcdn.com/articles/multiplewaves.html into
c# and failed. I tried using the OpenNetCF wrapper and
failed.

The wave functions want nice pointers to blocks of memoery
containing the data and c# just hates doing this! For
example, the OpenNetCF wrapper exepects an IntPtr
parameter as a pointer to a function. C# wants it to be a
delegate - but I can find no method of converting one to
the other! I know that secretly the delegate is a function
pointer - but can I pass it as a parameter to the wave
functions? No way? So I can't make it do a callback.

Please, somebody smart show me that it is really easy to
make multiple sounds at once using c# .NET . Show me that
I really can call low level wave functions. Tell me how to
convert a delegate to an IntPtr. Anything in fact that
helps me overcome the barrier between managed code and the
rest of the facilties on my little pocket pc!

Regards

Rob

.
 
I think that you want to look into using the managed wrappers for
DirectX 9. DirectX should allow you to play more than one sound at once,
easily.

Hope this helps.
 
Back
Top