softPut:
Filter:
Reference | JITLib > GUI

softPut

set a (number) parameter in an environment conditionally

Description

softPut is an extension method to Dictionary that changes an existing numerical value for key in a dictionary only in two conditions:

Typical uses would be switching to a new preset, then using a faderbox, and avoiding sudden controller jumps that could occur (soft takeover).

softPut(param, val, within = 0.025, lastVal, mapped = true, spec)

Arguments:

param

the name of the parameter (key) to set

val

the value to set the param to (can be mapped or unmapped)

within

the normalized range within which the set is accepted - default is 0.025

mapped

a flag whether val is mapped (within the range of param.asSpec) or unmapped (0.0-1.0)

lastVal

the previous value that a control has set - see last examples.

spec

a ControlSpec can be passed in. if nil, param.asSpec is used.

NOTE: if no spec is given, or no value exists yet, softSet simply allows setting.

Examples