From: <dave@synergy.org>
To: <alsa-devel@alsa-project.org>
Subject: the ALSA state machine
Date: Sat, 8 Aug 2026 15:47:24 -0700 [thread overview]
Message-ID: <000201dd2787$e39e3f10$aadabd30$@synergy.org> (raw)
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
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
Bluetooth code I do not get an error. Finally, I check the state before I
exit my initialization code and I am in the SND_PCM_STATE_PREPARED, not the
SND_PCM_STATE_RUNNING state. Evidently, the documentation and the code do
not agree. Which is correct? It would be trivial to check the state and omit
the snd_pcm_prepare() call if it is already in the prepared state. But I am
trying to follow the document as closely as possible.
Thoughts?
David
next reply other threads:[~2026-08-12 9:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 22:47 dave [this message]
2026-08-12 9:37 ` the ALSA state machine Jaroslav Kysela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000201dd2787$e39e3f10$aadabd30$@synergy.org' \
--to=dave@synergy.org \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.