2023-07-07 02:33:49 +01:00
|
|
|
module Voicemeeter
|
|
|
|
module Strip
|
2023-08-29 14:07:52 +01:00
|
|
|
# Base class for Strip
|
2023-07-27 10:58:26 +01:00
|
|
|
class Base
|
|
|
|
include IRemote
|
2023-07-09 19:31:27 +01:00
|
|
|
include Mixins::Outputs
|
|
|
|
include Mixins::Fades
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-07 02:33:49 +01:00
|
|
|
|
2023-07-13 21:57:18 +01:00
|
|
|
attr_reader :gainlayer, :levels
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_bool :solo, :mute, :mono
|
|
|
|
attr_accessor_float :gain
|
|
|
|
attr_accessor_int :limit
|
|
|
|
attr_accessor_string :label
|
2023-07-13 21:57:18 +01:00
|
|
|
|
2023-07-07 02:33:49 +01:00
|
|
|
def self.make(remote, i)
|
2023-07-29 18:06:34 +01:00
|
|
|
(i < remote.kind.phys_in) ? PhysicalStrip.new(remote, i) : VirtualStrip.new(remote, i)
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(remote, i)
|
|
|
|
super
|
2023-08-30 12:27:50 +01:00
|
|
|
make_attr_outputs(*remote.kind.outs)
|
2023-07-22 13:05:38 +01:00
|
|
|
@gainlayer = (0...8).map { GainLayer.new(remote, i, _1) }
|
2023-07-13 21:57:18 +01:00
|
|
|
@levels = StripLevels.new(remote, i)
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}]"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-08-29 11:21:05 +01:00
|
|
|
# Represents a Physical Strip
|
2023-07-27 10:58:26 +01:00
|
|
|
class PhysicalStrip < Base
|
2023-07-09 19:31:27 +01:00
|
|
|
include Mixins::Xy::Pan
|
|
|
|
include Mixins::Xy::Color
|
|
|
|
include Mixins::Xy::Fx
|
|
|
|
include Mixins::Fx
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-07 02:33:49 +01:00
|
|
|
|
2023-07-09 05:50:06 +01:00
|
|
|
attr_reader :comp, :gate, :denoiser, :eq, :device
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_float :audibility
|
2023-07-09 05:50:06 +01:00
|
|
|
|
2023-07-07 02:33:49 +01:00
|
|
|
def initialize(remote, i)
|
|
|
|
super
|
|
|
|
@comp = StripComp.new(remote, i)
|
|
|
|
@gate = StripGate.new(remote, i)
|
|
|
|
@denoiser = StripDenoiser.new(remote, i)
|
|
|
|
@eq = StripEq.new(remote, i)
|
|
|
|
@device = StripDevice.new(remote, i)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripComp
|
|
|
|
include IRemote
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-27 10:58:26 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_float :gainin,
|
|
|
|
:ratio,
|
|
|
|
:threshold,
|
|
|
|
:attack,
|
|
|
|
:release,
|
|
|
|
:knee,
|
|
|
|
:gainout
|
|
|
|
attr_accessor_bool :makeup
|
2023-07-07 02:33:49 +01:00
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}].comp"
|
|
|
|
end
|
|
|
|
|
|
|
|
def knob
|
2023-07-09 05:50:06 +01:00
|
|
|
getter("")
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def knob=(val)
|
2023-07-09 05:50:06 +01:00
|
|
|
setter("", val)
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripGate
|
|
|
|
include IRemote
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-27 10:58:26 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_float :threshold, :damping, :attack, :hold, :release
|
|
|
|
attr_accessor_int :bpsidechain
|
2023-07-07 02:33:49 +01:00
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}].gate"
|
|
|
|
end
|
|
|
|
|
|
|
|
def knob
|
2023-07-09 05:50:06 +01:00
|
|
|
getter("")
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def knob=(val)
|
2023-07-09 05:50:06 +01:00
|
|
|
setter("", val)
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripDenoiser
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-07 02:33:49 +01:00
|
|
|
def identifier
|
|
|
|
"strip[#{@index}].denoiser"
|
|
|
|
end
|
|
|
|
|
|
|
|
def knob
|
2023-07-09 05:50:06 +01:00
|
|
|
getter("")
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def knob=(val)
|
2023-07-09 05:50:06 +01:00
|
|
|
setter("", val)
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripEq
|
|
|
|
include IRemote
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-27 10:58:26 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_bool :on, :ab
|
2023-07-07 02:33:49 +01:00
|
|
|
|
|
|
|
def identifier
|
2023-07-09 05:50:06 +01:00
|
|
|
"strip[#{@index}].eq"
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripDevice
|
|
|
|
include IRemote
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-27 10:58:26 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_reader_int :sr
|
|
|
|
attr_reader_string :name
|
|
|
|
attr_writer_string :wdm, :ks, :mme, :asio
|
2023-07-07 02:33:49 +01:00
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}].device"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-08-29 11:21:05 +01:00
|
|
|
# Represents a Virtual Strip
|
2023-07-27 10:58:26 +01:00
|
|
|
class VirtualStrip < Base
|
2023-07-09 19:31:27 +01:00
|
|
|
include Mixins::Xy::Pan
|
|
|
|
include Mixins::Apps
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-07 02:33:49 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_bool :mc
|
|
|
|
attr_accessor_int :karaoke
|
2023-07-13 21:57:18 +01:00
|
|
|
|
|
|
|
def bass
|
|
|
|
round(getter("EQGain1"), 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def bass=(val)
|
|
|
|
setter("EQGain1", val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def mid
|
|
|
|
round(getter("EQGain2"), 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def mid=(val)
|
|
|
|
setter("EQGain2", val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def treble
|
|
|
|
round(getter("EQGain3"), 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def treble=(val)
|
|
|
|
setter("EQGain3", val)
|
|
|
|
end
|
2023-07-17 19:59:32 +01:00
|
|
|
|
|
|
|
alias_method :med, :mid
|
|
|
|
alias_method :med=, :mid=
|
|
|
|
alias_method :high, :treble
|
|
|
|
alias_method :high=, :treble=
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class GainLayer
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-13 21:57:18 +01:00
|
|
|
def initialize(remote, i, j)
|
|
|
|
super(remote, i)
|
|
|
|
@j = j
|
|
|
|
end
|
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}]"
|
|
|
|
end
|
|
|
|
|
|
|
|
def gain
|
2023-07-14 12:01:41 +01:00
|
|
|
getter("gainlayer[#{@j}]")
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def gain=(value)
|
2023-07-14 12:01:41 +01:00
|
|
|
setter("gainlayer[#{@j}]", value)
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class StripLevels
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-13 21:57:18 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
def identifier
|
|
|
|
"strip[#{@index}]"
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_level(mode)
|
2023-07-25 10:20:31 +01:00
|
|
|
convert = ->(x) { (x > 0) ? (20 * Math.log(x, 10)).round(1) : -200.0 }
|
|
|
|
|
2023-07-14 01:46:00 +01:00
|
|
|
@remote.cache[:strip_mode] = mode
|
2023-08-10 14:40:22 +01:00
|
|
|
vals = if @remote.running? && @remote.event.ldirty
|
2023-07-14 12:01:41 +01:00
|
|
|
@remote.cache[:strip_level][@init, @offset]
|
2023-07-13 21:57:18 +01:00
|
|
|
else
|
2023-07-14 12:01:41 +01:00
|
|
|
(@init...@init + @offset).map { |i| @remote.get_level(mode, i) }
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
2023-07-25 10:20:31 +01:00
|
|
|
vals.map(&convert)
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def prefader
|
2023-07-14 01:46:00 +01:00
|
|
|
get_level(Mixins::LevelEnum::PREFADER)
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def postfader
|
2023-07-14 01:46:00 +01:00
|
|
|
get_level(Mixins::LevelEnum::POSTFADER)
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def postmute
|
2023-07-14 01:46:00 +01:00
|
|
|
get_level(Mixins::LevelEnum::POSTMUTE)
|
2023-07-13 21:57:18 +01:00
|
|
|
end
|
|
|
|
|
2023-07-14 01:46:00 +01:00
|
|
|
def isdirty? = @remote.cache[:strip_comp][@init, @offset].any?
|
2023-07-07 02:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|