Would love to see short example of AEArray

Not sure how to use the different AEArray getters in the audio thread!

Thanks,
Chris

Comments

  • edited August 2016

    Hey @Michael, yes I have. I have a good handle on using AEManagedValue, but I'm still unsure about what a practical use case for the AEArray might be. If we can't use objective-c code in the render block, then I don't see the value in making objective-c accessible there. Is an AEArray is like a managed value that can be linked with multiple modules?

    Again apologies if my thinking / vocabulary is off. Thanks!

  • Ah, there's one exception to the "don't use Objective-C" rule: Objective-C objects work like C structs, so you can quite happily write C functions that interact with instances variables via the "->" dereference operator. TAAE and TAAE 2 do this quite heavily.

    So take a look at, for example, AEMixerModule, which is built around an AEArray of modules.

    You can also map between Objective-C objects and basic C structures with the mapping block utility of AEArray - this is actually how AEMixerModule works, because it manages volume and pan for each module it manages, and it stores these within the structure (in future I'll probably implement vol/pan within AEModule itself, but I haven't done it yet).

  • ah okay that's very helpful. so AEArrays and AEManagedValues are alike in that they both enable safe access to AE modules (or other objective-c objects which are c-accessible, or are made c-accessible by the mapping utility in the case of aearray) from the audio thread.

    so for example, if you wanted to have a variable amount of AEAudioFilePlayerModules, you might maintain a NSMutableArray of them and whenever there’s a change to it, update the associated AEArray (which is then accessed by the audio render block). Is that more or less a proper use case?

  • Exactly - yep! It also works with other types, of course, like recorders or other custom classes or structures.

Sign In or Register to comment.