[pulseaudio-discuss] Audio outside gnome-session and device suspension (request for help)
hanke at brailcom.org
Mon Apr 21 01:34:31 PDT 2008
I'm working on speech-dispatcher, that is an accessibility application,
basically an interface to speech synthesis. Its services are used by
programs running inside gnome-session as well by those who are not (for
example a text console screen reader, a reader for GDM or something that
talks when it is impossible to start X etc.) I'd like to consult one
thing with you that we face when trying to migrate to PulseAudio.
We have a special Pulse Audio daemon running under the user
speech-dispatcher for our system-wide Speech Dispatcher (which is
independent of Gnome Session or X) and then each user launches his own
Pulse Audio and Speech Dispatcher inside his gnome session. Each Speech
Dispatcher opens a connection to Pulse Audio at startup and doesn't
close it until it is terminated (it sends multiple requests to play
something or it may not send anything for quite a while, but it doesn't
want to close the connection for performance and other reasons). Now
obviously, if both Dispatchers keep the connection, there is a conflict
over which of the two PulseAudio daemons can access alsa:hw:0,0.
It never happens that both of the Pulse Audios would be asked to play a
sound at once, so in theory, everything is fine. In practice however, it
seems that PulseAudio keeps alsa:hw:0,0 open as long as the Speech
Dispatcher is connected to it, regardles of whether it is currently
playing something or not.
I've tried to suspend the sink when there is nothing to play in Speech
Dispatcher. This does the expected thing and I'm now able to switch
between these two Dispatchers/Pulse Audio daemons as long as I don't ask
them to play both at the same time (which is not a problem, as I said).
The unwanted effect of the suspension of the sinks however is that it
affects all other clients connected to the same Pulse Audio, which is a
big problem for the one inside gnome-session.
What I want to do, is to say to Pulse Audio: ''My application is not
going to play anything now, you are free to close hw:0,0 if you wish''.
And if all the applications connected to Pulse Audio say this, then
Pulse Audio would free the access to the soundcard. Currently, what the
suspend seems to do however, is to tel Pulse Audio: ''I don't want you
to play anything now,'' which is something I can't really do because I
have no information about the other clients, whether they need the
soundcard or no.
So is there some possibility to say: ''Please suspend the sink if nobody
else needs it now''?
Or perhaps I'm on a wrong path and there is a better way how to make two
Speech Dispatchers running under different users switch smoothly without
having to close the connection to Pulse or affecting other sound
Thank you for your help,
More information about the pulseaudio-discuss