Class: Voicemeeter::Strip::StripLevels
- Inherits:
-
Object
- Object
- Voicemeeter::Strip::StripLevels
- Includes:
- IRemote
- Defined in:
- lib/voicemeeter/strip.rb
Instance Method Summary collapse
- #get_level(mode) ⇒ Object
- #identifier ⇒ Object
-
#initialize(remote, i) ⇒ StripLevels
constructor
A new instance of StripLevels.
- #isdirty? ⇒ Boolean
- #postfader ⇒ Object
- #postmute ⇒ Object
- #prefader ⇒ Object
Methods included from IRemote
Methods included from Logging
Constructor Details
#initialize(remote, i) ⇒ StripLevels
Returns a new instance of StripLevels.
202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/voicemeeter/strip.rb', line 202 def initialize(remote, i) super p_in = remote.kind.phys_in if i < p_in @init = i * 2 @offset = 2 else @init = (p_in * 2) + ((i - p_in) * 8) @offset = 8 end end |
Instance Method Details
#get_level(mode) ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/voicemeeter/strip.rb', line 218 def get_level(mode) convert = ->(x) { (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 } @remote.cache[:strip_mode] = mode vals = if @remote.running? && @remote.event.ldirty @remote.cache[:strip_level][@init, @offset] else (@init...@init + @offset).map { |i| @remote.get_level(mode, i) } end vals.map(&convert) end |
#identifier ⇒ Object
214 215 216 |
# File 'lib/voicemeeter/strip.rb', line 214 def identifier "strip[#{@index}]" end |
#isdirty? ⇒ Boolean
242 |
# File 'lib/voicemeeter/strip.rb', line 242 def isdirty? = @remote.cache[:strip_comp][@init, @offset].any? |
#postfader ⇒ Object
234 235 236 |
# File 'lib/voicemeeter/strip.rb', line 234 def postfader get_level(Mixins::LevelEnum::POSTFADER) end |