mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Run condition check for paused macros
Otherwise conditions might behave in unexpected ways when resuming. For example, audio could immediately match after unpause, when it matched before it was paused due to timers not being updated.
This commit is contained in:
parent
961ea655fd
commit
5eb8378612
|
|
@ -20,10 +20,6 @@ Macro::~Macro() {}
|
|||
|
||||
bool Macro::CeckMatch()
|
||||
{
|
||||
if (_paused) {
|
||||
vblog(LOG_INFO, "Macro %s is paused", _name.c_str());
|
||||
return false;
|
||||
}
|
||||
_matched = false;
|
||||
for (auto &c : _conditions) {
|
||||
bool cond = c->CheckCondition();
|
||||
|
|
@ -64,6 +60,18 @@ bool Macro::CeckMatch()
|
|||
}
|
||||
|
||||
vblog(LOG_INFO, "Macro %s returned %d", _name.c_str(), _matched);
|
||||
|
||||
// Condition checks shall still be run even if macro is paused.
|
||||
// Otherwise conditions might behave in unexpected ways when resuming.
|
||||
//
|
||||
// For example, audio could immediately match after unpause, when it
|
||||
// matched before it was paused due to timers not being updated.
|
||||
if (_paused) {
|
||||
vblog(LOG_INFO, "Macro %s is paused", _name.c_str());
|
||||
_matched = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return _matched;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user