Class: UniMIDI::Platform

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/unimidi/platform.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlatform

Returns a new instance of Platform.



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

def initialize
  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 CoreMIDIAdapter
    when /java/ then MIDIJRubyAdapter
    when /linux/ then AlsaRawMIDIAdapter
    when /mingw/ then MIDIWinMMAdapter
  end
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



7
8
9
# File 'lib/unimidi/platform.rb', line 7

def interface
  @interface
end