From 67093eaa23112bf2cb3dee59797dbbefab8ca5aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Mon, 16 Dec 2013 00:53:38 +0100 Subject: [PATCH] Restart effect on update if it was previously stopped --- ffbdevice.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ffbdevice.cpp b/ffbdevice.cpp index 9f68337..350dcb1 100644 --- a/ffbdevice.cpp +++ b/ffbdevice.cpp @@ -223,7 +223,7 @@ bool FFBDevice::removeEffect(const int idx) bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr params) { - bool update = false; + bool dontStart = false; std::shared_ptr effect = FFBEffectFactory::createEffect(type); if (effect == nullptr) { qDebug() << "Unable to create effect"; @@ -248,7 +248,8 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< qDebug() << "Recreating effect" << idx; } else { effect->setInternalIdx(m_effects[idx]->internalIdx()); - update = true; + if (m_effects[idx]->status() == FFBEffect::FFBEffectStatus::PLAYING) + dontStart = true; qDebug() << "Updating effect" << idx; } } @@ -269,7 +270,7 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< delete kernelEff; return false; } - if (update) + if (dontStart) return true; m_effects[idx]->setInternalIdx(kernelEff->id); -- 2.43.5