mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
fixes bug reading midi values
This commit is contained in:
parent
eaf92197dc
commit
e5be645818
@ -209,11 +209,11 @@ module Voicemeeter
|
||||
exp: ->(x) { x >= 0 }
|
||||
)
|
||||
if (got_midi = res > 0)
|
||||
vals = cmsg.read_string_bytes
|
||||
vals = cmsg.read_string.bytes
|
||||
vals.each_slice(3) do |ch, key, velocity|
|
||||
midi.channel = ch if midi.channel.nil? || midi.channel != ch
|
||||
midi.channel = ch.to_i
|
||||
midi.current = key.to_i
|
||||
midi.set(key.to_i, velocity.to_i)
|
||||
midi.cache[key.to_i] = velocity.to_i
|
||||
end
|
||||
end
|
||||
got_midi
|
||||
|
@ -18,7 +18,7 @@ module Voicemeeter
|
||||
def trigger(event)
|
||||
@callbacks.each do |callback|
|
||||
if callback.respond_to? :on_update
|
||||
callback.on_update { event.to_s[3..] }
|
||||
callback.on_update event.to_s[3..]
|
||||
elsif callback.name == event
|
||||
callback.call
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Voicemeeter
|
||||
class Midi
|
||||
attr_accessor :cache, :current, :channel
|
||||
attr_accessor :current, :channel
|
||||
attr_reader :cache
|
||||
|
||||
def initialize
|
||||
@cache = {}
|
||||
@ -9,9 +10,5 @@ module Voicemeeter
|
||||
def get(key)
|
||||
cache[key]
|
||||
end
|
||||
|
||||
def set(key, velocity)
|
||||
cache[key] = velocity
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user