module UniMIDI::Platform

Deal with different dependencies between different user environments

Public Instance Methods

bootstrap() click to toggle source

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

# File lib/unimidi/platform.rb, line 9
def bootstrap
  require("unimidi/adapter/#{platform_lib}")
  Loader.use(platform_module::Loader)
end

Private Instance Methods

platform_lib() click to toggle source
# File lib/unimidi/platform.rb, line 16
def platform_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
end
platform_module() click to toggle source
# File lib/unimidi/platform.rb, line 25
def platform_module
  case RUBY_PLATFORM
    when /darwin/ then Adapter::CoreMIDI
    when /java/ then Adapter::MIDIJRuby
    when /linux/ then Adapter::AlsaRawMIDI
    when /mingw/ then Adapter::MIDIWinMM
  end
end