implement patch

This commit is contained in:
onyx-and-iris 2023-07-17 07:10:08 +01:00
parent d93ffc90a0
commit 6d080af041
2 changed files with 73 additions and 2 deletions

69
lib/voicemeeter/patch.rb Normal file
View File

@ -0,0 +1,69 @@
require_relative "iremote"
module Voicemeeter
module Patch
class Patch < IRemote
attr_reader :asio, :asioa2, :asioa3, :asioa4, :asioa5, :composite, :insert
def initialize(remote)
super
make_accessor_bool :postfadercomposite, :postfxinsert
asio_in, asio_out = remote.kind.asio
@asio = (0...asio_in).map { |i| PatchAsioIn.new(remote, i) }
@outa2 = (0...asio_out).map { |i| PatchAsioOut.new(remote, i) }
@outa3 = (0...asio_out).map { |i| PatchAsioOut.new(remote, i) }
@outa4 = (0...asio_out).map { |i| PatchAsioOut.new(remote, i) }
@outa5 = (0...asio_out).map { |i| PatchAsioOut.new(remote, i) }
@composite = (0...8).map { |i| PatchComposite.new(remote, i) }
@insert = (0...remote.kind.insert).map { |i| PatchInsert.new(remote, i) }
end
end
class PatchAsio < IRemote
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
def get
getter("asio[#{@index}]").to_i
end
def set(val)
setter("asio[#{@index}]", val)
end
end
class PatchComposite < IRemote
def get
getter("composite[#{@index}]").to_i
end
def set(val)
setter("composite[#{@index}]", val)
end
end
class PatchInsert < IRemote
def get
getter("insert[#{@index}]").to_i == 1
end
def set(val)
setter("insert[#{@index}]", val && 1 || 0)
end
end
end
end

View File

@ -9,6 +9,7 @@ require_relative "command"
require_relative "recorder" require_relative "recorder"
require_relative "device" require_relative "device"
require_relative "fx" require_relative "fx"
require_relative "patch"
require_relative "option" require_relative "option"
require_relative "configs" require_relative "configs"
@ -27,6 +28,7 @@ module Voicemeeter
@recorder = Recorder::Recorder.new(self) @recorder = Recorder::Recorder.new(self)
@device = Device.new(self) @device = Device.new(self)
@fx = Fx.new(self) @fx = Fx.new(self)
@patch = Patch::Patch.new(self)
@option = Option::Option.new(self) @option = Option::Option.new(self)
end end
@ -48,11 +50,11 @@ module Voicemeeter
end end
class RemoteBanana < Remote class RemoteBanana < Remote
attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder, :patch
end end
class RemotePotato < Remote class RemotePotato < Remote
attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder, :fx attr_reader :strip, :bus, :button, :vban, :command, :device, :option, :recorder, :patch, :fx
end end
public public