Re: Setting AudioQueue input device and format?
Re: Setting AudioQueue input device and format?
- Subject: Re: Setting AudioQueue input device and format?
- From: Brian Willoughby <email@hidden>
- Date: Thu, 10 Mar 2011 17:41:00 -0800
On Mar 10, 2011, at 17:32, Rick Mann wrote:
On Mar 10, 2011, at 17:17:50, Brian Willoughby wrote:
On Mar 10, 2011, at 14:25, Rick Mann wrote:
Format: I want the data in the exact same format that it comes
out of the device. The Programming Guide first has me set a
recording audio format, and then create the audio queue and ask
it for the input format. What's the right way to ensure that the
data in the buffers I get is the exact data output by the device?
I would suggest that the most important aspect of the format is
the sample rate. Make sure your graph is processing at the native
rate of your input hardware. Apart from that, there really is no
advantage to working in 16-bit just because the input data is 16-
bit. It's perfectly fine to convert any input format to 32-bit
float and leave it at that. The rest of your math will be much
simpler with float, and you'll also have access to all of the
existing AudioUnits that are designed for the canonical format.
Again, only the sample rate is important. Don't fret about the
rest of the format details unless your device somehow delivers
more than 25-bit fixed or 32-bit float.
Hmm, that's a good point. I'd still like to query the device for
its sample rate, rather than making assumptions, and then set the
rest of it for 32-bit float. Since I'm already writing code to get
AudioObject properties, perhaps I can use that to figure out the
sample rate? Or should I query the Audio Queue (I'm not yet sure I
can create it without specifying any particular format).
I believe that you'll need to call the CoreAudio API directly to
query the hardware sample rate, and I assume you have the right
AudioObject for this. You can confirm that your code is working by
comparing against the values shown in Audio MIDI Setup. There might
be a pass-through available via AudioQueue through some indirect
means but I would not necessarily trust it as easily as the direct API.
Brian Willoughby
Sound Consulting
_______________________________________________
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