Posted by: Administrator
on August 12, 2004 11:54 AM
I read the article and the Paul Davi's. For someone like me, trying to test programming for the sound device for the first time, both articles need to include instructions on how to compile and use the sample programs. I managed to compile the playback code example, but I get an error message when I use it.
<TT>
ALSA lib pcm.c:1972:(snd_pcm_open_noupdate) Unknown PCM<nobr> <wbr></nobr>/dev/snd/pcmC0D6c
cannot open audio device<nobr> <wbr></nobr>/dev/snd/pcmC0D6c (No such file or directory)
</TT>
I tried all the devices in<nobr> <wbr></nobr>/dev/snd/,<nobr> <wbr></nobr>/dev/dsp, etc. with no luck. Finally, after finding this tutorial <A HREF="http://www.suse.de/~mana/alsa090_howto.html" title="www.suse.de">http://www.suse.de/~mana/alsa090_howto.html</a www.suse.de>, I learned that the device convention is "plughw:0,0". This is a totally different API than the usual<nobr> <wbr></nobr>/dev/xxxxxx convention.
I also spotted an error with the sample code, in the function snd_pcm_hw_params_set_rate_near, the third and fourth arguments must be pointers. Since man pages seem not to exist, I had to google the function in order to find it's syntax (That doxygen crap is too hard to navigate, man function_name is simple and does not require a browser.)
To make the ALSA playback code work (and not produce a segmentation fault), you'll need to add/modify:
Compilation and usage would be nice.
Posted by: Administrator on August 12, 2004 11:54 AMI read the article and the Paul Davi's. For someone like me, trying to test programming for the sound device for the first time, both articles need to include instructions on how to compile and use the sample programs. I managed to compile the playback code example, but I get an error message when I use it.
<TT>
ALSA lib pcm.c:1972:(snd_pcm_open_noupdate) Unknown PCM<nobr> <wbr></nobr>/dev/snd/pcmC0D6c
cannot open audio device<nobr> <wbr></nobr>/dev/snd/pcmC0D6c (No such file or directory)
</TT>
I tried all the devices in<nobr> <wbr></nobr>/dev/snd/,<nobr> <wbr></nobr>/dev/dsp, etc. with no luck. Finally, after finding this tutorial <A HREF="http://www.suse.de/~mana/alsa090_howto.html" title="www.suse.de">http://www.suse.de/~mana/alsa090_howto.html</a www.suse.de>, I learned that the device convention is "plughw:0,0". This is a totally different API than the usual<nobr> <wbr></nobr>/dev/xxxxxx convention.
I also spotted an error with the sample code, in the function snd_pcm_hw_params_set_rate_near, the third and fourth arguments must be pointers. Since man pages seem not to exist, I had to google the function in order to find it's syntax (That doxygen crap is too hard to navigate, man function_name is simple and does not require a browser.)
To make the ALSA playback code work (and not produce a segmentation fault), you'll need to add/modify:
<TT>int dir=0;
int rate=44100;
snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, &rate, &dir)</TT>
The program needs to execute with the argument "plughw:0,0", you'll get a click.
As introductory material, this and the referenced ALSA tutorial are really poor articles. Both need the code checked to make sure it actually works.
#