2023-07-17 07:10:08 +01:00
|
|
|
module Voicemeeter
|
|
|
|
module Patch
|
2023-08-29 11:21:05 +01:00
|
|
|
# Base class for Patch types
|
2023-07-27 10:58:26 +01:00
|
|
|
class Base
|
|
|
|
include IRemote
|
2023-07-25 14:49:09 +01:00
|
|
|
attr_reader :asio, :A2, :A3, :A4, :A5, :composite, :insert
|
2023-07-17 07:10:08 +01:00
|
|
|
|
|
|
|
def initialize(remote)
|
|
|
|
super
|
|
|
|
make_accessor_bool :postfadercomposite, :postfxinsert
|
|
|
|
|
|
|
|
asio_in, asio_out = remote.kind.asio
|
2023-07-22 13:05:38 +01:00
|
|
|
@asio = (0...asio_in).map { PatchAsioIn.new(remote, _1) }
|
2023-07-25 14:49:09 +01:00
|
|
|
%i[A2 A3 A4 A5].each do |param|
|
|
|
|
instance_variable_set("@#{param}", (0...asio_out).map { PatchAsioOut.new(remote, _1, param) })
|
|
|
|
end
|
2023-07-22 13:05:38 +01:00
|
|
|
@composite = (0...8).map { PatchComposite.new(remote, _1) }
|
|
|
|
@insert = (0...remote.kind.insert).map { PatchInsert.new(remote, _1) }
|
2023-07-17 07:10:08 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class PatchAsio
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-17 07:10:08 +01:00
|
|
|
def identifier
|
|
|
|
:patch
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class PatchAsioIn < PatchAsio
|
|
|
|
def get
|
|
|
|
getter("asio[#{@index}]").to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
def set(val)
|
|
|
|
setter("asio[#{@index}]", val)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class PatchAsioOut < PatchAsio
|
2023-07-25 14:49:09 +01:00
|
|
|
def initialize(remote, i, param)
|
|
|
|
super(remote, i)
|
|
|
|
@param = param
|
|
|
|
end
|
|
|
|
|
2023-07-17 07:10:08 +01:00
|
|
|
def get
|
2023-07-25 14:49:09 +01:00
|
|
|
getter("out#{@param}[#{@index}]").to_i
|
2023-07-17 07:10:08 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def set(val)
|
2023-07-25 14:49:09 +01:00
|
|
|
setter("out#{@param}[#{@index}]", val)
|
2023-07-17 07:10:08 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class PatchComposite
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-17 07:10:08 +01:00
|
|
|
def get
|
|
|
|
getter("composite[#{@index}]").to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
def set(val)
|
|
|
|
setter("composite[#{@index}]", val)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class PatchInsert
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-17 07:10:08 +01:00
|
|
|
def get
|
|
|
|
getter("insert[#{@index}]").to_i == 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def set(val)
|
|
|
|
setter("insert[#{@index}]", val && 1 || 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|