RE: [GD-Windows] Streaming WAVE audio
Brought to you by:
vexxed72
From: Johnson, J. <Jam...@si...> - 2004-07-14 07:17:42
|
Buffer size and latency are different things. When a sound is queued it is immediately mixed into the current playing header sometime ahead of the current play position. On good hardware I was able to mix audio 10-15ms ahead of the play position without error. However like you, I discovered that to support most/all systems I had to mix a bit further ahead of the playback position; 50ms is what I chose. When I wrote this system I had some doubt about modifying the buffer addressed by a prepared and written WAVEHDR. The doco wasn't exactly clear on this point. It clearly states what members can be modified in the WAVEHDR after prepared, but doesn't mention the PCM data addressed by the header. I'm curious if others have had problems with this mixing strategy besides the obvious recomposition of the remaining playing buffer. James -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Jon Watte Sent: Tuesday, July 13, 2004 11:40 PM To: gam...@li... Subject: RE: [GD-Windows] Streaming WAVE audio > 2) On some system there appears to be a minimum required buffer size,=0D > e.g. at least 250ms. On systems like these I got silence at best, and=0D > lock up at worst. I didn't spend a lot of time investigating this=0D > because 250ms is pretty short buffer. I was shooting for 4/8/16k=0D > buffer sizes at that time. In the end I don't think it matters. 250 ms is a REALLY BIG buffer. 250 ms of latency means you pull the trigger now, and hear the gunshot sound when the target's already dead. (When I say "buffer" I really mean "WAVHDR chunk"). I've found that once I went above 40 ms buffers, and used at least 3 buffers, any hardware I tested on worked well. Less that that in either variable caused problems. Note that the scheduler on Win98 is VERY jittery -- 20 ms scheduling jitter is common, and it can jerk higher than that, even on a quiescent system with a fast CPU. > Furthermore I recommend not using the ACM to up/down sample as it=0D > appears to perform point sampling(!) which can produce terrible audio. I always code my own re-sampler, which sits at the reader/input stage of the mixer, which I also code on my own, for the WAVE output. I prefer to use cubic Hermite interpolation, which runs fast and sounds good. Cheers, / h+ ---------------------------------------------------- Vivendi Universal Games- <<http://www.vugames.com>>:=0D The information transmitted is intended only for the=0D person or entity to which it is addressed and may=0D contain confidential and/or privileged material of=0D Vivendi Universal Games which is for the exclusive=0D use of the individual designated above as the=0D recipient. Any review, retransmission, dissemination=0D or other use of, or taking of any action in reliance=0D upon, this information by persons or entities other=0D than the intended recipient is prohibited. If you=0D received this in error, please contact immediately=0D the sender by returning e-mail and delete the=0D material from any computer. If you are not the=0D specified recipient, you are hereby notified that=0D all disclosure, reproduction, distribution or action taken on the basis of this message is prohibited. |