Step Button |
A step button lets you step through the values of a parameter by repeatedly clicking on the button.
This view works for any parameter (both Vst and Jmb) that is (or can be interpreted as) a discrete parameter.
In addition to the attributes exposed by CustomDiscreteControlView
, this class exposes the following attributes:
Attribute | Description |
---|---|
step-increment |
Value by which this button will increment (positive) or decrement (negative) the parameter. |
shift-step-increment |
Value by which this button will increment (positive) or decrement (negative) the parameter when the shift key modified is being held. This allows to have bigger steps (or smaller steps) when shift is used. |
wrap |
Defines what happens when the value reaches its end of range after being incremented (resp. decremented). When set to true it will wrap around, otherwise it will remain at its max (resp. min) |
held-color |
Color to use when the button is held and no image is provided. |
released-color |
Color to use when the button is not held and no image is provided. |
button-image |
The image for the button (2 frames). |
arrow-direction |
Used only when no bitmap provided in order to draw an arrow pointing in the direction defined by this attribute. A value of auto will trigger the rendering of an arrow up if step-increment is positive, and down if negative. |
The image above shows an example of a vst parameter representing the encoding for exporting a sound file. The vst parameter is backed by a discrete value (a VST parameter where step count > 0), in this case it is backed by an enum. The UI shows 2 step buttons to manipulate the parameter (one to go up and one to go down and it wraps around). The UI also shows a label tied to the same parameter for visual feedback.
The json defining the 2 step buttons (and label) (Source)
"jamba::StepButton": {
"attributes": {
"arrow-direction": "auto",
"back-color": "~ TransparentCColor",
"button-image": "arrow_up",
"class": "jamba::StepButton",
"control-tag": "Param_ExportSampleMajorFormat",
"editor-mode": "false",
"held-color": "~ RedCColor",
"mouse-enabled": "true",
"opacity": "1",
"origin": "490, 26",
"released-color": "Pad_On_Color",
"shift-step-increment": "1",
"size": "17, 15",
"step-count": "-1",
"step-increment": "1",
"transparent": "false",
"wants-focus": "true",
"wrap": "true"
}
},
"jamba::StepButton": {
"attributes": {
"arrow-direction": "auto",
"back-color": "~ TransparentCColor",
"button-image": "arrow_down",
"class": "jamba::StepButton",
"control-tag": "Param_ExportSampleMajorFormat",
"editor-mode": "false",
"held-color": "~ RedCColor",
"mouse-enabled": "true",
"opacity": "1",
"origin": "490, 41",
"released-color": "Pad_On_Color",
"shift-step-increment": "-1",
"size": "17, 15",
"step-count": "-1",
"step-increment": "-1",
"transparent": "false",
"wants-focus": "true",
"wrap": "true"
}
},
"CTextLabel": {
"attributes": {
"back-color": "~ TransparentCColor",
"background-offset": "0, 0",
"class": "CTextLabel",
"control-tag": "Param_ExportSampleMinorFormat",
"default-value": "0.5",
"font": "~ NormalFontSmaller",
"font-antialias": "true",
"font-color": "LCD Foreground",
"frame-color": "~ TransparentCColor",
"frame-width": "1",
"max-value": "1",
"min-value": "0",
"mouse-enabled": "true",
"opacity": "1",
"origin": "430, 69",
"round-rect-radius": "6",
"shadow-color": "~ RedCColor",
"size": "55, 15",
"style-3D-in": "false",
"style-3D-out": "false",
"style-no-draw": "false",
"style-no-frame": "false",
"style-no-text": "false",
"style-round-rect": "false",
"style-shadow-text": "false",
"text-alignment": "center",
"text-inset": "0, 0",
"text-rotation": "0",
"text-shadow-offset": "1, 1",
"title": "PCM 24",
"transparent": "false",
"value-precision": "2",
"wants-focus": "false",
"wheel-inc-value": "0.1"
}
},
The vst param is defined this way (discrete parameter => represented by an enum) (Source)
// enum ESampleMinorFormat { kSampleFormatPCM16, kSampleFormatPCM24, kSampleFormatPCM32 };
VstParam<SampleStorage::ESampleMinorFormat> fExportSampleMinorFormat;
The vst param is initialized this way (Source)
using MinorFormat = SampleStorage::ESampleMinorFormat;
fExportSampleMinorFormat =
vst<EnumParamConverter<MinorFormat, MinorFormat::kSampleFormatPCM32>>(ESampleSplitterParamID::kExportSampleMinorFormat,
STR16("Minor Format"),
{{STR16("PCM 16"), STR16("PCM 24"), STR16("PCM 32")}})
.defaultValue(MinorFormat::kSampleFormatPCM24)
.guiOwned()
.shortTitle(STR16("MinFormat"))
.add();