SLMap(min, max, scale, name, init, res="float", ramp=0.03)
Base Map class used to manage control sliders.
Derived from Map class, a few parameters are added for sliders initialization.
Parent class : Map
Parameters:
min : int or float Smallest value of the range. max : int or float Highest value of the range. scale : string {'lin', 'log'} Method used to scale the input value on the specified range. name : string Name of the attributes the slider is affected to. init : int or float Initial value. Specified in the real range, not between 0 and 1. Use the `set` method to retreive the normalized corresponding value. res : string {'int', 'float'}, optional Sets the resolution of the slider. Defaults to 'float'. ramp : float, optional Ramp time, in seconds, used to smooth the signal sent from slider to object's attribute. Defaults to 0.025.
Methods:
get(x) : Returns the scaled value for `x` between 0 and 1. set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
Attributes:
min : Lowest value of the range. max : Highest value of the range. scale : Method used to scale the input value. name : Name of the parameter to control. init : Initial value of the slider. res : Slider resolution {int or float}. ramp : Ramp time in seconds.
Examples:
>>> s = Server().boot() >>> initvals = [350,360,375,388] >>> maps = [SLMap(20., 2000., 'log', 'freq', initvals), SLMapMul(.2)] >>> a = Sine(freq=initvals, mul=.2).out() >>> a.ctrl(maps) >>> s.gui(locals())
Methods details:
SLMap.get(x): Takes `x` between 0 and 1 and returns scaled value. SLMap.set(x): Takes `x` in the real range and returns value unscaled (between 0 and 1).