SpeedLimit:
Filter:
adclib/Classes (extension) | Control

SpeedLimit
ExtensionExtension

limit speed of incomming control messages

Description

Some control sources run at very fast rates, which may cause too much CPU load by running triggered functions too often. SpeedLimit limits these by keeping a minimum time between updates, while making sure slower messages are executed immediately.

First code examples:

Class Methods

.new

make a new speedlimit

Arguments:

action

the action to run when triggered

dt

the minimum time to wait before re-triggering

Instance Methods

.action

the action to run when triggered

.dt

the minimum time to wait before re-triggering

.filterValue

Trigger speedLimit action, if limiting permits. this is used in place of triggeredFunction.value(*args);

Arguments:

... args

.now

last time a trigger, i.e. a call to filterValue came in a.now //

.lastTime

last time the action ran

.latestArgs

the list of latest arguments received

.scheduled

flag whether there is currently a scheduled next trigger

.delta

difference between lastTime and incoming now

Examples