Re: Help for dumb ass's
Re: Help for dumb ass's
- Subject: Re: Help for dumb ass's
- From: "AUDIOSYNTH.COM" <email@hidden>
- Date: Tue, 26 Mar 2002 10:24:22 -0600 (CST)
On Tue, 26 Mar 2002, Arthur Clemens wrote:
>
On Tuesday, March 26, 2002, at 04:50 PM, AUDIOSYNTH.COM wrote:
>
>
> That code does an fread() in the IOProc - not an example to emulate.
>
>
Why not?
>
You see, I am a dumb ass, too.
Because fread is a call that can block. A real time thread such as the
IOProc should never block. The audio could glitch since the fread
may take some time to return. CoreAudio expects you to do your thing and
return asap.
>
>
>
>
> I suggest use a separate thread to wait on a condition and fill a
>
> buffer.
>
>
>
What condition?
read up on pthread_cond_signal and pthread_cond_wait.
Your ioproc should call pthread_cond_signal when the buffer is empty
and the feeder should call pthread_cond_wait to wait for these signals.
--
--- james mccartney email@hidden <
http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.
<
ftp://www.audiosynth.com/pub/updates/SC2.2.14.sea.hqx>
_______________________________________________
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.