I’m not sure anymore how this thing is supposed to work. I was expecting use_sched_ahead_time to delay the run of the loop with given amount of time, but it seems to affect the next sleep value in a loop in curious ways. Examples from the help:
live_loop :foo do
use_sched_ahead_time 1
play 70
sleep 1 # Effectively 0.5 in first run, after that 1.0?
end
live_loop :foo do
use_sched_ahead_time 0.5
play 82
sleep 1 # Same for each run
end
When testing with multiple sleeps the effect is more obvious:
live_loop :foo do
use_sched_ahead_time 1.0
play 60
sleep 1.0 # 0.5 in first run?
play 60
play 65
play 69
sleep 1.0 # But no effect here whatsoever
end
Value 0.5 seems to work (as I would expect) but all other values seem mess with the first sleep in the loop. What is happening here? All I want to do is to delay the start of some loops.
Can you not put a sleep ahead of the sequence you want to delay? And if it breaks your other loops can you not do it just once in the to be delayed loop possibly with the delay: parameter of live_loops?
If you do value 0.4 for the sched ahead it effectively add 0.1 to the first sleep. Why is the 0.5 only value that doesnt mess up the timing? Just wondering why it does what it does
In brief, it affects the outgoing time stamps and also affects how much “breathing” room the internal timing system has. It essentially adds latency to the system.
It shouldn’t be used unless you’re experiencing load issues on your system (you can increase it in this case) or for threads you want to be as responsive as possible (in which case use use_real_time).
I’m not quite sure what you’re trying to achieve here, but I’m pretty sure use_sched_ahead_time is unlikely to be part of a solution.