Clear channel after a effect stopped by itself

Former-commit-id: 98be2adfb9a6b2029fc2fe4dad4999b7c44a0aad
This commit is contained in:
johan 2013-11-30 15:54:47 +01:00
parent ae1bd7d254
commit 47eaf25904
3 changed files with 13 additions and 2 deletions

View File

@ -80,6 +80,11 @@ int Effect::getPriority() const
return _priority;
}
bool Effect::isAbortRequested() const
{
return _abortRequested;
}
void Effect::abort()
{
_abortRequested = true;

View File

@ -21,6 +21,8 @@ public:
int getPriority() const;
bool isAbortRequested() const;
public slots:
void abort();

View File

@ -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)
{