6

Ho bisogno di aiuto per capire quanto segue ASBD. E 'l'ASBD predefinito assegnato a un'istanza fresca di RemoteIO (I got it eseguendo AudioUnitGetProperty(..., kAudioUnitProperty_StreamFormat, ...) sull'unità audio RemoteIO, subito dopo l'allocazione e l'inizializzazione di esso).Understanding I/O remoto 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 

La domanda è, non dovrebbe essere mBytesPerFrame8? Se ho 32 bit (4 byte) per canale e 2 canali per fotogramma, non ogni fotogramma deve essere lungo 8 byte (anziché 4)?

Grazie in anticipo.

risposta

0

Credo che poiché i flag di formato specificano kAudioFormatFlagIsNonInterleaved, ne consegue che la dimensione di un frame in qualsiasi buffer può essere solo la dimensione di un frame a 1 canale. Se questo è corretto, mChannelsPerFrame è sicuramente un nome confuso.

spero che qualcun altro confermerà/chiarire questo.

5

Il valore di mBytesPerFrame dipende mFormatFlags. Da 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.