Module: UniMIDI::Platform

Extended by:
Platform
Included in:
Platform
Defined in:
lib/unimidi/platform.rb

Overview

Deal with different dependencies between different user environments

Instance Method Summary collapse

Instance Method Details

#bootstrapObject

Loads the proper MIDI library and adapter for the user’s environment



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/unimidi/platform.rb', line 9

def bootstrap
  lib = case RUBY_PLATFORM
    when /darwin/ then "ffi-coremidi"
    when /java/ then "midi-jruby"
    when /linux/ then "alsa-rawmidi"
    when /mingw/ then "midi-winmm"
  end
  require("unimidi/adapter/#{lib}")
  interface = case RUBY_PLATFORM
    when /darwin/ then Adapter::CoreMIDI
    when /java/ then Adapter::MIDIJRuby
    when /linux/ then Adapter::AlsaRawMIDI
    when /mingw/ then Adapter::MIDIWinMM
  end
  Loader.use(interface::Loader)
end