chataigne
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| chataigne [2023/02/04 02:24] – [midi module script] ssm2017 | chataigne [2023/02/17 17:54] (current) – [Values in script] ssm2017 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Chataigne ====== | ====== Chataigne ====== | ||
| - | ===== GrandMa2 fader automation | + | ===== object |
| - | ==== module.json | + | |
| <sxh js> | <sxh js> | ||
| - | { | + | var myObject = { |
| - | "name":" | + | "myprop1":" |
| - | "type":" | + | "myprop2":" |
| - | "path":" | + | "myMethod": |
| - | + | this.myprop1 = params[0]; | |
| - | " | + | } |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | + | ||
| - | " | + | |
| - | " | + | |
| - | + | ||
| - | " | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | [ | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | ], | + | |
| - | " | + | |
| - | [ | + | |
| - | " | + | |
| - | ] | + | |
| } | } | ||
| + | var my_instance = new myObject(); | ||
| + | script.log(my_instance.myprop1); | ||
| + | my_instance.mymethod([" | ||
| + | script.log(my_instance.myprop1); | ||
| </ | </ | ||
| - | ==== sequence mapping filter | + | ===== Values in script ===== |
| - | Create | + | When adding |
| <sxh js> | <sxh js> | ||
| - | function fixedIt(precision, value, num) { | + | var mycontainer = local.values.addContainer(" |
| - | var num = "" | + | var myint1 |
| - | //return num.substring(0, num.length - precision) + "." + num.substring(num.length - precision, num.length); | + | myint1.setAttribute(" |
| - | | + | </sxh> |
| + | ===== Custom variables ===== | ||
| + | <sxh js> | ||
| + | function getCustomVariablesGroup(name, shortname) { | ||
| + | var my_group = root.customVariables.getItemWithName(shortname); | ||
| + | | ||
| + | // build a new group | ||
| + | my_group = root.customVariables.addItem(shortname); | ||
| + | my_group.setName(name); | ||
| + | } | ||
| + | return my_group; | ||
| } | } | ||
| - | function | + | /** |
| - | var temp_coarse | + | * Set or create then set the custom variable value |
| - | var coarse | + | * @param {int} page_id |
| - | var coarse_hex | + | * @param {int} exec_id |
| - | | + | * @param {int} value |
| + | * @param {string} type | ||
| + | * @param {string} item_nice_name | ||
| + | */ | ||
| + | function | ||
| + | // build names | ||
| + | var shortname | ||
| + | var name = "Exec "+ page_id+ " | ||
| + | // get the group | ||
| + | var my_group | ||
| + | | ||
| + | var item_name = type; | ||
| + | var item_type | ||
| + | var int_max = 100; | ||
| - | | + | |
| - | var coarse_decimals = parseFloat(fixedIt(2,temp_coarse %2)); | + | |
| - | var temp_fine = coarse_decimals * 128; | + | |
| - | var fine = parseInt(Math.floor(temp_fine)); | + | |
| - | var fine_hex = Integer.toHexString(fine); | + | |
| - | if (fine < 16) fine_hex | + | |
| - | + | ||
| - | return { | + | |
| - | ' | + | |
| - | ' | + | |
| } | } | ||
| - | } | + | // build some names |
| + | var my_value = {}; | ||
| + | var my_value_name = " | ||
| + | var my_value_nice_name = "Exec "+ page_id+ " | ||
| - | function filter(inputValue, min, max) { | + | var my_value_item = my_group.variables.getItemWithName(my_value_name); |
| - | | + | |
| + | // create if not exist | ||
| + | my_value_item = my_group.variables.addItem(item_type+ " Parameter" | ||
| + | my_value = my_value_item.getChild(my_value_item.name); | ||
| + | my_value.setName(my_value_nice_name); | ||
| - | var parameter_name = script.getParent().getParent().getParent().getParent().getParent().name; | + | if ([" |
| - | + | int_max = 999; | |
| - | // | + | } |
| - | | + | |
| - | var param = root.customVariables.execs.variables.getChild(parameter_name+ " | + | int_max = 60; |
| - | | + | } |
| - | + | if (