Thanks Lennart for the response. It took a few hours staring sideways at the API and a &#39;little&#39; help from tanuk on the irc channel for me to see the path to the solution. Works perfectly now. <br><br>All the best,<br>
Conor<br><br><div class="gmail_quote">On Fri, Oct 16, 2009 at 3:49 AM, Lennart Poettering <span dir="ltr">&lt;<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 13.10.09 13:38, Forwind info (<a href="mailto:forward@forwind.net">forward@forwind.net</a>) wrote:<br>
<br>
Heya,<br>
<div class="im"><br>
&gt; At the moment I am trying to write a simple gtk application which in essence<br>
&gt; can detect this scenario :<br>
&gt;<br>
&gt; &#39;master&#39; volume is muted. And at the same time a client application is<br>
&gt; attempting to play audio.<br>
&gt;<br>
&gt; I have been digging through the API and I can&#39;t find anything obvious about<br>
&gt; the master volume.<br>
<br>
</div>You should subescribe to sink changes with pa_context_subscribe(). Then<br>
you need to enumerate the output sinks with<br>
pa_context_get_sink_info_list(). Look for pa_sink_info::mute and<br>
pa_sink_info::cvolume for the current mute state and the volume. Use<br>
pa_cvolume_is_muted() on pa_sink_info::cvolume to easily check if all<br>
channels of the volume are set to muted. i.e. something like this:<br>
<br>
  muted = si-&gt;muted || pa_cvolume_is_muted(&amp;si-&gt;cvolume);<br>
<br>
Then, wehn you get a subscription event simply ask for an update of<br>
the pa_sink_info for that sink via<br>
pa_context_get_sink_info_by_index().<br>
<br>
That way you will be able to follow the mute status of all audio sinks<br>
(aka &quot;output devices&quot;). Now if you also want to track the streams<br>
connecting to them you do basically the same for the sink inputs (aka<br>
&quot;output streams&quot;). The logic is very similar for that. If you want to<br>
know which sink input (i.e. stream) connects to which sink<br>
(i.e. output device) then compare pa_sink_input::sink and<br>
pa_sink::index.<br>
<br>
Hope this is not too confusing.<br>
<div class="im"><br>
&gt; I am using the Glib asynchronous api. So far I can query the server about<br>
&gt; the number channels and their respective volumes but I cannot query the<br>
&gt; overall master volume.<br>
<br>
</div>There is no overall master volume, because we distinguish different<br>
devices. The best you can get is the volume of each sink seperately.<br>
<div class="im"><br>
&gt; I thought it would be a case of setting up a callback whereby any channel<br>
&gt; attempting to play a stream would notify a custom call back which would then<br>
&gt; check if all channels are muted and then notify the GUI accordingly.<br>
&gt;<br>
&gt; another idea was to use PA_STREAM_START_MUTED. Connect to all streams and on<br>
&gt; a playback event check if any has this stream state ? clutching at straws to<br>
&gt; be honest. long time since I toyed with C API&#39;s.<br>
<br>
</div>No need to bother with that flag. The introspection APIs should offer<br>
all you need.<br>
<br>
Hope this helps!<br>
<br>
Lennart<br>
<font color="#888888"><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>
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>
</font></blockquote></div><br>