Class: Voicemeeter::StripLevels

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

Instance Method Summary collapse

Methods inherited from IRemote

#getter, #set_multi, #setter, #to_s

Methods included from Conversions

Boolean

Constructor Details

#initialize(remote, i) ⇒ StripLevels

Returns a new instance of StripLevels.



87
88
89
90
91
92
93
94
95
96
# File 'lib/voicemeeter/strip.rb', line 87

def initialize(remote, i)
  super
  if i < @remote.p_in
    @init = i * 2
    @offset = 2
  else
    @init = (@remote.p_in * 2) + ((i - @remote.p_in) * 8)
    @offset = 8
  end
end

Instance Method Details

#get_level(mode) ⇒ Object



102
103
104
105
106
107
108
109
# File 'lib/voicemeeter/strip.rb', line 102

def get_level(mode)
  if @remote.running && @remote.event.ldirty
    vals = @remote.cache["strip_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



98
99
100
# File 'lib/voicemeeter/strip.rb', line 98

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

#isdirty?Boolean

Returns:



126
# File 'lib/voicemeeter/strip.rb', line 126

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

#postfaderObject



116
117
118
119
# File 'lib/voicemeeter/strip.rb', line 116

def postfader
  @remote.strip_mode = 1
  get_level(1)
end

#postmuteObject



121
122
123
124
# File 'lib/voicemeeter/strip.rb', line 121

def postmute
  @remote.strip_mode = 2
  get_level(2)
end

#prefaderObject



111
112
113
114
# File 'lib/voicemeeter/strip.rb', line 111

def prefader
  @remote.strip_mode = 0
  get_level(0)
end