HALOutput -> AUConverter problems
HALOutput -> AUConverter problems
- Subject: HALOutput -> AUConverter problems
- From: Jeremy Cooper <email@hidden>
- Date: Mon, 3 Jul 2006 16:54:32 -0700
I am working on an application which operates on live audio, and for
code simplicity, that audio must be sampled at 6000 Hz. The
application has been interfacing with the CoreAudio HAL for a few
years now with the limitation being that it only works with my
Griffin iMic, since only my iMic can support a 6000 Hz sampling rate
natively.
I have now decided to make the application more usable by getting rid
of the need for the iMic and doing sample rate conversion in the
application. It seemed to me that my best route would be to use a
HALOutput audio unit (for input) followed by an AUConverter audio unit.
I followed the directions in Tech Note 2091
(http://developer.apple.com/technotes/tn2002/tn2091.html) for
instantiating a HALOutput unit for input. This part works just
fine. I can successfully read samples from the HALOutput unit by
calling its render() function during the InputCallback it posts to
me. That configuration is illustrated as follows:
Device HALOutput Unit -----------------> InputCallback()
,-----, ,--------------------------------, ,-----------------------
,
| mic |->| Input Bus/Element 1 |
| |
| | | Input Output |-> | HAL.Render(element
#1)|
|-----| |--------------------------------|
`-----------------------'
| | | Output Input |
| spk | | Output Bus/Element 0 |
`-----' `--------------------------------'
However, I am having a lot of difficulty adding an AUConverter unit
into the system.
I have tried configuring the AUConverter like this:
,-----------------------------------,
/ v
Device HALOutput Unit AUConverter
InputCallback()
,-----, ,-------------------------------, ,----------------, ,-----
---------,
| mic |->| Input Bus/Element 1 | | Element 0 |
| |
| | | Input Output |->| In (C) Out |->|
C.render(#0) |
|-----| |-------------------------------| `----------------'
`--------------'
| | | Output Input |
| spk | | Output Bus/Element 0 |
`-----' `-------------------------------'
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?
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").
Thank you for any suggestions, and I will gladly post code if asked.
Long-time lurker since 2002,
Jeremy Cooper
_______________________________________________
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