Yeah, cheers, I knew that. What I meant was if your insrtuments[1][1] doesn’t point to an observable object, it will never bind.
The caveat is that “'observable and node names can not start with a number (like XML keys).”
Here’s a hack I tried, works.
my_array = renoise.Document.create("MyDoc") {
_1 = {
_1 = renoise.Document.ObservableNumber(1),
_2 = renoise.Document.ObservableNumber(2),
_3 = renoise.Document.ObservableNumber(3),
},
_2 = {
_1 = renoise.Document.ObservableNumber(1),
_2 = renoise.Document.ObservableNumber(2),
_3 = renoise.Document.ObservableNumber(3),
}
}
function get_observable(x, y)
local my_string = "my_array._" .. x .. "._" .. y
return assert(loadstring("local my_return_func = " .. my_string .. "; return my_return_func"))()
end
function set_observable_value(x, y, val)
local my_string = "my_array._" .. x .. "._" .. y .. ".value = " .. val
assert(loadstring(my_string))()
end
Then you could do something like this:
-- GUI
local vb = renoise.ViewBuilder()
local dialog_content = vb:column {
vb:chooser {
id = "chooser",
items = {"First", "Second", "Third"},
bind = get_observable(1,1) -- THIS IS THE IMPORTANT LINE!
}
}
renoise.app():show_custom_dialog("Test", dialog_content)
This assigns your [1][1] observable to the GUI object.
Later you do
set_observable_value(1,1,3)
And the GUI will change to: 3.
Good luck.