I can run aplay with no problem, and play a wav test file.
In my application, the call to snd_pcm_open gives the following error:
ALSA lib conf.c:3357:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
I checked the code in aplay, and I'm using the same device name ('default'), and same mode. The codes are practically the same, only that aplay is only one file to test ALSA and I'm trying to run ALSA inside a very large application.
It gets even more weird when I realized that by just retrying the call after a brief sleep, it works.
If instead of opening the device I try to snd_ctl_open, I get an error
ALSA lib conf.c:3357:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL hw:0
control open (0): No such file or directory
after which I can open the device. As if after one call to snd_pcm_open or snd_ctl_open fixes the issue, so the next call it works.
what can cause this behaviour? I don't want to call snd_pcm_open twice. It's symptomatic that something is wrong.
I'm running ubuntu.