Base Src¶
Engine Box
Import¶
import "_IVLS/std-library/nodes/components/engine-box/base-src.ksp"Node: Stl.Data¶
Uses: Init
Overview¶
Engine Box
Parameter engine backend/frontend system for Kontakt instruments.
Core Capabilities:
- Parameter Binding - UI controls (knobs, sliders, menus, XY pads) bound to engine values with automatic range conversion
- Multi-Dimensional Storage - Parameters organized by arbitrary dimensions (layers, articulations, voices)
- Display Management - Per-parameter label updates with timeout-based reversion and dev-mode readout
- Preset Serialization - NKA save/load with version tracking and migration support
- Modulation Layer - Real-time mod offsets added to base values without affecting stored state
- Randomization - Per-parameter random ranges with undo memory
- Multiplexing - Multiple UI contexts routed through shared controls
- Widget Aliasing - Up to 8 alias controls per parameter
Module Variants:
- SingleDim (
Data.CreateSingleDim) - Single-dimension sets using_data[] - MultiDim (
Data.CreateMultiDim) - Multi-dimension sets usingdata[] - Tables (
Data.Tables.Create) - Array/table data, no modulation support
Required User Implementations:
#name#.par_cb.response()- React to parameter value changes#name#.par_disp.response()- Format display strings#name#.get_current_version()- Return version number for serialization#name#.check_version.response()- Handle version migration on load
API¶
Nodes¶
| Name | Description |
|---|---|
node Stl.Data |
Defines shared constants, metadata structures, and the engine ID registry for al... |
Defines¶
| Name | Description |
|---|---|
define Data.META_PARS |
Metadata field identifiers for parameter configuration. |
define MAX_ALIAS |
Maximum number of alias controls per parameter. |
Const Blocks¶
| Name | Description |
|---|---|
const #name#.#dim# |
Generated dimension member constants. |
const data.engine_id |
Product-specific engine identifiers used for serialization and UICBS routing. (23 entries) |
const data.param_meta |
Auto-enumerated indices for each metadata field. |
const dims |
Auto-enumerated dimension index constants for this engine. |
const ui |
Auto-enumerated UI element identifier constants for this engine. |
const xy |
XY coordinate constants for XY pad cursor addressing. (2 entries) |
Macros¶
| Name | Description |
|---|---|
Data.ACCB(#name#) |
Inject into async_complete callback for save/load completion handling. |
Data.Functions(#name#) |
Generates all runtime functions for the parameter engine. |
Data.InitializeCount(#name#, #dim#, #count#) |
Declares a dimension size constant. |
Data.InitializeDimension(#name#, #dim#) |
Creates an auto-enumerated const block from dimension member identifiers. |
Data.PCCB(#name#) |
Inject into persistence_changed callback for full state restoration. |
Data.Serialize.Functions(#name#, #sys#) |
Generates Stl.Serialize integration functions for an engine. |
Data.SnapLoaded(#name#) |
Restores engine data from the previously snapshotted buffer. |
Data.SnapLocked(#name#) |
Snapshots current engine data to buffer. |
Data.UICBS(#name#) |
Inject into ui_controls callback for UI event routing. |
Functions¶
| Name | Description |
|---|---|
#name#.apply_par_default(ui_id, #name#.DIMS) |
Applies parameter default to a specific control. |
#name#.ctrl_link_add(#name#.DIMS, ui_id) |
Adds an alias control to a parameter (max 8 aliases). |
#name#.get_par_disp(#name#.DIMS) -> return |
Gets display string for a parameter value. |
#name#.listen_par(par) |
Marks a parameter as multiplexed. |
#name#.listen_widget(ui_id) |
Marks a widget as multiplexed for this engine. |
#name#.load_defaults() |
Loads default values to all parameters with callbacks. |
#name#.load_defaults_raw() |
Loads default values directly without callbacks. |
#name#.load_from_data_dir(name) |
Loads preset from Data directory by name. |
#name#.load_from_path(path) |
Loads preset from explicit path. |
#name#.load_from_resource() |
Loads preset from library resources. |
#name#.load_via_dialog() |
Opens load dialog for NKA preset. |
#name#.par_cb(#name#.DIMS, src_id, val, from_ui, mutated) |
Main parameter callback. |
#name#.par_disp(#name#.DIMS, from_ui, force_widget) |
Updates parameter display on UI and automation labels. |
#name#.process_engine() |
Fires par_cb for all parameters without mutation flag. |
#name#.process_ui_routine(par) |
Triggers bound UI routine if configured for this parameter. |
#name#.push_data_id_to_ctrls() |
Assigns custom_id to all bound controls for UICBS routing. |
#name#.push_defaults_to_ctrls() |
Applies default values to UI control default property. |
#name#.randomize(#name#.DIMS) |
Randomizes a single parameter within its random range. |
#name#.randomize_all() |
Randomizes all parameters in the engine. |
#name#.randomize_group(#name#.MULTS) |
Randomizes all parameters in a dimension group. |
#name#.ranges.ctrl_to_engine(#name#.DIMS, ui_id) -> out |
Converts UI control value to engine value using parameter metadata. |
#name#.ranges.engine_to_ctrl(#name#.DIMS, ui_id, val) -> out |
Converts engine value to UI control value. |
#name#.read_from_ui(#name#.DIMS, ui_id) |
Reads value from UI control, converts it, and writes to engine. |
#name#.read_value(#name#.DIMS) -> out |
Reads base value from data storage. |
#name#.read_value.live(#name#.DIMS) -> out |
Reads value with modulation offset applied. |
#name#.receive_pad(pad_idx) |
Handles XY pad interaction by dispatching to receive_uicb for each parameter bou... |
#name#.receive_uicb(data_id) |
Handles UI callback for a specific data ID. |
#name#.reset_modulation() |
Clears all modulation offsets to zero. |
#name#.reset_randomize_memory() |
Clears all random memory flags. |
#name#.restore_randomize_memory() |
Restores all parameters from random memory. |
#name#.save_to_data_dir(name) |
Saves preset to Data directory with given name. |
#name#.save_to_path(path) |
Saves preset to explicit path. |
#name#.save_via_dialog() |
Opens save dialog for NKA preset. |
#name#.set_meta_par_all(specific_par, meta_par, value) |
Sets a specific metadata value for all dimension combinations of a parameter. |
#name#.set_random_range(par, rmi, rma) |
Sets random min/max range for all dimension combinations of a parameter. |
#name#.set_range(par, emi, ema) |
Sets engine min/max range for all dimension combinations of a parameter. |
#name#.submit_value(#name#.DIMS, value, disp) |
Submits a programmatic value change (not from UI interaction). |
#name#.update_ctrl_value(#name#.DIMS) |
Updates single control from engine data. |
#name#.update_ctrls() |
Updates all control values from engine data. |
#name#.update_multiplex() |
Updates all multiplexed controls. |
#name#.update_multiplex_ctrl(#name#.DIMS) |
Updates single multiplexed control. |
#name#.validate() |
Validates all parameter values against their engine_min/engine_max ranges. |
#name#.write_meta(par, Data.META_PARS) |
Writes all metadata values for a parameter at once. |
#name#.write_random_memory(#name#.DIMS) |
Manually stores current value in random memory for selective undo. |
#name#.write_to_ui(#name#.DIMS, ui_id) |
Writes engine value to UI control with conversion. |
#name#.write_value(#name#.DIMS, value) |
Writes value directly to data and buffer storage. |
serial.#sys#.check_version(version) |
Handles version migration and updates saved version. |
serial.#sys#.get_system_id() -> id |
Returns the engine ID for serialization identification. |
serial.#sys#.get_system_length() -> le |
Returns the total data size for serialization buffer allocation. |
serial.#sys#.get_system_version() -> ver |
Returns the current data version for migration support. |
serial.#sys#.process_data() |
Runs PCCB processing after data is loaded. |
serial.#sys#.read_from_memory() |
Copies serialization memory buffer to engine data. |
serial.#sys#.snapshot_load() |
Restores snapshot from buffer via SnapLoaded. |
serial.#sys#.snapshot_lock() |
Takes snapshot to buffer via SnapLocked. |
serial.#sys#.write_to_memory() |
Copies engine data to the serialization memory buffer. |
Task Functions¶
| Name | Description |
|---|---|
#name#.process_label_revert() |
Async task to revert label text after display timeout. |
Nodes¶
node Stl.Data¶
Callbacks: Init
Defines shared constants, metadata structures, and the engine ID registry for all engine variants.
Side effects:
| Name | Type | Purpose |
|---|---|---|
data.engine_ids[] |
int[] | Registry for engine ID collision detection |
@data.base_path |
string | Base path for preset files |
Defines¶
define Data.META_PARS¶
Metadata field identifiers for parameter configuration.
define MAX_ALIAS¶
Maximum number of alias controls per parameter.
Const Blocks¶
const #name#.#dim#¶
Generated dimension member constants.
const data.engine_id¶
Product-specific engine identifiers used for serialization and UICBS routing.
| Index | Name |
|---|---|
| 0 | base |
| 1 | console |
| 2 | tact |
| 3 | altera |
| 4 | shredder |
| 5 | ohshit.global |
| 6 | ohshit.layers |
| 7 | tokyo |
| 8 | tky.LegData |
| 9 | tky.LegUI |
| 10 | tss.LayerPurging |
| 11 | hegalong |
| 12 | plc.globals |
| 13 | plc.layers |
| 14 | steparp |
| 15 | steparp_t |
| 16 | phr.global |
| 17 | phr.keys |
| 18 | modrix |
| 19 | modrix.routings |
| 20 | modrix.controllers |
| 21 | handbells.data |
| 22 | peabody.sections |
const data.param_meta¶
Auto-enumerated indices for each metadata field.
const dims¶
Auto-enumerated dimension index constants for this engine.
const ui¶
Auto-enumerated UI element identifier constants for this engine.
const xy¶
XY coordinate constants for XY pad cursor addressing.
| Index | Name |
|---|---|
| 0 | X |
| 1 | Y |
Macros¶
Data.ACCB(#name#)¶
Inject into async_complete callback for save/load completion handling.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Resets
#name#.save_async_idor#name#.load_async_idto -1 on completion - Calls
#name#._pull_preset()on successful load
Data.Functions(#name#)¶
Generates all runtime functions for the parameter engine.
Preconditions:
- A Create macro (
Data.CreateSingleDim,Data.CreateMultiDim, etc.) must have been called first
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Generates dynabase functions via
dynabase.Functions() - Declares all engine functions (see module summary for full list)
Data.InitializeCount(#name#, #dim#, #count#)¶
Declares a dimension size constant.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
#dim# |
dimension identifier |
#count# |
number of elements in this dimension |
Side effects: | Name | Type | Purpose |
|------|------|---------|
| #name#.#dim#.SIZE | const | Dimension size constant |
Data.InitializeDimension(#name#, #dim#)¶
Creates an auto-enumerated const block from dimension member identifiers.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
#dim# |
dimension identifier (e.g., layer, par) |
Side effects: | Name | Type | Purpose |
|------|------|---------|
| #name#.#dim# | const block | Auto-enumerated dimension members |
Data.PCCB(#name#)¶
Inject into persistence_changed callback for full state restoration.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Resets randomize memory
- Calls
#name#.check_version.response()for version migration - Updates
#name#.saved_versionto current version - Resets modulation offsets to zero
- Validates all parameter values against ranges
- Fires
par_cbfor all parameters - Updates all UI controls from engine data
- Pushes default values to control default property
Data.Serialize.Functions(#name#, #sys#)¶
Generates Stl.Serialize integration functions for an engine.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
#sys# |
serialization system identifier |
Side effects:
| Name | Type | Purpose |
|---|---|---|
serial.#sys#.get_system_id() |
function | Returns engine ID |
serial.#sys#.get_system_version() |
function | Returns current version |
serial.#sys#.get_system_length() |
function | Returns data size |
serial.#sys#.write_to_memory() |
function | Copies data to serial memory |
serial.#sys#.read_from_memory() |
function | Copies serial memory to data |
serial.#sys#.check_version() |
function | Handles version migration |
serial.#sys#.process_data() |
function | Runs PCCB processing |
serial.#sys#.snapshot_load() |
function | Restores snapshot |
serial.#sys#.snapshot_lock() |
function | Takes snapshot |
Data.SnapLoaded(#name#)¶
Restores engine data from the previously snapshotted buffer.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Calls
#name#.check_version.response()for version handling - Updates
#name#.saved_versionto current version - Copies
#name#._data.bufferto#name#._data
Data.SnapLocked(#name#)¶
Snapshots current engine data to buffer.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Copies
#name#._datato#name#._data.buffer
Data.UICBS(#name#)¶
Inject into ui_controls callback for UI event routing.
| Parameter | Description |
|---|---|
#name# |
engine namespace |
Side effects:
- Dispatches XY pad events to
#name#.receive_pad() - Dispatches standard control events to
#name#.receive_uicb() - Dispatches multiplexed control events to
#name#._multiplex.to_engine()
Functions¶
#name#.apply_par_default(ui_id, #name#.DIMS)¶
Applies parameter default to a specific control.
| Parameter | Type | Description |
|---|---|---|
ui_id |
int | UI control ID |
#name#.DIMS |
— | dimension coordinates |
Side effects:
- Sets
ui_id->defaultto the converted default value
#name#.ctrl_link_add(#name#.DIMS, ui_id)¶
Adds an alias control to a parameter (max 8 aliases). Alias controls are kept in sync with the main control.
Preconditions:
- The parameter must have a main control bound via
par_ctrl
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
ui_id |
int | UI control ID to add as alias |
Side effects:
- Appends to
#name#.par_ctrl_links[] - Increments
#name#.par_ctrl_link_counts[]
#name#.get_par_disp(#name#.DIMS) -> return¶
Gets display string for a parameter value.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Returns: return — formatted display string
Side effects:
- Calls
#name#.par_disp.response()to populate display strings
#name#.listen_par(par)¶
Marks a parameter as multiplexed. Multiplexed parameters route through the multiplex functions for UI sync.
| Parameter | Type | Description |
|---|---|---|
par |
int | parameter index to mark as multiplexed |
Side effects:
- Sets
#name#.par_multiplex[par]to TRUE
#name#.listen_widget(ui_id)¶
Marks a widget as multiplexed for this engine.
The widget will route through multiplex.to_engine() in UICBS.
| Parameter | Type | Description |
|---|---|---|
ui_id |
int | UI control ID to mark as multiplexed |
Side effects:
- Sets
ui_id->custom_idtodata.engine_id.#name#
#name#.load_defaults()¶
Loads default values to all parameters with callbacks. Fires par_cb for each parameter to trigger responses.
Side effects:
- Calls
#name#.par_cb()for each parameter with default value - Calls
#name#.update_ctrl_value()for each parameter
#name#.load_defaults_raw()¶
Loads default values directly without callbacks. Writes default values to storage without triggering par_cb or responses.
Side effects:
- Calls
#name#.write_value()for each parameter with default value
#name#.load_from_data_dir(name)¶
Loads preset from Data directory by name.
| Parameter | Type | Description |
|---|---|---|
name |
string | preset name (without .nka extension) |
Side effects:
- Sets
#name#.load_async_idfromload_array_str()result
#name#.load_from_path(path)¶
Loads preset from explicit path.
| Parameter | Type | Description |
|---|---|---|
path |
string | full file path including .nka extension |
Side effects:
- Sets
#name#.load_async_idfromload_array_str()result
#name#.load_from_resource()¶
Loads preset from library resources. Uses load mode 2 for embedded resources.
Side effects:
- Sets
#name#.load_async_idfromload_array()result
#name#.load_via_dialog()¶
Opens load dialog for NKA preset. Starts async load operation.
Side effects:
- Sets
#name#.load_async_idfromload_array()result
#name#.par_cb(#name#.DIMS, src_id, val, from_ui, mutated)¶
Main parameter callback. Validates, writes value, syncs aliases, and runs response handlers.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
src_id |
int | source UI control ID (or -1 if programmatic) |
val |
int | engine value |
from_ui |
int | TRUE if triggered by UI interaction |
mutated |
int | TRUE if value should be written (FALSE for mod-only updates) |
Side effects:
- Writes value if parameter is enabled and mutated is TRUE
- Syncs linked/alias controls
- Calls
#name#.process_ui_routine() - Calls
#name#.par_action()if mutated - Calls
#name#.par_cb.response()if enabled - Calls
#name#.par_disp()if enabled
#name#.par_disp(#name#.DIMS, from_ui, force_widget)¶
Updates parameter display on UI and automation labels. Handles static labels, dynamic revert labels, and dev mode readout.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
from_ui |
int | TRUE if triggered by UI interaction |
force_widget |
int | specific widget to update (or UI.NULL) |
Side effects:
- Sets widget labels via
par_disp.response()output - Triggers display revert timer if not static
- Shows dev mode value readout if applicable
- Stores original label text for revert
#name#.process_engine()¶
Fires par_cb for all parameters without mutation flag. Used to refresh all parameter responses after state restoration.
Side effects:
- Calls
#name#.par_cb()for each parameter with mutated=FALSE
#name#.process_ui_routine(par)¶
Triggers bound UI routine if configured for this parameter.
| Parameter | Type | Description |
|---|---|---|
par |
int | parameter index |
Side effects:
- Calls
uir.update_by_id()ifpar_ui_routine[par]is set
#name#.push_data_id_to_ctrls()¶
Assigns custom_id to all bound controls for UICBS routing. Must be called after UI setup to enable automatic event routing. Handles XY pads specially by populating the pad registry.
Side effects:
- Sets
custom_idon all bound widgets with encoded data ID - Populates
#name#.pads[]with XY pad UI IDs - Populates
#name#.pad_data_idx[]for XY pad parameter mapping - Increments
#name#.pad_countand#name#.pad_par_count[] - Sets
custom_idon all alias controls
#name#.push_defaults_to_ctrls()¶
Applies default values to UI control default property. Sets the control's default property for reset functionality.
Side effects:
- Sets
->defaulton each bound control with converted default value
#name#.randomize(#name#.DIMS)¶
Randomizes a single parameter within its random range. Stores current value in random memory for undo.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Side effects:
- Stores current value in
#name#.par_random_memory[] - Sets
#name#.par_random_memory_flags[]to TRUE - Sets new random value via
#name#.par_cb() - Updates control via
#name#.update_ctrl_value()
Notes: Only randomizes if random_min differs from random_max.
#name#.randomize_all()¶
Randomizes all parameters in the engine.
Side effects:
- Stores current values in random memory
- Sets new random values for all parameters with valid random ranges
- Updates all controls
#name#.randomize_group(#name#.MULTS)¶
Randomizes all parameters in a dimension group. Iterates through all par indices for the given non-par dimensions.
| Parameter | Description |
|---|---|
#name#.MULTS |
non-parameter dimension coordinates |
Side effects:
- Calls
#name#.randomize()for each parameter index
#name#.ranges.ctrl_to_engine(#name#.DIMS, ui_id) -> out¶
Converts UI control value to engine value using parameter metadata. Handles XY pads, menus, and ranged widgets (knobs, sliders, value edits) with appropriate scaling.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
ui_id |
int | UI control ID |
Returns: out — converted engine value
Notes: For XY pads, requires pad_cursor to be set for this parameter.
For menus, returns the menu item value at the selected index.
For ranged widgets, scales from control range to engine range.
#name#.ranges.engine_to_ctrl(#name#.DIMS, ui_id, val) -> out¶
Converts engine value to UI control value. Handles XY pads, menus, and ranged widgets with appropriate scaling.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
ui_id |
int | UI control ID |
val |
int | engine value to convert |
Returns: out — converted control value
Notes: For XY pads, requires pad_cursor to be set for this parameter.
For menus, finds the menu index matching the engine value.
For ranged widgets, scales from engine range to control range.
#name#.read_from_ui(#name#.DIMS, ui_id)¶
Reads value from UI control, converts it, and writes to engine. Called by receive_uicb when a control interaction is detected.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
ui_id |
int | UI control ID |
Side effects:
- Calls
#name#.uicb_intercept()before processing - Calls
#name#.par_cb()with converted value - Calls
#name#.par_disp()to update display
#name#.read_value(#name#.DIMS) -> out¶
Reads base value from data storage.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Returns: out — current stored value
Side effects: None.
#name#.read_value.live(#name#.DIMS) -> out¶
Reads value with modulation offset applied.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Returns: out — base value plus modulation offset
Side effects: None.
#name#.receive_pad(pad_idx)¶
Handles XY pad interaction by dispatching to receive_uicb for each parameter bound to the pad.
| Parameter | Type | Description |
|---|---|---|
pad_idx |
int | index of the XY pad in the pads registry |
Side effects:
- Calls
#name#.receive_uicb()for each parameter bound to this pad
#name#.receive_uicb(data_id)¶
Handles UI callback for a specific data ID. Decodes dimension coordinates from the data ID and routes to read_from_ui.
| Parameter | Type | Description |
|---|---|---|
data_id |
int | encoded parameter data ID from custom_id |
Side effects:
- Decodes dimensions via
dynabase.get_place() - Calls
#name#.read_from_ui()with decoded dimensions
#name#.reset_modulation()¶
Clears all modulation offsets to zero.
Side effects:
- Fills
#name#._data.mod[]with 0
#name#.reset_randomize_memory()¶
Clears all random memory flags. Call before a new randomization session to reset undo state.
Side effects:
- Sets all
#name#.par_random_memory_flags[]to FALSE
#name#.restore_randomize_memory()¶
Restores all parameters from random memory. Undoes the last randomization for parameters with stored values.
Side effects:
- Restores values from
#name#.par_random_memory[]where flag is TRUE - Calls
#name#.par_cb()and#name#.update_ctrl_value()for restored parameters
#name#.save_to_data_dir(name)¶
Saves preset to Data directory with given name.
| Parameter | Type | Description |
|---|---|---|
name |
string | preset name (without .nka extension) |
Side effects:
- Calls
#name#._push_preset()to prepare data - Sets
#name#.save_async_idfromsave_array_str()result
#name#.save_to_path(path)¶
Saves preset to explicit path.
| Parameter | Type | Description |
|---|---|---|
path |
string | full file path including .nka extension |
Side effects:
- Calls
#name#._push_preset()to prepare data - Sets
#name#.save_async_idfromsave_array_str()result
#name#.save_via_dialog()¶
Opens save dialog for NKA preset. Starts async save operation.
Side effects:
- Calls
#name#._push_preset()to prepare data - Sets
#name#.save_async_idfromsave_array()result
#name#.set_meta_par_all(specific_par, meta_par, value)¶
Sets a specific metadata value for all dimension combinations of a parameter.
| Parameter | Type | Description |
|---|---|---|
specific_par |
int | parameter index |
meta_par |
int | metadata type (from data.param_meta) |
value |
int | metadata value to set |
Side effects:
- Sets
#name#.meta[..., meta_par]for all dimension combinations where par equals specific_par
#name#.set_random_range(par, rmi, rma)¶
Sets random min/max range for all dimension combinations of a parameter.
| Parameter | Type | Description |
|---|---|---|
par |
int | parameter index |
rmi |
int | random minimum value |
rma |
int | random maximum value |
Side effects:
- Sets
random_minandrandom_maxmetadata for all dimensions ofpar
#name#.set_range(par, emi, ema)¶
Sets engine min/max range for all dimension combinations of a parameter.
| Parameter | Type | Description |
|---|---|---|
par |
int | parameter index |
emi |
int | engine minimum value |
ema |
int | engine maximum value |
Side effects:
- Sets
engine_minandengine_maxmetadata for all dimensions ofpar
#name#.submit_value(#name#.DIMS, value, disp)¶
Submits a programmatic value change (not from UI interaction). Use this when setting parameter values from code rather than UI events.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
value |
int | engine value to set |
disp |
int | whether to trigger display update (TRUE/FALSE) |
Side effects:
- Calls
#name#.uicb_intercept()with -1 as ui_id - Calls
#name#.par_cb()with the value - Calls
#name#.update_ctrl_value()to sync UI
#name#.update_ctrl_value(#name#.DIMS)¶
Updates single control from engine data. Routes through multiplex if parameter is multiplexed, otherwise writes directly.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Side effects:
- Calls
#name#._multiplex.to_ui()if multiplexed - Calls
#name#.write_to_ui()for main and alias controls otherwise
#name#.update_ctrls()¶
Updates all control values from engine data. Call after bulk data changes to sync UI.
Side effects:
- Calls
#name#.update_ctrl_value()for each parameter
#name#.update_multiplex()¶
Updates all multiplexed controls. Call after context change (e.g., layer tab switch) to sync multiplexed UI.
Side effects:
- Calls
#name#.update_multiplex_ctrl()for each parameter
#name#.update_multiplex_ctrl(#name#.DIMS)¶
Updates single multiplexed control. Only acts if the parameter is marked as multiplexed.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Side effects:
- Calls
#name#._multiplex.to_ui()if parameter is multiplexed
#name#.validate()¶
Validates all parameter values against their engine_min/engine_max ranges. Resets out-of-range values to their defaults.
Side effects:
- Checks each parameter value against its configured range
- Writes default value for any parameter outside valid range
#name#.write_meta(par, Data.META_PARS)¶
Writes all metadata values for a parameter at once.
| Parameter | Type | Description |
|---|---|---|
par |
int | parameter index |
Data.META_PARS |
— | engine_min, engine_max, default, moddable, random_min, random_max |
Side effects:
- Sets all metadata fields in
#name#.meta[]for the given parameter
#name#.write_random_memory(#name#.DIMS)¶
Manually stores current value in random memory for selective undo. Use before making changes that should be undoable via restore_randomize_memory.
| Parameter | Description |
|---|---|
#name#.DIMS |
dimension coordinates |
Side effects:
- Stores current value in
#name#.par_random_memory[] - Sets
#name#.par_random_memory_flags[]to TRUE
#name#.write_to_ui(#name#.DIMS, ui_id)¶
Writes engine value to UI control with conversion. Used to sync control display with engine state.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
ui_id |
int | UI control ID |
Side effects:
- Sets control value (or XY pad cursor value)
- Calls
#name#.par_disp()to update display
#name#.write_value(#name#.DIMS, value)¶
Writes value directly to data and buffer storage.
| Parameter | Type | Description |
|---|---|---|
#name#.DIMS |
— | dimension coordinates |
value |
int | engine value to write |
Side effects:
- Writes to
#name#.data[]and#name#.data.buffer[] - Calls
#name#.write_value._post()hook
serial.#sys#.check_version(version)¶
Handles version migration and updates saved version.
| Parameter | Description |
|---|---|
version |
serial.#sys#.get_system_id() -> id¶
Returns the engine ID for serialization identification.
Returns: id
serial.#sys#.get_system_length() -> le¶
Returns the total data size for serialization buffer allocation.
Returns: le
serial.#sys#.get_system_version() -> ver¶
Returns the current data version for migration support.
Returns: ver
serial.#sys#.process_data()¶
Runs PCCB processing after data is loaded.
serial.#sys#.read_from_memory()¶
Copies serialization memory buffer to engine data.
serial.#sys#.snapshot_load()¶
Restores snapshot from buffer via SnapLoaded.
serial.#sys#.snapshot_lock()¶
Takes snapshot to buffer via SnapLocked.
serial.#sys#.write_to_memory()¶
Copies engine data to the serialization memory buffer.
Task Functions¶
#name#.process_label_revert()¶
Async task to revert label text after display timeout.
Waits for UI.PARAM_DISP_DELAY_MS then restores original label text.
Side effects:
- Sets
par_label_in_useto TRUE during wait - Waits for display delay timeout
- Restores
par_ctrl_labeltext frompar_label_original_text - Sets
par_label_in_useto FALSE when complete
Example¶
// TODO: Add usage example