[pulseaudio-discuss] General Pulse audio async api questions

Forwind info forward at forwind.net
Tue Jan 12 03:48:39 PST 2010


Hi all,

I have some notes below I made about using the Pulse Audio asynchronous API.
If you have a minute would you mind casting your eyes over my proposed
strategy. Any comments are very welcome.

thx,
Conor


1.  To obtain the volume of primary Output Device.
    ans: Fetch the sink info via pa_context_get_sink_info_by_index(). The
return value will  contain volume data type (pa_cvolume).

2.Differentiate between headphone volume if plugged in and speaker volume
    ans: Detect headphone connection - PulseAudio intend to expose
jack-sensing once it becomes available to them from below. Its in the
pipeline apparently. I need to do some more investigation around this. Some
devices expose individual headphone volumes as opposed to speaker volumes
others don't.

3. Detect no output devices(sinks)
   ans: pa_context_get_sink_info_list - if the returned array is empty then
there are no output devices.

4. If the sound is muted and some exterior application attempts to play
sound then flag it
    ans: Subscribe to the PA_SUBSCRIPTION_EVENT_SINK_INPUT event and on the
callback check to see if that sink is muted (boolean). Note if the client
application is paused, the sink is then muted and the client app is restart
the event will not be triggered. This might be not satisfy UI spec
requirements. Check with MPT.

5. Ability to mute all output sinks.
    ans: pa_context_set_sink_mute_by_index()- iterate through all sinks
returned via pa_context_get_sink_info_list().         Maybe there is a mute
all switch - could not see it in the docs right now - will ask on #pa on
freenode.

6. Unmute all outputs and return to previous volumes.
   ans: PA's module-stream-restore - more investigation. Apparently this
will store previous volumes of all sinks and restore them when required.

7. Set individual output volumes to 0 (distinct from mute)
    pa_context_set_sink_volume_by_index() or by name.

8. Set individual outputs volumes to max.
   ans: Set the sink (output device) in question to PA_VOLUME_NORM.
   pa_cvolume_reset() - should do this for the sink in question.
PA_VOLUME_NORM roughly corresponds to 0DB => MAX volume without clipping.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100112/db390b99/attachment.htm>


More information about the pulseaudio-discuss mailing list