mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
ensure we initialize comp arrays
use zip,map to calculate comps
This commit is contained in:
parent
07c1c20aec
commit
c0d2379b62
4
.gitignore
vendored
4
.gitignore
vendored
@ -57,4 +57,6 @@ Gemfile.lock
|
|||||||
# .rubocop-https?--*
|
# .rubocop-https?--*
|
||||||
|
|
||||||
# test
|
# test
|
||||||
quick.rb
|
quick.rb
|
||||||
|
|
||||||
|
.vscode/
|
@ -28,7 +28,7 @@ class Main
|
|||||||
|
|
||||||
def on_ldirty
|
def on_ldirty
|
||||||
@vm.bus.each do |bus|
|
@vm.bus.each do |bus|
|
||||||
puts "#{bus} #{bus.levels.all}" if bus.levels.isdirty?
|
puts "#{bus} #{bus.levels.all.join(" ")}" if bus.levels.isdirty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -64,7 +64,7 @@ module Voicemeeter
|
|||||||
cache[:strip_buf], cache[:bus_buf] = _get_levels
|
cache[:strip_buf], cache[:bus_buf] = _get_levels
|
||||||
!(
|
!(
|
||||||
cache[:strip_level] == cache[:strip_buf] &&
|
cache[:strip_level] == cache[:strip_buf] &&
|
||||||
@cache[:bus_level] == cache[:bus_buf]
|
cache[:bus_level] == cache[:bus_buf]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ module Voicemeeter
|
|||||||
@callbacks.each do |callback|
|
@callbacks.each do |callback|
|
||||||
if callback.respond_to? :on_update
|
if callback.respond_to? :on_update
|
||||||
callback.on_update { event.to_s[3..] }
|
callback.on_update { event.to_s[3..] }
|
||||||
else
|
elsif callback.name == event
|
||||||
callback.call # if callback == event
|
callback.call
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,6 +21,8 @@ module Voicemeeter
|
|||||||
def init_worker(que)
|
def init_worker(que)
|
||||||
logger.info "Listening for #{event.get.join(", ")} events"
|
logger.info "Listening for #{event.get.join(", ")} events"
|
||||||
@cache[:strip_level], @cache[:bus_level] = _get_levels
|
@cache[:strip_level], @cache[:bus_level] = _get_levels
|
||||||
|
@cache[:strip_comp] = Array.new(kind.num_strip_levels, false)
|
||||||
|
@cache[:bus_comp] = Array.new(kind.num_bus_levels, false)
|
||||||
@running = true
|
@running = true
|
||||||
Thread.new do
|
Thread.new do
|
||||||
loop do
|
loop do
|
||||||
@ -33,12 +35,8 @@ module Voicemeeter
|
|||||||
on_event :on_mdirty if e_from_que == :mdirty && mdirty?
|
on_event :on_mdirty if e_from_que == :mdirty && mdirty?
|
||||||
on_event :on_midi if e_from_que == :midi && get_midi_message
|
on_event :on_midi if e_from_que == :midi && get_midi_message
|
||||||
if e_from_que == :ldirty && ldirty?
|
if e_from_que == :ldirty && ldirty?
|
||||||
cache[:strip_comp] = cache[:strip_level].map.with_index do |x, i|
|
cache[:strip_comp] = cache[:strip_level].zip(cache[:strip_buf]).map { |a, b| a != b }
|
||||||
!(x == cache[:strip_buf][i])
|
cache[:bus_comp] = cache[:bus_level].zip(cache[:bus_buf]).map { |a, b| a != b }
|
||||||
end
|
|
||||||
cache[:bus_comp] = cache[:bus_level].map.with_index do |x, i|
|
|
||||||
!(x == cache[:bus_buf][i])
|
|
||||||
end
|
|
||||||
cache[:strip_level] = cache[:strip_buf]
|
cache[:strip_level] = cache[:strip_buf]
|
||||||
cache[:bus_level] = cache[:bus_buf]
|
cache[:bus_level] = cache[:bus_buf]
|
||||||
on_event :on_ldirty
|
on_event :on_ldirty
|
||||||
|
Loading…
Reference in New Issue
Block a user