Class: Voicemeeter::BusLevels

Inherits:
IRemote
  • Object
show all
Defined in:
lib/voicemeeter/bus.rb

Instance Method Summary collapse

Methods inherited from IRemote

#set_multi, #setter, #to_s

Methods included from Conversions

Boolean

Constructor Details

#initialize(remote, i) ⇒ BusLevels

Returns a new instance of BusLevels.



74
75
76
77
78
# File 'lib/voicemeeter/bus.rb', line 74

def initialize(remote, i)
  super
  @init = i * 8
  @offset = 8
end

Instance Method Details

#allObject



93
94
95
# File 'lib/voicemeeter/bus.rb', line 93

def all
  getter(3)
end

#getter(mode) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/voicemeeter/bus.rb', line 84

def getter(mode)
  if @remote.running && @remote.event.ldirty
    vals = @remote.cache["bus_level"][@init, @offset]
  else
    vals = (@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
  end
  vals.map { |x| x > 0 ? (20 * Math.log(x, 10)).round(1) : -200.0 }
end

#identifierObject



80
81
82
# File 'lib/voicemeeter/bus.rb', line 80

def identifier
  "bus[#{@index}]"
end

#isdirty?Boolean

Returns:



97
# File 'lib/voicemeeter/bus.rb', line 97

def isdirty? = @remote._bus_comp[@init, @offset].any?