Multiple sounds in c# using .NET Compact Framework

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Collins

    Multiple sounds in c# using .NET Compact Framework

    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

  • Guest's Avatar

    #2
    Multiple sounds in c# using .NET Compact Framework

    [color=blue]
    >-----Original Message-----
    >I have been trying for 3 weeks now to make multiple[/color]
    sounds[color=blue]
    >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.[/color]
    I[color=blue]
    >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[/color]
    into[color=blue]
    >c# and failed. I tried using the OpenNetCF wrapper and
    >failed.
    >
    >The wave functions want nice pointers to blocks of[/color]
    memoery[color=blue]
    >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[/color]
    function[color=blue]
    >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[/color]
    to[color=blue]
    >convert a delegate to an IntPtr. Anything in fact that
    >helps me overcome the barrier between managed code and[/color]
    the[color=blue]
    >rest of the facilties on my little pocket pc!
    >
    >Regards
    >
    >Rob
    >
    >.
    >[/color]

    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Multiple sounds in c# using .NET Compact Framework

      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.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m

      <anonymous@disc ussions.microso ft.com> wrote in message
      news:487c01c3a1 72$02372d20$7d0 2280a@phx.gbl.. .[color=blue]
      >[color=green]
      > >-----Original Message-----
      > >I have been trying for 3 weeks now to make multiple[/color]
      > sounds[color=green]
      > >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.[/color]
      > I[color=green]
      > >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[/color]
      > into[color=green]
      > >c# and failed. I tried using the OpenNetCF wrapper and
      > >failed.
      > >
      > >The wave functions want nice pointers to blocks of[/color]
      > memoery[color=green]
      > >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[/color]
      > function[color=green]
      > >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[/color]
      > to[color=green]
      > >convert a delegate to an IntPtr. Anything in fact that
      > >helps me overcome the barrier between managed code and[/color]
      > the[color=green]
      > >rest of the facilties on my little pocket pc!
      > >
      > >Regards
      > >
      > >Rob
      > >
      > >.
      > >[/color][/color]


      Comment

      Working...