I’d like to sync on cue events and store the values in a generated symbol that resembles the event. Here’s a trivial example:
cue "/hello/world/", 5
would cause the following:
set :hello_world, 5
In a live_loop, I’d like to get[:hello_world] in some type of control call – all this, of course, would be cue events from my MIDI/OSC controller in an effort to have a unified event listener pattern. Unfortunately, when I try this the cue monitor goes crazy with what looks like recursively generated event generation. Here’s my actual prototype:
event = "/**/"
live_loop :events, auto_cue: false do
use_real_time
x, fake = sync event
s = get_event(event).to_s.split("\"")[-2].gsub(/^\/|\/$/, '').gsub("/", "_")
s = s.to_sym # tried with and without this
puts "w00t:", s, x
set s, x
end
sleep 0.125
cue "/hello", 666
sleep 0.125
cue "/hello/world/and/then/some/", 42
sleep 0.125
cue "/hello/", 43
sleep 0.125
puts "get: ", get[:hello], get[:hello_world_and_then_some]
My goal is to have a small amount of SPi code to handle tens or hundreds of controller events. Sorta seems like symbols aren’t first class citizens.
TIA,
d00d