LevelEnum added to Mixins

BusLevels, BusDevice classes added
This commit is contained in:
onyx-and-iris 2023-07-14 01:46:00 +01:00
parent 07e06bf103
commit d8baaf4758
3 changed files with 54 additions and 20 deletions

View File

@ -8,7 +8,7 @@ module Voicemeeter
include Mixins::Fades
include Mixins::Return
attr_reader :eq, :mode
attr_reader :eq, :mode, :levels
def self.make(remote, i)
"
@ -16,7 +16,7 @@ module Voicemeeter
Returns a PhysicalBus or VirtualBus class
"
p_out, v_out = remote.kind.outs
p_out = remote.kind.phys_out
i < p_out ? PhysicalBus.new(remote, i) : VirtualBus.new(remote, i)
end
@ -28,6 +28,7 @@ module Voicemeeter
@eq = BusEq.new(remote, i)
@mode = BusModes.new(remote, i)
@levels = BusLevels.new(remote, i)
end
def identifier
@ -74,4 +75,43 @@ module Voicemeeter
end
end
end
class BusLevels < IRemote
def initialize(remote, i)
super
@init = i * 8
@offset = 8
end
def identifier
"bus[#{@index}]"
end
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
def all
getter(Mixins::LevelEnum::BUS)
end
def isdirty? = @remote.cache[:bus_comp][@init, @offset].any?
end
class BusDevice < IRemote
def initialize(remote, i)
super
make_reader_only :name, :sr
make_writer_only :wdm, :ks, :mme, :asio
end
def identifier
"bus[#{@index}].device"
end
end
end

View File

@ -13,8 +13,6 @@ module Voicemeeter
end
module Return
include Meta_Functions
def initialize(remote, i)
super
make_accessor_float :returnreverb, :returndelay, :returnfx1, :returnfx2
@ -45,8 +43,6 @@ module Voicemeeter
end
module Xy
include Meta_Functions
module Pan
def initialize(remote, i)
super
@ -70,13 +66,18 @@ module Voicemeeter
end
module Fx
include Meta_Functions
def initialize(remote, i)
super
make_accessor_float :reverb, :delay, :fx1, :fx2
make_accessor_bool :postreverb, :postdelay, :postfx1, :postfx2
end
end
module LevelEnum
PREFADER = 0
POSTFADER = 1
POSTMUTE = 2
BUS = 3
end
end
end

View File

@ -198,13 +198,6 @@ module Voicemeeter
end
end
module StripLevelEnum
PREFADER = 0
POSTFADER = 1
POSTMUTE = 2
BUS = 3
end
class StripLevels < IRemote
attr_reader :prefader, :postfader, :postmute
@ -225,7 +218,7 @@ module Voicemeeter
end
def get_level(mode)
@remote.strip_mode = mode
@remote.cache[:strip_mode] = mode
if @remote.running && @remote.event.ldirty
vals = @remote.cache[:strip_level][@init, @offset]
else
@ -236,18 +229,18 @@ module Voicemeeter
end
def prefader
get_level(StripLevelEnum::PREFADER)
get_level(Mixins::LevelEnum::PREFADER)
end
def postfader
get_level(StripLevelEnum::POSTFADER)
get_level(Mixins::LevelEnum::POSTFADER)
end
def postmute
get_level(StripLevelEnum::POSTMUTE)
get_level(Mixins::LevelEnum::POSTMUTE)
end
def isdirty? = @remote._strip_comp[@init, @offset].any?
def isdirty? = @remote.cache[:strip_comp][@init, @offset].any?
end
end
end