diff --git a/lib/voicemeeter/mixins.rb b/lib/voicemeeter/mixins.rb index c5ff9cf..4ab7e13 100644 --- a/lib/voicemeeter/mixins.rb +++ b/lib/voicemeeter/mixins.rb @@ -1,6 +1,18 @@ module Voicemeeter module Mixins module StripMixins + module Fades + def fadeto(target, time) + self.setter("FadeTo", "(#{target}, #{time})") + sleep(@remote.delay) + end + + def fadeby(change, time) + self.setter("FadeBy", "(#{change}, #{time})") + sleep(@remote.delay) + end + end + module Apps def appgain(name, gain) self.setter("AppGain", "(\"#{name}\", #{gain})") @@ -11,6 +23,19 @@ module Voicemeeter end end + module Outputs + def initialize(*args) + super + remote, *rem = args + num_A, num_B = remote.kind.outs + channels = + (1..(num_A + num_B)).map do |i| + i <= num_A ? "A#{i}" : "B#{i - num_A}" + end + make_accessor_bool *channels + end + end + module Xy include Meta_Functions diff --git a/lib/voicemeeter/strip.rb b/lib/voicemeeter/strip.rb index 7657aec..cc00ef1 100644 --- a/lib/voicemeeter/strip.rb +++ b/lib/voicemeeter/strip.rb @@ -1,12 +1,12 @@ require_relative "iremote" require_relative "kinds" -require_relative "meta" require_relative "mixins" module Voicemeeter module Strip class Strip < IRemote - include Meta_Functions + include Mixins::StripMixins::Outputs + include Mixins::StripMixins::Fades def self.make(remote, i) " @@ -37,6 +37,8 @@ module Voicemeeter include Mixins::StripMixins::Xy::Fx include Mixins::StripMixins::Fx + attr_reader :comp, :gate, :denoiser, :eq, :device + def initialize(remote, i) super make_accessor_float :audibility @@ -50,8 +52,6 @@ module Voicemeeter end class StripComp < IRemote - include Meta_Functions - def initialize(remote, i) super make_accessor_float :gainin, @@ -69,17 +69,15 @@ module Voicemeeter end def knob - getter("").to_i == 1 + getter("") end def knob=(val) - setter("", val && 1 || 0) + setter("", val) end end class StripGate < IRemote - include Meta_Functions - def initialize(remote, i) super make_accessor_float :threshold, :damping, :attack, :hold, :release @@ -91,17 +89,15 @@ module Voicemeeter end def knob - getter("").to_i == 1 + getter("") end def knob=(val) - setter("", val && 1 || 0) + setter("", val) end end class StripDenoiser < IRemote - include Meta_Functions - def initialize(remote, i) super end @@ -111,30 +107,26 @@ module Voicemeeter end def knob - getter("").to_i == 1 + getter("") end def knob=(val) - setter("", val && 1 || 0) + setter("", val) end end class StripEq < IRemote - include Meta_Functions - def initialize(remote, i) super make_accessor_bool :on, :ab end def identifier - "strip[#{@index}].device" + "strip[#{@index}].eq" end end class StripDevice < IRemote - include Meta_Functions - def initialize(remote, i) super make_reader_int :sr