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.