unimidi 0.1.5-i386-mingw32 → 0.1.6-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright 2010-2011 Ari Russo
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2010-2011 Ari Russo
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
@@ -1,52 +1,55 @@
1
- = UniMIDI
2
-
3
- == Summary
4
-
5
- Platform independent realtime MIDI input and output for Ruby.
6
-
7
- == Features
8
-
9
- * Supports Linux, JRuby, OSX, Windows and Cygwin
10
- * Both input and output to and from multiple devices concurrently
11
- * Agnostically handle different MIDI and SysEx Message types
12
-
13
- == Requirements
14
-
15
- Platform
16
-
17
- * JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
18
- * Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
19
- * OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
20
- * Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
21
-
22
- A couple of notes about JRuby only:
23
-
24
- * You must be in 1.9 mode. This is normally accomplished by passing --1.9 to JRuby at the command line.
25
- * javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
26
-
27
- == Install
28
-
29
- * gem install unimidi
30
-
31
- == Examples
32
-
33
- * {input}[http://github.com/arirusso/unimidi/blob/master/examples/input.rb]
34
- * {output}[http://github.com/arirusso/unimidi/blob/master/examples/output.rb]
35
-
36
- == Tests
37
-
38
- * please see {test/config.rb}[http://github.com/arirusso/unimidi/blob/master/test/config.rb] before running tests
39
-
40
- == Documentation
41
-
42
- * {rdoc}[http://rdoc.info/gems/unimidi]
43
-
44
- == Author
45
-
46
- {Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
47
-
48
- == License
49
-
50
- Apache 2.0, See the file LICENSE
51
-
52
- Copyright (c) 2010-2011 Ari Russo
1
+ = UniMIDI
2
+
3
+ == Summary
4
+
5
+ Platform independent realtime MIDI input and output for Ruby.
6
+
7
+ == Features
8
+
9
+ * Supports Linux, JRuby, OSX, Windows and Cygwin
10
+ * Both input and output to and from multiple devices concurrently
11
+ * Agnostically handle different MIDI and SysEx Message types
12
+
13
+ == Requirements
14
+
15
+ Platform
16
+
17
+ * JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
18
+ * Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
19
+ * OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
20
+ * Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
21
+
22
+ == Install
23
+
24
+ gem install unimidi
25
+
26
+ == Examples
27
+
28
+ * {input}[http://github.com/arirusso/unimidi/blob/master/examples/input.rb]
29
+ * {output}[http://github.com/arirusso/unimidi/blob/master/examples/output.rb]
30
+
31
+ == Tests
32
+
33
+ * please see {test/config.rb}[http://github.com/arirusso/unimidi/blob/master/test/config.rb] before running tests
34
+
35
+ == Documentation
36
+
37
+ * {rdoc}[http://rdoc.info/gems/unimidi]
38
+
39
+ == If you are using JRuby
40
+
41
+ A couple of notes
42
+
43
+ * You must be in 1.9 mode. This is normally accomplished by passing --1.9 to JRuby at the command line. For testing in 1.9 mode, use
44
+ jruby --1.9 -S rake test
45
+ * javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
46
+
47
+ == Author
48
+
49
+ {Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
50
+
51
+ == License
52
+
53
+ Apache 2.0, See the file LICENSE
54
+
55
+ Copyright (c) 2010-2011 Ari Russo
@@ -1,19 +1,22 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # A realtime MIDI interface for Ruby
4
- # (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
5
- #
6
-
7
- module UniMIDI
8
-
9
- VERSION = "0.1.5"
10
-
11
- end
12
-
13
- require 'unimidi/congruous_api_adapter'
14
- require 'unimidi/platform'
15
-
16
- module UniMIDI
17
- extend(Platform.instance.interface)
18
- include(Platform.instance.interface)
19
- end
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # A realtime MIDI interface for Ruby
4
+ # (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
5
+ #
6
+
7
+ module UniMIDI
8
+
9
+ VERSION = "0.1.6"
10
+
11
+ end
12
+
13
+ require 'forwardable'
14
+
15
+ require 'unimidi/congruous_api_adapter'
16
+ require 'unimidi/platform'
17
+ require 'unimidi/type_conversion'
18
+
19
+ module UniMIDI
20
+ extend(Platform.instance.interface)
21
+ include(Platform.instance.interface)
22
+ end
@@ -1,31 +1,26 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- require 'alsa-rawmidi'
5
-
6
- module UniMIDI
7
-
8
- module AlsaRawMIDIAdapter
9
-
10
- class Input
11
- include CongruousApiAdapter::Device
12
- include CongruousApiAdapter::Input
13
- DeferToClass = AlsaRawMIDI::Input
14
- end
15
-
16
- class Output
17
- include CongruousApiAdapter::Device
18
- include CongruousApiAdapter::Output
19
- DeferToClass = AlsaRawMIDI::Output
20
- end
21
-
22
- class Device
23
- extend CongruousApiAdapter::Device::ClassMethods
24
- DeferToClass = AlsaRawMIDI::Device
25
- InputClass = Input
26
- OutputClass = Output
27
- end
28
-
29
- end
30
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'alsa-rawmidi'
5
+
6
+ module UniMIDI
7
+
8
+ module AlsaRawMIDIAdapter
9
+
10
+ class Input < CongruousApiInput
11
+ defer_to AlsaRawMIDI::Input
12
+ end
13
+
14
+ class Output < CongruousApiOutput
15
+ defer_to AlsaRawMIDI::Output
16
+ end
17
+
18
+ class Device < CongruousApiDevice
19
+ defer_to AlsaRawMIDI::Device
20
+ input_class Input
21
+ output_class Output
22
+ end
23
+
24
+ end
25
+
31
26
  end
@@ -1,31 +1,26 @@
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
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'coremidi'
5
+
6
+ module UniMIDI
7
+
8
+ module CoreMIDIAdapter
9
+
10
+ class Input < CongruousApiInput
11
+ defer_to CoreMIDI::Input
12
+ end
13
+
14
+ class Output < CongruousApiOutput
15
+ defer_to CoreMIDI::Output
16
+ end
17
+
18
+ class Device < CongruousApiDevice
19
+ defer_to CoreMIDI::Entity
20
+ input_class Input
21
+ output_class Output
22
+ end
23
+
24
+ end
25
+
31
26
  end
@@ -1,31 +1,26 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- require 'midi-jruby'
5
-
6
- module UniMIDI
7
-
8
- module MIDIJRubyAdapter
9
-
10
- class Input
11
- include CongruousApiAdapter::Device
12
- include CongruousApiAdapter::Input
13
- DeferToClass = MIDIJRuby::Input
14
- end
15
-
16
- class Output
17
- include CongruousApiAdapter::Device
18
- include CongruousApiAdapter::Output
19
- DeferToClass = MIDIJRuby::Output
20
- end
21
-
22
- class Device
23
- extend CongruousApiAdapter::Device::ClassMethods
24
- DeferToClass = MIDIJRuby::Device
25
- InputClass = Input
26
- OutputClass = Output
27
- end
28
-
29
- end
30
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'midi-jruby'
5
+
6
+ module UniMIDI
7
+
8
+ module MIDIJRubyAdapter
9
+
10
+ class Input < CongruousApiInput
11
+ defer_to MIDIJRuby::Input
12
+ end
13
+
14
+ class Output < CongruousApiOutput
15
+ defer_to MIDIJRuby::Output
16
+ end
17
+
18
+ class Device < CongruousApiDevice
19
+ defer_to MIDIJRuby::Device
20
+ input_class Input
21
+ output_class Output
22
+ end
23
+
24
+ end
25
+
31
26
  end
@@ -1,31 +1,26 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- require 'midi-winmm'
5
-
6
- module UniMIDI
7
-
8
- module MIDIWinMMAdapter
9
-
10
- class Input
11
- include CongruousApiAdapter::Device
12
- include CongruousApiAdapter::Input
13
- DeferToClass = MIDIWinMM::Input
14
- end
15
-
16
- class Output
17
- include CongruousApiAdapter::Device
18
- include CongruousApiAdapter::Output
19
- DeferToClass = MIDIWinMM::Output
20
- end
21
-
22
- class Device
23
- extend CongruousApiAdapter::Device::ClassMethods
24
- DeferToClass = MIDIWinMM::Device
25
- InputClass = Input
26
- OutputClass = Output
27
- end
28
-
29
- end
30
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'midi-winmm'
5
+
6
+ module UniMIDI
7
+
8
+ module MIDIWinMMAdapter
9
+
10
+ class Input < CongruousApiInput
11
+ defer_to MIDIWinMM::Input
12
+ end
13
+
14
+ class Output < CongruousApiOutput
15
+ defer_to MIDIWinMM::Output
16
+ end
17
+
18
+ class Device < CongruousApiDevice
19
+ defer_to MIDIWinMM::Device
20
+ input_class Input
21
+ output_class Output
22
+ end
23
+
24
+ end
25
+
31
26
  end
@@ -1,187 +1,213 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- module UniMIDI
5
-
6
- module CongruousApiAdapter
7
-
8
- module Device
9
-
10
- def initialize(device_obj)
11
- @device = device_obj
12
- @id = @device.id
13
- @name = @device.name
14
- end
15
-
16
- # enable the device for use, can be passed a block to which the device will be passed back
17
- def open(*a, &block)
18
- @device.open(*a)
19
- unless block.nil?
20
- begin
21
- block.call(self)
22
- ensure
23
- close
24
- end
25
- else
26
- self
27
- end
28
- end
29
-
30
- # close the device
31
- def close(*a)
32
- @device.close(*a)
33
- end
34
-
35
- def self.included(base)
36
- #base.send(:attr_reader, :device)
37
- base.send(:attr_reader, :name)
38
- base.send(:attr_reader, :id)
39
- end
40
-
41
- module ClassMethods
42
-
43
- def first
44
- new(device_class.first)
45
- end
46
-
47
- def last
48
- new(device_class.last)
49
- end
50
-
51
- def all
52
- all_by_type.values.flatten
53
- end
54
-
55
- def all_by_type
56
- {
57
- :input => device_class.all_by_type[:input].map { |d| get_input_class.new(d) },
58
- :output => device_class.all_by_type[:output].map { |d| get_output_class.new(d) }
59
- }
60
- end
61
-
62
- def get_input_class
63
- self::InputClass
64
- end
65
-
66
- def get_output_class
67
- self::OutputClass
68
- end
69
-
70
- def device_class
71
- self::DeferToClass
72
- end
73
-
74
- end
75
-
76
- end
77
-
78
- module Input
79
-
80
- def self.included(base)
81
- base.extend(Device::ClassMethods)
82
- base.extend(ClassMethods)
83
- end
84
-
85
- #
86
- # returns an array of MIDI event hashes as such:
87
- # [
88
- # { :data => [144, 60, 100], :timestamp => 1024 },
89
- # { :data => [128, 60, 100], :timestamp => 1100 },
90
- # { :data => [144, 40, 120], :timestamp => 1200 }
91
- # ]
92
- #
93
- # the data is an array of Numeric bytes
94
- # the timestamp is the number of millis since this input was enabled
95
- #
96
- def gets(*a)
97
- @device.gets(*a)
98
- end
99
-
100
- #
101
- # same as gets but returns message data as string of hex digits as such:
102
- # [
103
- # { :data => "904060", :timestamp => 904 },
104
- # { :data => "804060", :timestamp => 1150 },
105
- # { :data => "90447F", :timestamp => 1300 }
106
- # ]
107
- #
108
- def gets_bytestr(*a)
109
- @device.gets_bytestr(*a)
110
- end
111
- alias_method :gets_s, :gets_bytestr
112
- alias_method :gets_hex, :gets_bytestr
113
-
114
- #
115
- # returns an array of data bytes such as
116
- # [144, 60, 100, 128, 60, 100, 144, 40, 120]
117
- #
118
- def gets_data(*a)
119
- arr = gets
120
- arr.map { |msg| msg[:data] }.inject { |a,b| a + b }
121
- end
122
-
123
- #
124
- # returns a string of data such as
125
- # "90406080406090447F"
126
- #
127
- def gets_data_bytestr(*a)
128
- arr = gets_bytestr
129
- arr.map { |msg| msg[:data] }.join
130
- end
131
- alias_method :gets_data_s, :gets_data_bytestr
132
- alias_method :gets_data_hex, :gets_data_bytestr
133
-
134
- module ClassMethods
135
-
136
- # returns all inputs
137
- def all
138
- device_class.all.map { |d| new(d) }
139
- end
140
-
141
- end
142
-
143
- end
144
-
145
- module Output
146
-
147
- def self.included(base)
148
- base.extend(Device::ClassMethods)
149
- base.extend(ClassMethods)
150
- end
151
-
152
- # sends a message to the output. the message can be:
153
- #
154
- # bytes eg output.puts(0x90, 0x40, 0x40)
155
- # an array of bytes eg output.puts([0x90, 0x40, 0x40])
156
- # or a string eg output.puts("904040")
157
- #
158
- def puts(*a)
159
- @device.puts(*a)
160
- end
161
-
162
- # sends a message to the output in a form of a string eg "904040". this method does not do
163
- # type checking and therefore is more performant than puts
164
- def puts_bytestr(*a)
165
- @device.puts_bytestr(*a)
166
- end
167
-
168
- # sends a message to the output in a form of bytes eg output.puts_bytes(0x90, 0x40, 0x40).
169
- # this method does not do type checking and therefore is more performant than puts
170
- def puts_bytes(*a)
171
- @device.puts_bytes(*a)
172
- end
173
-
174
- module ClassMethods
175
-
176
- # returns all outputs
177
- def all
178
- device_class.all.map { |d| new(d) }
179
- end
180
-
181
- end
182
-
183
- end
184
-
185
- end
186
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ module UniMIDI
5
+
6
+ module CongruousApiAdapter
7
+
8
+ module Device
9
+
10
+ def initialize(device_obj)
11
+ @device = device_obj
12
+ @id = @device.id
13
+ @name = @device.name
14
+ end
15
+
16
+ # enable the device for use, can be passed a block to which the device will be passed back
17
+ def open(*a, &block)
18
+ @device.open(*a)
19
+ unless block.nil?
20
+ begin
21
+ yield(self)
22
+ ensure
23
+ close
24
+ end
25
+ else
26
+ self
27
+ end
28
+ end
29
+
30
+ # close the device
31
+ def close(*a)
32
+ @device.close(*a)
33
+ end
34
+
35
+ def self.included(base)
36
+ base.send(:attr_reader, :name)
37
+ base.send(:attr_reader, :id)
38
+ end
39
+
40
+ module ClassMethods
41
+
42
+ # returns the first device for this class
43
+ def first(*a)
44
+ dev = @deference[self].first(*a)
45
+ raise 'Device not found' if dev.nil?
46
+ new(dev)
47
+ end
48
+
49
+ # returns the last device for this class
50
+ def last(*a)
51
+ dev = @deference[self].last(*a)
52
+ raise 'Device not found' if dev.nil?
53
+ new(dev)
54
+ end
55
+
56
+ # returns all devices in an array
57
+ def all
58
+ all_by_type.values.flatten
59
+ end
60
+
61
+ # returns all devices as a hash as such
62
+ # { :input => [input devices], :output => [output devices] }
63
+ def all_by_type
64
+ {
65
+ :input => @deference[self].all_by_type[:input].map { |d| @input_class.new(d) },
66
+ :output => @deference[self].all_by_type[:output].map { |d| @output_class.new(d) }
67
+ }
68
+ end
69
+
70
+ def defer_to(klass)
71
+ @deference ||= {}
72
+ @deference[self] = klass
73
+ end
74
+
75
+ def input_class(klass)
76
+ @input_class = klass
77
+ end
78
+
79
+ def output_class(klass)
80
+ @output_class = klass
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+
87
+ end
88
+
89
+ class CongruousApiInput
90
+
91
+ include CongruousApiAdapter::Device
92
+ extend CongruousApiAdapter::Device::ClassMethods
93
+ extend Forwardable
94
+
95
+ def_delegators :@device, :buffer
96
+
97
+ #
98
+ # returns an array of MIDI event hashes as such:
99
+ # [
100
+ # { :data => [144, 60, 100], :timestamp => 1024 },
101
+ # { :data => [128, 60, 100], :timestamp => 1100 },
102
+ # { :data => [144, 40, 120], :timestamp => 1200 }
103
+ # ]
104
+ #
105
+ # the data is an array of Numeric bytes
106
+ # the timestamp is the number of millis since this input was enabled
107
+ #
108
+ def gets(*a)
109
+ @device.gets(*a)
110
+ end
111
+
112
+ #
113
+ # same as gets but returns message data as string of hex digits as such:
114
+ # [
115
+ # { :data => "904060", :timestamp => 904 },
116
+ # { :data => "804060", :timestamp => 1150 },
117
+ # { :data => "90447F", :timestamp => 1300 }
118
+ # ]
119
+ #
120
+ def gets_s(*a)
121
+ @device.gets_s(*a)
122
+ end
123
+ alias_method :gets_bytestr, :gets_s
124
+ alias_method :gets_hex, :gets_s
125
+
126
+ #
127
+ # returns an array of data bytes such as
128
+ # [144, 60, 100, 128, 60, 100, 144, 40, 120]
129
+ #
130
+ def gets_data(*a)
131
+ arr = gets
132
+ arr.map { |msg| msg[:data] }.inject { |a,b| a + b }
133
+ end
134
+
135
+ #
136
+ # returns a string of data such as
137
+ # "90406080406090447F"
138
+ #
139
+ def gets_data_s(*a)
140
+ arr = gets_bytestr
141
+ arr.map { |msg| msg[:data] }.join
142
+ end
143
+ alias_method :gets_data_bytestr, :gets_data_s
144
+ alias_method :gets_data_hex, :gets_data_s
145
+
146
+ # clears the buffer
147
+ def clear_buffer
148
+ @device.buffer.clear
149
+ end
150
+
151
+ # gets any messages in the buffer in the same format as CongruousApiInput#gets
152
+ def gets_buffer(*a)
153
+ @device.buffer
154
+ end
155
+
156
+ # gets any messages in the buffer in the same format as CongruousApiInput#gets_s
157
+ def gets_buffer_s(*a)
158
+ @device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }
159
+ end
160
+
161
+ # gets any messages in the buffer in the same format as CongruousApiInput#gets_data
162
+ def gets_buffer_data(*a)
163
+ @device.buffer.map { |msg| msg[:data] }
164
+ end
165
+
166
+ # returns all inputs
167
+ def self.all
168
+ @deference[self].all.map { |d| new(d) }
169
+ end
170
+
171
+ end
172
+
173
+ class CongruousApiOutput
174
+
175
+ include CongruousApiAdapter::Device
176
+ extend CongruousApiAdapter::Device::ClassMethods
177
+
178
+ # sends a message to the output. the message can be:
179
+ #
180
+ # bytes eg output.puts(0x90, 0x40, 0x40)
181
+ # an array of bytes eg output.puts([0x90, 0x40, 0x40])
182
+ # or a string eg output.puts("904040")
183
+ #
184
+ def puts(*a)
185
+ @device.puts(*a)
186
+ end
187
+
188
+ # sends a message to the output in a form of a string eg "904040". this method does not do
189
+ # type checking and therefore is more performant than puts
190
+ def puts_s(*a)
191
+ @device.puts_s(*a)
192
+ end
193
+ alias_method :puts_bytestr, :puts_s
194
+ alias_method :puts_hex, :puts_s
195
+
196
+ # sends a message to the output in a form of bytes eg output.puts_bytes(0x90, 0x40, 0x40).
197
+ # this method does not do type checking and therefore is more performant than puts
198
+ def puts_bytes(*a)
199
+ @device.puts_bytes(*a)
200
+ end
201
+
202
+ # returns all outputs
203
+ def self.all
204
+ @deference[self].all.map { |d| new(d) }
205
+ end
206
+
207
+ end
208
+
209
+ class CongruousApiDevice
210
+ extend CongruousApiAdapter::Device::ClassMethods
211
+ end
212
+
187
213
  end
@@ -1,35 +1,35 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- require 'singleton'
5
-
6
- module UniMIDI
7
-
8
- class Platform
9
-
10
- include Singleton
11
-
12
- attr_reader :interface
13
-
14
- def initialize
15
- lib = case RUBY_PLATFORM
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"
21
- end
22
- require("unimidi/adapter/#{lib}")
23
- @interface = case RUBY_PLATFORM
24
- when /darwin/ then CoreMIDIAdapter
25
- when /java/ then MIDIJRubyAdapter
26
- when /linux/ then AlsaRawMIDIAdapter
27
- when /mingw/ then MIDIWinMMAdapter
28
- when /win/ then MIDIWinMMAdapter
29
- end
30
- end
31
-
32
- end
33
-
34
- end
35
-
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'singleton'
5
+
6
+ module UniMIDI
7
+
8
+ class Platform
9
+
10
+ include Singleton
11
+
12
+ attr_reader :interface
13
+
14
+ def initialize
15
+ lib = case RUBY_PLATFORM
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"
21
+ end
22
+ require("unimidi/adapter/#{lib}")
23
+ @interface = case RUBY_PLATFORM
24
+ when /darwin/ then CoreMIDIAdapter
25
+ when /java/ then MIDIJRubyAdapter
26
+ when /linux/ then AlsaRawMIDIAdapter
27
+ when /mingw/ then MIDIWinMMAdapter
28
+ #when /win/ then MIDIWinMMAdapter
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ module UniMIDI
5
+
6
+ module TypeConversion
7
+
8
+ # byte array to string of hex bytes
9
+ def numeric_byte_array_to_hex_string(bytes)
10
+ bytes.map { |b| b.hex }.join
11
+ end
12
+
13
+ end
14
+
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unimidi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: i386-mingw32
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-09 00:00:00.000000000 -04:00
12
+ date: 2011-05-17 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: midi-winmm
17
- requirement: &9426360 !ruby/object:Gem::Requirement
17
+ requirement: &16122156 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,8 +22,8 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *9426360
26
- description: Platform Independent, realtime MIDI input and output for Ruby.
25
+ version_requirements: *16122156
26
+ description: Cross-Platform, realtime MIDI input and output for Ruby.
27
27
  email:
28
28
  - ari.russo@gmail.com
29
29
  executables: []
@@ -36,6 +36,7 @@ files:
36
36
  - lib/unimidi/adapter/midi-winmm.rb
37
37
  - lib/unimidi/congruous_api_adapter.rb
38
38
  - lib/unimidi/platform.rb
39
+ - lib/unimidi/type_conversion.rb
39
40
  - lib/unimidi.rb
40
41
  - LICENSE
41
42
  - README.rdoc
@@ -63,5 +64,5 @@ rubyforge_project: unimidi
63
64
  rubygems_version: 1.5.2
64
65
  signing_key:
65
66
  specification_version: 3
66
- summary: Realtime MIDI input and output for Ruby.
67
+ summary: Cross-Platform, realtime MIDI input and output for Ruby
67
68
  test_files: []