Playing lots of tiny sounds with different formats?
Playing lots of tiny sounds with different formats?
- Subject: Playing lots of tiny sounds with different formats?
- From: William Shipley <email@hidden>
- Date: Thu, 1 Aug 2002 02:38:58 -0700
Ok, we've done a couple of game ports now using the low-level CoreAudio
stuff, and we're trying to move up to AudioUnits.
We're currently using a single AudioUnit much the way we did the raw
HAL -- we mix all of our sound effects and music ourselves and just hand
out buffers to the default output device at 44.1.
Tonight I started playing with using the higher-level features of
AudioToolbox and AudioUnits, and although I managed to get an reverb
unit attached to the default output (and MAN did that sound cool) I
still am fundamentally missing something.
So, given the following:
- I have 20-30 sound files that are stored at different sample rates (22
or 44), some stereo and some mono.
- During a game I need to queue these sounds in response to game
actions, and play them out real-time, often overlapping each other.
- I want to add in the ability to do stereo panning for mono samples.
- I'd like to add in 3D positioning under Jaguar.
- I don't want to do the mixing myself.
Then, how should I set up my AudioUnits to use the least CPU?
Should I create an instance of the default output device for each format
of sound file I might possibly play? (Does this even work?) This would
create (potentially) a lot of devices that need to be serviced every
cycle, and still leaves me doing the mixing myself for, say, all 22K
mono sounds, then all 44K mono, then 22K stereo, etc.
Note: One thing I don't have a good grasp on is "input elements". I just
haven't seen any docs on them. Reading through this list for the last
couple of months, it looks like some (all?) audioUnits can accept
multiple input streams at once, through the use of input elements.
Which units can do this? (The stereo mixer? The default output unit?)
Can each input stream be configured to have a different sample rate?
(Can the stereo mixer accept any sample rate I throw at it? Should I be
pre-converting all my sound files when I launch the app?)
Maybe I should create and remove input elements on-the-fly on the
default output unit, as I start and stop each sound? Or should I have a
stable of input elements that are pre-configured on my mixer unit?
Am I totally off-base?
RELP!
Thanks,
-Wil Shipley
President, The Omni Group
_______________________________________________
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.