Re: Documentation for Example Apps? (and recording stuff)
Re: Documentation for Example Apps? (and recording stuff)
- Subject: Re: Documentation for Example Apps? (and recording stuff)
- From: Kurt Revis <email@hidden>
- Date: Wed, 12 Mar 2003 00:01:32 -0800
On Tuesday, March 11, 2003, at 11:05 PM, Peter wrote:
You use QuickTime in your code. Is it possible to "do better" but
still use the HAL (or AUs)?
It's using QuickTime to get samples from the file, but it plays the
samples through the default audio output AU (which itself uses the
HAL). So we get to exploit all of QuickTime's code for reading sound
files and decoding compressed formats, while still getting to take
advantage of the new OS X sound architecture (including AUs, AUGraphs,
etc.)
Also, I wrote my example before the AudioFile API was released.
These days, as far as I know, the only disadvantages of AudioFile are
that it doesn't handle compressed formats and that it requires 10.2. If
neither of these is a problem for you, I'd try AudioFile. It's
certainly a lot cleaner than QuickTime.
I'm not familiar with AUs. After reading the CoreAudio PDF, AUs
seemed more relevant for AUGraphs?, MIDI stuff, or sound manipulation.
I only need to play and record sound but is that part of what AUs do?
I read an archive email about someone hooking up a SoundConverter (?)
to an AU... If AUs are the way, who should use the HAL? Driver
developers or me, higher-level-application-man?
Let's separate the two cases of output and input.
For output, it is highly recommended that you use the
DefaultAudioOutput AU instead of talking directly to the HAL. The AU
will take care of a lot of issues for you, like format and sample rate
conversion. I believe it also handles notifications from the HAL when
properties of the output device change (like sample rate).
Most of the examples you'll find use the audio output AU. If you want
a very simple example, look here:
/Developer/Examples/CoreAudio/Services/DefaultOutputUnit/
UsingDefaultNoAC.cpp
There is no AU which handles input yet. You will have to deal with the
HAL in order to do this. I put a very simple example here:
http://www.mat.ucsb.edu:8000/CoreAudio/13
I recommend getting familiar with the output side first, since it's
easier.
If you stick to just using the audio output AU, you can ignore all the
other kinds of AUs and the details of implementing an AU. You can also
ignore AUGraph for now.
Okay, Kurt, I will stop my parser work and check out the API. I
empathize with your pain at seeing yet another file parser.
Or at least take a look at the open-source AIFF code out there, like
libsndfile or SoX or whatever (see the links from this page:
http://www.zip.com.au/~erikd/libsndfile/). There is really no sense
reinventing this particular wheel.
Hope this helps...
--
Kurt Revis
email@hidden
_______________________________________________
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.