AUGraphGetNodeInteractions returns no interactions on iphone 5c

1

I use

AUNodeInteraction interaction;
UInt32 ioNumInteractions;    

AUGraphGetNodeInteractions(graph,
                           node,
                           &ioNumInteractions,
                           &interaction));

On all devices (iphone 5s, 6, 6s, 7) it returns interaction and connected nodes, but on iphone 5c and ipad mini it returns no interactions (ioNumInteractions = 0).

Maybe the reason is a 32bit CPU. Any ideas how to solve the problem?

CAShow(graph):

Member Nodes:
    node 1: 'augn' 'afpl' 'appl', instance 0x6000000323c0 O I
    node 2: 'auou' 'rioc' 'appl', instance 0x600000032460 O I
  Connections:
    node   1 bus   0 => node   2 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
  CurrentState:
    mLastUpdateError=0, eventsToProcess=F, isInitialized=T, isRunning=T (1)
objective-c
audiounit
ipad-mini
asked on Stack Overflow Dec 9, 2016 by Dmitrii • edited Dec 18, 2016 by Tim

1 Answer

2

You are supposed to set ioNumInteractions to the maximum number of interactions you want AUGraphGetNodeInteractions to return. You can get the actual count using AUGraphCountNodeInteractions. Then you need to initialize an array big enough to hold the result.

Here's an example:

UInt32 ioNumInteractions = 0;
AUGraphCountNodeInteractions(graph, node, & ioNumInteractions);

Now ioNumInteractions has a count. Use this to make the array that will hold the interactions.

AUNodeInteraction interactions[ioNumInteractions];

AUGraphGetNodeInteractions(graph,
                           node,
                           &ioNumInteractions,
                           interactions);

AUGraphGetNodeInteractions sets ioNumInteractions here too. Then iterate through the array of interactions.

for (int i = 0; i < ioNumInteractions; i++) {
    AUNodeInteraction interaction = interactions[i];
    if (interaction.nodeInteractionType == kAUNodeInteraction_Connection) {
        processConnection(interaction.nodeInteraction.connection);
        printf("connection\n");
    }
    else if (interaction.nodeInteractionType == kAUNodeInteraction_InputCallback){
        processCallback(interaction.nodeInteraction.inputCallback);
        printf("inputCallback\n");
    }
}

I think that on the 5c ioNumInteractions ended up with a value of 0 by chance alone, so AUGraphGetNodeInteractions returned 0 interactions. The nature of AUGraphGetNodeInteractions is that it will return no more than ioNumInteractions interactions, so if you pass it a garbage value like 2893040 (because you didn't initialize ioNumInteractions) it will still return just the one or two connections it has.

answered on Stack Overflow Dec 14, 2016 by dave234

User contributions licensed under CC BY-SA 3.0