7

次の ASBD を理解するのに助けが必要です。これは、の新しいインスタンスに割り当てられたデフォルトのASBDです(割り当てて初期化した直後に、オーディオユニットでRemoteIO実行AudioUnitGetProperty(..., kAudioUnitProperty_StreamFormat, ...)して取得しました)。RemoteIO

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

問題は、そうであってはならないmBytesPerFrameということ8です。チャネルごとに 32 ビット (4 バイト)、フレームごとに 2 つのチャネルがある場合、各フレームの長さは (4 ではなく) 8 バイトであるべきではありませんか?

前もって感謝します。

4

2 に答える 2

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.
于 2012-09-07T23:37:27.673 に答える
0

フォーマット フラグが指定kAudioFormatFlagIsNonInterleavedしているため、任意のバッファ内のフレームのサイズは 1 チャネル フレームのサイズにしかならないと考えられます。これが正しければ、mChannelsPerFrame確かに紛らわしい名前です。

他の誰かがこれを確認/明確にしてくれることを願っています。

于 2012-09-03T21:29:55.113 に答える