String Array:
I made a parameter like this
defineParameter("beatDiv", nil, 1, {"1/1", "1/2", "1/4", "1/8", "1/16"}, function() beatDivChange() end)
My plan was to use string.sub() and tonumber() to retrieve the denominator for use in calculations. The manual doesn’t say parameter “array” values can be accessed, but I assumed this from reading about table parameters. In this case print(beatDiv[1]) returns an error. Print(beatDiv) does show the current index value though.
My question is, do I use the returned index values from the array parameter to access a second table with values for calculations when beatDivChange() is called.
It seemed clumsy at first, but it looks like the only way.
Table Parameter:
I made this as a test
defineParameter("tabParam", nil, {10, 20, 30}, function() tabParamChange() end)
I tied this to a knob thinking it would give me 10, 20, 30 stepped values, but it didn’t work. The knob is stuck either at min. or max position.
I then tied it to a menu, but this came out.
I added 40, 50, 60 , but still only 2 menu options.
The manual says table parameter values can be accessed via indices, which works, print(tabParam[2]) => 20.
But I don’t see how to do this on a variable basis if the parameter doesn’t return either the table or index value.
I haven’t been able to find an example of table parameter use, so if someone can point me in the right direction I would be extremely grateful.
I’m a cat’s whisker away from completing my first instrument, I just need to figure this out.