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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/unimidi/platform.rb', line 14

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"
    #when /win/ 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
    #when /win/ then MIDIWinMMAdapter
  end
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



12
13
14
# File 'lib/unimidi/platform.rb', line 12

def interface
  @interface
end