mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-22 01:40:49 +00:00
make register a private method
This commit is contained in:
parent
ae30e929ac
commit
2e69321aca
@ -155,7 +155,7 @@ module Voicemeeter
|
|||||||
|
|
||||||
def get_num_devices(dir)
|
def get_num_devices(dir)
|
||||||
unless %i[in out].include? dir
|
unless %i[in out].include? dir
|
||||||
raise Errors::VMError.new("dir got: #{dir}, expected :in or :out")
|
raise Errors::VMError.new "dir got: #{dir}, expected :in or :out"
|
||||||
end
|
end
|
||||||
if dir == :in
|
if dir == :in
|
||||||
CBindings.call(:bind_input_get_device_number, exp: ->(x) { x >= 0 })
|
CBindings.call(:bind_input_get_device_number, exp: ->(x) { x >= 0 })
|
||||||
@ -166,7 +166,7 @@ module Voicemeeter
|
|||||||
|
|
||||||
def get_device_description(index, dir)
|
def get_device_description(index, dir)
|
||||||
unless %i[in out].include? dir
|
unless %i[in out].include? dir
|
||||||
raise Errors::VMError.new("dir got: #{dir}, expected :in or :out")
|
raise Errors::VMError.new "dir got: #{dir}, expected :in or :out"
|
||||||
end
|
end
|
||||||
ctype = FFI::MemoryPointer.new(:long, 1)
|
ctype = FFI::MemoryPointer.new(:long, 1)
|
||||||
cname = FFI::MemoryPointer.new(:string, 256, true)
|
cname = FFI::MemoryPointer.new(:string, 256, true)
|
||||||
|
@ -56,11 +56,11 @@ module Voicemeeter
|
|||||||
res = send(fn, *args)
|
res = send(fn, *args)
|
||||||
if exp.nil?
|
if exp.nil?
|
||||||
unless ok.include?(res)
|
unless ok.include?(res)
|
||||||
raise Errors::VMCAPIError.new(fn, res)
|
raise Errors::VMCAPIError.new fn, res
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
unless exp.call(res) || ok.include?(res)
|
unless exp.call(res) || ok.include?(res)
|
||||||
raise Errors::VMCAPIError.new(fn, res)
|
raise Errors::VMCAPIError.new fn, res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
res
|
res
|
||||||
|
@ -17,16 +17,16 @@ module Voicemeeter
|
|||||||
def initialize(kind)
|
def initialize(kind)
|
||||||
@kind = kind
|
@kind = kind
|
||||||
@configs = Hash.new do |hash, key|
|
@configs = Hash.new do |hash, key|
|
||||||
raise Errors::VMError.new("unknown config #{key}. known configs: #{hash.keys}")
|
raise Errors::VMError.new "unknown config #{key}. known configs: #{hash.keys}"
|
||||||
end
|
end
|
||||||
@reader = FileReader.new(self, kind)
|
@yml_reader = FileReader.new(self, kind)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"Loader #{@kind}"
|
"Loader #{@kind}"
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
private
|
||||||
|
|
||||||
def build_reset_profile
|
def build_reset_profile
|
||||||
aouts = (0...@kind.phys_out).to_h { |i| ["A#{i + 1}".to_sym, false] }
|
aouts = (0...@kind.phys_out).to_h { |i| ["A#{i + 1}".to_sym, false] }
|
||||||
@ -44,7 +44,7 @@ module Voicemeeter
|
|||||||
phys_strip =
|
phys_strip =
|
||||||
(0...@kind.phys_in).to_h do |i|
|
(0...@kind.phys_in).to_h do |i|
|
||||||
[
|
[
|
||||||
"strip-#{i}",
|
"strip-#{i}".to_sym,
|
||||||
{**aouts, **bouts, **strip_bools, **gain, **phys_float, **eq, **overrides}
|
{**aouts, **bouts, **strip_bools, **gain, **phys_float, **eq, **overrides}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -54,7 +54,7 @@ module Voicemeeter
|
|||||||
virt_strip =
|
virt_strip =
|
||||||
(@kind.phys_in...@kind.phys_in + @kind.virt_in).to_h do |i|
|
(@kind.phys_in...@kind.phys_in + @kind.virt_in).to_h do |i|
|
||||||
[
|
[
|
||||||
"strip-#{i}",
|
"strip-#{i}".to_sym,
|
||||||
{**aouts, **bouts, **strip_bools, **gain, **overrides}
|
{**aouts, **bouts, **strip_bools, **gain, **overrides}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -62,13 +62,13 @@ module Voicemeeter
|
|||||||
bus_bools = %i[mute mono].to_h { |param| [param, false] }
|
bus_bools = %i[mute mono].to_h { |param| [param, false] }
|
||||||
bus =
|
bus =
|
||||||
(0...@kind.num_bus).to_h do |i|
|
(0...@kind.num_bus).to_h do |i|
|
||||||
["bus-#{i}", {**bus_bools, **gain, **eq}]
|
["bus-#{i}".to_sym, {**bus_bools, **gain, **eq}]
|
||||||
end
|
end
|
||||||
|
|
||||||
{**phys_strip, **virt_strip, **bus}
|
{**phys_strip, **virt_strip, **bus}
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_from_yml = @reader.read
|
def read_from_yml = @yml_reader.read
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
||||||
@ -104,6 +104,8 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def register(filepath)
|
def register(filepath)
|
||||||
filename = (filepath.basename.sub_ext "").to_s.to_sym
|
filename = (filepath.basename.sub_ext "").to_s.to_sym
|
||||||
if @loader.configs.key? filename
|
if @loader.configs.key? filename
|
||||||
|
Loading…
Reference in New Issue
Block a user