unimidi 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa827114029d69f1567ba44b38c9ba4247849722
4
- data.tar.gz: a6f6e46bcf1f1a6b8bd6fc3d01c668b73c65c5e1
3
+ metadata.gz: a4f3cb4ead6e1ac868f749c5cf2dda0efa6e7b49
4
+ data.tar.gz: aa339b94d2f2f8cc50270c87928be812936dbeb8
5
5
  SHA512:
6
- metadata.gz: bb35485c5cd885ef8f58bad93adb17a94079885ac3b4b0bed8801c77059025d6e7078589f05a0bea85f8284c59f96bbfeef7c01d17e4f1e6e4a50cfa4fddc40b
7
- data.tar.gz: b084ffb6e4829d4fb08b33169c03247dd9f4e8ec2e8ed22341194bc2f91fd24f56507e0b02a1fa69006d085383db9eae4e6aebe8d71ad10a826e87dfcfe0d5dd
6
+ metadata.gz: e2002458e871943b6021f2d2266d6e282d4ed03d3e111c0169c08778ab8222391742e6fa5305de44ecb18157141a1efa95ecc5f034ee9fb3b2a2c65f74338d94
7
+ data.tar.gz: 15f7796a4d71bcb8656950b8077fb7f6c14f179a8a3be23a85754ed937af5d936c1dc47b7bde03205ea1718f703e8ff676185947f306ef3c52c19e8e6754783b
@@ -17,7 +17,7 @@ require "unimidi/output"
17
17
 
18
18
  module UniMIDI
19
19
 
20
- VERSION = "0.4.5"
20
+ VERSION = "0.4.6"
21
21
 
22
22
  Platform.bootstrap
23
23
 
@@ -16,7 +16,7 @@ module UniMIDI
16
16
  # Prints ids and names of each device to the console
17
17
  # @return [Array<String>]
18
18
  def list
19
- all.map do |device|
19
+ all.map do |device|
20
20
  name = device.pretty_name
21
21
  puts(name)
22
22
  name
@@ -34,19 +34,19 @@ module UniMIDI
34
34
  # When their input is received, the device is selected and enabled
35
35
  def gets(&block)
36
36
  device = nil
37
- class_name = self.name.split("::").last.downcase
37
+ direction = get_direction
38
38
  puts ""
39
- puts "Select a MIDI #{class_name}..."
39
+ puts "Select a MIDI #{direction}..."
40
40
  while device.nil?
41
41
  list
42
42
  print "> "
43
43
  selection = $stdin.gets.chomp
44
44
  if selection != ""
45
45
  selection = Integer(selection) rescue nil
46
- device = all.find { |d| d.id == selection }
46
+ device = all.find { |d| d.id == selection } unless selection.nil?
47
47
  end
48
48
  end
49
- device.open(&block) unless device.enabled?
49
+ device.open(&block)
50
50
  device
51
51
  end
52
52
 
@@ -71,7 +71,7 @@ module UniMIDI
71
71
  when :last then all.size - 1
72
72
  else index
73
73
  end
74
- use_device(all[index], &block)
74
+ use_device(all[index], &block)
75
75
  end
76
76
  alias_method :open, :use
77
77
 
@@ -84,12 +84,18 @@ module UniMIDI
84
84
 
85
85
  private
86
86
 
87
+ # The direction of the device eg "input", "output"
88
+ # @return [String]
89
+ def get_direction
90
+ self.name.split("::").last.downcase
91
+ end
92
+
87
93
  # Enable the given device
88
94
  # @param [Input, Output] device
89
95
  # @return [Input, Output]
90
96
  def use_device(device, &block)
91
97
  device.open(&block) unless device.enabled?
92
- device
98
+ device
93
99
  end
94
100
 
95
101
  end
@@ -98,7 +104,7 @@ module UniMIDI
98
104
  module InstanceMethods
99
105
 
100
106
  # @param [AlsaRawMIDI::Input, AlsaRawMIDI::Output, CoreMIDI::Destination, CoreMIDI::Source, MIDIJRuby::Input, MIDIJRuby::Output, MIDIWinMM::Input, MIDIWinMM::Output] device
101
- def initialize(device)
107
+ def initialize(device)
102
108
  @device = device
103
109
  @enabled = false
104
110
 
@@ -125,8 +131,8 @@ module UniMIDI
125
131
  at_exit do
126
132
  close
127
133
  end
128
- self
129
134
  end
135
+ self
130
136
  end
131
137
 
132
138
  # A human readable display name for this device
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class UniMIDI::AdapterTest < Test::Unit::TestCase
3
+ class UniMIDI::AdapterTest < Minitest::Test
4
4
 
5
5
  context "Adapter" do
6
6
 
@@ -13,7 +13,7 @@ class UniMIDI::AdapterTest < Test::Unit::TestCase
13
13
 
14
14
  should "be an output" do
15
15
  output = TestHelper.devices[:output]
16
- assert_equal(:output, output.type)
16
+ assert_equal(:output, output.type)
17
17
  end
18
18
 
19
19
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class UniMIDI::ClassMethodsTest < Test::Unit::TestCase
3
+ class UniMIDI::ClassMethodsTest < Minitest::Test
4
4
 
5
5
  context "ClassMethods" do
6
6
 
@@ -30,7 +30,7 @@ class UniMIDI::ClassMethodsTest < Test::Unit::TestCase
30
30
  context "no block given" do
31
31
  should "return last input" do
32
32
  i = UniMIDI::Input.last
33
- assert_equal(UniMIDI::Input.all.last, i)
33
+ assert_equal(UniMIDI::Input.all.last, i)
34
34
  end
35
35
  end
36
36
 
@@ -38,9 +38,9 @@ class UniMIDI::ClassMethodsTest < Test::Unit::TestCase
38
38
  should "pass and return last input" do
39
39
  sleep(1)
40
40
  i = UniMIDI::Input.last do |i|
41
- assert_equal(true, i.enabled?)
41
+ assert_equal(true, i.enabled?)
42
42
  end
43
- assert_equal(UniMIDI::Input.all.last, i)
43
+ assert_equal(UniMIDI::Input.all.last, i)
44
44
  end
45
45
 
46
46
  end
@@ -62,10 +62,10 @@ class UniMIDI::ClassMethodsTest < Test::Unit::TestCase
62
62
  should "return and enable an input" do
63
63
  sleep(1)
64
64
  i = UniMIDI::Input.use(0) do |i|
65
- assert_equal(true, i.enabled?)
65
+ assert_equal(true, i.enabled?)
66
66
  end
67
67
  assert_equal(UniMIDI::Input.first, i)
68
- assert_equal(UniMIDI::Input.all.first, i)
68
+ assert_equal(UniMIDI::Input.all.first, i)
69
69
  end
70
70
 
71
71
  end
@@ -75,9 +75,9 @@ class UniMIDI::ClassMethodsTest < Test::Unit::TestCase
75
75
  should "return an enabled input" do
76
76
  sleep(1)
77
77
  input = UniMIDI::Input.use(:first)
78
- assert_equal(true, input.enabled?)
78
+ assert_equal(true, input.enabled?)
79
79
  assert_equal(UniMIDI::Input.first, input)
80
- assert_equal(UniMIDI::Input.all.first, input)
80
+ assert_equal(UniMIDI::Input.all.first, input)
81
81
  end
82
82
 
83
83
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class UniMIDI::FunctionalTest < Test::Unit::TestCase
3
+ class UniMIDI::FunctionalTest < Minitest::Test
4
4
 
5
5
  # ** these tests assume that TestOutput is connected to TestInput
6
6
  context "UniMIDI" do
@@ -1,7 +1,7 @@
1
1
  dir = File.dirname(File.expand_path(__FILE__))
2
2
  $LOAD_PATH.unshift dir + '/../lib'
3
3
 
4
- require "test/unit"
4
+ require "minitest/autorun"
5
5
  require "mocha/test_unit"
6
6
  require "shoulda-context"
7
7
  require "unimidi"
@@ -30,7 +30,7 @@ module TestHelper
30
30
  until (bytestr = data.slice!(0,2)).eql?("")
31
31
  output << bytestr.hex
32
32
  end
33
- output
33
+ output
34
34
  end
35
35
 
36
36
  class MIDIObj
@@ -40,7 +40,7 @@ module TestHelper
40
40
  def to_bytes
41
41
  @bytes
42
42
  end
43
- end
43
+ end
44
44
 
45
45
  def message_objects
46
46
  numeric_messages.map { |message| MIDIObj.new(*message) }
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class UniMIDI::InputTest < Test::Unit::TestCase
3
+ class UniMIDI::InputTest < Minitest::Test
4
4
 
5
5
  context "Input" do
6
6
 
@@ -27,7 +27,7 @@ class UniMIDI::InputTest < Test::Unit::TestCase
27
27
 
28
28
  p "sending: #{message}"
29
29
  @output.puts(message)
30
- @bytes += message
30
+ @bytes += message
31
31
  sleep(1)
32
32
  buffer = @input.buffer.map { |m| m[:data] }.flatten
33
33
  p "received: #{buffer}"
@@ -1,17 +1,17 @@
1
1
  require 'helper'
2
2
 
3
- class UniMIDI::PlatformTest < Test::Unit::TestCase
3
+ class UniMIDI::PlatformTest < Minitest::Test
4
4
 
5
5
  def platform_test(adapter, mod, device_class = nil, input_class = nil, output_class = nil)
6
6
  device_class ||= mod::Device
7
7
  input_class ||= mod::Input
8
8
  output_class ||= mod::Output
9
- assert_not_same(input_class, UniMIDI::Input)
10
- assert_not_same(output_class, UniMIDI::Output)
11
- assert_not_same(device_class, UniMIDI::Device)
9
+ refute_equal(input_class, UniMIDI::Input)
10
+ refute_equal(output_class, UniMIDI::Output)
11
+ refute_equal(device_class, UniMIDI::Device)
12
12
  assert_equal(input_class.first.name, UniMIDI::Input.first.name)
13
13
  assert_equal(input_class.first.id, UniMIDI::Input.first.id)
14
- assert_not_same(output_class.first, UniMIDI::Output.first)
14
+ refute_equal(output_class.first, UniMIDI::Output.first)
15
15
  assert_equal(output_class.first.name, UniMIDI::Output.first.name)
16
16
  assert_equal(output_class.first.id, UniMIDI::Output.first.id)
17
17
  end
@@ -27,20 +27,20 @@ class UniMIDI::PlatformTest < Test::Unit::TestCase
27
27
  should "recognize linux" do
28
28
  if RUBY_PLATFORM.include?("linux")
29
29
  platform_test(UniMIDI::Adapter::AlsaRawMIDI, ::AlsaRawMIDI)
30
- end
30
+ end
31
31
  end
32
32
 
33
33
  should "recognize osx" do
34
34
  if RUBY_PLATFORM.include?("darwin")
35
35
  platform_test(UniMIDI::Adapter::CoreMIDI, ::CoreMIDI, ::CoreMIDI::Endpoint, ::CoreMIDI::Source, ::CoreMIDI::Destination)
36
- end
36
+ end
37
37
  end
38
38
 
39
39
  should "recognize windows" do
40
40
  if RUBY_PLATFORM.include?("mingw")
41
41
  platform_test(UniMIDI::Adapter::MIDIWinMM, ::MIDIWinMM)
42
42
  end
43
- end
43
+ end
44
44
 
45
45
  end
46
46
 
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class UniMIDI::TypeConversionTest < Test::Unit::TestCase
3
+ class UniMIDI::TypeConversionTest < Minitest::Test
4
4
 
5
5
  context "TypeConversion" do
6
6
 
metadata CHANGED
@@ -1,71 +1,175 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unimidi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Russo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-05 00:00:00.000000000 Z
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: alsa-rawmidi
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.5'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.5.0
23
+ type: :development
24
+ prerelease: false
15
25
  version_requirements: !ruby/object:Gem::Requirement
16
26
  requirements:
17
- - - ~>
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.5'
30
+ - - ">="
18
31
  - !ruby/object:Gem::Version
19
- version: '0'
32
+ version: 5.5.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: mocha
20
35
  requirement: !ruby/object:Gem::Requirement
21
36
  requirements:
22
- - - ~>
37
+ - - "~>"
23
38
  - !ruby/object:Gem::Version
24
- version: '0'
39
+ version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.0
43
+ type: :development
25
44
  prerelease: false
26
- type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: ffi-coremidi
29
45
  version_requirements: !ruby/object:Gem::Requirement
30
46
  requirements:
31
- - - ~>
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.1'
50
+ - - ">="
32
51
  - !ruby/object:Gem::Version
33
- version: '0'
52
+ version: 1.1.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
34
55
  requirement: !ruby/object:Gem::Requirement
35
56
  requirements:
36
- - - ~>
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '10.4'
60
+ - - ">="
37
61
  - !ruby/object:Gem::Version
38
- version: '0'
62
+ version: 10.4.2
63
+ type: :development
39
64
  prerelease: false
40
- type: :runtime
41
- - !ruby/object:Gem::Dependency
42
- name: midi-jruby
43
65
  version_requirements: !ruby/object:Gem::Requirement
44
66
  requirements:
45
- - - ~>
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.4'
70
+ - - ">="
46
71
  - !ruby/object:Gem::Version
47
- version: '0'
72
+ version: 10.4.2
73
+ - !ruby/object:Gem::Dependency
74
+ name: shoulda-context
48
75
  requirement: !ruby/object:Gem::Requirement
49
76
  requirements:
50
- - - ~>
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '1.2'
80
+ - - ">="
51
81
  - !ruby/object:Gem::Version
52
- version: '0'
82
+ version: 1.2.1
83
+ type: :development
53
84
  prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.2'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 1.2.1
93
+ - !ruby/object:Gem::Dependency
94
+ name: alsa-rawmidi
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.3'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.3.1
54
103
  type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.3'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.3.1
55
113
  - !ruby/object:Gem::Dependency
56
- name: midi-winmm
114
+ name: ffi-coremidi
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.3'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.3.5
123
+ type: :runtime
124
+ prerelease: false
57
125
  version_requirements: !ruby/object:Gem::Requirement
58
126
  requirements:
59
- - - ~>
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.3'
130
+ - - ">="
60
131
  - !ruby/object:Gem::Version
61
- version: '0'
132
+ version: 0.3.5
133
+ - !ruby/object:Gem::Dependency
134
+ name: midi-jruby
62
135
  requirement: !ruby/object:Gem::Requirement
63
136
  requirements:
64
- - - ~>
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '0.1'
140
+ - - ">="
65
141
  - !ruby/object:Gem::Version
66
- version: '0'
142
+ version: 0.1.4
143
+ type: :runtime
67
144
  prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '0.1'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 0.1.4
153
+ - !ruby/object:Gem::Dependency
154
+ name: midi-winmm
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.1'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 0.1.10
68
163
  type: :runtime
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: '0.1'
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: 0.1.10
69
173
  description: Platform independent realtime MIDI input and output for Ruby
70
174
  email:
71
175
  - ari.russo@gmail.com
@@ -73,7 +177,13 @@ executables: []
73
177
  extensions: []
74
178
  extra_rdoc_files: []
75
179
  files:
180
+ - LICENSE
181
+ - README.md
76
182
  - lib/unimidi.rb
183
+ - lib/unimidi/adapter/alsa-rawmidi.rb
184
+ - lib/unimidi/adapter/ffi-coremidi.rb
185
+ - lib/unimidi/adapter/midi-jruby.rb
186
+ - lib/unimidi/adapter/midi-winmm.rb
77
187
  - lib/unimidi/command.rb
78
188
  - lib/unimidi/device.rb
79
189
  - lib/unimidi/input.rb
@@ -81,10 +191,6 @@ files:
81
191
  - lib/unimidi/output.rb
82
192
  - lib/unimidi/platform.rb
83
193
  - lib/unimidi/type_conversion.rb
84
- - lib/unimidi/adapter/alsa-rawmidi.rb
85
- - lib/unimidi/adapter/ffi-coremidi.rb
86
- - lib/unimidi/adapter/midi-jruby.rb
87
- - lib/unimidi/adapter/midi-winmm.rb
88
194
  - test/adapter_test.rb
89
195
  - test/class_methods_test.rb
90
196
  - test/functional_test.rb
@@ -92,30 +198,28 @@ files:
92
198
  - test/input_test.rb
93
199
  - test/platform_test.rb
94
200
  - test/type_conversion_test.rb
95
- - LICENSE
96
- - README.md
97
201
  homepage: http://github.com/arirusso/unimidi
98
202
  licenses:
99
203
  - Apache 2.0
100
204
  metadata: {}
101
- post_install_message:
205
+ post_install_message:
102
206
  rdoc_options: []
103
207
  require_paths:
104
208
  - lib
105
209
  required_ruby_version: !ruby/object:Gem::Requirement
106
210
  requirements:
107
- - - '>='
211
+ - - ">="
108
212
  - !ruby/object:Gem::Version
109
213
  version: '0'
110
214
  required_rubygems_version: !ruby/object:Gem::Requirement
111
215
  requirements:
112
- - - '>='
216
+ - - ">="
113
217
  - !ruby/object:Gem::Version
114
218
  version: 1.3.6
115
219
  requirements: []
116
220
  rubyforge_project: unimidi
117
- rubygems_version: 2.1.9
118
- signing_key:
221
+ rubygems_version: 2.2.2
222
+ signing_key:
119
223
  specification_version: 4
120
224
  summary: Realtime MIDI IO for Ruby
121
225
  test_files: []