Hey everyone! Wanted to share my workaround for dealing with FX defined outside live_loops. Let me know what you think of this approach, would love to hear feedback!
Tackled this situation to save resources (e.g. not calling FX within live_loop). What’s neat is that the loop will remain in time!
Ran into some issues with faster loops so made another modification.
def live_fx (name, *args, &block) params, opts = split_params_and_merge_opts_array(*args) reset = opts.fetch(:reset, false) if !truthy?(reset) live_loop name, opts do block.() end return end in_thread sync: name do dur = block_duration do block.() end # allow time for loop register stop and start while dur < 2 dur += block_duration do block.() end end live_loop name, opts do block.() end end live_loop name, opts do cue name stop end end ##| Try this example code out by changing the mix parameter ##| Will reflect change in live loop if reset is set to true (false by default) with_fx :distortion, distort: 0.9, mix: 0 do live_fx :foo, reset: true do sample :bd_haus, amp: 5 sleep 1 end end