2013-01-09 73 views
2

我有一個AUGraph播放和錄製音頻,這樣設置:AUGraph三維混合機噼啪

RemoteIO  ->         -> RemoteIO 
        Mulichannel Mixer -> 3D Mixer 
Read Callback ->         -> Write Callback 

我的問題是,我在記錄的聲音裂紋。沒有3D混音器 聲音很好。但我需要他調整Playbackrate ...

音頻格式:

memset(&_audioFormat, 0, sizeof(_audioFormat)); 
size_t bytesPerSample = sizeof (UInt16); 
_audioFormat.mFormatID   = kAudioFormatLinearPCM; 
_audioFormat.mFormatFlags  = kAudioFormatFlagsCanonical; 
_audioFormat.mBytesPerPacket = bytesPerSample; 
_audioFormat.mFramesPerPacket = 1; 
_audioFormat.mBytesPerFrame  = bytesPerSample; 
_audioFormat.mChannelsPerFrame = 1; 
_audioFormat.mBitsPerChannel = 8 * bytesPerSample; 
_audioFormat.mSampleRate  = 22100.0f; 

我不知道爲什麼3D混音器增加了裂紋-.- 這裏是一個小樣本音頻:Click

希望有足夠的信息來找到解決方案。 謝謝:)

一些額外的信息:

隨着裂紋

AudioUnitGraph 0x7F8000: 
    Member Nodes: 
    node 1: 'auou' 'rioc' 'appl', instance 0x1cd66d40 O I 
    node 2: 'aumx' 'mcmx' 'appl', instance 0x1e055b40 O I 
    node 3: 'aumx' '3dem' 'appl', instance 0x1e05e7a0 O I 
    Connections: 
    node 1 bus 1 => node 2 bus 1 [ 1 ch, 22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer] 
    node 2 bus 0 => node 3 bus 0 [ 1 ch, 22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer] 
    node 3 bus 0 => node 1 bus 0 [ 2 ch, 44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved] 
    Input Callbacks: 
    {0x12d9c1, 0x1cd65f30} => node 2 bus 0 [1 ch, 22000 Hz] 
    CurrentState: 
    mLastUpdateError=0, eventsToProcess=F, isRunning=F 

無裂紋

AudioUnitGraph 0x7E7000: 
    Member Nodes: 
    node 1: 'auou' 'rioc' 'appl', instance 0x1e888810 O I 
    node 2: 'aumx' 'mcmx' 'appl', instance 0x1e88a0e0 O I 
    node 3: 'aumx' '3dem' 'appl', instance 0x1e88b200 O 
    Connections: 
    node 1 bus 1 => node 2 bus 1 [ 1 ch, 22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer] 
    node 2 bus 0 => node 1 bus 0 [ 1 ch, 22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer] 
    Input Callbacks: 
    {0x1469b9, 0x1d5bffa0} => node 2 bus 0 [1 ch, 22000 Hz] 
    CurrentState: 
    mLastUpdateError=0, eventsToProcess=F, isRunning=F 

更新:

我認爲只有在AudioGraph重新啓動後纔會出現問題。

1.) CheckError(AUGraphStart(self.graph), "Error starting graph. - error code"); 
2.) Recording <- NO CRACKLE! 
3.) CheckError(AUGraphStop(self.graph), "Error stopping graph. - error code"); 
4.) CheckError(AUGraphStart(self.graph), "Error starting graph. - error code"); 
5.) Recording <- CRACKLE! 

回答

1

我找到了解決方法,但不是解決方案。 只需用kAudioUnitSubType_Varispeed AU替換3DMixer即可。

speedDescription.componentFlags = 0; 
speedDescription.componentFlagsMask = 0; 
speedDescription.componentType = kAudioUnitType_FormatConverter; 
speedDescription.componentSubType = kAudioUnitSubType_Varispeed; 
speedDescription.componentManufacturer = kAudioUnitManufacturer_Apple; 

我希望這可以幫助別人!