The Audio Units Sample Code
The Audio Units Sample Code
- Subject: The Audio Units Sample Code
- From: Brian Barnes <email@hidden>
- Date: Tue, 2 Oct 2001 23:48:03 -0400
In my iDisk:
http://homepage.mac.com/ggadwa
CoreAudioTest.sit
It's a PB project (the 10.1 version). It plays 3 samples, one looping
centered, a one-shot far left and a one-shot far right. The API is:
snd_start_sample_list() // setup the list of samples
sample=snd_load_sample(char *name) // loads in an AIFF file,
returns an index
snd_close_sample(int index) closes the sample
snd_start_channel_list() // prepares audio units for playing
snd_end_channel_list() // closes down audio units
id=snd_play(int sample_idx,float lft_vol,float rgt_vol,Boolean loop) //
starts playing a sample returns a id
snd_stop(int id) // stops playing that sound
snd_alter(int id,float lft_vol,float rgt_vol) // alters volume of sound
playing
See the function at the top of main.c to see how these are called.
Bill, I took your suggestion and moved to a single mixer unit + an
output unit. I haven't hooked up the reverb unit, I have figured that
out yet. Any help would be appreciated! Hopefully this code will be
good enough to get others started up (and not bad enough to screw them
up!)
[>] Brian