【问题标题】:iOS AUGraph connecting kAudioUnitSubType_Reverb2 unit between Mixer and kAudioUnitSubType_RemoteIOiOS AUGraph 在 Mixer 和 kAudioUnitSubType_RemoteIO 之间连接 kAudioUnitSubType_Reverb2 单元
【发布时间】:2012-08-30 20:32:45
【问题描述】:

在我的 AuGraph 中,我有以下情况:

采样器--------->

                mixer ----> remoteIO

6 个回调 ----->

AudioUnitGraph 0x311E02A:   
Member Nodes:   
   node 1: 'auou' 'rioc' 'appl', instance 0xc66c020 O       
   node 2: 'aumx' 'mcmx' 'appl', instance 0x598f20 O    
   node 3: 'aumu' 'samp' 'appl', instance 0x59ba40 O    
Connections:    node   3 bus   0 => node   2 bus   7  [ 2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved]  
                node   2 bus   0 => node   1 bus   0  [ 2 ch,      0 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]   
Input Callbacks:    {0x1a7bb1, 0xd1f5648} => node   2 bus   0  [1 ch, 44100 Hz]
                    {0x1a7bb1, 0xd1f5648} => node   2 bus   1  [1 ch, 44100 Hz]     {0x1a7bb1, 0xd1f5648} => node   2 bus   2  [1 ch, 44100 Hz]     
                    {0x1a7bb1, 0xd1f5648} => node   2 bus   3  [1 ch, 44100 Hz]     
                    {0x1a7bb1, 0xd1f5648} => node   2 bus   4  [1 ch, 44100 Hz]     
                    {0x1a7bb1, 0xd1f5648} => node   2 bus   5  [1 ch, 44100 Hz]           
                    {0x1a7bb1, 0xd1f5648} => node   2 bus   6  [1 ch, 44100 Hz]

一切正常,但格式不匹配。回调工作和采样器 听起来很迷人。

现在我尝试像这样插入混响:

样本->

混音器 ----> 混响 --> remoteIO

6 调用-->

我得到了这张图:

AudioUnitGraph 0x313402A:
  Member Nodes:
    node 1: 'auou' 'rioc' 'appl', instance 0x569060 O  
    node 2: 'aumx' 'mcmx' 'appl', instance 0x56a210 O  
    node 3: 'aumu' 'samp' 'appl', instance 0x56b200 O  
    node 4: 'aufx' 'rvb2' 'appl', instance 0x56ba30 O  
  Connections:
    node   3 bus   0 => node   2 bus   7  [ 2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved]
    node   2 bus   0 => node   4 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
    node   4 bus   0 => node   1 bus   0  [ 2 ch,      0 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]

    Input Callbacks: (the same as before)

还有错误: AUGraphInitialize 错误:-10868*

连接代码:

result = AUGraphConnectNodeInput ( processingGraph,
            mixerNode,         // source node
             0,                 // source node output bus number
             revNode,            // destination node
             0                  // desintation node input bus number
         );


result = AUGraphConnectNodeInput ( processingGraph,
                                                                    revNode,         // source node
                                                                    0,                 // source node output bus number
                                                                    iONode,            // destination node
                                                                    0                  // desintation node input bus number                                                         );

我还尝试统一混响和混音器的格式:

AudioStreamBasicDescription asbd;
UInt32 asbdSize = sizeof (asbd);
memset (&asbd, 0, sizeof (asbd));

AudioUnitGetProperty(mixerUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &asbd, &asbdSize);
AudioUnitSetProperty(reverbUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &asbd, sizeof(asbd));

我做错了什么? 抱歉,格式错误,今天加入。

【问题讨论】:

    标签: ios5 audio core-audio


    【解决方案1】:

    我遇到了同样的问题,但发现我必须从混音器输入的其中一个单元复制 ASBD,并将其设置为混音器单元的输出范围。

    AudioStreamBasicDescription asbd;
    UInt32 sz = sizeof(asbd);
    result = AudioUnitGetProperty(someUnitBeforeMixer, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &asbd, &sz);
    NSCAssert (result == noErr, @"Unable to get ASBD. Error code: %d '%.4s'", (int) result, (const char *)&result);
    result = AudioUnitSetProperty(mixerUnit,
                                  kAudioUnitProperty_StreamFormat,
                                  kAudioUnitScope_Output,
                                  0,
                                  &asbd,
                                  sizeof(asbd));
    NSCAssert (result == noErr, @"Unable to set ASBD. Error code: %d '%.4s'", (int) result, (const char *)&result);
    

    如果您知道它应该是什么格式,您可以手动设置它,而不是复制 ASBD。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-21
      • 2016-05-06
      • 2018-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多