3 Replies
      Latest reply on Feb 7, 2020 2:10 AM by Michele Longhi
      mgarcia Level 1 Level 1 (0 points)



        I am currently writing plug-in hosting code for my iOS/OSX app and I am using the new AudioUnit V3 API.

        My app is capable of hosting both instruments and effects. I already have implemented this using the V2 API (OSX "classic AU", and iOS IAA) in the past with success. All is written in C++ so I use the Obj-C interface.


        I am able to instanciate V2 effects (iOS/OSX) & V3 effects (iOS "FilterDemo") and use them without any issue.

        However, some V2 instruments will fail to instanciate (error -3000) on OSX. I cannot test this on iOS 9 since no AU instruments are available to this day.


        To instanciate and use an instrument, I do the following.

        Note that my effect instanciation/configuration code is similar (I just enable the inputBusses[0] and provide a AURenderPullInputBlock to the renderBlock).

        • Instanciate the AudioUnit from its AudioComponentDescription using:

        [AUAudioUnit instantiateWithComponentDescription:desc
                                          completionHandler:^ (AUAudioUnit * __nullable audioUnit, NSError * __nullable error
        { // here is the code that will configure the returned AUAudioUnit }

        • When the completion handler is called, I setup the the AUAudioUnit:

        // Set maximum frames
        pAUAudioUnit.maximumFramesToRender = ...;
        // check the format from pAUAUdioUnit.outputBusses[0].format; etc. [stripped] 
        // Allocate resources
        if ([pAVAudioUnit.AUAudioUnit allocateRenderResourcesAndReturnError:&nserr] == NO) {
          // error handling
        // Cache the renderBlock property
        pInstance->mpRenderBlock = pAudioUnit.AUAudioUnit.renderBlock;


        • Then, when I need to render the AudioUnit

        err = mpInstance->mpRenderBlock(&f, &mAUTime, frames, 0, mpAUBuffers, nil /*effects would pass the input block here*/);


        On iOS, I cannot effect instruments because none are available.

        On OSX (10.11 BETA 6), I can instanciate and use AUSampler, AUAudioFilePlayer, but instruments like Kontakt 5 or Massive won't load.


        I get this error in the completionHandler after using instantiateWithComponentDescription.


        Cannot async instantiate component: The operation couldn’t be completed. (OSStatus error -3000.)



        Also, apparently the

        kAudioComponentInstantiation_LoadInProcess / kAudioComponentInstantiation_LoadOutOfProcess

        option passed to the

        +[AUAudioUnit instantiateWithComponentDescription:...]

        has an impact on the result.


        So my question is pretty simple: in its current state, is this normal to have these kind of errors while instanciating older, V2 3rd party instrument AudioUnits ?


        I remember being able to instanciate V2 instruments with the V3 API using:

        +[AVAudioUnit instantiateWithComponentDescription:...]

        However, I am not using an AVAudioEngine so it does not make sense to use an AVAudioUnit (which is an AVAudioNode); this also does not work for effects in my case since they are not connected to a graph (ie: no connection error).


        Some confirmation on the current state of the V3 implementation on both iOS and OSX would be appreciated.


        Thank you !