From: Sayem Ahmed <sayem64@gmail.com>
To: alsa-devel@alsa-project.org
Subject: Opening a PCM device in shared mode
Date: Sun, 20 Nov 2011 14:54:30 +0600 [thread overview]
Message-ID: <4EC8C046.4030706@gmail.com> (raw)
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
next reply other threads:[~2011-11-20 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-20 8:54 Sayem Ahmed [this message]
[not found] ` <C516192DA6D2B74F8192CDC209D958FD5834F34861@dr-mail>
2011-11-21 11:11 ` Opening a PCM device in shared mode Sayem Ahmed
2011-11-24 17:31 ` Clemens Ladisch
2011-11-26 16:31 ` Sayem Ahmed
2011-11-26 20:13 ` Clemens Ladisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EC8C046.4030706@gmail.com \
--to=sayem64@gmail.com \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox