Re: CDDA and AIFF again
Re: CDDA and AIFF again
- Subject: Re: CDDA and AIFF again
- From: Jeff Moore <email@hidden>
- Date: Mon, 11 Feb 2002 12:18:47 -0800
on 2/10/02 1:17 PM, Lubor Prikryl <email@hidden> wrote:
>
now the conversion behaves properly. I am dealing with HAL, because I
>
develop a VST effect engine, not only player.
You should still probably use the output AudioUnit to do IO. It does a lot
of the hard work associated with dealing with the HAL for you. It may save
you some time and effort.
>
Maybe it would be important to know what you genarally suggest for async
>
file reading in OS X for audio purposes.
>
PB async reads are done during interrupts in OS 9. In X, there is a
>
possibility to implement async reads as a new preemptive thread, which
>
is probably true for PB based calls in X(?). I didn't debug it yet.
On X, PBReadAsync does it's work in the Carbon IO thread. That's also the
thread context for when it calls your completion routine. Other than that,
it works more or less like it does on 9.
>
Is the PB async file access the best solution for OS X audio (e.g.
>
PBReadForkAsync)?
PBReadAsync suffers from two fatal flaws.
First, the priority of the Carbon IO thread is such that the Window Server
wins out over it. Actually, this is a more general problem since this is
true about any non-time constraint thread created by an unprivileged
process. The effect is that threads doing real work can be pre-empted by
actions that involve the Window Server such as drawing to the screen or
processing mouse events. At this point, there really isn't much you can do
about this problem.
The second, more subtle problem with PBReadAsync is that it does all it's
work in a single thread and only processes one request at a time in that
thread. This effectively eliminates any possibility of taking advantage of
the parallelism of multiple CPUs and/or multiple drive mechanisms. This is a
huge drawback on OS X and will prevent your app from taking full advantage
of all the resources available on the machine.
Probably the best strategy is to do your own disk IO scheduling using your
own threads and synchronous file IO calls. You could use either the BSD file
API or the synchronous calls in the File Manager, which ever you are most
comfortable with.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.