Hi List, We had a little conversation with "Lonely Stranger" about lxpanel's volumealsa plugin and that it updates icon, tooltip, etc twice every time user sets volume. He suggested me to reply here so do I. I copied relevant part of the discussion below in case anyone interested.
I do not share the belief that mixer's latency causes the problem. I suspect currently this plugin misuses signal blocking and unblocking (or gtk behaves in an unexpected way, depending on the viewpoint) and tested this theory with the following code : http://pastebin.ca/2878175 I could reproduce the problem without any sound devices, mixers involved. This convinces me, that duplicate updates are caused by value-changed signal emitted by vertical scale. Even though the signal is blocked, when the scale is repositioned, the signal is emitted and just waits to get unblocked. Or gets emitted after unblocked. Proposed solution for this here : https://sourceforge.net/p/lxde/patches/490/ > Thank you very much for explanations. I believe though, > this kind of discussion is not suitable for this place and > better be going in the lxde mailing list. > > Your explanation reveals obvious fact that mixer has > latency. That is fairly reasonable knowing mixer is an > analog device, and even can be connected via some bus (USB, > etc.), thus you'll get changes after some delay (thus after > signal was unblocked). Therefore volume changing > application (our plugin) should take this latency into > consideration. > > Case when volume was changed not from our side (external > mixer application for example) is simple: we got a volume > change, we updated the scale indicator. > > Case when plugin changes the volume becomes more tricky > then: > 1) got a change from user (mouse, keys); > 2) update scale, freeze it now; > 3) calculate volume level, send to ALSA; > 4) ignore any changes from ALSA for some latency period; > 5) after that period (50-100-200 ms) read ALSA, update > scale; > 6) accept ALSA changes again. > > So if we take latency into consideration then no duplicate > updates will appear I believe. Anyway, it's better to > continue discussion in the mailing list. Thank you very > much. :) >> [...] When I set volume on >> the vertical scale volumealsa_update_display() is called, >> and that updates the position of the vertical scale, that I >> have just set to some level. >> >> The real problem begins here. Even though the vertical >> scale's value changed signal is blocked, when it is >> updated, it still emits the signal, when it is unblocked. I >> don't know if it is a bug or an intended behaviour. >> Anyways, it sets the volume, uptdates display, emits value >> changed signal, then sets the volume, updates display, >> emits signal and goes like this for a few cycles until the >> vertical scale would be repositioned to its current level, >> so it would not emit the value changed signal. >> >> This problem is hidden for a mapping like level=volume and >> volume=level. Even in this case it updates display twice >> for every time the user sets volume. This however causes >> more trouble if the mapping is different. [...] ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ Lxde-list mailing list Lxde-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxde-list