Hi Lennart,<div><br></div><div>>Note that only very few audio devices actually have independant<br>>headphone and speaker volumes. PA supports different mixer paths by<br>>means of the device port functionality, but you may not assume that a<br>
>particular path is available. Also, PA will not allow you to control<br>>the volume of a path that is currently not active. The reason for that<br>>is that this is often not even possible since multiple paths might not<br>
>be independant of each other.<br></div><div><br></div><div>Understood. One question re headphone operation - when is jack-sensing expected in PA ?</div><div><br></div><div>>If you want to control this the best way is probably to write a little<br>
>module that lives inside of PA and can flag this synchrnously instead<br>>of doing that out-of-process asynchronously.<br></div><div><br></div><div>Would hope to get around to doing this in the near future. Time or lack of being the only factor ... Will get back to you on this.</div>
<div><br></div><div>>I'd be happy to merge a patch that would treat<br>>pa_context_set_sink_mute_by_index() with an index of PA_INVALID_INDEX<br>>as a request to mute all sinks, and similarly for sources.<br>
</div><div><br></div><div>That would be very useful for me. thanks. </div><div><br></div><div>>muting and volume changing is orthogonal. PA treats them completely<br>>indendantly. (Note however that some client programs do apply some<br>
>connection here: i.e. gnome-volume-control mutes the device if you<br>>pull the volume to minimum)<br></div><div><br></div><div>>PA_VOLUME_NORM really means max hw amplification. As tanuk pointed >out<br>>the 0dB value of the hw is at the "base" volume. And if you want<br>
>digital amp you can even go > PA_VOLUME_NORM which is even louder.<br></div><div><br></div><div>Understood.</div><div><br></div><div>Thanks for the clarifications. </div><div><br></div><div>Conor</div><div><br></div>
<div><br><br><div class="gmail_quote">On Wed, Jan 13, 2010 at 7:56 PM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Tue, 12.01.10 11:48, Forwind info (<a href="mailto:forward@forwind.net">forward@forwind.net</a>) wrote:<br>
<br>
A few comments on top of those tanuk already provided:<br>
<div class="im"><br>
> 1. To obtain the volume of primary Output Device.<br>
> ans: Fetch the sink info via pa_context_get_sink_info_by_index(). The<br>
> return value will contain volume data type (pa_cvolume).<br>
><br>
> 2.Differentiate between headphone volume if plugged in and speaker volume<br>
> ans: Detect headphone connection - PulseAudio intend to expose<br>
> jack-sensing once it becomes available to them from below. Its in the<br>
> pipeline apparently. I need to do some more investigation around this. Some<br>
> devices expose individual headphone volumes as opposed to speaker volumes<br>
> others don't.<br>
<br>
</div>Note that only very few audio devices actually have independant<br>
headphone and speaker volumes. PA supports different mixer paths by<br>
means of the device port functionality, but you may not assume that a<br>
particular path is available. Also, PA will not allow you to control<br>
the volume of a path that is currently not active. The reason for that<br>
is that this is often not even possible since multiple paths might not<br>
be independant of each other.<br>
<div class="im"><br>
> 4. If the sound is muted and some exterior application attempts to play<br>
> sound then flag it<br>
> ans: Subscribe to the PA_SUBSCRIPTION_EVENT_SINK_INPUT event and on the<br>
> callback check to see if that sink is muted (boolean). Note if the client<br>
> application is paused, the sink is then muted and the client app is restart<br>
> the event will not be triggered. This might be not satisfy UI spec<br>
> requirements. Check with MPT.<br>
<br>
</div>If you want to control this the best way is probably to write a little<br>
module that lives inside of PA and can flag this synchrnously instead<br>
of doing that out-of-process asynchronously.<br>
<div class="im"><br>
> 5. Ability to mute all output sinks.<br>
> ans: pa_context_set_sink_mute_by_index()- iterate through all sinks<br>
> returned via pa_context_get_sink_info_list(). Maybe there is a mute<br>
> all switch - could not see it in the docs right now - will ask on #pa on<br>
> freenode.<br>
<br>
</div>I'd be happy to merge a patch that would treat<br>
pa_context_set_sink_mute_by_index() with an index of PA_INVALID_INDEX<br>
as a request to mute all sinks, and similarly for sources.<br>
<div class="im"><br>
> 6. Unmute all outputs and return to previous volumes.<br>
> ans: PA's module-stream-restore - more investigation. Apparently this<br>
> will store previous volumes of all sinks and restore them when required.<br>
<br>
</div>muting and volume changing is orthogonal. PA treats them completely<br>
indendantly. (Note however that some client programs do apply some<br>
connection here: i.e. gnome-volume-control mutes the device if you<br>
pull the volume to minimum)<br>
<div class="im"><br>
> 8. Set individual outputs volumes to max.<br>
> ans: Set the sink (output device) in question to PA_VOLUME_NORM.<br>
> pa_cvolume_reset() - should do this for the sink in question.<br>
> PA_VOLUME_NORM roughly corresponds to 0DB => MAX volume without clipping.<br>
<br>
</div>PA_VOLUME_NORM really means max hw amplification. As tanuk pointed out<br>
the 0dB value of the hw is at the "base" volume. And if you want<br>
digital amp you can even go > PA_VOLUME_NORM which is even louder.<br>
<br>
Also see:<br>
<br>
<a href="http://pulseaudio.org/wiki/WritingVolumeControlUIs#Volumes" target="_blank">http://pulseaudio.org/wiki/WritingVolumeControlUIs#Volumes</a><br>
<div class="im"><br>
Lennart<br>
<br>
--<br>
Lennart Poettering Red Hat, Inc.<br>
lennart [at] poettering [dot] net<br>
<a href="http://0pointer.net/lennart/" target="_blank">http://0pointer.net/lennart/</a> GnuPG 0x1A015CC4<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">pulseaudio-discuss mailing list<br>
<a href="mailto:pulseaudio-discuss@mail.0pointer.de">pulseaudio-discuss@mail.0pointer.de</a><br>
<a href="https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss" target="_blank">https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss</a><br>
</div></div></blockquote></div><br></div>