uvi-script
Musical event scripting with Lua

Knob widget. More...

Inheritance diagram for Knob:
ParamWidget Widget

Public Member Functions

 Knob (string name, number def, number min, number max, bool integer)
 creates a knob widget on the user interface.
 
void setValue (number value, bool callChangedCallback=true)
 
void setRange (number min, number max)
 
void setStripImage (string imagePath, int numImages)
 
void setLottieAnimation (string path)
 dress the widget with a Lottie animation, whose frame follows the value.
 

Public Attributes

number value
 the widget's value
 
number min
 the widget's minimum value (read-only, use setRange)
 
number max
 the widget's maximum value (read-only, use setRange)
 
number default
 the widget's default value
 
string stripImage
 path to knob strip image
 
bool showPopupDisplay
 show/hide the value popup display (if any)
 
bool showValue
 show/hide value display
 
string displayText
 custom text to display in place of the standard value display.
 
string fillColour
 fill colour.
 
string outlineColour
 outline colour.
 
string lottieAnimation
 path to a Lottie animation or package, see Lottie Animations
 
- Public Attributes inherited from ParamWidget
Mapper::Type mapper
 Mapper type, default is Mapper.Linear.
 
Unit::Type unit
 Unit type, default is Unit.Generic.
 
int paramId
 parameter id, assigned automatically (read-only)
 
bool exported
 default: false, set it to true to export this parameter as an automatable parameter
 
- Public Attributes inherited from Widget
string name
 widget name, given at construction (read-only)
 
string displayName
 widget display name
 
string displayText
 custom text to display in place of the standard value display, on widgets that show one.
 
string tooltip
 widget tooltip, default is name
 
int x
 x position in pixels
 
int y
 y position in pixels
 
int width
 widget width in pixels
 
int height
 widget height in pixels
 
int w
 alias of width
 
int h
 alias of height
 
table size
 widget size {width, height}
 
table position
 widget position {x,y}
 
table pos
 alias of position
 
table bounds
 widget bounding rect {x,y,width,height}
 
number alpha
 transparency value between 0.0 and 1.0
 
bool enabled
 boolean flag to enable / disable the widget
 
bool visible
 boolean flag to toggle widget visibility
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget.
 
bool showLabel
 show widgets label if any
 
bool persistent
 flag to tell if the widget values should be serialized when saving.
 
function changed
 callback function used by child widgets to be notified of changes.
 

Detailed Description

Knob widget.

creates a knob widget on the user interface.

k = Knob("knob", 0.5, 0.0, 1.0, false)
k.changed = function(self)
print("knob changed", self.value)
end
number value
the widget's value
Definition ui.cpp:1793
Knob(string name, number def, number min, number max, bool integer)
creates a knob widget on the user interface.
function changed
callback function used by child widgets to be notified of changes.
Definition ui.cpp:1001

Constructor & Destructor Documentation

◆ Knob()

Knob::Knob ( string name,
number def,
number min,
number max,
bool integer )

creates a knob widget on the user interface.

Parameters
namethe name to give to the widget
defdefault and initial value
minminimum value
maxmaximum value
integer(optional) default is false

Member Function Documentation

◆ setLottieAnimation()

void Knob::setLottieAnimation ( string path)

dress the widget with a Lottie animation, whose frame follows the value.

See Lottie Animations.

Parameters
pathpath to a .json animation or a .lottie package

◆ setRange()

void Knob::setRange ( number min,
number max )
Parameters
minminimum value
maxmaximum value

◆ setStripImage()

void Knob::setStripImage ( string imagePath,
int numImages )
Parameters
imagePathpath to knob strip image. Supports Retina @2x variants.
numImagesnumber of images in strip

◆ setValue()

void Knob::setValue ( number value,
bool callChangedCallback = true )
Parameters
valuethe new widget's value
callChangedCallbackcall the changed callback function if true

Member Data Documentation

◆ displayText

string Knob::displayText

custom text to display in place of the standard value display.

To revert to the standard behaviour, leave it empty.

◆ fillColour

string Knob::fillColour

fill colour.

It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format

◆ outlineColour

string Knob::outlineColour

outline colour.

It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format