Re: Question and source... long post...
Re: Question and source... long post...
- Subject: Re: Question and source... long post...
- From: Jeff Moore <email@hidden>
- Date: Tue, 27 Nov 2001 11:00:59 -0800
on 11/27/01 12:12 AM, Michael A. Thompson <email@hidden> wrote:
>
I have been messing around with coreaudio. I have a few questions.
>
First Question: Is it correct to have separate AudioDeviceIOProc for
>
every type of audio signal like found in the Apple CASoundLab2?
It is legal, but it is wasteful of resources. Every IOProc requires it's own
set of buffers for doing IO. Each buffer is wired down and thereby increases
the chances of page faults, etc.
It is better practice (and better performance) to have a single IOProc and
do your own mixing.
>
Second Question: On retro-fitting an old app to coreaudio...
>
I started messing around with the patch to the enlightenment sound
>
daemon to see how they were adding coreaudio support. I abstracted it
>
into an example of building a buffer that is passed to an
>
AudioDeviceIOProc. It uses p_threads as well... it runs but the audio
>
not clear. wondering if I am doing something wrong.
The biggest problem I see is that you are locking and unlocking a mutex in
the IOProc. This is very very dangerous as it has the potential of putting
the IOThread to sleep and thereby blowing out it's timing.
Signaling is a fine thing to do, but locking is a bad thing to do. You'll
need to come up with a way to copy your buffers without using a lock.
--
Jeff Moore
Core Audio
Apple