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.



3
4
5
# File 'lib/voicemeeter/device.rb', line 3

def initialize(remote)
  @remote = remote
end

Instance Method Details

#getter(**kwargs) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/voicemeeter/device.rb', line 11

def getter(**kwargs)
  kwargs => {direction:}
  return @remote.get_num_devices(direction) unless kwargs.key? :index

  vals = @remote.get_device_description(kwargs[:index], direction)
  types = {1 => "mme", 3 => "wdm", 4 => "ks", 5 => "asio"}
  {name: vals[0], type: types[vals[1]], id: vals[2]}
end

#input(i) ⇒ Object



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

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

#insObject



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

def ins = getter(direction: :in)

#output(i) ⇒ Object



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

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

#outsObject



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

def outs = getter(direction: :out)

#to_sObject



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

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