Re: Output Audio Devices
Re: Output Audio Devices
- Subject: Re: Output Audio Devices
- From: Doug Wyatt <email@hidden>
- Date: Fri, 14 Nov 2003 12:55:32 -0800
On Nov 12, 2003, at 13:15, Lubor Prikryl wrote:
Hi,
Hi Lubor,
First I'll warn you that there are some bugs in the Panther
implementation of using output units for input ... on the bright side,
I'm hopeful that they will be fixed sooner rather than later (this is a
wish, not a promise!) ...
I tried to use output AU instead of CA callbacks, but there are some
goals I cannot reach.
- There is written in the new CoreAudio PDF, that we can connect to
bus 0 of Output AU (OAU) for output and to bus 1 for input. But the
Output units have one output bus and one input bus, when asked for the
property.
The default output unit (kAudioUnitSubType_DefaultOutput) cannot be
used for input. The "HAL output unit" (kAudioUnitSubType_HALOutput)
can, but first you must set its kAudioOutputUnitProperty_EnableIO
property for input scope, element 1, to 1.
- Well, and it is a mistake. They should have as many buses as the
physical device, e.g. G4 QS built in should have no input bus, or
SPDIF + Analog MAudio Delta should have two in and two out buses.
Shouldn't they?
This is a feature, not a bug :-) For both input and output, we flatten
all of the device's channels across multiple streams into one bus. Then
you can set the formats you wish to use as follows:
- for output, input scope, element 0
- for input, output scope, element 1
This can result in the automatic creation of an AudioConverter to make
the formats match, if necessary. Most notably, as part of this, the
output unit can detect any device streams which aren't being used and
turn them off, to lower I/O overhead. You can control how channels are
mapped using kAudioOutputUnitProperty_ChannelMap -- for example, if you
have a device with 8 channels, and you just want to output stereo to
channels 3 and 4, your channel map would look like:
-1 -1 0 1 -1 -1 -1 -1
And if you want to just receive stereo from channels 3 and 4, on input,
the channel map would be:
2 3 -1 -1 -1 -1 -1 -1
- I would like to pull audio from one device to another one. How can I
do that, when AUGraph supports up to one OAU? And mixer should pull
from two or more inputs of OAU devices as well.
Input units currently provide no buffering -- the incoming data is only
valid when the HAL delivers it -- and therefore the units are only
really useful in contexts where you are either doing your own
buffering, or working with a two-way device, in which case you can just
have one input/output unit in a graph. To use multiple inputs with a
graph, you'll need to manage the inputs outside of the graph and do
your own buffering and compensation for potential latency and clock
drift between the devices. We're aware that we can do more here...
- I tried to change the device for HAL or default OAU, calling
err = AudioUnitSetProperty (rtAU->mUnitComponent,
kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Output, 0,
&(allDevicesList[t]), dataSize);
allDevicesList is an array of devic IDs.
There is NO ERROR returned, but nothing happens.
I suspect your dataSize is sizeof(AudioDeviceID) or we'd be returning a
proper error. We're aware of a bug where you'll get noErr from setting
the current device if there's a failure in setting up the new device.
It's *supposed* to fail if you are trying to do this on the *default*
output unit -- its job is to stay attached to the default device and
should not permit you to use another. But the HAL output unit should be
OK, unless you are setting it to a device which has only inputs (this
is one of the bugs we know about).
What device are you using?
- And the worst thing - input pulled from OAU does not work at all for
me. I connect a converter to OAU, set up the formats, the input of OAU
connects with noErr, when I connect output to the converter (OAU ->
converter-> effect -> OAU), there is noErr, too, starting up the unit,
application crashes in the audio rendering.
When are you pulling for input? You'll only get valid input during the
I/O cycle of the corresponding output unit -- or when you have set an
input callback with kAudioOutputUnitProperty_SetInputCallback and you
are calling AudioUnitRender in direct response to that. Otherwise
you'll probably get a null buffer list.
Do I need to prepare some buffers or so?
Thanks for help
Lubor Prikryl, DSound
Please let me know if any of this needs clarification.
I visited Prague Sunday-Wednesday -- beautiful city -- are you there?
Doug
_______________________________________________
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.