Spec input datatype specification
This is an abstract class. Specs specify what kind of input is required or permissible, and what the range of those parameters are.
The most common subclass is:
which is used by GUI sliders and knobs to specify the range and curve of the controls.
The crucial library defines a number of additional subclasses. See the crucial/Instr/MoreSpecs.sc
Input datatypes are of interest to functions, to gui interface objects (sliders etc.) and can also be used for introspection.
The class Spec itself holds a master Dictionary of common specifications.
The name that the spec was stored as can then be used as a shorthand to refer to specs:
\freq.asSpec.dump
Some common mappings are initialized in ControlSpec.initClass.
You may add or overwrite mappings as you wish.
*add(name, item) add a spec to the global spec dictionary under the name
the item will be converted to a spec using .asSpec
// example:
Spec.add(\helpExp, ControlSpec( 0.01, 1.0, \exp) );
// the array will be converted to a control spec (see ControlSpec)
ControlSpec.add(\helpLin, [0, 1, \lin, 0.011, 0.01]);
// a symbol will be looked up converteuse the existing \freq spec for \helpLin2
Spec.add(\helpLin2, \freq);
// existing spec:
Spec.add(\helpLin, ControlSpec(0.ampdb, 1.ampdb, \db, units: " dB"));