<table><tr><td style="">Zren added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4140" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Is the <tt style="background: #ebebeb; font-size: 13px;">onVolumeChange</tt> call delayed? I'm not sure if it's fired when we set it, or PulseAudio gets back to us.</p>

<p>Does this fire <tt style="background: #ebebeb; font-size: 13px;">onVolumeChange</tt> immediately?</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">sinkModel.preferredSink.volume = volume;</pre></div>

<p>If so, you're currently calling</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">playFeedback(); // feedback.sinkIndex = sinkModel.preferredSink.index;</pre></div>

<p>after you change the volume. Which means <tt style="background: #ebebeb; font-size: 13px;">feedback.sinkIndex</tt> isn't set the first volume change, but it is still set until the next time you change the volume. Since it's not <tt style="background: #ebebeb; font-size: 13px;">-1</tt> after the first "volume change", it will play feedback, even if it's from something else.</p>

<p>If this is so, then we probably want to move the call before we assign the volume. Maybe even rename the function to <tt style="background: #ebebeb; font-size: 13px;">playFeedbackNextVolumeChange()</tt> as well.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml</span>
<span style="color: #000080">index 1c9b759..cf58149 100644</span>
<span style="color: #a00000">--- a/applet/contents/ui/main.qml</span>
<span style="color: #00a000">+++ b/applet/contents/ui/main.qml</span>
<span style="color: #800080">@@ -78,10 +78,10 @@ Item {</span>
         }
         var volume = boundVolume(sinkModel.preferredSink.volume + volumeStep);
         var percent = volumePercent(volume, maxVolumeValue);
<span style="color: #00a000">+        playFeedbackNextVolumeChange();</span>
         sinkModel.preferredSink.muted = percent == 0;
         sinkModel.preferredSink.volume = volume;
         osd.show(percent);
<span style="color: #a00000">-        playFeedback();</span>
     }
 
     function decreaseVolume() {</pre></div>

<p>Also, does <tt style="background: #ebebeb; font-size: 13px;">sinkModel.preferredSink.volume</tt> = <tt style="background: #ebebeb; font-size: 13px;">sinkModel.preferredSink.volume</tt> fire <tt style="background: #ebebeb; font-size: 13px;">onVolumeChange</tt> too?</p>

<p>Eg: <tt style="background: #ebebeb; font-size: 13px;">increaseVolume()</tt> setting it to 100% when it's already at 100%.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R115 Plasma Audio Volume Applet</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4140" rel="noreferrer">https://phabricator.kde.org/D4140</a></div></div><br /><div><strong>To: </strong>drosca, Plasma<br /><strong>Cc: </strong>Zren, broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>