Class: Voicemeeter::Configs::TOMLConfBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/voicemeeter/configs.rb

Class Method Summary collapse

Class Method Details

.run(kind) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/voicemeeter/configs.rb', line 4

def self.run(kind)
  aouts = (0...kind.phys_out).to_h { |i| [:"A#{i + 1}", false] }
  bouts = (0...kind.virt_out).to_h { |i| [:"B#{i + 1}", false] }
  strip_bools = %i[mute mono solo].to_h { |param| [param, false] }
  gain = [:gain].to_h { |param| [param, 0.0] }

  phys_float =
    %i[comp gate denoiser].to_h { |param| [param, {knob: 0.0}] }
  eq = [:eq].to_h { |param| [param, {on: false}] }

  overrides = {B1: true}
  phys_strip =
    (0...kind.phys_in).to_h do |i|
      [
        "strip-#{i}".to_sym,
        {**aouts, **bouts, **strip_bools, **gain, **phys_float, **eq, **overrides}
      ]
    end

  overrides = {A1: true}
  virt_strip =
    (kind.phys_in...kind.phys_in + kind.virt_in).to_h do |i|
      [
        :"strip-#{i}",
        {**aouts, **bouts, **strip_bools, **gain, **overrides}
      ]
    end

  bus_bools = %i[mute mono].to_h { |param| [param, false] }
  bus =
    (0...kind.num_bus).to_h do |i|
      [:"bus-#{i}", {**bus_bools, **gain, **eq}]
    end

  {**phys_strip, **virt_strip, **bus}
end