From 3ad38ca68cd3f066d057519c3f134dccf7987590 Mon Sep 17 00:00:00 2001
From: Michael Pyne <mpyne@kde.org>
Date: Sun, 24 Apr 2016 19:15:54 -0400
Subject: [PATCH 2/7] Don't update volume from DBus if the change is
microscopic.
Floating point fun! Seems some DBus-based media player managers see a
volume change, sends the new volume to Juk, Juk updates and sends back
over DBus, repeat loop. Not very efficient for CPU...
---
playermanager.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/playermanager.cpp b/playermanager.cpp
index 33005d7..6ca08e0 100644
--- a/playermanager.cpp
+++ b/playermanager.cpp
@@ -570,8 +570,11 @@ void PlayerManager::slotMutedChanged(bool muted)
if(!output)
return;
- if(output != m_output[m_curOutputPath])
+ if(output != m_output[m_curOutputPath] ||
+ m_output[m_curOutputPath]->isMuted() == muted)
+ {
return;
+ }
emit mutedChanged(muted);
}
@@ -583,8 +586,11 @@ void PlayerManager::slotVolumeChanged(qreal volume)
if(!output)
return;
- if(output != m_output[m_curOutputPath])
+ if(output != m_output[m_curOutputPath] ||
+ qFuzzyCompare(m_output[m_curOutputPath]->volume(), volume))
+ {
return;
+ }
emit volumeChanged(volume);
}
--
2.7.4