RelSet:
Filter:
Modality-toolkit/Classes (extension) | Utilities

RelSet
ExtensionExtension

set an objects's param relatively

Description

RelSet is intended for encoder-style controllers, such as infinite MIDI knobs that only send relative values. RelSet can move a single param of an object by a normalized relative amount. One can choose to provide a spec for unmapping the object's current value, or one can let the object provide the spec. If spec is \none, or none can be found, RelSet will add the offset as is.

Technical Note: As this behavior is useful for many objects that have numerical parameters (such as Synth, Ndef, Tdef, Pdef), it is implemented as a class that can act like a method of such an object.

Class Methods

NOTE: SoftSet only has class methods, to be used as pseudo methods with multiple classes.

.new

Arguments:

obj

the object whose param to set

paramName

the name of the param to set

relVal

the relative value in unipolar [0, 1] range

spec

an optional spec by which to unmap the objects current value. if none provided, the object is asked for its value with getSpec(paramName)

Returns:

true if set succeeded, false if not

.getSpec

Arguments:

obj

the object to ask for the spec

paramName

the name of the param for wich to obtain a spec

Returns:

a spec