Home Up Articles Tutorials Downloads Web Links Newsgroups About Me Search
 

DirectX Audio FAQ

Q: I'm hearing static (white noise) in my sound buffers sometimes.
A: The debug version of the DirectX runtime fills sound buffers with static. If you are not filling a buffer before playback is started, static will be heard.

Q: Playback stops on my DirectSound application when it looses focus.
A: You need to include the DSBCAPS_GLOBALFOCUS flag in your DSBUFFERDESC structure when you call the CreateSoundBuffer method.

Q: How do I stream a sound to a DirectSound buffer?
A: One method would be to convert the code in the C++ SDK sample class called CStreamSound to VB code. (I may post my VB code at a later date.) This is basically what you need to do: You should create at least two events in your secondary buffer. For example, set one event halfway through the buffer and another event at the end. Fill the entire buffer and then start playing it. When the first event is fired, (half way through the buffer) write data to the first half of the buffer. When the next event is fired (end of buffer) write to the second half of the buffer. This keeps your application from trying to write to the same data in the buffer that the audio card is currently reading from.

Q: DirectMusic always finds the length of a .WAV file to be 1, not allowing the start point to be set.
A: With DirectX 8, DirectMusic does not allow you to set the current play position of a wave file. The current play position can be set on a wave file played using a DirectSound buffer. The only disadvantage is DirectSound is not as easy to implement as DirectMusic.

"If we knew what it was we were doing, it would not be called research, would it?"
- Albert Einstein

 
edebrosse@mvps.org
©2009 Eric DeBrosse

www.orionengine.com

Hit Counter
Visitors since 5/21/2002