Module: Voicemeeter::Mixins::Outputs

Included in:
Recorder::Base, Strip::Base
Defined in:
lib/voicemeeter/mixins.rb

Instance Method Summary collapse

Instance Method Details

#make_attr_outputs(num_a, num_b) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/voicemeeter/mixins.rb', line 31

def make_attr_outputs(num_a, num_b)
  (1..(num_a + num_b)).each do |i|
    param = (i <= num_a) ? :"A#{i}" : :"B#{i - num_a}"
    define_singleton_method(param) do
      getter(param).to_i == 1
    end
    define_singleton_method("#{param}=") do |value|
      setter(param, value && 1 || 0)
    end
  end
end