Sync at start-up inconsistency


#1

… or lack of understanding on my part.

In the first example you will notice that the output that is produced as the second live loop starts at time 0.25 even though it is set to sync with the :kick thread, which begins at 0.0.

In the second example I tried to hack and see if I could get the “slave” thread to start at 0 and it was possible.

Is this expected behavior? If so then can someone clear my ignorance. CIA (cheers in advance)

Example 1 (the first “hats” output occurs at 0.25 seconds NOT 0.0 when kick starts:

live_loop :kick do
  on (spread 1,4).tick do
    puts "kick"
  end
  sleep 0.25
end

live_loop :hats, sync: :kick do
  puts "hats"
  sleep 0.25
end

Example 2 (In this example “hats” is outputted at time 0.0 as expected)

live_loop :kick do
  on (spread 1,4).tick do
    puts "kick"
    cue :on_the_floor
  end
  sleep 0.25
end

live_loop :hats, sync: :on_the_floor do
  puts "hats"
  sleep 0.25
end

#2

take a look at the reply to this post by @samaaron


#3

Thanks Robin! I read came across this post but somehow missed its application to my observation. Thanks for highlighting it for me!

And thanks for all of your great work, writing and coding for the community. It is very helpful an inspiring!!