Re: Mixing arbitrary numbers of sounds out an AUHAL unit (was: MOTU devices on Intel machines)
Re: Mixing arbitrary numbers of sounds out an AUHAL unit (was: MOTU devices on Intel machines)
- Subject: Re: Mixing arbitrary numbers of sounds out an AUHAL unit (was: MOTU devices on Intel machines)
- From: Christopher Ashworth <email@hidden>
- Date: Wed, 15 Nov 2006 22:03:46 -0500
Summary of problem: Using multiple AUGraphs appears to not work with
MOTU devices on Intel machines--after three AUGraphs (attached to the
same output device) are running the render callback from additional
AUGraphs is requesting precisely zero frames, resulting in silence.
I ordered an Intel machine and a MOTU UltraLight to try to solve this
properly. Since they finally arrived, I can now talk slightly more
intelligently about this.
I tried Kurt's suggestion, which was to create a single AUHAL, with a
mixer in front of it.
The good news is that the prototype of this design works--the driver
only sees it as a single source, and whatever was confusing it before
does not come into play.
The bad news is that it appears I need to violate the CoreAudio
guidelines to make this work.
To wit:
Because I need to support playing a potentially large number of audio
files (the specific number of which is not known a priori), I create
a Matrix Mixer with a very large number of input busses. If I set
the render callback for every bus, the performance penalty is
(unsurprisingly) high. However, if most of the busses have a NULL
callback, the mixer performs great even with a high number of input
busses, because it appears to just ignore the busses with a NULL
callback.
Each audio file that plays is "attached" to the output device by
assigning it to one of the mixer busses. It is removed when it is
not playing.
Here's the problem:
"For other properties, such as the
kAudioUnitProperty_SetRenderCallback property, the audio unit
specification prohibits hosts from changing the property on an
initialized audio unit but there is no programmatic enforcement
against it."
http://developer.apple.com/documentation/MusicAudio/Conceptual/
AudioUnitProgrammingGuide/TheAudioUnit/chapter_4_section_6.html
Although my preliminary tests are working fine so far, I appear to be
playing with fire by changing the bus render callback when the
AUGraph is initialized.
If that is true, what other approach can I use? I do not presently
see any other way to support an arbitrary number of files out of the
same AUHAL audio unit without either interrupting playback or having
a relatively low limit on the number of sounds that can play
simultaneously.
Surely I'm missing something...?
Thanks for any insight,
Chris
On Oct 28, 2006, at 6:14 PM, Kurt Revis wrote:
- My application allows sound designers to play back multiple
sounds during a show.
- Each sound is driven by an AUGraph, with an AUHAL audio unit for
the output.
Are you creating a separate AUHAL for each sound you play? If so,
why not just create one, put a stereo mixer AU in front of it, and
then play each sound through a separate input to the mixer?
My understanding is that the intended usage pattern is to use one
output AU and the mixer. You *can* create separate output AUs for
the same device in the same process, and it will work, but it
probably isn't as efficient. Odds are that the bug you're hitting
now would not happen if you used a mixer, since all the mixing
would be happening in your process, and the driver level would be
completely unaware of how many sounds you're playing at once.
_______________________________________________
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