unimidi 0.2.1-java → 0.2.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/unimidi.rb +1 -1
- data/lib/unimidi/adapter/ffi-coremidi.rb +1 -1
- data/lib/unimidi/congruous_api_adapter.rb +9 -0
- data/test/helper.rb +21 -2
- data/test/test_input_buffer.rb +3 -4
- data/test/test_io.rb +6 -7
- data/test/test_platform.rb +1 -2
- metadata +28 -38
- data/test/config.rb +0 -15
data/README.rdoc
CHANGED
@@ -14,7 +14,7 @@ Platform independent realtime MIDI input and output for Ruby.
|
|
14
14
|
|
15
15
|
== Requirements
|
16
16
|
|
17
|
-
Ruby 1.9.2 or JRuby 1.6.1
|
17
|
+
Using Ruby 1.9.2 or JRuby 1.6.1 (or newer) is strongly recommended. JRuby should be run in 1.9 mode
|
18
18
|
|
19
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
20
|
|
@@ -47,7 +47,7 @@ Here's another {blog post}[http://tx81z.blogspot.com/2011/06/osx-unimidi-and-mid
|
|
47
47
|
|
48
48
|
== Tests
|
49
49
|
|
50
|
-
There are a set of
|
50
|
+
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.
|
51
51
|
|
52
52
|
The tests can be run using
|
53
53
|
|
data/lib/unimidi.rb
CHANGED
@@ -27,6 +27,10 @@ module UniMIDI
|
|
27
27
|
self
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
def pretty_name
|
32
|
+
"#{id}: #{name}"
|
33
|
+
end
|
30
34
|
|
31
35
|
# close the device
|
32
36
|
def close(*a)
|
@@ -60,6 +64,11 @@ module UniMIDI
|
|
60
64
|
def all
|
61
65
|
all_by_type.values.flatten
|
62
66
|
end
|
67
|
+
|
68
|
+
# returns the device at <em>index</em>
|
69
|
+
def [](index)
|
70
|
+
all[index]
|
71
|
+
end
|
63
72
|
|
64
73
|
# returns all devices as a hash as such
|
65
74
|
# { :input => [input devices], :output => [output devices] }
|
data/test/helper.rb
CHANGED
@@ -8,7 +8,26 @@ require 'unimidi'
|
|
8
8
|
|
9
9
|
module TestHelper
|
10
10
|
|
11
|
-
TestSysex = !RUBY_PLATFORM.include?("java")
|
11
|
+
TestSysex = !RUBY_PLATFORM.include?("java")
|
12
|
+
|
13
|
+
def self.select_devices
|
14
|
+
$test_device ||= {}
|
15
|
+
{ :input => UniMIDI::Input.all, :output => UniMIDI::Output.all }.each do |type, devs|
|
16
|
+
puts ""
|
17
|
+
puts "select an #{type.to_s}..."
|
18
|
+
while $test_device[type].nil?
|
19
|
+
devs.each do |device|
|
20
|
+
puts device.pretty_name
|
21
|
+
end
|
22
|
+
selection = $stdin.gets.chomp
|
23
|
+
if selection != ""
|
24
|
+
selection = selection.to_i
|
25
|
+
$test_device[type] = devs.find { |d| d.id == selection }
|
26
|
+
puts "selected #{selection} for #{type.to_s}" unless $test_device[type]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
12
31
|
|
13
32
|
def platform_test(adapter, mod)
|
14
33
|
assert_equal(adapter, UniMIDI::Platform.instance.interface)
|
@@ -69,4 +88,4 @@ module TestHelper
|
|
69
88
|
|
70
89
|
end
|
71
90
|
|
72
|
-
|
91
|
+
TestHelper.select_devices
|
data/test/test_input_buffer.rb
CHANGED
@@ -6,16 +6,15 @@ class InputBufferTest < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
include UniMIDI
|
8
8
|
include TestHelper
|
9
|
-
|
10
|
-
|
9
|
+
|
11
10
|
def test_input_buffer
|
12
11
|
sleep(1)
|
13
12
|
|
14
13
|
messages = VariousMIDIMessages
|
15
14
|
bytes = []
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
$test_device[:output].open do |output|
|
17
|
+
$test_device[:input].open do |input|
|
19
18
|
|
20
19
|
messages.each do |msg|
|
21
20
|
|
data/test/test_io.rb
CHANGED
@@ -6,7 +6,6 @@ class IoTest < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
include UniMIDI
|
8
8
|
include TestHelper
|
9
|
-
include TestHelper::Config # before running these tests, adjust the constants in config.rb to suit your hardware setup
|
10
9
|
|
11
10
|
# ** this test assumes that TestOutput is connected to TestInput
|
12
11
|
def test_full_io
|
@@ -15,8 +14,8 @@ class IoTest < Test::Unit::TestCase
|
|
15
14
|
messages_arr = messages.inject { |a,b| a+b }.flatten
|
16
15
|
received_arr = []
|
17
16
|
pointer = 0
|
18
|
-
|
19
|
-
|
17
|
+
$test_device[:output].open do |output|
|
18
|
+
$test_device[:input].open do |input|
|
20
19
|
|
21
20
|
messages.each do |msg|
|
22
21
|
|
@@ -52,8 +51,8 @@ class IoTest < Test::Unit::TestCase
|
|
52
51
|
received_str = ""
|
53
52
|
pointer = 0
|
54
53
|
|
55
|
-
|
56
|
-
|
54
|
+
$test_device[:output].open do |output|
|
55
|
+
$test_device[:input].open do |input|
|
57
56
|
|
58
57
|
messages.each do |msg|
|
59
58
|
|
@@ -86,8 +85,8 @@ class IoTest < Test::Unit::TestCase
|
|
86
85
|
messages_arr = messages.map { |m| m.to_bytes }.flatten
|
87
86
|
received_arr = []
|
88
87
|
pointer = 0
|
89
|
-
|
90
|
-
|
88
|
+
$test_device[:output].open do |output|
|
89
|
+
$test_device[:input].open do |input|
|
91
90
|
|
92
91
|
messages.each do |msg|
|
93
92
|
|
data/test/test_platform.rb
CHANGED
metadata
CHANGED
@@ -1,39 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimidi
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.1
|
6
6
|
platform: java
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ari Russo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-26 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: midi-jruby
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &81210930 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :runtime
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *81210930
|
27
25
|
description: Platform Independent, realtime MIDI input and output for Ruby
|
28
|
-
email:
|
26
|
+
email:
|
29
27
|
- ari.russo@gmail.com
|
30
|
-
executables:
|
28
|
+
executables:
|
31
29
|
- unimidi
|
32
30
|
extensions: []
|
33
|
-
|
34
31
|
extra_rdoc_files: []
|
35
|
-
|
36
|
-
files:
|
32
|
+
files:
|
37
33
|
- bin/unimidi
|
38
34
|
- lib/unimidi.rb
|
39
35
|
- lib/unimidi/adapter/ffi-coremidi.rb
|
@@ -44,39 +40,33 @@ files:
|
|
44
40
|
- lib/unimidi/platform.rb
|
45
41
|
- lib/unimidi/type_conversion.rb
|
46
42
|
- test/helper.rb
|
47
|
-
- test/config.rb
|
48
43
|
- test/test_io.rb
|
49
44
|
- test/test_input_buffer.rb
|
50
45
|
- test/test_platform.rb
|
51
46
|
- LICENSE
|
52
47
|
- README.rdoc
|
53
|
-
has_rdoc: true
|
54
48
|
homepage: http://github.com/arirusso/unimidi
|
55
49
|
licenses: []
|
56
|
-
|
57
50
|
post_install_message:
|
58
51
|
rdoc_options: []
|
59
|
-
|
60
|
-
require_paths:
|
52
|
+
require_paths:
|
61
53
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
55
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
61
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
73
65
|
version: 1.3.6
|
74
66
|
requirements: []
|
75
|
-
|
76
67
|
rubyforge_project: unimidi
|
77
|
-
rubygems_version: 1.
|
68
|
+
rubygems_version: 1.8.7
|
78
69
|
signing_key:
|
79
70
|
specification_version: 3
|
80
71
|
summary: Realtime MIDI input and output for Ruby
|
81
72
|
test_files: []
|
82
|
-
|
data/test/config.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
module TestHelper::Config
|
4
|
-
|
5
|
-
# adjust these constants to suit your hardware configuration
|
6
|
-
# before running tests
|
7
|
-
|
8
|
-
TestInput = UniMIDI::Input.first # this is the device you wish to use to test input
|
9
|
-
TestOutput = UniMIDI::Output.first # likewise for output
|
10
|
-
|
11
|
-
puts "connect #{TestInput.name} (#{TestInput.id}) to #{TestOutput.name} (#{TestOutput.id}) and press enter"
|
12
|
-
$stdin.gets.chomp
|
13
|
-
|
14
|
-
end
|
15
|
-
|