level array variables moved into cache

This commit is contained in:
onyx-and-iris 2023-07-14 01:46:25 +01:00
parent d8baaf4758
commit 520bab0fce

View File

@ -6,17 +6,14 @@ module Voicemeeter
def init_producer(que) def init_producer(que)
Thread.new do Thread.new do
loop do while @running
que << :pdirty if event.pdirty que << :pdirty if event.pdirty
que << :mdirty if event.mdirty que << :mdirty if event.mdirty
que << :midi if event.midi que << :midi if event.midi
que << :ldirty if event.ldirty que << :ldirty if event.ldirty
if !@running
que << :stop
break
end
sleep(@ratelimit) sleep(@ratelimit)
end end
que << :stop
end end
end end
@ -27,7 +24,7 @@ module Voicemeeter
Thread.new do Thread.new do
loop do loop do
e_from_que = @que.pop e_from_que = @que.pop
if event == :stop if e_from_que == :stop
break break
logger.debug("closing #{self} thread") logger.debug("closing #{self} thread")
end end
@ -35,14 +32,14 @@ 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?
@_strip_comp = cache[:strip_comp] = cache[:strip_level].map.with_index do |x, i|
cache[:strip_level].map.with_index do |x, i| !(x == cache[:strip_buf][i])
!(x == @strip_buf[i]) end
end cache[:bus_comp] = cache[:bus_level].map.with_index do |x, i|
@_bus_comp = !(x == cache[:bus_buf][i])
cache[:bus_level].map.with_index { |x, i| !(x == @bus_buf[i]) } end
cache[:strip_level] = @strip_buf cache[:strip_level] = cache[:strip_buf]
cache[:bus_level] = @bus_buf cache[:bus_level] = cache[:bus_buf]
on_event :on_ldirty on_event :on_ldirty
end end
end end