![]() |
uvi-script
Musical event scripting with Lua
|
Common Elements base class. More...
Public Member Functions | |
| void | setParameter (string parameter, Value value) |
| Sets an Element parameter. | |
| Value | getParameter (string parameter) |
| Gets an Element parameter. | |
| bool | hasParameter (string parameter) |
| table | getParameterConnections (string parameter) |
| Get all SignalConnection for this parameter. | |
| AsyncTask | insertEffect (string type, int slot, function completion) |
| Insert a new effect in this element's insert chain. | |
| AsyncTask | removeEffect (int slot, function completion) |
Remove the effect at slot from this element's insert chain. | |
| AsyncTask | moveEffect (int from, int to, function completion) |
Move the effect at from so that it ends up at to in this element's insert chain. | |
Public Attributes | |
| string | name |
| internal element name | |
| string | displayName |
| name to display on the User Interface, name is used if displayName is not specified. | |
| string | type |
| internal element type | |
| string | path |
| full path of the element in the synthesis tree | |
| Element & | parent |
| element parent | |
| table | children |
| element children using the element name as key | |
| table | synthChildren |
| children of the element in the synthesis hierarchy, as a 1-indexed array. | |
| table | mods |
all ControlSignalSource for this node as a 1-indexed array (same content as modulations, keyed by index instead of name) | |
| int | output |
| output bus index for the element. Reading returns the index parsed from the current output bus name (1 when the element uses the default bus). Writing is asynchronous: the engine applies the new routing shortly after the assignment, so reading the property back immediately may still return the old value. Assigning on an element that cannot change its output raises an error. | |
| int | numParams |
| number of parameters | |
| table | parameterDefinitions |
| table of parameter definitions. | |
Common Elements base class.
| Value Element::getParameter | ( | string | parameter | ) |
Gets an Element parameter.
| parameter | parameterName or parameterId |
| table Element::getParameterConnections | ( | string | parameter | ) |
Get all SignalConnection for this parameter.
| parameter | parameterName or parameterId |
| bool Element::hasParameter | ( | string | parameter | ) |
| AsyncTask Element::insertEffect | ( | string | type, |
| int | slot, | ||
| function | completion ) |
Insert a new effect in this element's insert chain.
Available on every element that has an inserts chain: Synth, Part, Program, Layer, Keygroup and AuxEffect. Calling it on any other element raises an error.
The edit is asynchronous: the call returns at once and the chain changes a little later, so read inserts again in the completion callback, not right after the call. task.success is false when the edit could not be applied: unknown type, a type that is not an effect, an effect that cannot run per voice on a Keygroup, or a slot past the end of the chain at the time the edit runs.
The new effect starts with its default settings; configure it with setParameter once the task has completed.
| type | effect type, as listed in Elements & parameters (e.g. "Chorus", "SparkVerb") |
| slot | (optional) 1-based position of the new effect; nil or omitted appends it |
| completion | (optional) function called with the AsyncTask when the edit has been applied |
Example:
| AsyncTask Element::moveEffect | ( | int | from, |
| int | to, | ||
| function | completion ) |
Move the effect at from so that it ends up at to in this element's insert chain.
The effect is not recreated: it keeps its settings, its modulations and its audio state (a reverb or delay tail carries on), and references to it stay valid. Asynchronous, like insertEffect; task.success is false when either slot is out of range by the time the edit runs.
| from | 1-based position of the effect to move |
| to | 1-based position the effect should have once moved |
| completion | (optional) function called with the AsyncTask when the edit has been applied |
Example:
| AsyncTask Element::removeEffect | ( | int | slot, |
| function | completion ) |
Remove the effect at slot from this element's insert chain.
Asynchronous, like insertEffect. task.success is false when there is no effect at slot by the time the edit runs. A reference to the removed effect held by the script expires.
| slot | 1-based position of the effect to remove |
| completion | (optional) function called with the AsyncTask when the edit has been applied |
| void Element::setParameter | ( | string | parameter, |
| Value | value ) |
Sets an Element parameter.
| parameter | parameterName or parameterId |
| value | parameterValue (number|bool|string) according to definition |
| table Element::parameterDefinitions |
table of parameter definitions.
returns the following table:
| property | type | optional |
|---|---|---|
| name | string | no |
| id | number | no |
| type | "int","float","bool","string" | no |
| default | type | no |
| displayName | string | no |
| description | string | no |
| readOnly | boolean | no |
| serialize | boolean | no |
| min | type | yes |
| max | type | yes |
| table Element::synthChildren |
children of the element in the synthesis hierarchy, as a 1-indexed array.
Differs from children in both content and indexing: children is keyed by element name and lists every direct sub-element (insert and aux effects, event processors, modulation sources, sends, ...), while synthChildren is an ordered array restricted to the nested synthesis structure — the Parts of a Synth, the Program of a Part, the Layers of a Program, the Keygroups of a Layer. Use #element.synthChildren for the count or iterate with ipairs. Oscillators are not synthesis-tree nodes: a Keygroup exposes them through oscillators instead.
Only valid on synthesis-tree elements (Synth, Part, Program, Layer, Keygroup); reading it on any other element raises the error "this Element doesn't have sub elements".