Class: Voicemeeter::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/voicemeeter/device.rb

Instance Method Summary collapse

Constructor Details

#initialize(remote) ⇒ Device

Returns a new instance of Device.



6
7
8
# File 'lib/voicemeeter/device.rb', line 6

def initialize(remote)
  @remote = remote
end

Instance Method Details

#getter(**kwargs) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/voicemeeter/device.rb', line 14

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

#input(i) ⇒ Object



26
# File 'lib/voicemeeter/device.rb', line 26

def input(i) = getter(index: i, direction: "in")

#insObject



22
# File 'lib/voicemeeter/device.rb', line 22

def ins = getter(direction: "in")

#output(i) ⇒ Object



28
# File 'lib/voicemeeter/device.rb', line 28

def output(i) = getter(index: i, direction: "out")

#outsObject



24
# File 'lib/voicemeeter/device.rb', line 24

def outs = getter(direction: "out")

#to_sObject



10
11
12
# File 'lib/voicemeeter/device.rb', line 10

def to_s
  "#{self.class.name.split("::").last}#{@index}#{@remote.kind}"
end