Preparing the PCM subchannel
The next step in playing back or capturing the sound stream is to prepare the allocated subchannel to run.
Call one of the following functions to prepare the allocated subchannel:
- snd_pcm_plugin_prepare() if you're using the plugin interface
if you aren't.
The snd_pcm_channel_prepare() function simply calls snd_pcm_capture_prepare() or snd_pcm_playback_prepare(), depending on the channel direction that you specify.
This step and the SND_PCM_STATUS_PREPARED state may seem unnecessary, but they're required to correctly handle underrun conditions when playing back, and overrun conditions when capturing. For more information, see If the PCM subchannel stops during playback and If the PCM subchannel stops during capture , later in this chapter.