2023-07-18 07:30:24 +01:00
|
|
|
require_relative "../../lib/voicemeeter"
|
|
|
|
|
|
|
|
class Main
|
|
|
|
GAINLAYER = 0
|
|
|
|
|
|
|
|
def initialize(vm)
|
|
|
|
@vm = vm
|
2023-07-28 18:51:15 +01:00
|
|
|
@vm.register(self)
|
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
|
|
|
|
|
|
|
|
def on_update(event)
|
|
|
|
if event == "midi"
|
|
|
|
current = @vm.midi.current
|
|
|
|
midi_handler(current, @vm.midi.get(current))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def midi_handler(i, val)
|
|
|
|
if i.between?(1, 8)
|
|
|
|
@vm.strip[i - 1].gainlayer[GAINLAYER].gain = (val * 72 / 127) - 60
|
|
|
|
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
|