SpeedLim:
Filter:
Classes (extension) | Scheduling

SpeedLim : Object
ExtensionExtension

Guarantees minimum time between updates
Source: SpeedLim.sc

Description

SpeedLim does the same thing as [speedlim] in Max: Given an incoming stream of data, it passes through updates only after a period of time. Use this for GUI, MIDI or OSC control streams where too many messages are being sent per second and you want to slow down SC's response.

More specifically:

Unlike SkipJack, there is no guarantee of exact periodicity. But, SpeedLim will react immediately if it's idle (where SkipJack simply quantizes time). Also, SkipJack will fire its action even if there is no update; SpeedLim avoids redundant actions.

Class Methods

SpeedLim.new(time: 0, action, clock)

Create a new instance.

Arguments:

time

Minimum number of seconds between firing the action.

action

A function that will be called with updates. It takes any number of arguments, corresponding to values passed from the upstream caller. See the "argument passing" example below.

clock

Optional. You may specify a clock for scheduling future updates. The default is SystemClock, although AppClock may be used if you expect to run GUI updates in response to incoming messages.

Returns:

The SpeedLim instance.

Inherited class methods

Instance Methods

.value( ... invals)

Update the SpeedLim value, and fire the action when needed. This is analogous to an incoming message in the Max [speedlim] object. If not enough time has passed, the action will be delayed.

Because this is value and not value_, a SpeedLim can be used in place of an action function in GUI objects, MIDIFuncs and OSCFuncs.

Arguments:

... invals

Any value(s) serving as the update. There is no restriction on datatype. They will be passed as-is to the action function, as multiple arguments if several values were passed in initially.

Returns:

Self.

.time

.time = value

Get or set the time period.

.action

.action = value

Get or set the action function.

.clock

.clock = value

Get or set the clock.

Inherited instance methods

Examples