R3.3.1 Win10 x64
I am experiencing precision issues with the timer to run a function repeatedly. When using:
renoise.tool():add_timer(func,time)
I can’t get the timer to run below 60-62 ms. This could be used to create a repeat button, for example to shift the position of the line up or down.
The problem is that the timer seems to run very slow with a value in milliseconds below 60-70 ms.
For example, if you put 1000ms (1s), the timer will work practically perfect:
renoise.tool():add_timer(func,1000)
Up to about 70-80 ms it seems to work fine:
renoise.tool():add_timer(func,70)
But if you use a value lower than 60 ms, the timer will keep running something above 60 ms always. I get the feeling that in previous versions of Renoise (v3.0 …), the timer could run at 10 and even 5 ms with a small margin of error.
Is it possible that add_timer now has a minimum limitation above 50 ms? We need a timer to work ultra-fast, which can reach up to 1ms speed. For example:
renoise.tool():add_timer(func,20)
renoise.tool():add_timer(func,15)
renoise.tool():add_timer(func,10)
renoise.tool():add_timer(func,5)
I have been experimenting with this code that I have purposely written to test it:
local C=0
local T=0
local function bang()
local NC=os.clock()
T=T+1
--print("T:",T,"clock:",("%d"):format((NC-C)*1000),"ms")
vws.TIME_TEXT.text=("T: %s | clock: %d ms"):format(T,(NC-C)*1000)
C=os.clock()
end
local function bang_timer()
if not renoise.tool():has_timer(bang) then
renoise.tool():add_timer(bang,vws.TIME_VALUEBOX.value)
else
renoise.tool():remove_timer(bang)
vws.TIME_TEXT.text=""
C=0
T=0
end
end
--viewbuilder
local function gwt_frame()
local FRAME=vb:row{
vb:valuebox{
id="TIME_VALUEBOX",
height=19,
width=79,
min=1,
max=5000,
value=1000,
tostring=function(value) return ("%d ms"):format(value) end,
tonumber=function(value) return tonumber(value) end,
},
vb:button{
height=19,
width=99,
text="Timer Test On/Off",
notifier=function() C=os.clock() bang_timer() end
},
vb:text{
id="TIME_TEXT",
width=140,
text=""
}
}
return FRAME
end
It is even possible to notice that something is wrong simply by simply printing on the terminal.
Can anyone try this? If we cannot comfortably set a value between 10 and 100 ms, the timer is useless in many cases.
@taktik, can you review this matter in depth? Personally I use various tools with add_timer () remove_timer () and i’m experimenting serious slowness problems below 100 ms.