iOS - 连接调音台,remoteio和动态处理器的AudioFormat问题

时间:2012-12-03 13:22:29

标签: ios audio core-audio

我正在尝试连接我的调音台 - > remoteio - >动力学处理器

这是我的AudioFormat     //描述格式

memset( &audioFormat, 0, sizeof(AudioStreamBasicDescription) );
audioFormat.mSampleRate         = 44100.00;
audioFormat.mFormatID           = kAudioFormatLinearPCM;
audioFormat.mFormatFlags        = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket    = 1;
audioFormat.mChannelsPerFrame   = 1;
audioFormat.mBitsPerChannel     = 16;
audioFormat.mBytesPerPacket     = 2;
audioFormat.mBytesPerFrame      = 2;

当我使用CAShow时,它给了我以下内容。

AudioUnitGraph 0x4725000:
  Member Nodes:
node 1: 'auou' 'rioc' 'appl', instance 0x1c5ab3a0 O I
node 2: 'aumx' 'mcmx' 'appl', instance 0x1d07a6d0 O I
node 3: 'aufx' 'dcmp' 'appl', instance 0x1d085330 O I
 Connections:
    node   2 bus   0 => node   1 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved]
node   1 bus   0 => node   3 bus   0  [ 2 ch,      0 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]

尝试         result = AudioUnitSetProperty(                                        _dynamicsUnit,                                        kAudioUnitProperty_StreamFormat,                                        kAudioUnitScope_Input,                                        0,                                        &安培; AudioFormat的,                                        sizeof(audioFormat)                                        );

将audioFormat设置为所需的格式会给出错误代码-10868。

我也意识到从audynamicsprocessor获取ASBD会产生这种效果。

effectASBD  AudioStreamBasicDescription 
mSampleRate Float64 44100
mFormatID   UInt32  1819304813
mFormatFlags    UInt32  41
mBytesPerPacket UInt32  4
mFramesPerPacket    UInt32  1
mBytesPerFrame  UInt32  4
mChannelsPerFrame   UInt32  2
mBitsPerChannel UInt32  32
mReserved           UInt32  0

我尝试了各种各样的事情,比如让audioformat ABSD按照AUdynamics处理器,但我得到了同样的错误。

由于延迟考虑,我想尽可能使用我原来的audioformat ASBD。此外,我的回调算法已经为该audioformat编写。 这可能吗?

提前致谢。

码头。

1 个答案:

答案 0 :(得分:1)

因为没有答案我会自己回答这个问题的完整性。 最后,在来自Core Audio Mailing List的Chris Adamson的一些建议之后,我做到了这一点。

我发现dynamicsProcessor需要8.24格式。 所以我在dynamicsProcessor之前和之后放置了一个转换器,将我想要的格式转换为8.24(dynamicsProcessor想要的),反之亦然。

混合器 - >转换器 - > dynamicsProcessor - >转换器 - > remoteIO