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

Directsound Buffers Sync

Last post 05-11-2008 9:29 AM by Dabuzz. 2 replies.
  • 05-09-2008 4:11 AM

    Directsound Buffers Sync

    I am adding a voip like functionallity to my application and have runned into problem with direct sound.
    I send sound packets over the wire and notice that for some reason the CaptureBuffer is faster then the SecondaryBuffer when playing. Both buffers have exactly the same WaveFormat but still it seem that they dont run at same speed. Is this logical? How can i resolve this and have both buffers in sync.
  • 05-09-2008 2:46 PM In reply to

    Re: Directsound Buffers Sync

    There are a large number of really crappy sound card implementations in the consumer space. If you're sure it's not your own fault, then you'll have to work around it. For example, you can detect when you receive too much data, and drop a packet now and then on the receiving side (don't let the queue exceed X milliseconds). For the reverse problem, you will also detect underrun when you get too little data, which will automatically add one buffer's worth of buffering through a silence/repeat glitch.

    The real solution is to use good hardware, with ASIO drivers, which is defined and implemented for true sample accurate record/playback. That limits the amount of hardware you can use, though, as most cheap crap consumer hardware doesn't have ASIO drivers.

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 05-11-2008 9:29 AM In reply to

    Re: Directsound Buffers Sync

    Thank you for your answer.
    For a second i thought of dropping the packets but then i realized that this wouldnt be correct solution for the problem. I also noticed the FullDuplex class which i have used but still the problem didnt go away. After running few test i have noticed absolutely strange thing. When the Winamp running on any of computers that creates a voice session between them the buffers stays in sync !!! I really would like to see any answers from any professionals out ther of how running another application that uses directsound affects the buffer sync.
    The problem is still there and i am really interested in any help that can be offered.
Page 1 of 1 (3 items) Previous Next