Re: OpenAL for flight simulator

Ben Supnik <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Hi Chris,

Chris Robinson wrote:

> It depends on how small of sizes you're talking about. If you have at least 2 
> buffers queued at a given time, that total at least 50ms audio, that should be 
> good enough to get by as long as your code can react fast enough to refill 
> them. However, if you can queue more audio, you would be better off.

Right...assume for the sake of argument that I want to minimize latency, 
e.g. I am streaming so I can apply real-time sw FX based on game play 
(e.g. I have a distortion on an engine sound that gets more, um, 
distorted with RPM, etc.).

(Stop me where I say something truly idiotic...I haven't

If I had a double-buffer callback, my worst latency is 2n where n is the 
number of milliseconds of sound in the buffer.  I hit this case when I 
write the last sample in the buffer...if my write func is infinitely 
fast, I write that last sample n ms before it is played, and I pick up 
just under n ms of additional latency because it's at the end of the buffer.

If I use the minimum number of OpenAL buffers (2) and OpenAL dequeues 
the buffers infinitely fast in its infinitely fast mix function I think 
I pick up 3n ms of latency because once I write a buffer, it sits on 
OpenAL's source Q for n ms before it sits in the non-playing hardware 
buffer for n ms before it is played for n ms.

Do the two buffers include the one being played 'now' or do I actually 
need to keep 2 of 3 buffers filled?

> http://repo.or.cz/w/alure.git/blob/HEAD:/examples/alurestream.c
> It is, of course, subject to change until a proper release is made, but I 
> don't see it changing all that much.

Ah - I see it, and if I understand, this implementation polls at a 
global interval to pick off and refill streams.  The risk there is that 
if I don't poll frequently enough, the wasted time from when I should 
have refilled to when I did refill might be too late and I'll under-run. 
  I suppose in practice the buffers have to be long enough that the 
polling interval would be a non-issue.

cheers
Ben

-- 
Scenery Home Page: http://scenery.x-plane.com/
Scenery blog: http://xplanescenery.blogspot.com/
Plugin SDK: http://www.xsquawkbox.net/xpsdk/
X-Plane Wiki: http://wiki.x-plane.com/
Scenery mailing list: [email protected]
Developer mailing list: [email protected]
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.