Re: How do you get the native bit-depth of the input device?
Re: How do you get the native bit-depth of the input device?
- Subject: Re: How do you get the native bit-depth of the input device?
- From: Jeff Moore <email@hidden>
- Date: Fri, 10 Aug 2007 18:19:33 -0700
All the info you need is contained in the various AudioStream
properties that pertain to the format. You get a list of what formats
are available for each stream as well as what format is currently
selected.
As for which stream the user is using, that is actually already known
to you since you have to know that in order to process the incoming
audio data. If you are trying to capture stereo data from a multi-
channel device, you'll need to put some UI in to allow the user to
tell you which two channels to use (you can also use the default
stereo pair property). Since you know which two channels (or whatever
number) you are using, it is a simple matter to identify the stream
those channels belong to.
BTW, you might want to look over the HALLab sample app in our SDK.
While it probably won't help you out with your AUHAL code, it is a
good app to use to get a feel for how audio devices are represented in
the system.
On Aug 10, 2007, at 5:32 PM, Dave Fernandes wrote:
So if my user plugs in a complex device with multiple input streams,
how can they tell me which one(s) they are using? I need to get and
set bit-depths and sample rates for the correct stream. Is it
possible to support multi-stream devices without specs from the
device manufacturer?
On Aug 10, 2007, at 8:06 PM, Jeff Moore wrote:
On Aug 10, 2007, at 4:49 PM, Dave Fernandes wrote:
Thanks! It took me a while to figure out how to get this format
info, but I think it is working. I'm using the "master channel" of
the AudioDevice to get the AudioStream to get the format. Is this
correct?
You're close. Format info in the HAL is handled differently than it
is in AUHAL. Each audio device has some number of streams and each
stream has it's own format. Thus, the format of the audio device is
actually a vector of ASBDs, one for each stream. So, to get the
format of the device, you'd do the following (in pseudo code):
Get the list of streams for the device
For each stream do
Get the physical format of the stream
By just getting the format of the first stream, you are only
getting a partial picture of the format of the device. For devices
that have only one stream in a given direction (like the built-in
hardware), this will be fine. But for more complex hardware, it
will leave you with just part of the info.
I can't find any documentation on what exactly a master channel is.
This is covered somewhat in <CoreAudio/AudioHardware.h>. But the
short answer is that the HAL always numbers channels in streams
starting with number 1. Number 0 is reserved for the "master"
channel which is useful for controls or properties that apply to
the entire scope or object involved.
In the case of the stream format stuff, getting the various device
related format properties on the master channel gets you the
information about the first stream of the device in the given
direction.
Dave
On Aug 6, 2007, at 2:57 PM, William Stewart wrote:
In AudioHardware.h there are format descriptor properties for the
virtual and physical formats of the device. The virtual format is
normally the canonical Float32. The physical format is whatever
the device is using.
On 02/08/2007, at 2:24 PM, Dave Fernandes wrote:
The AudioOutputUnit nicely provides a stream of Float32 samples.
But I would like to choose the bit-depth of the file I am
recording to based on the precision of the input device. So how
can I determine this precision? The
--
Jeff Moore
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
_______________________________________________
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
--
Jeff Moore
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