From 4ffab9bcdb9f2ddb1350355e127207c4dcb18871 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Sun, 15 Dec 2013 15:54:04 +0100 Subject: [PATCH] Do not start effect when is can be just updated --- ffbdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ffbdevice.cpp b/ffbdevice.cpp index 4116653..9f68337 100644 --- a/ffbdevice.cpp +++ b/ffbdevice.cpp @@ -223,6 +223,7 @@ bool FFBDevice::removeEffect(const int idx) bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr params) { + bool update = false; std::shared_ptr effect = FFBEffectFactory::createEffect(type); if (effect == nullptr) { qDebug() << "Unable to create effect"; @@ -247,6 +248,7 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< qDebug() << "Recreating effect" << idx; } else { effect->setInternalIdx(m_effects[idx]->internalIdx()); + update = true; qDebug() << "Updating effect" << idx; } } @@ -267,6 +269,8 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< delete kernelEff; return false; } + if (update) + return true; m_effects[idx]->setInternalIdx(kernelEff->id); m_effects[idx]->setStatus(FFBEffect::FFBEffectStatus::STOPPED); -- 2.43.5