unimidi 0.1.3-i686-linux → 0.1.4-i686-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -2
- data/lib/unimidi.rb +1 -1
- data/lib/unimidi/adapter/alsa-rawmidi.rb +5 -7
- data/lib/unimidi/adapter/ffi-coremidi.rb +31 -0
- data/lib/unimidi/adapter/midi-jruby.rb +5 -7
- data/lib/unimidi/adapter/midi-winmm.rb +5 -7
- data/lib/unimidi/congruous_api_adapter.rb +10 -20
- data/lib/unimidi/platform.rb +7 -7
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ Platform independent realtime MIDI input and output for Ruby.
|
|
6
6
|
|
7
7
|
== Features
|
8
8
|
|
9
|
-
*
|
9
|
+
* Supports Linux, JRuby, OSX, Windows and Cygwin
|
10
10
|
* Both input and output to and from multiple devices concurrently
|
11
11
|
* Agnostically handle different MIDI and SysEx Message types
|
12
12
|
|
@@ -16,7 +16,8 @@ Platform
|
|
16
16
|
|
17
17
|
* JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
|
18
18
|
* Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
|
19
|
-
*
|
19
|
+
* OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
|
20
|
+
* Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
|
20
21
|
|
21
22
|
A couple of notes about JRuby only:
|
22
23
|
|
data/lib/unimidi.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
-
#
|
5
3
|
|
6
4
|
require 'alsa-rawmidi'
|
7
5
|
|
@@ -12,20 +10,20 @@ module UniMIDI
|
|
12
10
|
class Input
|
13
11
|
include CongruousApiAdapter::Device
|
14
12
|
include CongruousApiAdapter::Input
|
15
|
-
|
13
|
+
DeferToClass = AlsaRawMIDI::Input
|
16
14
|
end
|
17
15
|
|
18
16
|
class Output
|
19
17
|
include CongruousApiAdapter::Device
|
20
18
|
include CongruousApiAdapter::Output
|
21
|
-
|
19
|
+
DeferToClass = AlsaRawMIDI::Output
|
22
20
|
end
|
23
21
|
|
24
22
|
class Device
|
25
23
|
extend CongruousApiAdapter::Device::ClassMethods
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
DeferToClass = AlsaRawMIDI::Device
|
25
|
+
InputClass = Input
|
26
|
+
OutputClass = Output
|
29
27
|
end
|
30
28
|
|
31
29
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
|
4
|
+
require 'coremidi'
|
5
|
+
|
6
|
+
module UniMIDI
|
7
|
+
|
8
|
+
module CoreMIDIAdapter
|
9
|
+
|
10
|
+
class Input
|
11
|
+
include CongruousApiAdapter::Device
|
12
|
+
include CongruousApiAdapter::Input
|
13
|
+
DeferToClass = CoreMIDI::Input
|
14
|
+
end
|
15
|
+
|
16
|
+
class Output
|
17
|
+
include CongruousApiAdapter::Device
|
18
|
+
include CongruousApiAdapter::Output
|
19
|
+
DeferToClass = CoreMIDI::Output
|
20
|
+
end
|
21
|
+
|
22
|
+
class Device
|
23
|
+
extend CongruousApiAdapter::Device::ClassMethods
|
24
|
+
DeferToClass = CoreMIDI::Device
|
25
|
+
InputClass = Input
|
26
|
+
OutputClass = Output
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
-
#
|
5
3
|
|
6
4
|
require 'midi-jruby'
|
7
5
|
|
@@ -12,20 +10,20 @@ module UniMIDI
|
|
12
10
|
class Input
|
13
11
|
include CongruousApiAdapter::Device
|
14
12
|
include CongruousApiAdapter::Input
|
15
|
-
|
13
|
+
DeferToClass = MIDIJRuby::Input
|
16
14
|
end
|
17
15
|
|
18
16
|
class Output
|
19
17
|
include CongruousApiAdapter::Device
|
20
18
|
include CongruousApiAdapter::Output
|
21
|
-
|
19
|
+
DeferToClass = MIDIJRuby::Output
|
22
20
|
end
|
23
21
|
|
24
22
|
class Device
|
25
23
|
extend CongruousApiAdapter::Device::ClassMethods
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
DeferToClass = MIDIJRuby::Device
|
25
|
+
InputClass = Input
|
26
|
+
OutputClass = Output
|
29
27
|
end
|
30
28
|
|
31
29
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
-
#
|
5
3
|
|
6
4
|
require 'midi-winmm'
|
7
5
|
|
@@ -12,20 +10,20 @@ module UniMIDI
|
|
12
10
|
class Input
|
13
11
|
include CongruousApiAdapter::Device
|
14
12
|
include CongruousApiAdapter::Input
|
15
|
-
|
13
|
+
DeferToClass = MIDIWinMM::Input
|
16
14
|
end
|
17
15
|
|
18
16
|
class Output
|
19
17
|
include CongruousApiAdapter::Device
|
20
18
|
include CongruousApiAdapter::Output
|
21
|
-
|
19
|
+
DeferToClass = MIDIWinMM::Output
|
22
20
|
end
|
23
21
|
|
24
22
|
class Device
|
25
23
|
extend CongruousApiAdapter::Device::ClassMethods
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
DeferToClass = MIDIWinMM::Device
|
25
|
+
InputClass = Input
|
26
|
+
OutputClass = Output
|
29
27
|
end
|
30
28
|
|
31
29
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
-
#
|
5
3
|
|
6
4
|
module UniMIDI
|
7
5
|
|
@@ -42,7 +40,7 @@ module UniMIDI
|
|
42
40
|
|
43
41
|
module ClassMethods
|
44
42
|
|
45
|
-
def first
|
43
|
+
def first
|
46
44
|
new(device_class.first)
|
47
45
|
end
|
48
46
|
|
@@ -60,29 +58,17 @@ module UniMIDI
|
|
60
58
|
:output => device_class.all_by_type[:output].map { |d| get_output_class.new(d) }
|
61
59
|
}
|
62
60
|
end
|
63
|
-
|
64
|
-
def defer_to(klass)
|
65
|
-
const_set("DeferToClass", klass)
|
66
|
-
end
|
67
|
-
|
61
|
+
|
68
62
|
def get_input_class
|
69
|
-
|
63
|
+
self::InputClass
|
70
64
|
end
|
71
|
-
|
65
|
+
|
72
66
|
def get_output_class
|
73
|
-
|
67
|
+
self::OutputClass
|
74
68
|
end
|
75
69
|
|
76
|
-
def input_class(klass)
|
77
|
-
const_set("InputClass", klass)
|
78
|
-
end
|
79
|
-
|
80
|
-
def output_class(klass)
|
81
|
-
const_set("OutputClass", klass)
|
82
|
-
end
|
83
|
-
|
84
70
|
def device_class
|
85
|
-
|
71
|
+
self::DeferToClass
|
86
72
|
end
|
87
73
|
|
88
74
|
end
|
@@ -122,6 +108,8 @@ module UniMIDI
|
|
122
108
|
def gets_bytestr(*a)
|
123
109
|
@device.gets_bytestr(*a)
|
124
110
|
end
|
111
|
+
alias_method :gets_s, :gets_bytestr
|
112
|
+
alias_method :gets_hex, :gets_bytestr
|
125
113
|
|
126
114
|
#
|
127
115
|
# returns an array of data bytes such as
|
@@ -140,6 +128,8 @@ module UniMIDI
|
|
140
128
|
arr = gets_bytestr
|
141
129
|
arr.map { |msg| msg[:data] }.join
|
142
130
|
end
|
131
|
+
alias_method :gets_data_s, :gets_data_bytestr
|
132
|
+
alias_method :gets_data_hex, :gets_data_bytestr
|
143
133
|
|
144
134
|
module ClassMethods
|
145
135
|
|
data/lib/unimidi/platform.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
-
#
|
5
3
|
|
6
4
|
require 'singleton'
|
7
5
|
|
@@ -15,16 +13,18 @@ module UniMIDI
|
|
15
13
|
|
16
14
|
def initialize
|
17
15
|
lib = case RUBY_PLATFORM
|
18
|
-
when /
|
19
|
-
when /
|
20
|
-
when /
|
21
|
-
when /
|
16
|
+
when /darwin/ then "ffi-coremidi"
|
17
|
+
when /java/ then "midi-jruby"
|
18
|
+
when /linux/ then "alsa-rawmidi"
|
19
|
+
when /mingw/ then "midi-winmm"
|
20
|
+
when /win/ then "midi-winmm"
|
22
21
|
end
|
23
22
|
require("unimidi/adapter/#{lib}")
|
24
23
|
@interface = case RUBY_PLATFORM
|
24
|
+
when /darwin/ then CoreMIDIAdapter
|
25
25
|
when /java/ then MIDIJRubyAdapter
|
26
26
|
when /linux/ then AlsaRawMIDIAdapter
|
27
|
-
when /mingw/ then MIDIWinMMAdapter
|
27
|
+
when /mingw/ then MIDIWinMMAdapter
|
28
28
|
when /win/ then MIDIWinMMAdapter
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: unimidi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.4
|
6
6
|
platform: i686-linux
|
7
7
|
authors:
|
8
8
|
- Ari Russo
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-07 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,7 @@ extra_rdoc_files: []
|
|
35
35
|
|
36
36
|
files:
|
37
37
|
- lib/unimidi.rb
|
38
|
+
- lib/unimidi/adapter/ffi-coremidi.rb
|
38
39
|
- lib/unimidi/adapter/midi-winmm.rb
|
39
40
|
- lib/unimidi/adapter/alsa-rawmidi.rb
|
40
41
|
- lib/unimidi/adapter/midi-jruby.rb
|