add :direction key assertion

This commit is contained in:
onyx-and-iris 2023-07-31 19:22:29 +01:00
parent 2c5783b1a1
commit 89ee553bb4

View File

@ -12,9 +12,10 @@ module Voicemeeter
end end
def getter(**kwargs) def getter(**kwargs)
return @remote.get_num_devices(kwargs[:direction]) if kwargs[:index].nil? kwargs => {direction:}
return @remote.get_num_devices(direction) unless kwargs.key? :index
vals = @remote.get_device_description(kwargs[:index], kwargs[:direction]) vals = @remote.get_device_description(kwargs[:index], direction)
types = {1 => "mme", 3 => "wdm", 4 => "ks", 5 => "asio"} types = {1 => "mme", 3 => "wdm", 4 => "ks", 5 => "asio"}
{name: vals[0], type: types[vals[1]], id: vals[2]} {name: vals[0], type: types[vals[1]], id: vals[2]}
end end