From: Michal MalĂ˝ Date: Sun, 15 Dec 2013 23:53:38 +0000 (+0100) Subject: Restart effect on update if it was previously stopped X-Git-Tag: 0.4a~11 X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=67093eaa23112bf2cb3dee59797dbbefab8ca5aa;p=FFBChecker.git Restart effect on update if it was previously stopped --- 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);