From 6d080af041d1c44e8cba642de842e05ef92253e2 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 17 Jul 2023 07:10:08 +0100 Subject: [PATCH] implement patch --- lib/voicemeeter/patch.rb | 69 +++++++++++++++++++++++++++++++++++++++ lib/voicemeeter/remote.rb | 6 ++-- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 lib/voicemeeter/patch.rb diff --git a/lib/voicemeeter/patch.rb b/lib/voicemeeter/patch.rb new file mode 100644 index 0000000..7da8cac --- /dev/null +++ b/lib/voicemeeter/patch.rb @@ -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 diff --git a/lib/voicemeeter/remote.rb b/lib/voicemeeter/remote.rb index b6f554e..27e6259 100644 --- a/lib/voicemeeter/remote.rb +++ b/lib/voicemeeter/remote.rb @@ -9,6 +9,7 @@ require_relative "command" require_relative "recorder" require_relative "device" require_relative "fx" +require_relative "patch" require_relative "option" require_relative "configs" @@ -27,6 +28,7 @@ module Voicemeeter @recorder = Recorder::Recorder.new(self) @device = Device.new(self) @fx = Fx.new(self) + @patch = Patch::Patch.new(self) @option = Option::Option.new(self) end @@ -48,11 +50,11 @@ module Voicemeeter end 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 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 public