When to set kA开发者_开发问答udioUnitProperty_StreamFormat (and kAudioUnitProperty_SampleRate too)? For each AU in my AUGraph ? Or is it enough to set it jus for the AU Mixer ?
André
you set it on the inputs and outputs of each audiounit.
iphone only allows input signed ints. so don't bother with floats it just won't work.
you set the sample rates using
CAStreamBasicDesciption myDescription;
myDescription.mSampleRate = 44100.0f; // and do this for the other options such as mBitsPerChannel etc.
On the output of audiounits such as the mixer, it comes out as 8.24 fixed point format.
be aware of this when you're trying to create callbacks and using the audiounitrender function, the formats have to match and you can't change the output formats. (but you may still need to set it)
use printf("Mixer file format: "); myDescription.Print(); to get the format description. It will depend on where you put it in your initialization process.
In short, yes - for more detail on what you actually need to set on each unit, see Audio Unit Hosting Guide for iOS
精彩评论