RE: In Search of Audio I/O
RE: In Search of Audio I/O
- Subject: RE: In Search of Audio I/O
- From: "Richard Furse" <email@hidden>
- Date: Wed, 4 Jun 2008 18:27:49 +0100
Thanks for the response.
I'm using a mix of calls with names of form AudioDevice*(), AudioHardware*()
and AudioUnit*() - do you mean I should only be using AudioUnit*() calls?
I'm instantiating the object in a style borrowed from the CAPlayThrough
sample:
FindNextComponent()
OpenAComponent()
AudioUnitInitialize()
But I'm using AudioDevice*() and AudioHardware*() calls before this and I'm
experiencing some strangeness there, so it would be great if there's an
easier API I could be using! I'm currently working from code from the
AudioDevice and AudioDeviceList classes in the CAPlayThrough sample, which
do some things that I don't understand (e.g. the sum operation in
AudioDevice::CountChannels()) and some sample rate and channel label stuff
that I improvised (almost certainly incorrectly) from the headers. Is there
another sample or documentation that presents things a different way?
Specifically what I'm trying to do with this group of functions is:
1. Enumerate devices (AudioHardwareGetProperty(k...Devices) seems to
work fine).
2. Find device names (AudioDeviceGetProperty(k...DeviceName) also
seems to work fine).
3. Find device input and output channel counts (don't understand
this bit yet, but currently using
AudioDeviceGetProperty(k...StreamConfiguration) and summing over buffer
channel counts, as in CAPlayThrough).
4. Find device input and output channel names (I'm currently using
AudioDeviceGetProperty(k...ChannelName), but I'm not getting what I expected
back and the shape of the calls doesn't correspond to the calls in item 3,
so I guess this isn't right).
5. Check device support for a particular sample rate (I'm calling
AudioDeviceGetProperty(k...AvailableNominalSampleRates), but I don't seem to
be getting anything back).
Incidentally, on the subject of sample rates, what's the best way for me to
set a sample rate on the device? I'm a bit worried that if I attempt to play
and record at 96kHz the kernel mixer or suchlike is just going to SRC to and
from 44.1kHz if I'm not careful.
Clues or pointers appreciated!
Cheers,
--Richard
> -----Original Message-----
> From: Jens Alfke [mailto:email@hidden]
> Sent: 04 June 2008 15:58
> To: Richard Furse
> Cc: email@hidden
> Subject: Re: In Search of Audio I/O
>
>
> On 4 Jun '08, at 4:14 AM, Richard Furse wrote:
>
> > 3. Stream audio to and from one of these devices synchronously at a
> > fixed sample rate of my choosing
> >
> ...
> > At step three, I've an AUHAL object that looks happy
> enough, but I'm
> > not clear what state change logic I should be using and what
> > properties apply when. I'm receiving an error code -10865 (what's
> > that?) when I try to set stream properties on AUHAL - and I really
> > have no idea what I'm doing! :-)
> >
>
>
> I think you want to use slightly higher-level APIs than
> talking to the HAL directly. Generally one does this using
> AudioUnits - find the input or output unit corresponding to
> the device you want, then either use its audio callbacks
> directly, or hook it up to other AudioUnits that do things
> like mixing and effects.
>
> There are a number of sample apps that demonstrate using AudioUnits.
>
> -Jens
>
>
_______________________________________________
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