Key Points of ALSA library Programming

Source: Internet
Author: User

1. snd_pcm_open: Open the handle.

2. configuration parameters: snd_pcm_hw_params_alloca, snd_pcm_hw_params_any, parameters, parameters, snd_pcm_hw_params_set_access, parameters, parameters, and snd_pcm_hw_params.

3. read/write: snd_pcm_writei and snd_pcm_readi.

Note:

1. Create a handle Based on the functions to be implemented. The snd_pcm_open parameter snd_pcm_stream_capture corresponds to snd_pcm_readi, And the snd_pcm_stream_playback corresponds to snd_pcm_writei.

2. Configure parameters. The third parameter in snd_pcm_hw_params_set_format corresponds to the format of the corresponding file, that is, snd_pcm_format_a_law corresponds to g711 data, and snd_pcm_format_s16_le corresponds to 16-bit small-end PCM data.

3. In some cases, PCM Data and g711 data are required for mutual conversion between g722 data and PCM data. However, it should be noted that the size of a g722 data package is generally 120. Therefore, when reading files and sending data to the decoder, you must change the size to 120. the size of a g711 data package is 320. Therefore, you must change the size to 320 when sending the decoder.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.