简体   繁体   中英

What is the android audio buffer format in HAL?

I am trying to integrate some library in android HAL.I need to pass the audio data to my library in blocks of left sample and right sample as below:

LLLLLRRRRR

Where L and R stand for left and right respectively . I am not able to understand the format in which the HAL is given the buffer by the audioflinger. Can someone give some pointers? Is it in this below format?

LRLRLRLRLRLR

Is it in this below format?

LRLRLRLRLRLR

Yes, stereo audio data is interleaved that way. I don't have any piece of documentation to point to that explicitly states this, but you can infer that that is the case by looking at various places in the Android source code. For example, in this function in the Downmix effect which converts 5.1 audio to stereo, you'll see that for each 5.1 sample it writes one int16_t representing the left output, directly followed by an int16_t representing the right output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM