2023-07-07 02:36:35 +01:00
|
|
|
require_relative "base"
|
|
|
|
require_relative "kinds"
|
|
|
|
require_relative "errors"
|
|
|
|
require_relative "strip"
|
|
|
|
require_relative "bus"
|
|
|
|
require_relative "button"
|
|
|
|
require_relative "vban"
|
2023-07-14 17:07:56 +01:00
|
|
|
require_relative "command"
|
2023-07-14 16:12:18 +01:00
|
|
|
require_relative "recorder"
|
2023-07-15 00:16:54 +01:00
|
|
|
require_relative "device"
|
2023-07-16 23:30:24 +01:00
|
|
|
require_relative "fx"
|
2023-07-17 07:10:08 +01:00
|
|
|
require_relative "patch"
|
2023-07-17 06:30:09 +01:00
|
|
|
require_relative "option"
|
2023-07-09 05:50:57 +01:00
|
|
|
require_relative "configs"
|
2023-07-07 02:36:35 +01:00
|
|
|
|
|
|
|
module Voicemeeter
|
|
|
|
module Remote
|
|
|
|
private
|
|
|
|
|
|
|
|
class Remote < Base
|
|
|
|
def initialize(kind, **kwargs)
|
|
|
|
super
|
2023-07-14 01:46:46 +01:00
|
|
|
@strip = (0...kind.num_strip).map { |i| Strip::Strip.make(self, i) }
|
|
|
|
@bus = (0...kind.num_bus).map { |i| Bus::Bus.make(self, i) }
|
|
|
|
@button = (0...kind.num_buttons).map { |i| Button::Button.new(self, i) }
|
2023-07-07 02:36:35 +01:00
|
|
|
@vban = Vban::Vban.new(self)
|
2023-07-14 17:07:56 +01:00
|
|
|
@command = Command.new(self)
|
2023-07-14 16:12:18 +01:00
|
|
|
@recorder = Recorder::Recorder.new(self)
|
2023-07-15 00:16:54 +01:00
|
|
|
@device = Device.new(self)
|
2023-07-16 23:30:24 +01:00
|
|
|
@fx = Fx.new(self)
|
2023-07-17 07:10:08 +01:00
|
|
|
@patch = Patch::Patch.new(self)
|
2023-07-17 06:30:09 +01:00
|
|
|
@option = Option::Option.new(self)
|
2023-07-07 02:36:35 +01:00
|
|
|
end
|
2023-07-09 05:50:57 +01:00
|
|
|
|
|
|
|
def configs
|
2023-07-14 01:46:46 +01:00
|
|
|
Configs.get(kind.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
login
|
|
|
|
|
2023-07-14 17:07:56 +01:00
|
|
|
yield(self) if block_given?
|
2023-07-14 01:46:46 +01:00
|
|
|
|
|
|
|
logout
|
2023-07-09 05:50:57 +01:00
|
|
|
end
|
2023-07-07 02:36:35 +01:00
|
|
|
end
|
|
|
|
|
2023-07-16 22:33:02 +01:00
|
|
|
class RemoteBasic < Remote
|
2023-07-17 06:30:09 +01:00
|
|
|
attr_reader :strip, :bus, :button, :vban, :command, :device, :option
|
2023-07-16 22:33:02 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
class RemoteBanana < Remote
|
2023-07-17 07:10:08 +01:00
|
|
|
attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder, :patch
|
2023-07-16 22:33:02 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
class RemotePotato < Remote
|
2023-07-17 07:10:08 +01:00
|
|
|
attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder, :patch, :fx
|
2023-07-16 22:33:02 +01:00
|
|
|
end
|
|
|
|
|
2023-07-07 02:36:35 +01:00
|
|
|
public
|
|
|
|
|
2023-07-14 01:46:46 +01:00
|
|
|
def self.new(kind_id, **kwargs)
|
2023-07-16 22:33:02 +01:00
|
|
|
kind = Kinds.get(kind_id)
|
|
|
|
rescue KeyError
|
|
|
|
raise Errors::VMError.new "unknown Voicemeeter kind #{kind_id}"
|
|
|
|
else
|
|
|
|
if kind_id == :basic
|
|
|
|
RemoteBasic.new(kind, **kwargs)
|
|
|
|
elsif kind_id == :banana
|
|
|
|
RemoteBanana.new(kind, **kwargs)
|
|
|
|
elsif kind_id == :potato
|
|
|
|
RemotePotato.new(kind, **kwargs)
|
2023-07-07 02:36:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|