mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-24 02:40:48 +00:00
use array
This commit is contained in:
parent
6769013ee3
commit
10a4eade93
@ -88,11 +88,7 @@ module Voicemeeter
|
|||||||
def type
|
def type
|
||||||
ckind = FFI::MemoryPointer.new(:long, 1)
|
ckind = FFI::MemoryPointer.new(:long, 1)
|
||||||
CBindings.call(:bind_get_voicemeeter_type, ckind)
|
CBindings.call(:bind_get_voicemeeter_type, ckind)
|
||||||
kinds = {
|
kinds = [nil, :basic, :banana, :potato]
|
||||||
Kinds::KindEnum::BASIC => :basic,
|
|
||||||
Kinds::KindEnum::BANANA => :banana,
|
|
||||||
Kinds::KindEnum::POTATO => :potato
|
|
||||||
}
|
|
||||||
kinds[ckind.read_long]
|
kinds[ckind.read_long]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,19 +214,16 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def apply(data)
|
def apply(data)
|
||||||
data.each do |key, val|
|
data.each do |key, hash|
|
||||||
kls, index, *rem = key.to_s.split("-")
|
case key.to_s.split("-")
|
||||||
case kls
|
in [/strip|bus|button/ => kls, /^[0-9]+$/ => index]
|
||||||
when "strip", "bus", "button"
|
|
||||||
target = send(kls)
|
target = send(kls)
|
||||||
when "vban"
|
in ["vban", String => dir, /^[0-9]+$/ => index]
|
||||||
dir = "#{index.chomp("stream")}stream"
|
target = vban.send("#{dir.chomp("stream")}stream")
|
||||||
index = rem[0]
|
|
||||||
target = vban.send(dir)
|
|
||||||
else
|
else
|
||||||
raise KeyError, "invalid config key '#{kls}'"
|
raise KeyError, "invalid config key '#{key}'"
|
||||||
end
|
end
|
||||||
target[index.to_i].apply(val)
|
target[index.to_i].apply(hash)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user