質問

In AudioStreamBasicDescription struct:

struct AudioStreamBasicDescription {
    Float64 mSampleRate;
    UInt32  mFormatID;
    UInt32  mFormatFlags;
    UInt32  mBytesPerPacket;
    UInt32  mFramesPerPacket;
    UInt32  mBytesPerFrame;
    UInt32  mChannelsPerFrame;
    UInt32  mBitsPerChannel;
    UInt32  mReserved; 
};

if we know nChannelsPerFrame and mBitsPerChannels, we can calculate mBytesPerFrame like this: mBytesPerFrame = mBitsPerChannels * mChannelsPerFrame / 8 (correct me if I'm wrong)

I believe that all of the fields exist for some reason. What is it for mBytesPerFrame?

役に立ちましたか?

解決

Yes. The field can be used to aid in describing packing and alignment of LPCM sample data/frames. That's also mandatory for describing some external LPCM representations.

For example, you can specify a 20 bit sample size, but an implementation may favor to represent/transfer/store that using 3 bytes, or 24 bits (ignoring 4 bits per sample).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top