RE: [GD-Windows] Latency of wavOutWrite vs. DSound
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2001-11-05 18:05:49
|
> I'm working on a small title that needs to run across as wide a range of > Win32 platforms as possible. I know that the non-DX audio capabilities > such as wavOutWrite have higher latencies than using DirectSound, but > has anyone quantified the difference? Is it high enough to be > aggravating in a game that isn't an action game? The weird thing is that the wavOut API, as designed, could achieve very low latencies, if only the Windows scheduler would cooperate, and drivers were well written. I've found that there are a few issues with getting low latencies on wavOut: -) some kernels (especially NT 4 I believe) implement it poorly -) some hardware or drivers make assumptions about minimum block sizes -) some systems (especially Win95 and original Win98) may not schedule you as often as you'd wish The problem is that most modern cards and systems would have no problem with you writing 1024 frame buffers at 44.1kHz/16bit/2ch (~23 milliseconds), but there are some oddball cases that need about 300 milliseconds to work right. Of course, 300 milliseconds get to the point where buffers are too big for some hardware so you'd have to split the amount of data you want to write up into several smaller buffers. Perhaps you could profile the system, and do double-buffering with 23 ms buffers on high-end "modern" systems, 69 ms buffers on less "modern" systems and have a "alternate sound" checkbox which doubled the amount of buffering, to use in troubleshooting cases. (Note that with 23 ms buffers, your perceived latency is twice that, or up to 46 milliseconds; still OK for games). > Is there a significant difference between PlaySound( resource ) vs. > waveOutWrite? Yes. Cheers, / h+ |