occasionally clock.sync will schedule resume events too far in the future. this is reproducible by the following example:
localfunctionformat_beats()
returnstring.format("%.3f", clock.get_beats())
endlocalfunctionsync_to_4()
print('at beat: '..format_beats()..' syncing to 4')
clock.sync(4)
print('at beat: '..format_beats())
endlocalfunctionlate_sync()
clock.sync(3.75)
clock.run(sync_to_4)
endfunctioninit()
clock.run(late_sync)
end
running the example results in the following output:
at beat: 3.744 syncing to 4
at beat: 8.000 <-- should be 4
the issue is caused by the absolute duration check for sync events which prevents unwanted repeats, when resume events happen slightly earlier than expected.
for example as seen above, clock.sync(3.75) can result in a resume event happening at beat 3.744, which would cause a subsequent call to clock.sync(3.75) schedule another wakeup in 0.005 beats.
The text was updated successfully, but these errors were encountered:
for reference, here's the result of measuring current beat after running clock.sync(4)[1] a hundred times on hardware with the system under load[2]. clock is set to internal / 120 bpm.
[1] the duration check mentioned above is disabled for the purpose of this measurement.
[2] matron object files are being constantly erased and rebuilt in the background.
occasionally
clock.syncwill schedule resume events too far in the future. this is reproducible by the following example:running the example results in the following output:
the issue is caused by the absolute duration check for sync events which prevents unwanted repeats, when resume events happen slightly earlier than expected.
for example as seen above,
clock.sync(3.75)can result in a resume event happening at beat 3.744, which would cause a subsequent call toclock.sync(3.75)schedule another wakeup in 0.005 beats.The text was updated successfully, but these errors were encountered: