Class: Voicemeeter::BusLevels
- Inherits:
-
Object
- Object
- Voicemeeter::BusLevels
- Includes:
- IRemote
- Defined in:
- lib/voicemeeter/bus.rb
Instance Method Summary collapse
- #all ⇒ Object
- #getter(mode) ⇒ Object
- #identifier ⇒ Object
-
#initialize(remote, i) ⇒ BusLevels
constructor
A new instance of BusLevels.
- #isdirty? ⇒ Boolean
Methods included from IRemote
Methods included from Logging
Constructor Details
#initialize(remote, i) ⇒ BusLevels
Returns a new instance of BusLevels.
85 86 87 88 89 |
# File 'lib/voicemeeter/bus.rb', line 85 def initialize(remote, i) super @init = i * 8 @offset = 8 end |
Instance Method Details
#all ⇒ Object
106 107 108 |
# File 'lib/voicemeeter/bus.rb', line 106 def all getter(Mixins::LevelEnum::BUS) end |
#getter(mode) ⇒ Object
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/voicemeeter/bus.rb', line 95 def getter(mode) convert = ->(x) { (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 } vals = if @remote.running? && @remote.event.ldirty @remote.cache[:bus_level][@init, @offset] else (@init...@init + @offset).map { |i| @remote.get_level(mode, i) } end vals.map(&convert) end |
#identifier ⇒ Object
91 92 93 |
# File 'lib/voicemeeter/bus.rb', line 91 def identifier "bus[#{@index}]" end |
#isdirty? ⇒ Boolean
110 |
# File 'lib/voicemeeter/bus.rb', line 110 def isdirty? = @remote.cache[:bus_comp][@init, @offset].any? |