Hello all,
I am a beginner in ALSA API. I am developing a sound application where I need to open a PCM device for recording/playback audio data. I want to open this device in shared mode so that other applications can use the same device. I have downloaded the example ALSA program from here http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html and run it on my PC. It works fine when it runs alone. But when I start a song on a media player and then run this example, it shows an error saying -
|Playback open error: Device or resource busy
|
Looking at the source code of this example I could say that thesnd_pcm_open http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#gb7eaaec6f27e4ca48cada9795cd2479bfunction at line 882 is throwing this error. It finds the device busy since another process is currently using it. I also tried the reverse way - first started the example then tried to start a song. In this case the media player stays idle, showing "idle" just beside the progress bar (I am using Banshee). I am assuming that snd_pcm_open gains exclusive right of the device resource so that no other process can use it.
But I don't want that. I want to play sound to a audio device without requiring any exclusive rights so that other processes in the PC can share the same device for outputting audio data.
How can I do that? How can I open a PCM device so that other processes can also share the same device?
P.S. : I have two sound cards on my system, one is built-in in motherboard, another one is a USB Card. I tried opening the USB (by specifying "plughw:1,0" as argument in the snd_pcm_open) card and then got this error.
Thank you in advance.
Regards, Sayem Ahmed