2023-07-18 07:30:24 +01:00
|
|
|
require_relative "../../lib/voicemeeter"
|
|
|
|
|
|
|
|
class Main
|
|
|
|
GAINLAYER = 0
|
|
|
|
|
|
|
|
def initialize(vm)
|
|
|
|
@vm = vm
|
2023-08-18 00:27:43 +01:00
|
|
|
@vm.on :midi do
|
|
|
|
current = @vm.midi.current
|
|
|
|
handler(current, @vm.midi.get(current))
|
|
|
|
end
|
2023-07-18 07:30:24 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
puts "press <Enter> to quit"
|
2023-07-21 09:34:26 +01:00
|
|
|
loop { break if gets.chomp.empty? }
|
2023-07-18 07:30:24 +01:00
|
|
|
end
|
|
|
|
|
2023-08-18 00:27:43 +01:00
|
|
|
def handler(i, val)
|
2023-07-29 21:36:05 +01:00
|
|
|
if i.between?(0, 7)
|
|
|
|
@vm.strip[i].gainlayer[GAINLAYER].gain = (val * 72 / 127) - 60
|
2023-07-18 07:30:24 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2023-07-21 09:34:26 +01:00
|
|
|
if $PROGRAM_NAME == __FILE__
|
2023-07-18 07:30:24 +01:00
|
|
|
Voicemeeter::Remote.new(:potato, midi: true).run do |vm|
|
|
|
|
Main.new(vm).run
|
|
|
|
end
|
|
|
|
end
|