Re: HALOutputUnit (Pt 2)
Re: HALOutputUnit (Pt 2)
- Subject: Re: HALOutputUnit (Pt 2)
- From: Bob Stuller <email@hidden>
- Date: Mon, 23 Feb 2004 14:02:09 -0500
Bill, Greetings!
At 4:05 PM -0800 1/9/04, William Stewart wrote:
AUHAL and Devices
The AUHAL units sit on top of the AudioDevice objects as defined in
<CoreAudio/AudioHardware.h>
A client can send property calls directly to the AudioDevice the AUHAL
unit is currently connected too by making the call on the AUHAL unit as
either AudioUnitGetProperty or AudioUnitSetProperty. (Underneath, the
AUHAL unit can detect that the property ID is actually a property of
the AudioDeviceID, and it will turn around and call the
AudioDeviceGet/Set Property calls for you).
I guess at this point the problems I am having using the input
element of the HALAU arises from the mismatch between what the device
(the input device of a usb microphone) is set to do & what the HALAU
is thinking is going on.
I've been making this first call, where the Basic Description carries
the device's best match with what I need:
status = AudioDeviceSetProperty(mInputDesc.mDeviceID, nil,
0, true, kAudioDevicePropertyStreamFormat,
sizeof(AudioStreamBasicDescription),
&mInputDesc.description);
This returns noErr.
But when I call this:
status = AudioUnitSetProperty(mHALOutInstance,
kAudioDevicePropertyStreamFormat,
kAudioUnitScope_Output,
kDeviceInputElement,
&mInputDesc.description,
sizeof(AudioStreamBasicDescription));
This returns 'kAudioDeviceUnsupportedFormatError'.
I got to adding this second call because I wanted to get the HALAU on
the same page as the attached device.
To back up a little, what I'm doing is: I examine the device to
determine how close it can come to my desired audio: 16-bit, 16k
samples per second. The device replies that the closest it can come
is 16k float samples per second. I set up the buffer sizes to get
120 milliseconds of data at a whack, moved the samples out of the
Core Audio thread, and converted them. Except that I find that the
audio is garbage... Then I instrumented the callback to find out how
often it gets hit & it gets hit every 43.5 milliseconds...
120ms = (43.5ms * 44.1k) / 16k
and that is when it dawned on me that the AU & the device were not on
the same page and I added the AudioUnitSetProperty code to set the
format of the HALAU. Unsuccessfully.
What can I do convince the HALAU to let me have the format that the
device says it can do?
Peace,
Bob
--
In theory, there is no difference between theory and practice. In
practice, there is.
- Yogi Berra
_______________________________________________
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.