Thanks Ledger!
I had a similar approach, but I did not get it to work properly. I returned errors. Then I deduced that it was necessary to add math.floor in the value of the mini-slip to always return whole numbers.
Also, the mess I was having is that I’m working with an updateable pattern buffer when necessary, and all the data I get out of there.One question I have is, is it better to use a table and avoid mathematical operations (basically add or subtract). I do not know if it is faster to consult a table of 129 values (whole numbers) than to add an addition or subtraction in an equality, thinking that it is inside a timer and that it affects many lines, at least 64, just like me I have it configured at most.
In the end, I chose to use a table like this:
PRE_VOL_PAN_VAL = {
255,0,1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,
51,52,53,54,55,56,57,58,59,60,
61,62,63,64,65,66,67,68,69,70,
71,72,73,74,75,76,77,78,79,80,
81,82,83,84,85,86,87,88,89,90,
91,92,93,94,95,96,97,98,99,100,
101,102,103,104,105,106,107,108,109,110,
111,112,113,114,115,116,117,118,119,120,
121,122,123,124,125,126,127
}
The timer executes this:
PRE_BYPASS_VOL = false
...
...
if ( vws.PRE_VOL.visible ) then
PRE_BYPASS_VOL = true
local slot_vol = vws[("PRE_SLOT_VOL_%s"):format( lns )]
local vfd_vol_val = vws[("PRE_VFD_VAL_VOL_%s"):format( lns )]
local vol_val = PRE_BUFFER_PTT_TRK[lns]["note_columns"][snci]["volume_value"] --line:note_column(snci).volume_value
if ( vol_val > 127 ) then
slot_vol.value = 1
vfd_vol_val.value = 1
else
slot_vol.value = vol_val +2
vfd_vol_val.value = vol_val +2
end
PRE_BYPASS_VOL = false
end
I use a "bypass"to avoid running the minislider’s notifier from the timer that reads the pattern (my pattern buffer).
And the minislider:
class "Pre_Show_PR_Vol"
function Pre_Show_PR_Vol:__init( lns )
M_ROW_VOL = vb:row { id = "M_ROW_VOL_"..lns, spacing = -3,
vb:space { height = 15 },
vb:row { spacing = -4,
id = ("PRE_SLD_VAL_VOL_%s"):format( lns ),
visible = false,
vb:row { spacing = -3,
vb:bitmap {
active = false,
height = 15,
mode = "body_color",
bitmap = "ico/v_ico.png"
},
vb:minislider {
id = ("PRE_SLOT_VOL_%s"):format( lns ),
height = 15,
width = 79,
min = 1,
max = 129,
value = 1,
notifier = function( value ) pre_sld_val_vol( math.floor(value), lns ) end
}
},
vb:valuefield {
id = ("PRE_VFD_VAL_VOL_%s"):format( lns ),
height = 15,
width = 21,
align = "center",
min = 1,
max = 129,
value = 1,
tostring = function( value ) if ( value ~= 1 ) then return ("%.2X"):format( tostring( PRE_VOL_PAN_VAL[value] ) ) else return "--" end end,
tonumber = function( value ) return tonumber( value +2, 16 ) end,
notifier = function( value ) if ( vws[("PRE_SLOT_VOL_%s"):format( lns )].value ~= value ) then vws[("PRE_SLOT_VOL_%s"):format( lns )].value = value end end
}
}
}
self.cnt = M_ROW_VOL
end
Although I use a table, it is also necessary to adjust the values by +2. I have tried it and the performance is optimal and the bypass works perfectly.I was afraid that this issue would worsen the timer’s performance.This table would also be worth panning. For delay it is not necessary.Another problem that I have found is that, if the track uses concrete effects in the effects columns linked with the effect chains, the value 0 of the volume_value is returned as a 4-digit number. Then the minislider will not return 0, because it depends on a condition <= 127.As long as the user does not use effects that affect the volume, the sliders will update correctly.I really do not know how to solve that, and I do not want to overload the functions either.
…
I understand that access to a type table of 129 values: PRE_VOL_PAN_VAL[2] it’s instantaneous.It is not like this? I mean, if the table has 10,000 values, will it take the same time to access the second position?