diff --git a/libsrc/effectengine/Effect.cpp b/libsrc/effectengine/Effect.cpp index 7ea26567..54ffd739 100644 --- a/libsrc/effectengine/Effect.cpp +++ b/libsrc/effectengine/Effect.cpp @@ -80,6 +80,11 @@ int Effect::getPriority() const return _priority; } +bool Effect::isAbortRequested() const +{ + return _abortRequested; +} + void Effect::abort() { _abortRequested = true; diff --git a/libsrc/effectengine/Effect.h b/libsrc/effectengine/Effect.h index 8310076c..d464f70d 100644 --- a/libsrc/effectengine/Effect.h +++ b/libsrc/effectengine/Effect.h @@ -21,6 +21,8 @@ public: int getPriority() const; + bool isAbortRequested() const; + public slots: void abort(); diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index 2e1ada31..d28cdae5 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -80,7 +80,6 @@ int EffectEngine::runEffect(const std::string &effectName, int priority, int tim void EffectEngine::channelCleared(int priority) { - std::cout << "clear effect on channel " << priority << std::endl; for (Effect * effect : _activeEffects) { if (effect->getPriority() == priority) @@ -92,7 +91,6 @@ void EffectEngine::channelCleared(int priority) void EffectEngine::allChannelsCleared() { - std::cout << "clear effect on every channel" << std::endl; for (Effect * effect : _activeEffects) { effect->abort(); @@ -101,6 +99,12 @@ void EffectEngine::allChannelsCleared() void EffectEngine::effectFinished(Effect *effect) { + if (!effect->isAbortRequested()) + { + // effect stopped by itself. Clear the channel + _hyperion->clear(effect->getPriority()); + } + std::cout << "effect finished" << std::endl; for (auto effectIt = _activeEffects.begin(); effectIt != _activeEffects.end(); ++effectIt) {