The software processes for playing back and capturing audio data are similar.
This section describes the common steps.
Opening your PCM device
The first thing you need to do in order to play back or capture sound is open a connection to a PCM playback or capture device.
Configuring the PCM device
The next step in playing back or capturing the sound stream is to inform the device of the format of the data that you're about to send it or want to receive from it.
Controlling voice conversion
Configuration of the libasound library is based on the maximum number of voices supported in hardware.
Preparing the PCM subchannel
The next step in playing back or capturing the sound stream is to prepare the allocated subchannel to run.
Closing the PCM subchannel
When you've finished playing back or capturing audio data, you can close the subchannel by calling snd_pcm_close().