Skip to content

Commit c000206

Browse files
committed
Lang - keep old fx open after live loop has moved by waiting on synth tracker
1 parent 4839a25 commit c000206

File tree

1 file changed

+6
-5
lines changed
  • app/server/ruby/lib/sonicpi/lang

1 file changed

+6
-5
lines changed

app/server/ruby/lib/sonicpi/lang/core.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,15 +2325,14 @@ def live_loop(name=nil, *args, &block)
23252325

23262326
# immediately reset for the next move
23272327
__system_thread_locals.set_local :sonic_pi_local_live_loop_move_to_bus_and_parent_t, nil
2328-
end
2328+
23292329
if new_bus
23302330
moved_prom = __system_thread_locals.get :sonic_pi_local_spider_thread_moved
23312331
ack_prom = __system_thread_locals.get :sonic_pi_local_spider_thread_moved_ack
23322332
# update the context
23332333
# reset tracker and send old tracker with ack
23342334
tracker = __current_tracker
23352335
__system_thread_locals.set_local(:sonic_pi_local_tracker, nil)
2336-
old_bus = __system_thread_locals.get :sonic_pi_mod_sound_synth_out_bus
23372336
__system_thread_locals.set(:sonic_pi_mod_sound_synth_out_bus, new_bus)
23382337
__system_thread_locals.set(:sonic_pi_mod_sound_job_group, new_group)
23392338
moved_prom.deliver! tracker
@@ -2350,6 +2349,7 @@ def live_loop(name=nil, *args, &block)
23502349
__live_loop_cue name if __system_thread_locals.get :sonic_pi_local_live_loop_auto_cue
23512350
res = send(ll_name, res)
23522351
end
2352+
end
23532353
end
23542354
end
23552355

@@ -2379,7 +2379,7 @@ def live_loop(name=nil, *args, &block)
23792379
_b, _g, t, p = __system_thread_locals(st).get(:sonic_pi_local_live_loop_move_to_bus_and_parent_t)
23802380
if p
23812381
## another live loop already registered a move, but didn't manage to swap in time - so we're going to clobber it
2382-
p.deliver! :clobbered
2382+
p.deliver! :clobbered, false
23832383
end
23842384
__system_thread_locals(st).set_local :sonic_pi_local_live_loop_auto_cue, auto_cue if st
23852385
## register our move
@@ -2391,7 +2391,7 @@ def live_loop(name=nil, *args, &block)
23912391
ct2 = Thread.new do
23922392
__system_thread_locals.set_local :sonic_pi_local_thread_group, "ll ct2 join waiter for #{name} #{st.object_id} #{__system_thread_locals(st).get(:sonic_pi_local_thread_group)}"
23932393
st.join
2394-
completed_prom.deliver! :joined
2394+
completed_prom.deliver! :joined, false
23952395
end
23962396

23972397
moved_or_clobbered = completed_prom.get
@@ -2419,7 +2419,8 @@ def live_loop(name=nil, *args, &block)
24192419
end
24202420
move_holding_thread_prom.deliver! true
24212421
end
2422-
2422+
tracker = new_thread_moved_prom.get
2423+
tracker.get
24232424
move_holding_thread_prom.get
24242425
end
24252426
end

0 commit comments

Comments
 (0)