unimidi 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +2 -2
- data/README.md +87 -0
- data/lib/unimidi.rb +11 -10
- data/lib/unimidi/adapter/alsa-rawmidi.rb +1 -4
- data/lib/unimidi/adapter/ffi-coremidi.rb +1 -4
- data/lib/unimidi/adapter/midi-jruby.rb +1 -4
- data/lib/unimidi/adapter/midi-winmm.rb +1 -4
- data/lib/unimidi/congruous_api_adapter.rb +25 -10
- data/lib/unimidi/platform.rb +0 -8
- data/lib/unimidi/type_conversion.rb +8 -6
- data/test/congruous_api_adapter_test.rb +36 -0
- data/test/helper.rb +77 -68
- data/test/{test_input_buffer.rb → input_buffer_test.rb} +2 -7
- data/test/{test_io.rb → io_test.rb} +2 -7
- data/test/{test_platform.rb → platform_test.rb} +2 -7
- data/test/{test_selectors.rb → selectors_test.rb} +2 -7
- data/test/type_conversion_test.rb +10 -0
- metadata +18 -65
- data/README.rdoc +0 -84
- data/bin/unimidi +0 -10
- data/test/test_congruous_api_adapter.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1a3cabe6bf779bac0a603b691c6cc7ecca461cd3
|
4
|
+
data.tar.gz: 54089b763c59265bcf3bcd461c4031b178b4508b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 44514e6ea421db707de0a1ece765921c4082419aa25ec09b9195ade67e03f4b02173d57fd1aef8b24564f14177f552c399fc495ab05880c1043f24f253c8211c
|
7
|
+
data.tar.gz: 8c2fbd60b0b34a21adfffffd3eaebea24bfe33cc7dfeddfa0fab0761642d60e47430b18ddf23336199091944f34f9a87f198efe8cb68568825238eae60afa760
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2010-
|
1
|
+
Copyright 2010-2013 Ari Russo
|
2
2
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
you may not use this file except in compliance with the License.
|
@@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
|
|
10
10
|
distributed under the License is distributed on an "AS IS" BASIS,
|
11
11
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
See the License for the specific language governing permissions and
|
13
|
-
limitations under the License.
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# UniMIDI
|
2
|
+
|
3
|
+
#### Platform independent realtime MIDI input and output for Ruby.
|
4
|
+
|
5
|
+
Also see [MicroMIDI](http://github.com/arirusso/micromidi) which builds a full MIDI messaging DSL on top of this library.
|
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) Use IAC to internally route MIDI to other programs
|
14
|
+
|
15
|
+
### Requirements
|
16
|
+
|
17
|
+
Using Ruby 1.9.2 or JRuby 1.6.1 (or newer) is strongly recommended. JRuby should be run in 1.9 mode where applicable
|
18
|
+
|
19
|
+
UniMIDI uses one of the following libraries, depending on which platform you're using it on. The necessary library 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
|
+
If you're using Bundler, add this line to your application's Gemfile:
|
31
|
+
|
32
|
+
`gem "unimidi"`
|
33
|
+
|
34
|
+
Otherwise...
|
35
|
+
|
36
|
+
`gem install unimidi`
|
37
|
+
|
38
|
+
### Usage
|
39
|
+
|
40
|
+
##### Blog Posts
|
41
|
+
|
42
|
+
* [What is UniMIDI?](http://tx81z.blogspot.com/2011/06/unimidi-platform-independent-realtime.html)
|
43
|
+
* [Selecting a device](http://tx81z.blogspot.com/2011/10/selecting-midi-device-with-unimidi.html)
|
44
|
+
* [Internally patching in OSX](http://tx81z.blogspot.com/2011/06/osx-unimidi-and-midi-patch-bay.html)
|
45
|
+
* [Using UniMIDI with MicroMIDI](http://tx81z.blogspot.com/2011/08/micromidi-ruby-dsl-for-midi.html)
|
46
|
+
|
47
|
+
In addition, some examples are included with the library
|
48
|
+
|
49
|
+
* [Selecting a device](http://github.com/arirusso/unimidi/blob/master/examples/select_a_device.rb)
|
50
|
+
* [MIDI input](http://github.com/arirusso/unimidi/blob/master/examples/input.rb)
|
51
|
+
* [MIDI output](http://github.com/arirusso/unimidi/blob/master/examples/output.rb)
|
52
|
+
* [MIDI Sysex output](http://github.com/arirusso/unimidi/blob/master/examples/sysex_output.rb)
|
53
|
+
|
54
|
+
### Tests
|
55
|
+
|
56
|
+
UniMIDI includes a set of tests which assume that an output is connected to an input. You will be asked to select which input and output as the test is run.
|
57
|
+
|
58
|
+
The tests can be run using
|
59
|
+
|
60
|
+
`rake test`
|
61
|
+
|
62
|
+
See below for additional notes on testing with JRuby
|
63
|
+
|
64
|
+
### Documentation
|
65
|
+
|
66
|
+
[rdoc](http://rdoc.info/gems/unimidi)
|
67
|
+
|
68
|
+
### Platform Specific Notes
|
69
|
+
|
70
|
+
##### JRuby
|
71
|
+
|
72
|
+
* 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 `jruby --1.9 -S rake test`
|
73
|
+
* javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
|
74
|
+
|
75
|
+
##### Linux
|
76
|
+
|
77
|
+
* *libasound* and *libasound-dev* packages are required
|
78
|
+
|
79
|
+
### Author
|
80
|
+
|
81
|
+
[Ari Russo](http://github.com/arirusso) <ari.russo at gmail.com>
|
82
|
+
|
83
|
+
### License
|
84
|
+
|
85
|
+
Apache 2.0, See the file LICENSE
|
86
|
+
|
87
|
+
Copyright (c) 2010-2013 Ari Russo
|
data/lib/unimidi.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
1
|
# A realtime MIDI interface for Ruby
|
4
|
-
# (c)2010-
|
5
|
-
#
|
6
|
-
|
2
|
+
# (c)2010-2013 Ari Russo and licensed under the Apache 2.0 License
|
7
3
|
module UniMIDI
|
8
4
|
|
9
|
-
VERSION = "0.3.
|
5
|
+
VERSION = "0.3.4"
|
10
6
|
|
11
7
|
end
|
12
8
|
|
13
|
-
|
9
|
+
# libs
|
10
|
+
require "forwardable"
|
11
|
+
require "singleton"
|
12
|
+
|
13
|
+
# modules
|
14
|
+
require "unimidi/congruous_api_adapter"
|
15
|
+
require "unimidi/type_conversion"
|
14
16
|
|
15
|
-
|
16
|
-
require
|
17
|
-
require 'unimidi/type_conversion'
|
17
|
+
# classes
|
18
|
+
require "unimidi/platform"
|
18
19
|
|
19
20
|
module UniMIDI
|
20
21
|
extend(Platform.instance.interface)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
|
4
1
|
module UniMIDI
|
5
2
|
|
6
3
|
module CongruousApiAdapter
|
@@ -28,7 +25,10 @@ module UniMIDI
|
|
28
25
|
close
|
29
26
|
end
|
30
27
|
else
|
31
|
-
|
28
|
+
at_exit do
|
29
|
+
close
|
30
|
+
end
|
31
|
+
self
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -49,12 +49,23 @@ module UniMIDI
|
|
49
49
|
end
|
50
50
|
|
51
51
|
module ClassMethods
|
52
|
-
|
53
|
-
|
52
|
+
|
53
|
+
include Enumerable
|
54
|
+
|
55
|
+
def each(&block)
|
56
|
+
all.each { |device| yield(device) }
|
57
|
+
end
|
58
|
+
|
59
|
+
# Prints ids and names of each device to the console
|
54
60
|
def list
|
55
61
|
all.each { |device| puts(device.pretty_name) }
|
56
62
|
end
|
57
|
-
|
63
|
+
|
64
|
+
# Shortcut to get a device by its name
|
65
|
+
def find_by_name(name)
|
66
|
+
all.find { |device| name == device.name }
|
67
|
+
end
|
68
|
+
|
58
69
|
# streamlined console prompt that asks the user to select a device
|
59
70
|
def gets(&block)
|
60
71
|
device = nil
|
@@ -140,7 +151,11 @@ module UniMIDI
|
|
140
151
|
private
|
141
152
|
|
142
153
|
def ensure_initialized
|
143
|
-
populate
|
154
|
+
populate unless initialized?
|
155
|
+
end
|
156
|
+
|
157
|
+
def initialized?
|
158
|
+
instance_variable_defined?(:@devices) && !@devices.nil?
|
144
159
|
end
|
145
160
|
|
146
161
|
def use_device(device, &block)
|
@@ -210,7 +225,7 @@ module UniMIDI
|
|
210
225
|
#
|
211
226
|
def gets_data(*a)
|
212
227
|
arr = gets
|
213
|
-
arr.map { |msg| msg[:data] }.inject
|
228
|
+
arr.map { |msg| msg[:data] }.inject(:+)
|
214
229
|
end
|
215
230
|
|
216
231
|
#
|
@@ -303,4 +318,4 @@ module UniMIDI
|
|
303
318
|
extend CongruousApiAdapter::Device::ClassMethods
|
304
319
|
end
|
305
320
|
|
306
|
-
end
|
321
|
+
end
|
data/lib/unimidi/platform.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
|
4
|
-
require 'singleton'
|
5
|
-
|
6
1
|
module UniMIDI
|
7
2
|
|
8
3
|
class Platform
|
@@ -17,7 +12,6 @@ module UniMIDI
|
|
17
12
|
when /java/ then "midi-jruby"
|
18
13
|
when /linux/ then "alsa-rawmidi"
|
19
14
|
when /mingw/ then "midi-winmm"
|
20
|
-
#when /win/ then "midi-winmm"
|
21
15
|
end
|
22
16
|
require("unimidi/adapter/#{lib}")
|
23
17
|
@interface = case RUBY_PLATFORM
|
@@ -25,11 +19,9 @@ module UniMIDI
|
|
25
19
|
when /java/ then MIDIJRubyAdapter
|
26
20
|
when /linux/ then AlsaRawMIDIAdapter
|
27
21
|
when /mingw/ then MIDIWinMMAdapter
|
28
|
-
#when /win/ then MIDIWinMMAdapter
|
29
22
|
end
|
30
23
|
end
|
31
24
|
|
32
25
|
end
|
33
26
|
|
34
27
|
end
|
35
|
-
|
@@ -1,15 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
|
4
1
|
module UniMIDI
|
5
2
|
|
3
|
+
# Utility module for converting between different data formats
|
6
4
|
module TypeConversion
|
5
|
+
|
6
|
+
extend self
|
7
7
|
|
8
|
-
#
|
8
|
+
# Convert an array of numeric bytes to string of hex bytes
|
9
|
+
# @param [Array<Fixnum>] byte An array of numeric bytes eg [0x90, 0x40, 0x40]
|
10
|
+
# @return [String] A string of hex bytes eg "904040"
|
9
11
|
def numeric_byte_array_to_hex_string(bytes)
|
10
|
-
bytes.map { |b| b.
|
12
|
+
bytes.map { |b| b.to_s(16) }.join
|
11
13
|
end
|
12
14
|
|
13
15
|
end
|
14
16
|
|
15
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class CongruousApiAdapterTest < UniMIDI::TestCase
|
4
|
+
|
5
|
+
def test_input_type
|
6
|
+
input = $test_device[:input]
|
7
|
+
assert_equal(:input, input.type)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_output_type
|
11
|
+
output = $test_device[:output]
|
12
|
+
assert_equal(:output, output.type)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_count
|
16
|
+
count = 0
|
17
|
+
Input.all.each do |input|
|
18
|
+
count += 1
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_equal count, Input.count
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_find_by_name
|
25
|
+
index = rand(0..(Input.count-1))
|
26
|
+
input = Input.all[index]
|
27
|
+
selected_input = Input.find_by_name(input.name)
|
28
|
+
assert_equal input, selected_input
|
29
|
+
|
30
|
+
output = rand(0..(Output.count-1))
|
31
|
+
output = Output.all[index]
|
32
|
+
selected_input = Input.find_by_name(input.name)
|
33
|
+
assert_equal input, selected_input
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,82 +1,91 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
dir = File.dirname(File.expand_path(__FILE__))
|
4
2
|
$LOAD_PATH.unshift dir + '/../lib'
|
5
3
|
|
6
4
|
require 'test/unit'
|
7
5
|
require 'unimidi'
|
8
6
|
|
9
|
-
module
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
$test_device
|
7
|
+
module UniMIDI
|
8
|
+
|
9
|
+
module TestHelper
|
10
|
+
|
11
|
+
TestSysex = !RUBY_PLATFORM.include?("java")
|
12
|
+
|
13
|
+
def self.select_devices
|
14
|
+
$test_device ||= {}
|
15
|
+
{ :input => UniMIDI::Input, :output => UniMIDI::Output }.each do |type, klass|
|
16
|
+
$test_device[type] = klass.gets
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def platform_test(adapter, mod, device_class = nil, input_class = nil, output_class = nil)
|
21
|
+
device_class ||= mod::Device
|
22
|
+
input_class ||= mod::Input
|
23
|
+
output_class ||= mod::Output
|
24
|
+
assert_equal(adapter, UniMIDI::Platform.instance.interface)
|
25
|
+
assert_not_same(input_class, UniMIDI::Input)
|
26
|
+
assert_not_same(output_class, UniMIDI::Output)
|
27
|
+
assert_not_same(device_class, UniMIDI::Device)
|
28
|
+
assert_equal(input_class.first.name, UniMIDI::Input.first.name)
|
29
|
+
assert_equal(input_class.first.id, UniMIDI::Input.first.id)
|
30
|
+
assert_not_same(output_class.first, UniMIDI::Output.first)
|
31
|
+
assert_equal(output_class.first.name, UniMIDI::Output.first.name)
|
32
|
+
assert_equal(output_class.first.id, UniMIDI::Output.first.id)
|
17
33
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
device_class ||= mod::Device
|
22
|
-
input_class ||= mod::Input
|
23
|
-
output_class ||= mod::Output
|
24
|
-
assert_equal(adapter, UniMIDI::Platform.instance.interface)
|
25
|
-
assert_not_same(input_class, UniMIDI::Input)
|
26
|
-
assert_not_same(output_class, UniMIDI::Output)
|
27
|
-
assert_not_same(device_class, UniMIDI::Device)
|
28
|
-
assert_equal(input_class.first.name, UniMIDI::Input.first.name)
|
29
|
-
assert_equal(input_class.first.id, UniMIDI::Input.first.id)
|
30
|
-
assert_not_same(output_class.first, UniMIDI::Output.first)
|
31
|
-
assert_equal(output_class.first.name, UniMIDI::Output.first.name)
|
32
|
-
assert_equal(output_class.first.id, UniMIDI::Output.first.id)
|
33
|
-
end
|
34
|
-
|
35
|
-
def bytestrs_to_ints(arr)
|
36
|
-
data = arr.map { |m| m[:data] }.join
|
34
|
+
|
35
|
+
def bytestrs_to_ints(arr)
|
36
|
+
data = arr.map { |m| m[:data] }.join
|
37
37
|
output = []
|
38
38
|
until (bytestr = data.slice!(0,2)).eql?("")
|
39
39
|
output << bytestr.hex
|
40
40
|
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
class MIDIObj
|
45
|
-
def initialize(*bytes)
|
46
|
-
@bytes = bytes
|
41
|
+
output
|
47
42
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
43
|
+
|
44
|
+
class MIDIObj
|
45
|
+
def initialize(*bytes)
|
46
|
+
@bytes = bytes
|
47
|
+
end
|
48
|
+
def to_bytes
|
49
|
+
@bytes
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# some MIDI messages
|
54
|
+
VariousMIDIObjects = [
|
55
|
+
TestSysex ? MIDIObj.new(0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7) : nil, # SysEx
|
56
|
+
MIDIObj.new(0x90, 100, 100), # note on
|
57
|
+
MIDIObj.new(0x90, 43, 100), # note on
|
58
|
+
MIDIObj.new(0x90, 76, 100), # note on
|
59
|
+
MIDIObj.new(0x90, 60, 100), # note on
|
60
|
+
MIDIObj.new(0x80, 100, 100) # note off
|
61
|
+
].compact
|
62
|
+
|
63
|
+
# some MIDI messages
|
64
|
+
VariousMIDIMessages = [
|
65
|
+
TestSysex ? [0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7] : nil, # SysEx
|
66
|
+
[0x90, 100, 100], # note on
|
67
|
+
[0x90, 43, 100], # note on
|
68
|
+
[0x90, 76, 100], # note on
|
69
|
+
[0x90, 60, 100], # note on
|
70
|
+
[0x80, 100, 100] # note off
|
71
|
+
].compact
|
72
|
+
|
73
|
+
# some MIDI messages
|
74
|
+
VariousMIDIByteStrMessages = [
|
75
|
+
TestSysex ? "F04110421240007F0041F7" : nil, # SysEx
|
76
|
+
"906440", # note on
|
77
|
+
"804340" # note off
|
78
|
+
].compact
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
class TestCase < Test::Unit::TestCase
|
83
|
+
|
84
|
+
include UniMIDI
|
85
|
+
include TestHelper
|
86
|
+
|
87
|
+
end
|
88
|
+
|
80
89
|
end
|
81
90
|
|
82
|
-
TestHelper.select_devices
|
91
|
+
UniMIDI::TestHelper.select_devices
|
@@ -1,11 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'helper'
|
4
2
|
|
5
|
-
class InputBufferTest <
|
6
|
-
|
7
|
-
include UniMIDI
|
8
|
-
include TestHelper
|
3
|
+
class InputBufferTest < UniMIDI::TestCase
|
9
4
|
|
10
5
|
def test_input_buffer
|
11
6
|
sleep(1)
|
@@ -42,4 +37,4 @@ class InputBufferTest < Test::Unit::TestCase
|
|
42
37
|
end
|
43
38
|
end
|
44
39
|
|
45
|
-
end
|
40
|
+
end
|
@@ -1,11 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'helper'
|
4
2
|
|
5
|
-
class IoTest <
|
6
|
-
|
7
|
-
include UniMIDI
|
8
|
-
include TestHelper
|
3
|
+
class IoTest < UniMIDI::TestCase
|
9
4
|
|
10
5
|
# ** this test assumes that TestOutput is connected to TestInput
|
11
6
|
def test_full_io
|
@@ -117,4 +112,4 @@ class IoTest < Test::Unit::TestCase
|
|
117
112
|
end
|
118
113
|
end
|
119
114
|
|
120
|
-
end
|
115
|
+
end
|
@@ -1,11 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'helper'
|
4
2
|
|
5
|
-
class PlatformTest <
|
6
|
-
|
7
|
-
include UniMIDI
|
8
|
-
include TestHelper
|
3
|
+
class PlatformTest < UniMIDI::TestCase
|
9
4
|
|
10
5
|
def test_jruby
|
11
6
|
if RUBY_PLATFORM.include?("java")
|
@@ -31,4 +26,4 @@ class PlatformTest < Test::Unit::TestCase
|
|
31
26
|
end
|
32
27
|
end
|
33
28
|
|
34
|
-
end
|
29
|
+
end
|
@@ -1,11 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'helper'
|
4
2
|
|
5
|
-
class SelectorTest <
|
6
|
-
|
7
|
-
include UniMIDI
|
8
|
-
include TestHelper
|
3
|
+
class SelectorTest < UniMIDI::TestCase
|
9
4
|
|
10
5
|
def test_first
|
11
6
|
i = Input.first
|
@@ -61,4 +56,4 @@ class SelectorTest < Test::Unit::TestCase
|
|
61
56
|
assert_equal(Device.all_by_type[:input], Input.all)
|
62
57
|
end
|
63
58
|
|
64
|
-
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,69 +1,25 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimidi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ari Russo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: alsa-rawmidi
|
16
|
-
requirement: &70130345865340 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *70130345865340
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: ffi-coremidi
|
27
|
-
requirement: &70130345864640 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70130345864640
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: midi-jruby
|
38
|
-
requirement: &70130345861000 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70130345861000
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: midi-winmm
|
49
|
-
requirement: &70130345860460 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *70130345860460
|
11
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
58
13
|
description: Platform Independent, realtime MIDI input and output for Ruby
|
59
14
|
email:
|
60
15
|
- ari.russo@gmail.com
|
61
|
-
executables:
|
62
|
-
- unimidi
|
16
|
+
executables: []
|
63
17
|
extensions: []
|
64
18
|
extra_rdoc_files: []
|
65
19
|
files:
|
66
|
-
-
|
20
|
+
- LICENSE
|
21
|
+
- README.md
|
22
|
+
- lib/unimidi.rb
|
67
23
|
- lib/unimidi/adapter/alsa-rawmidi.rb
|
68
24
|
- lib/unimidi/adapter/ffi-coremidi.rb
|
69
25
|
- lib/unimidi/adapter/midi-jruby.rb
|
@@ -71,37 +27,34 @@ files:
|
|
71
27
|
- lib/unimidi/congruous_api_adapter.rb
|
72
28
|
- lib/unimidi/platform.rb
|
73
29
|
- lib/unimidi/type_conversion.rb
|
74
|
-
-
|
30
|
+
- test/congruous_api_adapter_test.rb
|
75
31
|
- test/helper.rb
|
76
|
-
- test/
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/
|
80
|
-
- test/
|
81
|
-
- LICENSE
|
82
|
-
- README.rdoc
|
32
|
+
- test/input_buffer_test.rb
|
33
|
+
- test/io_test.rb
|
34
|
+
- test/platform_test.rb
|
35
|
+
- test/selectors_test.rb
|
36
|
+
- test/type_conversion_test.rb
|
83
37
|
homepage: http://github.com/arirusso/unimidi
|
84
38
|
licenses: []
|
39
|
+
metadata: {}
|
85
40
|
post_install_message:
|
86
41
|
rdoc_options: []
|
87
42
|
require_paths:
|
88
43
|
- lib
|
89
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
45
|
requirements:
|
92
|
-
- -
|
46
|
+
- - ">="
|
93
47
|
- !ruby/object:Gem::Version
|
94
48
|
version: '0'
|
95
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
50
|
requirements:
|
98
|
-
- -
|
51
|
+
- - ">="
|
99
52
|
- !ruby/object:Gem::Version
|
100
53
|
version: 1.3.6
|
101
54
|
requirements: []
|
102
55
|
rubyforge_project: unimidi
|
103
|
-
rubygems_version:
|
56
|
+
rubygems_version: 2.2.2
|
104
57
|
signing_key:
|
105
|
-
specification_version:
|
58
|
+
specification_version: 4
|
106
59
|
summary: Realtime MIDI input and output for Ruby
|
107
60
|
test_files: []
|
data/README.rdoc
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
= UniMIDI
|
2
|
-
|
3
|
-
== Summary
|
4
|
-
|
5
|
-
Platform independent realtime MIDI input and output for Ruby.
|
6
|
-
|
7
|
-
Also see {micromidi}[http://github.com/arirusso/micromidi] which builds a full MIDI messaging DSL on top of unimidi
|
8
|
-
|
9
|
-
== Features
|
10
|
-
|
11
|
-
* Supports Linux, JRuby, OSX, Windows and Cygwin
|
12
|
-
* No compilation required
|
13
|
-
* Both input and output to and from multiple devices concurrently
|
14
|
-
* Agnostically handle different MIDI and SysEx Message types
|
15
|
-
* (OSX Only) Use IAC to internally route MIDI to other programs
|
16
|
-
|
17
|
-
== Requirements
|
18
|
-
|
19
|
-
Using Ruby 1.9.2 or JRuby 1.6.1 (or newer) is strongly recommended. JRuby should be run in 1.9 mode
|
20
|
-
|
21
|
-
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
|
22
|
-
|
23
|
-
Platform
|
24
|
-
|
25
|
-
* JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
|
26
|
-
* Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
|
27
|
-
* OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
|
28
|
-
* Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
|
29
|
-
|
30
|
-
== Install
|
31
|
-
|
32
|
-
gem install unimidi
|
33
|
-
|
34
|
-
== Usage
|
35
|
-
|
36
|
-
==== Blog Posts
|
37
|
-
|
38
|
-
* {general tutorial}[http://tx81z.blogspot.com/2011/06/unimidi-platform-independent-realtime.html]
|
39
|
-
* {selecting a device}[http://tx81z.blogspot.com/2011/10/selecting-midi-device-with-unimidi.html]
|
40
|
-
* {internally patching in OSX}[http://tx81z.blogspot.com/2011/06/osx-unimidi-and-midi-patch-bay.html]
|
41
|
-
* {with MicroMIDI DSL}[http://tx81z.blogspot.com/2011/08/micromidi-ruby-dsl-for-midi.html]
|
42
|
-
|
43
|
-
In addition, some examples are included with the library
|
44
|
-
|
45
|
-
* {selecting a device}[http://github.com/arirusso/unimidi/blob/master/examples/select_a_device.rb]
|
46
|
-
* {input}[http://github.com/arirusso/unimidi/blob/master/examples/input.rb]
|
47
|
-
* {output}[http://github.com/arirusso/unimidi/blob/master/examples/output.rb]
|
48
|
-
* {sysex output}[http://github.com/arirusso/unimidi/blob/master/examples/sysex_output.rb]
|
49
|
-
|
50
|
-
== Tests
|
51
|
-
|
52
|
-
There are a set of tests which assume that an output is connected to an input. You will be asked to select which input and output as the test is run.
|
53
|
-
|
54
|
-
The tests can be run using
|
55
|
-
|
56
|
-
rake test
|
57
|
-
|
58
|
-
See below for additional notes on testing with JRuby
|
59
|
-
|
60
|
-
== Documentation
|
61
|
-
|
62
|
-
* {rdoc}[http://rdoc.info/gems/unimidi]
|
63
|
-
|
64
|
-
== Platform Specific Notes
|
65
|
-
|
66
|
-
==== JRuby
|
67
|
-
|
68
|
-
* 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
|
69
|
-
jruby --1.9 -S rake test
|
70
|
-
* javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
|
71
|
-
|
72
|
-
==== Linux
|
73
|
-
|
74
|
-
* libasound and libasound-dev packages are required
|
75
|
-
|
76
|
-
== Author
|
77
|
-
|
78
|
-
{Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
|
79
|
-
|
80
|
-
== License
|
81
|
-
|
82
|
-
Apache 2.0, See the file LICENSE
|
83
|
-
|
84
|
-
Copyright (c) 2010-2011 Ari Russo
|
data/bin/unimidi
DELETED
@@ -1,10 +0,0 @@
|
|
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
|
-
UniMIDI.command(ARGV.first.to_sym, opts)
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
class CongruousApiAdapterTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
include UniMIDI
|
8
|
-
include TestHelper
|
9
|
-
|
10
|
-
def test_input_type
|
11
|
-
i = $test_device[:input]
|
12
|
-
assert_equal(:input, i.type)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_output_type
|
16
|
-
o = $test_device[:output]
|
17
|
-
assert_equal(:output, o.type)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|