Re: HALOutput -> AUConverter problems
Re: HALOutput -> AUConverter problems
- Subject: Re: HALOutput -> AUConverter problems
- From: Doug Wyatt <email@hidden>
- Date: Wed, 5 Jul 2006 12:07:34 -0700
On Jul 3, 2006, at 16:54 , Jeremy Cooper wrote:
In this configuration, I am relying on the HALOutput unit's
InputCallback, as before, as an indication that I should attempt to
pull the received audio through the converter. Unfortunately,
whenever I ask the converter (C) to give me some samples during the
HAL's InputCallback(), I always receive the error -10863
(kAudioUnitErr_CannotDoInCurrentContext).
What might possibly be wrong here?
You can't do sample rate conversion with this signal path. Both
AudioConverter and AU's work on a pull model, which breaks down when
the pull sizes vary, as they must with a rate conversion. AUHAL
requires that all input be consumed on each I/O cycle, so you really
do need to push, as you're saying.
Aside, I would really like some sort of "push" model where the
downconverted samples are pushed to me, just as they were in the
previous incarnation of my application when it interfaced to the
AudioIOProc of the device directly. But outside of the semantics of
the AudioIOProc method, nothing else in the CoreAudio system
provides it. How can I get use the AUConverter in a push fashion?
(I'm guessing the answer is, "You're out of luck").
While it is not possible to push data through an AU chain, it is
possible (if not entirely straightforward) to push data through an
AudioConverter.
In pseudocode:
converter input proc:
if there is unconsumed input
return it with noErr
else
return a special error code of your own devising (e.g. "DONE")
to convert:
while there is unconsumed input
err = AudioConverterFillComplexBuffer
if (err != noErr and err != 'DONE') or 0 frames were produced
break
store/process the returned samples
if err == 'DONE'
break
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden