Re: the ALSA state machine

Jaroslav Kysela <[email protected]>
Newsgroups gmane.linux.alsa.devel
Message-ID <[email protected]>
On 8/9/26 00:47, [email protected] wrote:
> Hello,
> 	I am trying to debug some ALSA playback code. I have two playback
> devices,. The first is A USB sound bar and the second is A Bluetooth sound
> bar. The issue I am debugging is truncated output on the Bluetooth sound
> bar. The USB sound bar works fine. I've added assertions to understand how
> my code may be getting out of sync with the ALSA state machine.
> 	For reference, I am using the documentation at
> https://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html
> 	After opening the device, I check its state and it is always in the
> SND_PCM_STATE_OPEN state, as expected. After initializing the h/w and s/w
> params, however, the document says I should be in the SND_PCM_STATE_SETUP
> state. Instead, however, I am in the SND_PCM_STATE_PREPARED state. I then

It's correct per snd_pcm_hw_params() documentation:

"""
  * After this call, #snd_pcm_prepare() is called automatically and
  * the stream is brought to \c #SND_PCM_STATE_PREPARED state.
"""

> call snd_pcm_prepare() and remain in the SND_PCM_STATE_PREPARED state. I
> then call snd_pcm_start(). In the USB version I get an -EPIPE error. In the

EPIPE usually means that there are not enough data (samples) in the ring buffer.

				Jaroslav

-- 
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.