Re: HALOutputUnit (Pt 2)
Re: HALOutputUnit (Pt 2)
- Subject: Re: HALOutputUnit (Pt 2)
- From: Bob Stuller <email@hidden>
- Date: Mon, 23 Feb 2004 21:33:42 -0500
Doug, Jeff, Greetings!
At 2:36 PM -0800 2/23/04, Doug Wyatt wrote:
Aha!
I missed this in your earlier message. I should have noticed that you
were getting back a HAL error and not an AudioUnit error. AUHAL
delegates HAL properties to the HAL proper, and only interprets the
AudioUnit properties itself.
You want to be calling:
AudioUnitSetProperty(mHALOutInstance, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
kDeviceInputElement,
&mInputDesc.description,
sizeof(AudioStreamBasicDescription));
You can choose either interleaved or non-interleaved depending on
what's most convenient based on what you're doing with the incoming
data.
You can go back to attempting to set the device format if you like, --
in case you do happen to be working with an odd device that will
support a 16K sample rate, that will save you from doing a conversion
from the default sample rate (most likely 44.1) down to 16K.
D'oh! Changing the 'kAudioDevicePropertyStreamFormat' to
'kAudioUnitProperty_StreamFormat' makes that error go away... Muchas
Gracias!
Most of the headsets that we are interested in for speech do 16k so
that's cool. My experimenting since your fix came through shows that
the HAL is doing a good job with passing the format through to the
device... And yet... this leads to another question. Since I've
given the HALAU a channel map specifying a single channel, should I
also be modifying the 'best-match' format to reflect that fact if the
format specifies multiple channels as most do? That would seem to go
along with setting the non-interleaved bit.
Meanwhile:
At 2:59 PM -0800 2/23/04, Jeff Moore wrote:
To answer Doug's question, setting
kLinearPCMFormatFlagIsNonInterleaved on an ASBD that gets passed to
the HAL is illegal. The HAL doesn't support any formats where
kLinearPCMFormatFlagIsNonInterleaved needs to be set.
... because the HALAU always de-interleaves the channels into
separate buffers??
Now, interestingly, when I look through my usage of
AudioUnitSetProperty, I see that I have been getting away with using
kAudioDevicePropertyBufferFrameSizeRange &
kAudioDevicePropertyBufferFrameSize with the HALAU. These calls have
been working to give me the buffers that I want. Go figure. Are
there AudioUnit analogs for these device constants?
Meanwhile, I am now getting a
'kAudioUnitErr_CannotDoInCurrentContext' error from AudioUnitRender
that stubbornly persists even when I stop with setting
BufferFrameSize or modifying the best-match format. I am asking for
the same number of frames my callbacks gets as a parameter. What
other causes for this error are possibilities?
Peace,
Bob
--
Sir Isaac Newton secretly admitted to some friends: He understood how
gravity behaved, but not how it worked !!
- Lily Tomlin
The Search for Signs of Intelligent Life in the Universe
_______________________________________________
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.