6

Potrzebuję pomocy w zrozumieniu następującego ASBD. Jest to domyślny ASBD przypisany świeżej instancji RemoteIO (otrzymałem ją wykonując AudioUnitGetProperty(..., kAudioUnitProperty_StreamFormat, ...) na jednostce audio RemoteIO zaraz po przydzieleniu i zainicjowaniu jej).Zrozumieć zdalny 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 

Chodzi o to, nie powinno być 8mBytesPerFrame? Jeśli mam 32 bity (4 bajty) na kanał i 2 kanały na ramkę, czy każda klatka nie powinna mieć 8 bajtów (zamiast 4)?

Z góry dziękuję.

Odpowiedz

0

Wierzę, że ponieważ flagi formatu określają kAudioFormatFlagIsNonInterleaved wynika, że ​​rozmiar ramki w dowolnym buforze może być tylko wielkością ramki 1-kanałowej. Jeśli jest to poprawne, mChannelsPerFrame jest z pewnością mylącą nazwą.

Mam nadzieję, że ktoś inny to potwierdzi/wyjaśni.

5

Wartość mBytesPerFrame zależy od mFormatFlags. Z 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.