TAAE2- NOOB question

edited May 2016

I want to know how is possible for the renderer to play the array of players(samples) on the block at the same time?
is there a loop somewhere?
"This is all performed on the audio thread" where's the audio thread? how can I see it in xcode?

I'm still new trying to figure it out.
thank you


  • Hi @south123 ,

    Take a look at AEAudioController.m in the TAAE2 sample app for this; specifically this bit:

            // Run all the players
            AEArrayEnumerateObjects(playersArray, AEAudioFilePlayerModule *, player, {
                if ( AEAudioFilePlayerModuleGetPlaying(player) ) {
                    // Process
                    AEModuleProcess(player, context);
                    // Put on output
                    AERenderContextOutput(context, 1);
                    AEBufferStackPop(context->stack, 1);

    Here, you keep an AEArray with the players, and then enumerate it and process each one on the audio thread.

    The audio thread is the thread responsible for rendering the audio. It is distinct from the main thread, and carries certain responsibilities (such as being fast, not calling Objective-C, holding locks, or allocating memory, for instance). You see it in Xcode when running the app in the debugger, and pressing pause; it appears in the thread list to the left.

  • when I try to use
    "AERenderContextOutput(context, 1);"
    i get an error "implicit declaration"

    thank you

  • Are you using the latest codebase, @south123? AERenderContextOutput was added fairly recently

  • edited May 2016

    Thank you, that might be it.
    another question
    this might be a dumb question,
    but the renderer and subrenderer its always running so that means the AEAudiocontroller.m is being called somewhere
    where's that? :)

  • Cool =)

    The renderer (and subrenderer) both invoke their render blocks for each pass of the render loop; the render blocks are provided by AEAudioController.m during initialisation.

  • edited May 2016

    Thank you!
    what's the purpose of AEManagedValue ?
    for example in your TAEE Sample you have

    // Setup recording player placeholder
    AEManagedValue * playerValue = [AEManagedValue new];
    self.playerValue = playerValue;
  • edited May 2016

    From the docs (option-click any class/method/function name to see these):

     *  This class manages a mutable reference to a memory buffer or Objective-C object which is both thread-safe
     *  and realtime safe. It manages the life-cycle of the buffer/object so that it can not be deallocated
     *  while being accessed on the main thread, and does so without locking the realtime thread.
     *  You can use this utility to manage a single module instance, which can be swapped out for
     *  another at any time, for instance.
  • Thank you!! :DD

Sign In or Register to comment.