| Newsgroups |
gmane.linux.alsa.devel |
| Message-ID |
<[email protected]> |
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