diff --git a/examples/midi/main.rb b/examples/midi/main.rb index c9d7aef..70fa4ac 100644 --- a/examples/midi/main.rb +++ b/examples/midi/main.rb @@ -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 diff --git a/lib/voicemeeter/event.rb b/lib/voicemeeter/event.rb index 9ff9091..2af4fc2 100644 --- a/lib/voicemeeter/event.rb +++ b/lib/voicemeeter/event.rb @@ -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 diff --git a/lib/voicemeeter/worker.rb b/lib/voicemeeter/worker.rb index 58d8b7b..d48d33d 100644 --- a/lib/voicemeeter/worker.rb +++ b/lib/voicemeeter/worker.rb @@ -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