mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-22 01:40:49 +00:00
event type passed as symbol to on_update callback
This commit is contained in:
parent
33635e5f9b
commit
2dab83ec31
@ -14,7 +14,7 @@ class Main
|
||||
end
|
||||
|
||||
def on_update(event)
|
||||
if event == "midi"
|
||||
if event == :midi
|
||||
current = @vm.midi.current
|
||||
midi_handler(current, @vm.midi.get(current))
|
||||
end
|
||||
|
@ -18,9 +18,9 @@ module Voicemeeter
|
||||
private def trigger(event)
|
||||
callbacks.each do |callback|
|
||||
if callback.is_a? Method
|
||||
callback.call if callback.name == event
|
||||
callback.call if callback.name == "on_#{event}".to_sym
|
||||
elsif callback.respond_to? :on_update
|
||||
callback.on_update event.to_s[3..]
|
||||
callback.on_update event
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -35,15 +35,15 @@ module Voicemeeter
|
||||
logger.debug "closing #{Thread.current.name} thread"
|
||||
break
|
||||
end
|
||||
trigger :on_pdirty if e_from_que == :pdirty && pdirty?
|
||||
trigger :on_mdirty if e_from_que == :mdirty && mdirty?
|
||||
trigger :on_midi if e_from_que == :midi && get_midi_message
|
||||
trigger :pdirty if e_from_que == :pdirty && pdirty?
|
||||
trigger :mdirty if e_from_que == :mdirty && mdirty?
|
||||
trigger :midi if e_from_que == :midi && get_midi_message
|
||||
if e_from_que == :ldirty && ldirty?
|
||||
cache[:strip_comp] = cache[:strip_level].zip(cache[:strip_buf]).map { |a, b| a != b }
|
||||
cache[:bus_comp] = cache[:bus_level].zip(cache[:bus_buf]).map { |a, b| a != b }
|
||||
cache[:strip_level] = cache[:strip_buf]
|
||||
cache[:bus_level] = cache[:bus_buf]
|
||||
trigger :on_ldirty
|
||||
trigger :ldirty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user