Module: Voicemeeter::RunVM

Includes:
CBindings, Kinds
Included in:
Voicemeeter, Base
Defined in:
lib/voicemeeter/runvm.rb

Instance Method Summary collapse

Methods included from Kinds

get_kind, kind_map, kinds_all

Methods included from CBindings

#clear_polling, #ldirty?, #mdirty?, #pdirty?

Instance Method Details

#start(kind_id) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/voicemeeter/runvm.rb', line 12

def start(kind_id)
  unless Kinds.kind_map.key? kind_id
    raise VMRemoteErrors.new("Unknown Voicemeeter Kind.")
  end

  enums =
    Kinds.kinds_all.map.with_index do |kind, i|
      if CBindings::OS_BITS == 64 && kind.name.to_s == "potato"
        [kind.name.to_s, i + 4]
      else
        [kind.name.to_s, i + 1]
      end
    end
  exes = enums.to_h { |k, v| [k, v.to_i] }

  CBindings.vm_runvm(exes[kind_id])
  sleep(1)
end