Using SDL for audio in C# (.NET)

Hello,

currently I am trying to get the SDL audio part running with my
application, written in C# (for .NET). I have it running for a large
part, but get an unexpected (and unsolvable) WIN32 exception. Can
someone help me:

(code is attached)

  • I first read the whole WAV file in a byte[] header and a byte[] data;
  • Then I do SDL_Init(AUDIO) and define the SDL_AudioSpecs (desired and
    obtained)
  • I open the AudioDevice with SDL_OpenAudio(…) and this also
    succeeds, and I print the data of the structures to stdout.
  • The I wait for a user command (eg. ‘p’ for playing) and then do
    SDL_PauseAudio(0). This should start the plating.

The callback function (FillBuffer) is called only once. The buffer
stream is filled correctly with len bytes from the byte[] data. After
that the callback returns. The audio starts playing (only the first
buffer part, silence for the second buffer) and a unexpected Win32
exception (Instruction at 0x… referenced memory 0x…: the memory
could not be ‘written’ ) is generated, which results in closing the
application.

Can someone help me with this problem? Has someone a working example in
C# maybe?

Please react: Thanks in advance

Arjan Claassen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: TestPlayer.cs
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020912/fa971b99/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: Class1.cs
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020912/fa971b99/attachment.asc