6

我需要幫助瞭解以下ASBD。這是默認的ASBD分配給一個新的實例RemoteIO(我通過在RemoteIO音頻單元上執行AudioUnitGetProperty(..., kAudioUnitProperty_StreamFormat, ...),在分配並初始化它後立即得到它)。瞭解遠程I/O AudioStreamBasicDescription(ASBD)

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

的問題是,不應該mBytesPerFrame8?如果每個通道有32位(4字節),每幀有2個通道,那麼每幀不應該是8個字節(而不是4個)?

在此先感謝。

回答

0

我認爲,因爲格式標誌指定kAudioFormatFlagIsNonInterleaved它遵循任何緩衝區中的幀的大小隻能是1通道幀的大小。如果這是正確的mChannelsPerFrame肯定是一個令人困惑的名字。

我希望別人會確認/澄清這一點。

5

mBytesPerFrame的值取決於mFormatFlags。來自CoreAudioTypes.h:

Typically, when an ASBD is being used, the fields describe the complete layout 
of the sample data in the buffers that are represented by this description - 
where typically those buffers are represented by an AudioBuffer that is 
contained in an AudioBufferList. 

However, when an ASBD has the kAudioFormatFlagIsNonInterleaved flag, the 
AudioBufferList has a different structure and semantic. In this case, the ASBD 
fields will describe the format of ONE of the AudioBuffers that are contained in 
the list, AND each AudioBuffer in the list is determined to have a single (mono) 
channel of audio data. Then, the ASBD's mChannelsPerFrame will indicate the 
total number of AudioBuffers that are contained within the AudioBufferList - 
where each buffer contains one channel. This is used primarily with the 
AudioUnit (and AudioConverter) representation of this list - and won't be found 
in the AudioHardware usage of this structure.