Hi,
basically, there are two functions to get control messages from external midi hardware: sync and get. sync waits for an event, get will give the last message received.
Let’s say you’d like to get the current value of controller number one, the code could look like this:
live_loop :player do
controller, value = get "/midi/photon_25_midi_1/1/1/control_change"
puts value if controller == 1
sleep 1
end
This is not very elegant, is it?
I found another solution, which is a nice hack perhaps, but still awkward:
values = [0,0,0,0,0,0,0,0,0,0,0,0,0]
live_loop :updater do
controller, values[controller] = get "/midi/photon_25_midi_1/1/1/control_change"
puts values[1]
sleep 1
end
Any better idea? Something like
get "....", 1
would be awesome!