File Duplex/ControlMap.lua
Functions
ControlMap:__init () | Initializate the ControlMap class |
ControlMap:_parse_xml (str) | Parse the control-map into a table (add meta-info - such as unique ids - while parsing) |
ControlMap:count_columns (group_name) | Count number of columns for the provided group |
ControlMap:count_rows (group_name) | Count number of rows for the provided group |
ControlMap:determine_type (str) | Determine the type of message (OSC/Note/CC) |
ControlMap:get_group_dimensions (group_name) | Get width/height of provided group |
ControlMap:get_group_size (group_name) | Count number of parameters in group |
ControlMap:get_indexed_element (index, group_name) | Retrieve by position within group |
ControlMap:get_osc_param (str) | Get OSC parameters: retrieve a parameter by matching it's "value" or "action" attribute, with pattern-matching for particular types of values: "/press 1 %i" matches "/press 1 1" but not "/press 1 A" "/pre** 1 %f" matches "/press 1 1" and "/preff 10 1.42" the method will match the action property if it's available, otherwise the "value" property (the action property is needed when a device transmit a different outgoing than incoming value) |
ControlMap:get_params_by_value (str, msg_context) | Get parameters by value: used by the MidiDevice to retrieves a parameter by it's note/cc-value-string. |
ControlMap:import_colorspace (str) | Parse a string into a colorspace table |
ControlMap:is_button (group_name, index) | Test if the parameter describes a button |
ControlMap:is_grid_group (group_name) | Test if the group describe a grid group (meaning: it contains columns, and each member is a button) |
ControlMap:load_definition (file_path) | Load_definition: load and parse xml |
ControlMap:parse_definition (control_map_name, xml_string) | Parse the supplied xml string (reset the counter first) |
Functions
- ControlMap:__init ()
- Initializate the ControlMap class
- ControlMap:_parse_xml (str)
-
Parse the control-map into a table (add meta-info - such as unique ids - while parsing)
Parameters:
-
str
: (String) the xml string
Return value:
- Table
-
- ControlMap:count_columns (group_name)
-
Count number of columns for the provided group
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders"
Return value:
- Number
-
- ControlMap:count_rows (group_name)
-
Count number of rows for the provided group
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders"
Return value:
- Number
-
- ControlMap:determine_type (str)
-
Determine the type of message (OSC/Note/CC)
Parameters:
-
str
: (String), supply a control-map value such as "C#4"
Return value:
- integer (e.g. MIDI_NOTE_MESSAGE)
-
- ControlMap:get_group_dimensions (group_name)
-
Get width/height of provided group
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders"
Return values:
- width (or nil if not matched)
- height (or nil if not matched)
-
- ControlMap:get_group_size (group_name)
-
Count number of parameters in group
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders"
Return value:
- Number
-
- ControlMap:get_indexed_element (index, group_name)
-
Retrieve by position within group
Parameters:
-
index
: (Number) the index/position -
group_name
: (String) the control-map group name, e.g. "Encoders"
Return value:
- the attributes array
-
- ControlMap:get_osc_param (str)
-
Get OSC parameters: retrieve a parameter by matching it's "value" or "action" attribute, with pattern-matching for particular types of values: "/press 1 %i" matches "/press 1 1" but not "/press 1 A" "/pre** 1 %f" matches "/press 1 1" and "/preff 10 1.42" the method will match the action property if it's available, otherwise the "value" property (the action property is needed when a device transmit a different outgoing than incoming value)
Parameters:
-
str
: (string, control-map value/action attribute)
Return value:
- Table ( node), values (table), if matched against a wildcard, wildcard_idx (integer), the matched index replace_char (string), the characters to insert
-
- ControlMap:get_params_by_value (str, msg_context)
-
Get parameters by value: used by the MidiDevice to retrieves a parameter by it's note/cc-value-string. The function will match values on the default channel, if not defined: "CC#105|Ch1" will match both "CC#105|Ch1" and "CC#105". Also, we have wildcard support: "C#*|Ch1" will match both "C#1|Ch1" and "C#5"
Parameters:
-
str
: (string, control-map value attribute) -
msg_context
: (String/Enum) the message context, e.g. MIDI_NOTE_MESSAGE
Return value:
- Table containing matched parameters
-
- ControlMap:import_colorspace (str)
-
Parse a string into a colorspace table
Parameters:
-
str
: (String) a comma-separated string of RGB values, e.g. "4,4,0"
Return value:
- Table
-
- ControlMap:is_button (group_name, index)
-
Test if the parameter describes a button
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders" -
index
: (Number/Int) index within group
Return value:
- (Boolean) true if matched, false if not
-
- ControlMap:is_grid_group (group_name)
-
Test if the group describe a grid group (meaning: it contains columns, and each member is a button)
Parameters:
-
group_name
: (String) the control-map group name, e.g. "Encoders"
Return value:
- boolean
-
- ControlMap:load_definition (file_path)
-
Load_definition: load and parse xml
Parameters:
-
file_path
: (String) the name of the file, e.g. "my_map.xml"
-
- ControlMap:parse_definition (control_map_name, xml_string)
-
Parse the supplied xml string (reset the counter first)
Parameters:
-
control_map_name
: (String) path to XML file -
xml_string
: (String) the XML string
-