3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/voicemeeter/worker.rb', line 3
def init_worker
LOGGER.info("Listening for #{@event.get.join(", ")} events")
@cache["strip_level"], @cache["bus_level"] = _get_levels
@running = true
Thread.new do
loop do
Thread.stop if !@running
if @event.pdirty && pdirty?
changed
notify_observers("pdirty")
end
if @event.mdirty && mdirty?
changed
notify_observers("mdirty")
end
if @event.midi && get_midi_message
changed
notify_observers("midi")
end
if @event.ldirty && ldirty?
changed
@_strip_comp =
@cache["strip_level"].map.with_index do |x, i|
!(x == @strip_buf[i])
end
@_bus_comp =
@cache["bus_level"].map.with_index { |x, i| !(x == @bus_buf[i]) }
@cache["strip_level"] = @strip_buf
@cache["bus_level"] = @bus_buf
notify_observers("ldirty")
end
sleep(@ratelimit)
end
end
end
|