mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-22 09:50:49 +00:00
Device class implemented
This commit is contained in:
parent
077a14fe62
commit
24edb0b134
30
lib/voicemeeter/device.rb
Normal file
30
lib/voicemeeter/device.rb
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
require_relative "iremote"
|
||||||
|
require_relative "meta"
|
||||||
|
|
||||||
|
module Voicemeeter
|
||||||
|
class Device
|
||||||
|
def initialize(remote)
|
||||||
|
@remote = remote
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
"#{self.class.name.split("::").last}#{@index}#{@remote.kind}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def getter(**kwargs)
|
||||||
|
return @remote.get_num_devices(kwargs[:direction]) if kwargs[:index].nil?
|
||||||
|
|
||||||
|
vals = @remote.get_device_description(kwargs[:index], kwargs[:direction])
|
||||||
|
types = {1 => "mme", 3 => "wdm", 4 => "ks", 5 => "asio"}
|
||||||
|
{name: vals[0], type: types[vals[1]], id: vals[2]}
|
||||||
|
end
|
||||||
|
|
||||||
|
def ins = getter(direction: :in)
|
||||||
|
|
||||||
|
def outs = getter(direction: :out)
|
||||||
|
|
||||||
|
def input(i) = getter(index: i, direction: :in)
|
||||||
|
|
||||||
|
def output(i) = getter(index: i, direction: :out)
|
||||||
|
end
|
||||||
|
end
|
@ -7,6 +7,7 @@ require_relative "button"
|
|||||||
require_relative "vban"
|
require_relative "vban"
|
||||||
require_relative "command"
|
require_relative "command"
|
||||||
require_relative "recorder"
|
require_relative "recorder"
|
||||||
|
require_relative "device"
|
||||||
require_relative "configs"
|
require_relative "configs"
|
||||||
|
|
||||||
module Voicemeeter
|
module Voicemeeter
|
||||||
@ -14,7 +15,7 @@ module Voicemeeter
|
|||||||
private
|
private
|
||||||
|
|
||||||
class Remote < Base
|
class Remote < Base
|
||||||
attr_reader :strip, :bus, :button, :vban, :command, :recorder
|
attr_reader :strip, :bus, :button, :vban, :command, :recorder, :device
|
||||||
|
|
||||||
def initialize(kind, **kwargs)
|
def initialize(kind, **kwargs)
|
||||||
super
|
super
|
||||||
@ -24,6 +25,7 @@ module Voicemeeter
|
|||||||
@vban = Vban::Vban.new(self)
|
@vban = Vban::Vban.new(self)
|
||||||
@command = Command.new(self)
|
@command = Command.new(self)
|
||||||
@recorder = Recorder::Recorder.new(self)
|
@recorder = Recorder::Recorder.new(self)
|
||||||
|
@device = Device.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def configs
|
def configs
|
||||||
|
Loading…
Reference in New Issue
Block a user