Implement update rate limit
Closes #117 Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
d9fc8dafde
commit
c06768f70f
7 changed files with 71 additions and 0 deletions
|
|
@ -233,6 +233,7 @@ class CardinalUI : public CardinalBaseUI,
|
|||
rack::math::Vec fLastMousePos;
|
||||
ResizeHandle fResizeHandle;
|
||||
WindowParameters fWindowParameters;
|
||||
int fRateLimitStep = 0;
|
||||
|
||||
struct ScopedContext {
|
||||
CardinalPluginContext* const context;
|
||||
|
|
@ -361,6 +362,10 @@ public:
|
|||
filebrowserhandle = nullptr;
|
||||
}
|
||||
|
||||
if (fWindowParameters.rateLimit != 0 && ++fRateLimitStep % (fWindowParameters.rateLimit * 2))
|
||||
return;
|
||||
|
||||
fRateLimitStep = 0;
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
@ -416,6 +421,10 @@ public:
|
|||
case kWindowParameterLockModulePositions:
|
||||
fWindowParameters.lockModules = value > 0.5f;
|
||||
break;
|
||||
case kWindowParameterUpdateRateLimit:
|
||||
fWindowParameters.rateLimit = static_cast<int>(value + 0.5f);
|
||||
fRateLimitStep = 0;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
@ -476,6 +485,10 @@ protected:
|
|||
case kWindowParameterLockModulePositions:
|
||||
fWindowParameters.lockModules = value > 0.5f;
|
||||
break;
|
||||
case kWindowParameterUpdateRateLimit:
|
||||
fWindowParameters.rateLimit = static_cast<int>(value + 0.5f);
|
||||
fRateLimitStep = 0;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue