[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Review Request: Rework KMix DBus API and add KMix plasma
From:       "Aaron Seigo" <aseigo () kde ! org>
Date:       2011-03-06 3:52:25
Message-ID: 20110306035225.9037.26744 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On March 5, 2011, 8:25 a.m., Aaron Seigo wrote:
> > "When I request an source for Mixer, it also adds soucres for controls. And then \
> > when I request source for already available Control, it doesn't react anyhow. But \
> > when I set "Update every % ms", and click "Reqeust", it works fine." 
> > this is because the data for the control (or at least, the readableName) is set \
> > in updateMixerData. then, when it is later requested the DataEngine sees it \
> > exists already and so does not call sourceRequestEvent. since there is no poll \
> > (time) request, updateSourceEvent isn't called either. when there is a poll time \
> > set, then updateSourceEvent is (eventually) called and the data is updated. the \
> > fix is to not set any data on the control until such time as a visualization \
> > requests it. you can set up the behind-the-scenes objects, but leave the setData \
> > calls for the control out of updateMixerData. 
> > there are some memory leaks that need closing as well.
> > 
> > i also recommend, for stylistic reasons, using "natural language" labels rather \
> > than camelCaseAsIfItsAFunctionName labels. e.g.: "Controls", "Readable Name", \
> > etc.
> 
> Igor Poboiko wrote:
> Big thanks for your review.
> I just thought that these things end-user will never see, so there is no reason to \
> set user-friendly labels. But if you suggest so, I'll fix it. 
> And there is a little problem. For example, user wants to configure visible \
> controls. He goes to settings, and we should show him all available controls (its \
> readable names, maybe icons, etc). To do it we should request sources for every \
> available control. But when I requests source for control, it starts to listen dbus \
> about volume level changes, etc. If such a thing started for every control, it's \
> bad (just because we doesn't need such an information). The solution I can see for \
> it is to add list of readable mixers names in the same order as its IDs (and maybe \
> icons, and more data user may need) in "mixers" source and to add list of controls \
> readable names (and again, maybe something else) to every mixer source. Will it be \
> a correct solution? And if not, what should I do then?

"end-user will never see"

with DataEngines, it's useful to consider plasmoid developers as their end-users :)

"add list of readable mixers names in the same order as its IDs (and maybe icons, and \
more data user may need) in "mixers" source and to add list of controls readable \
names (and again, maybe something else)"

probably not in "mixers", but in the mixer specific source that is set in \
updateMixerData.


> On March 5, 2011, 8:25 a.m., Aaron Seigo wrote:
> > /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp, lines 48-49
> > <http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line48>
> > 
> > this is wrong. if the name is "KMix" then the source created _must_ be "KMix", \
> > but getKMixData creates/sets "running" and "mixers" 
> > my suggestion: change this to if (name == "mixers")
> 
> Igor Poboiko wrote:
> I didn't understand. It adds only the "KMix" source, and sets "running" and \
> "mixers" data to it. Am I right?

no, it doesn't add the "KMix" source. it adds "running" and "mixers". there is not \
setData("KMix", ..) calls, so "KMix" is never created! the visualization (e.g. \
plasmaengineexplorer) asks for "KMix" and the DataEngine instead creates two _other_ \
sources named "running" and "mixers". "KMix" is never created, and so the \
visualization does not get the source it requested. the name of the sources created \
with setData _must_ match the name of source passed in to sourceRequestEvent.

i'd also suggest that it's irrelevant that it's coming from KMix, or any other \
specific application. the DataEngine should simply expose audio mixer information. \
where it gets it is irrelevant.

so .. a source called "mixers" should be requested by the visualization and the \
DataEngine should populate it with the mixers available.


> On March 5, 2011, 8:25 a.m., Aaron Seigo wrote:
> > /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp, line 80
> > <http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line80>
> > 
> > does this matter? if mixers is empty, shouldn't that be enough?
> 
> Igor Poboiko wrote:
> Actually, I think there might be a situation when user just don't have any \
> soundcard (or KMix can't detect any). With this thing we can separate this \
> situation from situation when the KMix isn't running (for example, show different \
> notifications, etc)

that KMix can be not running when this DataEngine is run is a bug. KMix is \
essentially becoming a service and as such should be started on demand as needed. if \
it fails to run, then there are no mixers available to the DataEngine. simple as \
that. anything else is an implementation detail that doesn't need to be exposed.

i do recognize it could be useful for debugging / troubleshooting purposes, but \
that's not usually a good reason to put a publicly visible source in a DataEngine :)


> On March 5, 2011, 8:25 a.m., Aaron Seigo wrote:
> > /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp, lines 118-123
> > <http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line118>
> > 
> > looks like a good candidate for a QHash rather than a QList
> 
> Igor Poboiko wrote:
> I didn't use QHash there because I should search mixer not only by its ID, but also \
> by its DBus path. And I thought it will be a bad idea to have two QHash for both of \
> them. Moreover, average user have maximum 4-5 mixers (for example, in ALSA KMix \
> backend, one mixer is one soundcard), so it won't be a big speedup if I set it to \
> QHash; and this loop runs few times during the session.

fair enough :)

if it isn't a performance issue, then we don't need to worry about it. 

however, just for future reference, you can iterate over a hash just as if it were a \
list. so you could key the hash by the most commonly looked up key (dbus interface or \
control ID) and then iterate linearly over the hash for the other case.


> On March 5, 2011, 8:25 a.m., Aaron Seigo wrote:
> > /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp, line 186
> > <http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line186>
> > 
> > where is this deleted?
> 
> Igor Poboiko wrote:
> Yep, I forgot to delete it. I'll check for every removed control when *changed() \
> DBus signal is emitted and remove unused ControlInfos (and dbus interfaces).

it also needs to be deleted in the destructor of the DataEngine.


- Aaron


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6587/#review9951
-----------------------------------------------------------


On March 5, 2011, 7:56 a.m., Igor Poboiko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6587/
> -----------------------------------------------------------
> 
> (Updated March 5, 2011, 7:56 a.m.)
> 
> 
> Review request for Plasma and Diego Casella.
> 
> 
> Summary
> -------
> 
> This patch reworks KMix DBus API and adds a plasma dataengine+service as a frontend \
> to information provided by DBus. New DBus structure is:
> - /Mixers
> used to get some global information, such as available mixers list and global \
>                 master mixer
> - /Mixers/MIXER_ID
> used to get information about mixer with id=MIXER_ID. It provides such information \
>                 as list of available controls, name of this mixer, id, etc
> - /Mixers/MIXER_ID/CONTROL_ID
> used to get and set information about control. Such information as volume level, \
> mute, name of control, etc. It also adds a DBus signals which are emitted when new \
> mixer/control appears, or volume level changes. It also splits all dbus-related \
> code to separate class, DBus{KMix,Mixer,Control}Wrapper. 
> The Plasma Dataengine:
> By default, the only available source is "KMix". It provides information global \
> information about KMix: is KMix running, and list of available mixers. (its IDs) \
> Source for every mixer is called by it's ID (for example, "ALSA::HDA_Intel:1"). \
> This source provides such information about current Mixer as: it's readable name, \
> is it opened, its balance and list of available controls. It also adds basic \
> sources for every control, which provides only information about its readable name \
> Sources for controls are called by 'MIXER_ID/CONTROL_ID' (for example, \
> "ALSA::HDA_Intel:1/Master:0"). If you request this source, it will provide such \
> information as its readable name, is it muted and its volume level (which are \
> updates automatically, using DBus signals). There is a service available for \
> controls sources. It provides such methods as setVolume() and setMute(). 
> It doesn't close bug 171287, but it becomes one step closer to its solving :)
> 
> And, I'm not very familiar with CMake, but it would be great idea to make plasma \
> part optional. 
> 
> This addresses bug 171287.
> https://bugs.kde.org/show_bug.cgi?id=171287
> 
> 
> Diffs
> -----
> 
> /trunk/KDE/kdemultimedia/kmix/CMakeLists.txt 1223790 
> /trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp 1223790 
> /trunk/KDE/kdemultimedia/kmix/core/mixdevice.h 1223790 
> /trunk/KDE/kdemultimedia/kmix/core/mixdevice.cpp 1223790 
> /trunk/KDE/kdemultimedia/kmix/core/mixer.h 1223790 
> /trunk/KDE/kdemultimedia/kmix/core/mixer.cpp 1223790 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbuscontrolwrapper.h PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbuscontrolwrapper.cpp PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbusmixerwrapper.h PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbusmixerwrapper.cpp PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbusmixsetwrapper.h PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/dbusmixsetwrapper.cpp PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.control.xml PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.mixer.xml PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.mixset.xml PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/CMakeLists.txt PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/CMakeLists.txt PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixer.operations PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.h PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerservice.h PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerservice.cpp PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/plasma/engine/plasma-engine-mixer.desktop \
>                 PRE-CREATION 
> /trunk/KDE/kdemultimedia/kmix/tests/CMakeLists.txt 1223790 
> 
> Diff: http://svn.reviewboard.kde.org/r/6587/diff
> 
> 
> Testing
> -------
> 
> KMix from KDE SC 4.6.0 compiles ok with this patch, and patch applies to current \
> trunk. Tested on system with one card and with ALSA backend, so I don't know is \
> plasma dataengine works correctly with plugging/unplugging mixers (but it should). \
> All DBus methods/properties works fine, signals are emitted, volume can be set \
> using DBus methods. 
> Plasma dataengine was tested using plasmaengineexplorer. 
> All works fine except the one thing. When I request an source for Mixer, it also \
> adds soucres for controls. And then when I request source for already available \
> Control, it doesn't react anyhow. But when I set "Update every % ms", and click \
> "Reqeust", it works fine. If I request a source for control BEFORE requesting the \
> source for mixer, all works fine too (without setting "Update every % ms"). I don't \
> know is it a plasmaengineexplorer bug, or my. 
> 
> Thanks,
> 
> Igor
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://svn.reviewboard.kde.org/r/6587/">http://svn.reviewboard.kde.org/r/6587/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2011, 8:25 a.m., <b>Aaron Seigo</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">&quot;When \
I request an source for Mixer, it also adds soucres for controls. And then when I \
request source for already available Control, it doesn&#39;t react anyhow. But when I \
set &quot;Update every % ms&quot;, and click &quot;Reqeust&quot;, it works \
fine.&quot;

this is because the data for the control (or at least, the readableName) is set in \
updateMixerData. then, when it is later requested the DataEngine sees it exists \
already and so does not call sourceRequestEvent. since there is no poll (time) \
request, updateSourceEvent isn&#39;t called either. when there is a poll time set, \
then updateSourceEvent is (eventually) called and the data is updated. the fix is to \
not set any data on the control until such time as a visualization requests it. you \
can set up the behind-the-scenes objects, but leave the setData calls for the control \
out of updateMixerData.

there are some memory leaks that need closing as well.

i also recommend, for stylistic reasons, using &quot;natural language&quot; labels \
rather than camelCaseAsIfItsAFunctionName labels. e.g.: &quot;Controls&quot;, \
&quot;Readable Name&quot;, etc.</pre>  </blockquote>




 <p>On March 5th, 2011, 9:32 a.m., <b>Igor Poboiko</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Big thanks for your \
review. I just thought that these things end-user will never see, so there is no \
reason to set user-friendly labels. But if you suggest so, I&#39;ll fix it.

And there is a little problem. For example, user wants to configure visible controls. \
He goes to settings, and we should show him all available controls (its readable \
names, maybe icons, etc). To do it we should request sources for every available \
control. But when I requests source for control, it starts to listen dbus about \
volume level changes, etc. If such a thing started for every control, it&#39;s bad \
(just because we doesn&#39;t need such an information). The solution I can see for it \
is to add list of readable mixers names in the same order as its IDs (and maybe \
icons, and more data user may need) in &quot;mixers&quot; source and to add list of \
controls readable names (and again, maybe something else) to every mixer source. Will \
it be a correct solution? And if not, what should I do then?</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">&quot;end-user will \
never see&quot;

with DataEngines, it&#39;s useful to consider plasmoid developers as their end-users \
:)

&quot;add list of readable mixers names in the same order as its IDs (and maybe \
icons, and more data user may need) in &quot;mixers&quot; source and to add list of \
controls readable names (and again, maybe something else)&quot;

probably not in &quot;mixers&quot;, but in the mixer specific source that is set in \
updateMixerData.</pre> <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2011, 8:25 a.m., <b>Aaron Seigo</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line48" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool MixerEngine::sourceRequestEvent( const QString &amp;name )</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">48</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="k">if</span> <span class="p">(</span> <span class="n">name</span> <span \
class="o">==</span> <span class="s">&quot;KMix&quot;</span> <span \
class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">49</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="k">return</span> <span class="n">getKMixData</span><span class="p">(</span> \
<span class="n">name</span> <span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">this is wrong. if the \
name is &quot;KMix&quot; then the source created _must_ be &quot;KMix&quot;, but \
getKMixData creates/sets &quot;running&quot; and &quot;mixers&quot;

my suggestion: change this to if (name == &quot;mixers&quot;)</pre>
 </blockquote>



 <p>On March 5th, 2011, 9:14 a.m., <b>Igor Poboiko</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I didn&#39;t understand. \
It adds only the &quot;KMix&quot; source, and sets &quot;running&quot; and \
&quot;mixers&quot; data to it. Am I right?</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">no, it \
doesn&#39;t add the &quot;KMix&quot; source. it adds &quot;running&quot; and \
&quot;mixers&quot;. there is not setData(&quot;KMix&quot;, ..) calls, so \
&quot;KMix&quot; is never created! the visualization (e.g. plasmaengineexplorer) asks \
for &quot;KMix&quot; and the DataEngine instead creates two _other_ sources named \
&quot;running&quot; and &quot;mixers&quot;. &quot;KMix&quot; is never created, and so \
the visualization does not get the source it requested. the name of the sources \
created with setData _must_ match the name of source passed in to sourceRequestEvent.

i&#39;d also suggest that it&#39;s irrelevant that it&#39;s coming from KMix, or any \
other specific application. the DataEngine should simply expose audio mixer \
information. where it gets it is irrelevant.

so .. a source called &quot;mixers&quot; should be requested by the visualization and \
the DataEngine should populate it with the mixers available.</pre> <br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2011, 8:25 a.m., <b>Aaron Seigo</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line80" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool MixerEngine::sourceRequestEvent( const QString &amp;name )</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">80</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="n">setData</span><span class="p">(</span> <span class="n">source</span><span \
class="p">,</span> <span class="s">&quot;running&quot;</span><span class="p">,</span> \
<span class="kc">true</span> <span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">does this matter? if \
mixers is empty, shouldn&#39;t that be enough?</pre>  </blockquote>



 <p>On March 5th, 2011, 8:42 a.m., <b>Igor Poboiko</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Actually, I think there \
might be a situation when user just don&#39;t have any soundcard (or KMix can&#39;t \
detect any). With this thing we can separate this situation from situation when the \
KMix isn&#39;t running (for example, show different notifications, etc)</pre>  \
</blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">that KMix \
can be not running when this DataEngine is run is a bug. KMix is essentially becoming \
a service and as such should be started on demand as needed. if it fails to run, then \
there are no mixers available to the DataEngine. simple as that. anything else is an \
implementation detail that doesn&#39;t need to be exposed.

i do recognize it could be useful for debugging / troubleshooting purposes, but \
that&#39;s not usually a good reason to put a publicly visible source in a DataEngine \
:)</pre> <br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2011, 8:25 a.m., <b>Aaron Seigo</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line118" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool MixerEngine::sourceRequestEvent( const QString &amp;name )</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">118</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="n">Q_FOREACH</span><span class="p">(</span> <span \
class="n">MixerInfo</span><span class="o">*</span> <span class="n">mi</span><span \
class="p">,</span> <span class="n">m_mixers</span> <span \
class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">119</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="k">if</span> <span class="p">(</span> <span class="n">mi</span><span \
class="o">-&gt;</span><span class="n">id</span> <span class="o">==</span> <span \
class="n">source</span> <span class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">120</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="p">{</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">121</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="n">curmi</span> <span class="o">=</span> <span class="n">mi</span><span \
class="p">;</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">122</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="k">break</span><span class="p">;</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">123</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="p">}</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">looks like a good \
candidate for a QHash rather than a QList</pre>  </blockquote>



 <p>On March 5th, 2011, 9:29 a.m., <b>Igor Poboiko</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I didn&#39;t use QHash \
there because I should search mixer not only by its ID, but also by its DBus path. \
And I thought it will be a bad idea to have two QHash for both of them. Moreover, \
average user have maximum 4-5 mixers (for example, in ALSA KMix backend, one mixer is \
one soundcard), so it won&#39;t be a big speedup if I set it to QHash; and this loop \
runs few times during the session.</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">fair enough \
:)

if it isn&#39;t a performance issue, then we don&#39;t need to worry about it. 

however, just for future reference, you can iterate over a hash just as if it were a \
list. so you could key the hash by the most commonly looked up key (dbus interface or \
control ID) and then iterate linearly over the hash for the other case.</pre> <br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2011, 8:25 a.m., <b>Aaron Seigo</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/6587/diff/1/?file=45445#file45445line186" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool MixerEngine::sourceRequestEvent( const QString &amp;name )</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">186</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="n">curci</span> <span class="o">=</span> <span class="k">new</span> <span \
class="n">ControlInfo</span><span class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">where is this \
deleted?</pre>  </blockquote>



 <p>On March 5th, 2011, 9:32 a.m., <b>Igor Poboiko</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yep, I forgot to delete \
it. I&#39;ll check for every removed control when *changed() DBus signal is emitted \
and remove unused ControlInfos (and dbus interfaces).</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">it also \
needs to be deleted in the destructor of the DataEngine.</pre> <br />




<p>- Aaron</p>


<br />
<p>On March 5th, 2011, 7:56 a.m., Igor Poboiko wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Plasma and Diego Casella.</div>
<div>By Igor Poboiko.</div>


<p style="color: grey;"><i>Updated March 5, 2011, 7:56 a.m.</i></p>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">This patch reworks KMix DBus API and adds a plasma dataengine+service as \
a frontend to information provided by DBus. New DBus structure is:
 - /Mixers
used to get some global information, such as available mixers list and global master \
                mixer
 - /Mixers/MIXER_ID
used to get information about mixer with id=MIXER_ID. It provides such information as \
                list of available controls, name of this mixer, id, etc
 - /Mixers/MIXER_ID/CONTROL_ID
used to get and set information about control. Such information as volume level, \
mute, name of control, etc. It also adds a DBus signals which are emitted when new \
mixer/control appears, or volume level changes. It also splits all dbus-related code \
to separate class, DBus{KMix,Mixer,Control}Wrapper.

The Plasma Dataengine:
By default, the only available source is &quot;KMix&quot;. It provides information \
global information about KMix: is KMix running, and list of available mixers. (its \
IDs) Source for every mixer is called by it&#39;s ID (for example, \
&quot;ALSA::HDA_Intel:1&quot;). This source provides such information about current \
Mixer as: it&#39;s readable name, is it opened, its balance and list of available \
controls. It also adds basic sources for every control, which provides only \
information about its readable name Sources for controls are called by \
&#39;MIXER_ID/CONTROL_ID&#39; (for example, &quot;ALSA::HDA_Intel:1/Master:0&quot;). \
If you request this source, it will provide such information as its readable name, is \
it muted and its volume level (which are updates automatically, using DBus signals). \
There is a service available for controls sources. It provides such methods as \
setVolume() and setMute().

It doesn&#39;t close bug 171287, but it becomes one step closer to its solving :)

And, I&#39;m not very familiar with CMake, but it would be great idea to make plasma \
part optional. </pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">KMix from KDE SC 4.6.0 compiles ok with this patch, and patch applies to \
current trunk. Tested on system with one card and with ALSA backend, so I don&#39;t \
know is plasma dataengine works correctly with plugging/unplugging mixers (but it \
should). All DBus methods/properties works fine, signals are emitted, volume can be \
set using DBus methods.

Plasma dataengine was tested using plasmaengineexplorer. 
All works fine except the one thing. When I request an source for Mixer, it also adds \
soucres for controls. And then when I request source for already available Control, \
it doesn&#39;t react anyhow. But when I set &quot;Update every % ms&quot;, and click \
&quot;Reqeust&quot;, it works fine. If I request a source for control BEFORE \
requesting the source for mixer, all works fine too (without setting &quot;Update \
every % ms&quot;). I don&#39;t know is it a plasmaengineexplorer bug, or my.</pre>  \
</td>  </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://bugs.kde.org/show_bug.cgi?id=171287">171287</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/KDE/kdemultimedia/kmix/CMakeLists.txt <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/core/mixdevice.h <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/core/mixdevice.cpp <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/core/mixer.h <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/core/mixer.cpp <span style="color: \
grey">(1223790)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbuscontrolwrapper.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbuscontrolwrapper.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbusmixerwrapper.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbusmixerwrapper.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbusmixsetwrapper.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/dbusmixsetwrapper.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.control.xml <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.mixer.xml <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/dbus/org.kde.kmix.mixset.xml <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/CMakeLists.txt <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/CMakeLists.txt <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixer.operations <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerservice.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerservice.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/plasma/engine/plasma-engine-mixer.desktop <span \
style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/KDE/kdemultimedia/kmix/tests/CMakeLists.txt <span style="color: \
grey">(1223790)</span></li>

</ul>

<p><a href="http://svn.reviewboard.kde.org/r/6587/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic