I’m experiencing an issue when communicating values from one live_loop to another:
set :cnt,0
live_loop :loop1, sync: :loop2 do
use_real_time
use_bpm 60
sleep 0.1
print "loop1", get[:cnt]
end
live_loop :loop2 do
use_real_time
use_bpm 60
note, velocity = sync "/midi:midiin2_(lpminimk3_midi)_1:10/note_on"
set :cnt, get[:cnt]+1
print "loop2", get[:cnt]
end
I see the following log when I press a key and trigger a 2nd MIDI in event.
....
{run: 85, time: 3.248, thread: :live_loop_loop2}
└─ "loop2" 2
{run: 85, time: 3.323, thread: :live_loop_loop1}
└─ "loop1" 1
{run: 85, time: 3.423, thread: :live_loop_loop1}
└─ "loop1" 1
{run: 85, time: 3.523, thread: :live_loop_loop1}
└─ "loop1" 1
{run: 85, time: 3.623, thread: :live_loop_loop1}
└─ "loop1" 2
How is it possible that loop1 needs 3 iterations before it sees the update of cnt?