mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
update rakefile
rework examples
This commit is contained in:
parent
04775e8a3e
commit
d8ee19e2f8
20
README.md
20
README.md
@ -38,17 +38,27 @@ Login and logout are handled for you in this scenario.
|
||||
```ruby
|
||||
require "voicemeeter"
|
||||
|
||||
class Main
|
||||
def run
|
||||
Voicemeeter::Remote
|
||||
.new(:banana)
|
||||
.run do |vm|
|
||||
# mute the leftmost strip
|
||||
vm.strip[0].label = "podmic"
|
||||
vm.strip[0].mute = true
|
||||
puts vm.strip[0].mute
|
||||
puts "strip 0 #{vm.strip[0].label} mute was set to #{vm.strip[0].mute}"
|
||||
|
||||
# disable eq for second from left bus
|
||||
vm.bus[1].eq.on = false
|
||||
puts vm.bus[1].eq.on
|
||||
vm.bus[3].gain = -6.3
|
||||
vm.bus[4].eq.on = true
|
||||
info = [
|
||||
"bus 3 gain has been set to #{vm.bus[3].gain}",
|
||||
"bus 4 eq has been set to #{vm.bus[4].eq.on}"
|
||||
]
|
||||
puts info
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Main.new.run if $PROGRAM_NAME == __FILE__
|
||||
```
|
||||
|
||||
Otherwise you must remember to call `vm.login` `vm.logout` at the start/end of your code.
|
||||
|
@ -7,7 +7,8 @@ class Main
|
||||
end
|
||||
|
||||
def run
|
||||
exit if gets.chomp.empty?
|
||||
puts "press <Enter> to quit"
|
||||
loop { break if gets.chomp.empty? }
|
||||
end
|
||||
|
||||
def on_pdirty
|
||||
@ -20,7 +21,7 @@ class Main
|
||||
|
||||
def on_midi
|
||||
current = @vm.midi.current
|
||||
puts "Value of midi button #{current}: #{@vm.midi.get(current)}"
|
||||
puts "Value of midi input #{current}: #{@vm.midi.get(current)}"
|
||||
end
|
||||
|
||||
def on_ldirty
|
||||
@ -30,7 +31,7 @@ class Main
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
if $PROGRAM_NAME == __FILE__
|
||||
Voicemeeter::Remote.new(:potato, pdirty: true, mdirty: true, midi: true, ldirty: true).run do |vm|
|
||||
Main.new(vm).run
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ class Main
|
||||
|
||||
def run
|
||||
puts "press <Enter> to quit"
|
||||
loop { exit if gets.chomp.empty? }
|
||||
loop { break if gets.chomp.empty? }
|
||||
end
|
||||
|
||||
def on_update(event)
|
||||
@ -28,7 +28,7 @@ class Main
|
||||
end
|
||||
|
||||
|
||||
if $0 == __FILE__
|
||||
if $PROGRAM_NAME == __FILE__
|
||||
Voicemeeter::Remote.new(:potato, midi: true).run do |vm|
|
||||
Main.new(vm).run
|
||||
end
|
||||
|
@ -2,8 +2,4 @@
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "voicemeeter", path: "../.."
|
||||
|
||||
gem "obsws", "~> 0.1.3"
|
||||
|
||||
gem "pathname", "~> 0.2.1"
|
||||
|
@ -1,4 +1,4 @@
|
||||
require "voicemeeter"
|
||||
require_relative "../../lib/voicemeeter"
|
||||
require "obsws"
|
||||
require "yaml"
|
||||
require "pathname"
|
||||
@ -59,7 +59,7 @@ def conn_from_yml
|
||||
end
|
||||
|
||||
|
||||
if $0 == __FILE__
|
||||
if $PROGRAM_NAME == __FILE__
|
||||
Voicemeeter::Remote.new(:potato).run do |vm|
|
||||
Main.new(vm, **conn_from_yml).run
|
||||
end
|
||||
|
23
main.rb
Normal file
23
main.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require "voicemeeter"
|
||||
|
||||
class Main
|
||||
def run
|
||||
Voicemeeter::Remote
|
||||
.new(:banana)
|
||||
.run do |vm|
|
||||
vm.strip[0].label = "podmic"
|
||||
vm.strip[0].mute = true
|
||||
puts "strip 0 #{vm.strip[0].label} mute was set to #{vm.strip[0].mute}"
|
||||
|
||||
vm.bus[3].gain = -6.3
|
||||
vm.bus[4].eq.on = true
|
||||
info = [
|
||||
"bus 3 gain has been set to #{vm.bus[3].gain}",
|
||||
"bus 4 eq has been set to #{vm.bus[4].eq.on}"
|
||||
]
|
||||
puts info
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Main.new.run if $PROGRAM_NAME == __FILE__
|
16
rakefile
16
rakefile
@ -1,6 +1,22 @@
|
||||
require "rake/testtask"
|
||||
|
||||
HERE = __dir__
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.pattern = "test/**/*_test.rb"
|
||||
end
|
||||
|
||||
task default: :test
|
||||
task :events do
|
||||
filepath = File.join(HERE, "examples", "events", "main.rb")
|
||||
ruby filepath
|
||||
end
|
||||
task :midi do
|
||||
filepath = File.join(HERE, "examples", "midi", "main.rb")
|
||||
ruby filepath
|
||||
end
|
||||
task :obs do
|
||||
targetdir = File.join(HERE, "examples", "obs")
|
||||
Dir.chdir(targetdir)
|
||||
bundle exec ruby File.join(targetdir, "main.rb")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user