How to create an "empty" AudioUnit in an application?

Hello,

I know how to implement AURenderCallbacks in an AVAudioEngine using the audioUnits of the input or output nodes.

In my new project, I would have to create an AVAudioUnit node to connect my AuRenderCallback to it, but whatever I do, this creation does not work: I read with NSLog "aUnit = (null)".


I followed the advice in this discussion:


My code is :

AVAudioEngine *audioEngine;

AVAudioPlayerNode *player; //I'll need a PlayerNode and a SamplerNode in my project

AVAudioUnit *aUnit; //this one will analyse the audio of the player


When I create the graph (with AVAudioEngine) :

[AUAudioUnit registerSubclass:aUnit.class asComponentDescription:desc name:@"HerveNoury:TestCaptureAudioRythm" version:67072];

[AVAudioUnit instantiateWithComponentDescription:desc options:0 completionHandler:^(AVAudioUnit * unit, NSError *error) {

self->aUnit = unit;

//[self->audioEngine attachNode:self->aUnit];

NSLog(@"AVAudioUnit: %@, error: %@", unit.description, error);

}];


I added to the info.plist the NSExtension > AudioComponents :

<array>

<dict>

<key>description</key>

<string>TestCaptureExtension</string>

<key>factoryFunction</key>

<string>$(PRODUCT_MODULE_NAME).AudioClass</string>

<key>manufacturer</key>

<string>rvnr</string>

<key>name</key>

<string>HerveNoury:TestCaptureAudioRythm</string>

<key>sandboxSafe</key>

<true/>

<key>subtype</key>

<string>fltx</string>

<key>tags</key>

<array>

<string>Effects</string>

</array>

<key>type</key>

<string>aufx</string>

<key>version</key>

<integer>67072</integer>

</dict>

</array>


What am I doing wrong that explains that the AVAudioUnit is never instantiated?


Thank you in advance for your help.