> The APIs I've tried (FMod, SDL, and briefly OpenAL) have a 
> sort of callback mechanism.. where they call your function 
> when they need more sound -- I can't just give them the sound 
> as I produce it (at least not with the methods I've been 
> using -- if I'm mistaken here I would certainly love to know 
> how this can be accomplished).
> 
> To work with these I've had to end up double-buffering my 
> sound which makes it a little tricky to keep the video synced 
> with it, but I've managed.
> 
> That's one thing I did really like about DirectSound -- 
> direct, realtime access to the buffer actually being 
> streamed.  You could poll its current playback position and 
> everything.. right down to the sample.

With the callback mechanism, you can pretty much set things up to get
similar behaviour to the DirectSound case.
Basically, you set up a bigish circular buffer, that your code can dump
stuff into at will.
The sound callback takes a chunk out of this buffer on each call (big
enough not to run dry too quickly, small enough to minimise your
latency...)
Your code can read the in and out positions of the buffer, so you can
easily tell how much audio data is in there, and (to the nearest chunk,
anyway) where the replay has got to. You can also keep an eye on the
fill/empty rates to make sure everything is keeping up, and that you are
not in danger or over or under flow.
(For this sort of use case, a circular buffer maybe a better idea than a
double-buffer anyway, as a general choice, I think...)

Any use?
-- 
Ian




SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to