[Openal-devel] last call: ALC_EXT_disconnect
StApostol
stapostol at gmail.com
Wed Aug 26 02:52:07 PDT 2009
On Wed, Aug 26, 2009 at 11:07 AM, E. Wing <ewmailing at gmail.com> wrote:
> On 8/19/09, Chris Robinson <chris.kcat at gmail.com> wrote:
> > On Wednesday 19 August 2009 6:19:05 am E. Wing wrote:
> >> I also wanted to put this idea out there. What do people think of
> >> having a callback function you can define (via function pointers) to
> >> handle device changes? It seems that constantly polling for a device
> >> change is awkward at best. I know OpenAL doesn't have any event
> >> callbacks, but maybe looking forward to future revisions, maybe this
> >> is desirable.
> >
> > Normally I wouldn't be for callbacks. However, as long as it's restricted
> to
> > the system-level ALC API it may not be that bad. Only concern I would
> have
> > is
> > what kind of execution context could be said about the callback? Could it
> be
> > in a real system-level interrupt (rest of the app is stopped)? A
> background
> > thread (eg. the mixer)? The "main" thread (where the last app call to AL
> > occurred)? And what about blocking and re-entrancy, given OpenAL's
> thread-
> > safety?
>
> These are all terrific questions. I thought about trying to answer
> them, but on reflection, I don't think I'm qualified. I do think it
> would interesting to see what other people and platforms do. Maybe
> since we are mainly talking about USB device disconnects, do any of
> the major platforms have callback APIs for their USB systems?
>
> I have seen that Apple's Core Audio uses a callback system for their
> Audio Queues. It might be interesting to know what their underlying
> design decisions were. And Apple's Core Video has a callback system
> called the display link which is synchronized to the video display's
> refresh rate. I do know it runs on a separate high priority thread.
>
For what it's worth, OpenCL is using callbacks for a select few functions
(open device, create context, compile kernel). These are either the moral
equivalents of ALC or methods were you might wish for more information than
a simple error code (i.e. a compilation log). The callbacks are also
strictly optional - it is valid to specify null and ignore them.
Note that callbacks are notoriously hard to bind from other languages like
C# or Python, especially when they involve pointers. I'm all for adding
callbacks to the API where it makes sense, as long as they remain optional
and are used sparingly (ALC is a good fit).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal-devel/attachments/20090826/c1a02899/attachment.html
More information about the Openal-devel
mailing list