Well reading this Raul I’m like:
Also rprint? So:
rprint(vb.views["x"].color)
would probably be better than just standard ‘print’ to give the contents of a table? Each individual RGB component of the color table can probably be accessed with:
vb.views["x"].color[1] -- Red component
vb.views["x"].color[2] -- Green component
vb.views["x"].color[3] -- Blue component
Also:
local mycolor = vb.views["x"].color -- Store vb.views["x"].color table into 'mycolor' table
vb.views["x"].color = mycolor -- Put mycolor back into vb.views["x"].color
vb.views["x"].color = {0,0,0} -- 'Transparent' (themes) color
Just some random thoughts Raul
Thanks! Finally, I have solved this problem by creating a specific function (return_key_note_released() ). I wanted to make it simpler, because it affects 120 buttons. But it works:
function return_key_note_pressed( k )
k = vb.views['WMP_CTRL_NOT'].value
vb.views["WMP_KEY_"..k..""].color = { 0xFF,0x00,0x00 }
end
---
function return_key_note_released( k, tb_cl )
k = vb.views['WMP_CTRL_NOT'].value
tb_cl = {}
tb_cl.yl_1 = { 0,2,4,5,7,9,11, 12,14,16,17,19,21,23 }
tb_cl.yl_2 = { 1,3,6,8,10, 13,15,18,20,22 }
tb_cl.bl_1 = { 24,26,28,29,31,33,35, 36,38,40,41,43,45,47, 48,50,52,53,55,57,59 }
tb_cl.bl_2 = { 25,27,30,32,34, 37,39,42,44,46, 49,51,54,56,58 }
tb_cl.rd_1 = { 60,62,64,65,67,69,71, 72,74,76,77,79,81,83, 84,86,88,89,91,93,95 }
tb_cl.rd_2 = { 61,63,66,68,70, 73,75,78,80,82, 85,87,90,92,94 }
tb_cl.gy_1 = { 96,98,100,101,103,105,107, 108,110,112,113,115,117,119 }
tb_cl.gy_2 = { 97,99,102,104,106, 109,111,114,116,118 }
local function restore_color_piano()
for i = 0, 119 do
if tb_cl.yl_1[i] == k then return { 0xFF,0xFF,0xBF } end
if tb_cl.yl_2[i] == k then return { 0x60,0x60,0x15 } end
if tb_cl.bl_1[i] == k then return { 0xCF,0xCF,0xFF } end
if tb_cl.bl_2[i] == k then return { 0x26,0x26,0x76 } end
if tb_cl.rd_1[i] == k then return { 0xFF,0xCF,0xCF } end
if tb_cl.rd_2[i] == k then return { 0x56,0x26,0x26 } end
if tb_cl.gy_1[i] == k then return { 0xCF,0xFF,0xCF } end
if tb_cl.gy_2[i] == k then return { 0x26,0x46,0x26 } end
end
end
vb.views["WMP_KEY_"..k..""].color = restore_color_piano()
end
--- --- ---
WMP_KEY_NOTE = vb:button {
active = false,
id = 'WMP_KEY_NOTE',
width = 50,
height = 22,
--color = { 0x40, 0x00, 0x00 },
text = '---',
tooltip = "'Last Note Monitor': show last pressed key. Press to locate!\n[Range: C-0 to B-9 (120 notes)]\nINS = Number of Instrument\nEMP = Note Empty\nOFF = Note-Off",
pressed = function() return_key_note_pressed() repeat_key() wmp_fn_bt_pres() end,
released = function() return_key_note_released() repeat_key(true) wmp_fn_bt_rel() end,
}
WMP_KEY_NOTE is a button that can modify up to 120 buttons.
Sometimes a small problem affects much bigger things