mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 23:00:48 +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
|
```ruby
|
||||||
require "voicemeeter"
|
require "voicemeeter"
|
||||||
|
|
||||||
|
class Main
|
||||||
|
def run
|
||||||
Voicemeeter::Remote
|
Voicemeeter::Remote
|
||||||
.new(:banana)
|
.new(:banana)
|
||||||
.run do |vm|
|
.run do |vm|
|
||||||
# mute the leftmost strip
|
vm.strip[0].label = "podmic"
|
||||||
vm.strip[0].mute = true
|
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[3].gain = -6.3
|
||||||
vm.bus[1].eq.on = false
|
vm.bus[4].eq.on = true
|
||||||
puts vm.bus[1].eq.on
|
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
|
||||||
|
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.
|
Otherwise you must remember to call `vm.login` `vm.logout` at the start/end of your code.
|
||||||
|
@ -7,7 +7,8 @@ class Main
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
exit if gets.chomp.empty?
|
puts "press <Enter> to quit"
|
||||||
|
loop { break if gets.chomp.empty? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_pdirty
|
def on_pdirty
|
||||||
@ -20,7 +21,7 @@ class Main
|
|||||||
|
|
||||||
def on_midi
|
def on_midi
|
||||||
current = @vm.midi.current
|
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
|
end
|
||||||
|
|
||||||
def on_ldirty
|
def on_ldirty
|
||||||
@ -30,7 +31,7 @@ class Main
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if $0 == __FILE__
|
if $PROGRAM_NAME == __FILE__
|
||||||
Voicemeeter::Remote.new(:potato, pdirty: true, mdirty: true, midi: true, ldirty: true).run do |vm|
|
Voicemeeter::Remote.new(:potato, pdirty: true, mdirty: true, midi: true, ldirty: true).run do |vm|
|
||||||
Main.new(vm).run
|
Main.new(vm).run
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ class Main
|
|||||||
|
|
||||||
def run
|
def run
|
||||||
puts "press <Enter> to quit"
|
puts "press <Enter> to quit"
|
||||||
loop { exit if gets.chomp.empty? }
|
loop { break if gets.chomp.empty? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_update(event)
|
def on_update(event)
|
||||||
@ -28,7 +28,7 @@ class Main
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if $0 == __FILE__
|
if $PROGRAM_NAME == __FILE__
|
||||||
Voicemeeter::Remote.new(:potato, midi: true).run do |vm|
|
Voicemeeter::Remote.new(:potato, midi: true).run do |vm|
|
||||||
Main.new(vm).run
|
Main.new(vm).run
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,4 @@
|
|||||||
|
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "voicemeeter", path: "../.."
|
|
||||||
|
|
||||||
gem "obsws", "~> 0.1.3"
|
gem "obsws", "~> 0.1.3"
|
||||||
|
|
||||||
gem "pathname", "~> 0.2.1"
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require "voicemeeter"
|
require_relative "../../lib/voicemeeter"
|
||||||
require "obsws"
|
require "obsws"
|
||||||
require "yaml"
|
require "yaml"
|
||||||
require "pathname"
|
require "pathname"
|
||||||
@ -59,7 +59,7 @@ def conn_from_yml
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if $0 == __FILE__
|
if $PROGRAM_NAME == __FILE__
|
||||||
Voicemeeter::Remote.new(:potato).run do |vm|
|
Voicemeeter::Remote.new(:potato).run do |vm|
|
||||||
Main.new(vm, **conn_from_yml).run
|
Main.new(vm, **conn_from_yml).run
|
||||||
end
|
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"
|
require "rake/testtask"
|
||||||
|
|
||||||
|
HERE = __dir__
|
||||||
|
|
||||||
Rake::TestTask.new do |t|
|
Rake::TestTask.new do |t|
|
||||||
t.pattern = "test/**/*_test.rb"
|
t.pattern = "test/**/*_test.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
task default: :test
|
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