All of lore.kernel.org
 help / color / mirror / Atom feed
* Opening a PCM device in shared mode
@ 2011-11-20  8:54 Sayem Ahmed
       [not found] ` <C516192DA6D2B74F8192CDC209D958FD5834F34861@dr-mail>
  0 siblings, 1 reply; 5+ messages in thread
From: Sayem Ahmed @ 2011-11-20  8:54 UTC (permalink / raw)
  To: alsa-devel

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#gb7eaaec6f27e4ca48cada9795cd2479b>function 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-26 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-20  8:54 Opening a PCM device in shared mode Sayem Ahmed
     [not found] ` <C516192DA6D2B74F8192CDC209D958FD5834F34861@dr-mail>
2011-11-21 11:11   ` Sayem Ahmed
2011-11-24 17:31     ` Clemens Ladisch
2011-11-26 16:31       ` Sayem Ahmed
2011-11-26 20:13         ` Clemens Ladisch

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.