fixes bug reading zero values.

(input with index 0, velocity 0 etc)
This commit is contained in:
onyx-and-iris 2023-07-29 18:11:52 +01:00
parent 73fc0dc243
commit 45370cb234

View File

@ -199,11 +199,11 @@ module Voicemeeter
exp: ->(x) { x >= 0 } exp: ->(x) { x >= 0 }
) )
if (got_midi = res > 0) if (got_midi = res > 0)
vals = cmsg.read_string.bytes data = cmsg.read_bytes(res).bytes
vals.each_slice(3) do |ch, key, velocity| data.each_slice(3) do |ch, key, velocity|
midi.channel = ch.to_i midi.channel = ch
midi.current = key.to_i midi.current = key
midi.cache[key.to_i] = velocity.to_i midi.cache[key] = velocity
end end
end end
got_midi got_midi