XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

I need some help, please... (problems with Dsound)

Last post 12/5/2008 1:41 PM by andreibanc. 2 replies.
  • 12/4/2008 7:56 PM

    I need some help, please... (problems with Dsound)

     

    Hello!

    I've got a very annoying error while playing sounds using DirectSound. My application uses some IDirectSoundBuffer-s, all filled with data from wave files. I actually don't mind if too much memory is used, therefore I copied the files into memory in their entire size. 

    test1.wav              :      19 kb

    test2.wav              :      200 kb  --------> here is the bug... is this to large? don't think so, because DSBSIZE_MAX is set to 0x0FFFFFFF...

    I want the sound to be played immediately when a key is pressed, so I call  

    myBuffer->Stop();

    myBuffer->SetCurrentPosition(0);

    respectively myBuffer->Play(0,0,0);

    at that moment. But, then, a very short (but loud enough) sound, like a "pok!" ... or a "beep" is played simultaneously.

    I tried unsuccesufully to increase myBufferDescription.dwBufferBytes, dwBufferBytes being a member of DSBUFFERDESC structure. I think I should not use streaming buffers because, as I said before, I have enough memory to use. Which is the cause of that short "beep" then? 

    I would appreciate any help or advice! Thank you!

  • 12/4/2008 9:22 PM In reply to

    Re: I need some help, please... (problems with Dsound)

    Are you loading the entire wave file into the buffer? That means that the file header is part of the data played, and will sound like a short amount of noise before the real data starts.
    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 12/5/2008 1:41 PM In reply to

    Re: I need some help, please... (problems with Dsound)

    THANK YOU A LOT!!! It works now. That was the bug... Thank you again! :D Regards, andrei
Page 1 of 1 (3 items) Previous Next