In your audioUnitRenderCallback, inBusNumber corresponds to the element number.
In CoreAudio, Element is synonymous with Bus. A bus can have any number of channels: one (mono), two (stereo), or more. In your callback, inBusNumber tells your function which bus/element is being rendered on the output AU. However, you might be dealing with a v3 AU that only has one bus/element, so passing in a value of 1 or more might easily result in kAudioUnitErr_InvalidElement being returned. Another strong possibility is that your v3 AU is not completely initialized, meaning that even the default bus/element 0 is not ready or available. Make sure you've set all the necessary properties on the v3 AU, and initialized it before you try rendering. Brian Willoughby Sound Consulting On Nov 27, 2016, at 11:10 PM, Bram Bos <[email protected]> wrote: > Thanks for the reply. Which one of the parameters is the 'element index'? > > My iOS app is trying to interact with an Audio Unit v3 extension. It is > correctly loaded and initialised and I've retrieved its AURenderBlock. I'm > not using AUGraph but the 'old C API', because that's what Audiobus prefers. > Either way, I've set up an audio render callback in which I'm calling my > AUv3's RenderBlock: > > static OSStatus audioUnitRenderCallback(void *inRefCon, > AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, > UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList*ioData) { > > // <...stripped and simplified for readability...> > > > // passing through all parameters because there doesn't seem to be a need > to change any of them... > if ( AUv3RenderBlock != nil ) { > OSStatus err = AUv3RenderBlock( ioActionFlags, inTimeStamp, > inNumberFrames, inBusNumber, ioData, nil ); > // <handling err here> > } > > return noErr; > } > > My biggest problem is not knowing what the error message means. Right now, > what would help me tremendously is simply knowing what an "element" is and > what its index would denote. > > Cheers! > Bram > From: Brian Willoughby > Sent: Monday, November 28, 2016 12:11:16 AM > > Simply passing through the parameters is almost surely the wrong thing to do. > When the system calls you, it's as part of a render callback, I assume, for > some audio unit other than the one you're calling. While it's correct to pass > through the time stamp and certain other parameters, the element is specific > to each audio unit. Most audio units have only a single element, in which > case passing through the element parameter will work because there is no > other choice. > > In your case, "invalid element" means that the AU you're calling does not > have an element with that index. > > It would help if you described your audio setup. > Are you using AUGraph? > What AudioUnit are you calling? > Have you initialized all of the audio unit's properties and then started it, > or is it part of a graph? > Finally, under which API is the system calling your code? Have you registered > a callback on the Output AudioUnit? Have you registered a callback on some > other audio unit's input element? > > Brian Willoughby > > > On Nov 27, 2016, at 2:31 AM, Bram Bos <[email protected]> wrote: > > I'm calling an AUAudioUnit's renderblock and it's returning > > "kAudioUnitErr_InvalidElement". > > Neither Google nor the CoreAudio documentation is clear on what this error > > means. > > > > Here's the offending call; parameters are simply passed through verbatim > > from what the system passed to me through the audio render callback. > > > > OSStatus err = myAURenderBlock( actionFlags, timestamp, frameCount, > > outputBusNumber, ioData, nil ); > > // err returns as kAudioUnitErr_InvalidElement > > > > Anyone knows what kAudioUnitErr_InvalidElement can mean in this context? > _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
