unimidi 0.1.14-i386-mingw32 → 0.2.0-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +12 -12
- data/README.rdoc +82 -63
- data/bin/unimidi +9 -9
- data/lib/unimidi.rb +31 -31
- data/lib/unimidi/adapter/alsa-rawmidi.rb +25 -25
- data/lib/unimidi/adapter/ffi-coremidi.rb +25 -25
- data/lib/unimidi/adapter/midi-jruby.rb +25 -25
- data/lib/unimidi/adapter/midi-winmm.rb +25 -25
- data/lib/unimidi/congruous_api_adapter.rb +226 -214
- data/lib/unimidi/platform.rb +35 -35
- data/lib/unimidi/type_conversion.rb +14 -14
- data/test/config.rb +15 -0
- data/test/helper.rb +72 -0
- data/test/test_input_buffer.rb +44 -0
- data/test/test_io.rb +117 -0
- data/test/test_platform.rb +35 -0
- metadata +45 -33
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.
|
data/README.rdoc
CHANGED
@@ -1,63 +1,82 @@
|
|
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
|
-
*
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
*
|
24
|
-
*
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
==
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
*
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
+
* No compilation required
|
11
|
+
* Both input and output to and from multiple devices concurrently
|
12
|
+
* Agnostically handle different MIDI and SysEx Message types
|
13
|
+
* (OSX Only) Internally patch to other programs using IAC and {MIDI Patch Bay}[http://www.apple.com/downloads/macosx/audio/midipatchbay.html]
|
14
|
+
|
15
|
+
== Requirements
|
16
|
+
|
17
|
+
Ruby 1.9.2 or JRuby 1.6.1 are strongly recommended
|
18
|
+
|
19
|
+
One of the following libraries is required based on what platform you're using. It should install automatically with the unimidi gem. In some uncommon cases, they will all install
|
20
|
+
|
21
|
+
Platform
|
22
|
+
|
23
|
+
* JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
|
24
|
+
* Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
|
25
|
+
* OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
|
26
|
+
* Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
|
27
|
+
|
28
|
+
== Install
|
29
|
+
|
30
|
+
gem install unimidi
|
31
|
+
|
32
|
+
== Usage
|
33
|
+
|
34
|
+
Here's a {blog post}[http://tx81z.blogspot.com/2011/06/unimidi-platform-independent-realtime.html] with a quick tutorial to {get started}[http://tx81z.blogspot.com/2011/06/unimidi-platform-independent-realtime.html].
|
35
|
+
|
36
|
+
Here's another {blog post}[http://tx81z.blogspot.com/2011/06/high-level-midi-io-with-ruby.html] that {explains how to do high-level messaging}[http://tx81z.blogspot.com/2011/06/high-level-midi-io-with-ruby.html]
|
37
|
+
|
38
|
+
In addition, some examples are included with the library
|
39
|
+
|
40
|
+
* {selecting a device}[http://github.com/arirusso/unimidi/blob/master/examples/select_a_device.rb]
|
41
|
+
* {input}[http://github.com/arirusso/unimidi/blob/master/examples/input.rb]
|
42
|
+
* {output}[http://github.com/arirusso/unimidi/blob/master/examples/output.rb]
|
43
|
+
|
44
|
+
{more examples}[http://github.com/arirusso/unimidi/blob/master/examples]
|
45
|
+
|
46
|
+
Here's another {blog post}[http://tx81z.blogspot.com/2011/06/osx-unimidi-and-midi-patch-bay.html] about {using unimidi with MIDI Patch Bay on OSX}[http://tx81z.blogspot.com/2011/06/osx-unimidi-and-midi-patch-bay.html]
|
47
|
+
|
48
|
+
== Tests
|
49
|
+
|
50
|
+
There are a set of generic tests which assume that an output is connected to an input. If you wish to run these tests, first edit {test/config.rb}[http://github.com/arirusso/unimidi/blob/master/test/config.rb] to configure it to your setup.
|
51
|
+
|
52
|
+
The tests can be run using
|
53
|
+
|
54
|
+
rake test
|
55
|
+
|
56
|
+
See below for additional notes on testing with JRuby
|
57
|
+
|
58
|
+
== Documentation
|
59
|
+
|
60
|
+
* {rdoc}[http://rdoc.info/gems/unimidi]
|
61
|
+
|
62
|
+
== Platform Specific Notes
|
63
|
+
|
64
|
+
==== JRuby
|
65
|
+
|
66
|
+
* 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
|
67
|
+
jruby --1.9 -S rake test
|
68
|
+
* javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
|
69
|
+
|
70
|
+
==== Linux
|
71
|
+
|
72
|
+
* libasound and libasound-dev packages are required
|
73
|
+
|
74
|
+
== Author
|
75
|
+
|
76
|
+
{Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
|
77
|
+
|
78
|
+
== License
|
79
|
+
|
80
|
+
Apache 2.0, See the file LICENSE
|
81
|
+
|
82
|
+
Copyright (c) 2010-2011 Ari Russo
|
data/bin/unimidi
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
-
|
4
|
-
require 'unimidi'
|
5
|
-
|
6
|
-
opts = ARGV.length > 1 ? ARGV.slice(1, ARGV.length-1) : {}
|
7
|
-
|
8
|
-
raise "No command specified" if ARGV.first.nil?
|
9
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
|
4
|
+
require 'unimidi'
|
5
|
+
|
6
|
+
opts = ARGV.length > 1 ? ARGV.slice(1, ARGV.length-1) : {}
|
7
|
+
|
8
|
+
raise "No command specified" if ARGV.first.nil?
|
9
|
+
|
10
10
|
UniMIDI.command(ARGV.first.to_sym, opts)
|
data/lib/unimidi.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
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.
|
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
|
-
|
23
|
-
def self.command(command, options = {})
|
24
|
-
if [:l, :list, :list_devices].include?(command)
|
25
|
-
require 'pp'
|
26
|
-
pp Device::all
|
27
|
-
else
|
28
|
-
raise "Command #{command.to_s} not found"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
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.2.0"
|
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
|
+
|
23
|
+
def self.command(command, options = {})
|
24
|
+
if [:l, :list, :list_devices].include?(command)
|
25
|
+
require 'pp'
|
26
|
+
pp Device::all
|
27
|
+
else
|
28
|
+
raise "Command #{command.to_s} not found"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,26 +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 < 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
|
-
|
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
|
+
|
26
26
|
end
|
@@ -1,26 +1,26 @@
|
|
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
|
-
|
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
|
+
|
26
26
|
end
|
@@ -1,26 +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 < 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
|
-
|
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
|
+
|
26
26
|
end
|
@@ -1,26 +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 < 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
|
-
|
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
|
+
|
26
26
|
end
|