mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 23:00:48 +00:00
pass convert as block to map
This commit is contained in:
parent
dced3bc183
commit
53f2c1847f
@ -93,12 +93,14 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def getter(mode)
|
def getter(mode)
|
||||||
|
convert = ->(x) { (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 }
|
||||||
|
|
||||||
vals = if @remote.running && @remote.event.ldirty
|
vals = if @remote.running && @remote.event.ldirty
|
||||||
@remote.cache[:bus_level][@init, @offset]
|
@remote.cache[:bus_level][@init, @offset]
|
||||||
else
|
else
|
||||||
(@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
|
(@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
|
||||||
end
|
end
|
||||||
vals.map { |x| (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 }
|
vals.map(&convert)
|
||||||
end
|
end
|
||||||
|
|
||||||
def all
|
def all
|
||||||
|
@ -212,13 +212,15 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_level(mode)
|
def get_level(mode)
|
||||||
|
convert = ->(x) { (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 }
|
||||||
|
|
||||||
@remote.cache[:strip_mode] = mode
|
@remote.cache[:strip_mode] = mode
|
||||||
vals = if @remote.running && @remote.event.ldirty
|
vals = if @remote.running && @remote.event.ldirty
|
||||||
@remote.cache[:strip_level][@init, @offset]
|
@remote.cache[:strip_level][@init, @offset]
|
||||||
else
|
else
|
||||||
(@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
|
(@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
|
||||||
end
|
end
|
||||||
vals.map { |x| (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 }
|
vals.map(&convert)
|
||||||
end
|
end
|
||||||
|
|
||||||
def prefader
|
def prefader
|
||||||
|
Loading…
Reference in New Issue
Block a user