1

私が使う

AUNodeInteraction interaction;
UInt32 ioNumInteractions;    

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

すべてのデバイス (iphone 5s、6、6s、7) では相互作用と接続されたノードが返されますが、iphone 5c と ipad mini では相互作用は返されません (ioNumInteractions = 0)。

理由はおそらく32ビットCPUです。問題を解決する方法はありますか?

CAShow(グラフ):

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)
4

1 に答える 1

2

ioNumInteractions を、AUGraphGetNodeInteractions が返すインタラクションの最大数に設定することになっています。実際のカウントは、AUGraphCountNodeInteractions を使用して取得できます。次に、結果を保持するのに十分な大きさの配列を初期化する必要があります。

次に例を示します。

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

ioNumInteractions にカウントが追加されました。これを使用して、相互作用を保持する配列を作成します。

AUNodeInteraction interactions[ioNumInteractions];

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

AUGraphGetNodeInteractions は、ここでも ioNumInteractions を設定します。次に、相互作用の配列を反復処理します。

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");
    }
}

5c では ioNumInteractions の値がたまたま 0 になったので、AUGraphGetNodeInteractions は 0 のインタラクションを返したと思います。AUGraphGetNodeInteractions の性質は、それが ioNumInteractions より多くの相互作用を返さないということです。そのため、2893040 のようなガベージ値を渡しても (ioNumInteractions を初期化していないため)、1 つまたは 2 つの接続だけが返されます。

于 2016-12-14T06:23:26.300 に答える