midi-instrument 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f3c9154aa1efd30952181b2f74376d8f17ab331
4
- data.tar.gz: 66da9d0dba8be4774226657bf67a465685d46708
3
+ metadata.gz: b21ce1d5388b6997b631fa90ec42fb943551f389
4
+ data.tar.gz: 5fe47c6bf24b529ba188081f01bbc7b8571322aa
5
5
  SHA512:
6
- metadata.gz: e576411ece44d81ddd9ea64fd75b1e9dabdb9b1434cc46f7c2ef9590ef5c2c620f4f7d85a5e7dbf177056c2b3cdfb7ce936b8b19c00d5888f5ac13141bc2069f
7
- data.tar.gz: d26a17a4680d6ec34b6d61a6a4768ab1709f98022d9c993ad1410e78b4f3cc6b68746fc4e9573b1984d761ab4ae88c9ad5a1c29d5e9369ef60c2d2bb90c28d73
6
+ metadata.gz: f76bb278616f805236ca8dd5d43c13af3cbc737e23bc01e9d4b7c218bbd2d09b9aa1dedd69abac9a7e39b32005ba24aafb0a13bf9e663668497410e3d8311760
7
+ data.tar.gz: 3cc910a1b2010067a33b92bb96cd5ea0a57f603ef13ee1fb913f6213ab340e7debc32589feaa287f014468c341772818a5c2d8637bb6091e6e19620c4993119b
@@ -27,6 +27,6 @@ require "midi-instrument/output"
27
27
 
28
28
  module MIDIInstrument
29
29
 
30
- VERSION = "0.4.7"
30
+ VERSION = "0.4.8"
31
31
 
32
32
  end
@@ -77,7 +77,7 @@ module MIDIInstrument
77
77
  # @param [Object] object
78
78
  # @return [Boolean]
79
79
  def message?(object)
80
- object.class.name.match(/\AMIDIMessage::[a-zA-Z]+\z/)
80
+ object.kind_of?(MIDIMessage)
81
81
  end
82
82
 
83
83
  # Is this object a string note name? eg "A4"
@@ -32,7 +32,7 @@ module MIDIInstrument
32
32
  def puts(*args)
33
33
  messages = Message.to_messages(*args)
34
34
  messages = filter_output(messages)
35
- bytes = messages.map(&:to_bytes)
35
+ bytes = messages.map(&:to_bytes).flatten
36
36
  if !@mute
37
37
  @devices.each { |output| output.puts(*bytes) }
38
38
  end
@@ -17,8 +17,7 @@ class MIDIInstrument::MessageTest < Minitest::Test
17
17
  end
18
18
 
19
19
  should "pass MIDI messages" do
20
- names = ["A-1", "C#4", "F#5", "D6"]
21
- messages = MIDIInstrument::Message.to_messages(*names)
20
+ messages = (0..3).to_a.map { |channel| MIDIMessage::NoteOn.new(channel, 64, 100) }
22
21
  result = MIDIInstrument::Message.to_messages(*messages)
23
22
  refute_nil result
24
23
  refute_empty result
@@ -30,6 +29,15 @@ class MIDIInstrument::MessageTest < Minitest::Test
30
29
  assert_nil MIDIInstrument::Message.to_messages("bla", "blah")
31
30
  end
32
31
 
32
+ should "not change midi channel on messages" do
33
+ messages = (0..3).to_a.map { |channel| MIDIMessage::NoteOn.new(channel, 64, 100) }
34
+ result = MIDIInstrument::Message.to_messages(*messages)
35
+ refute_nil result
36
+ refute_empty result
37
+ assert result.all? { |message| message.is_a?(MIDIMessage::NoteOn) }
38
+ assert_equal [0, 1, 2, 3], result.map(&:channel)
39
+ end
40
+
33
41
  end
34
42
 
35
43
  context ".to_bytes" do
@@ -24,7 +24,7 @@ class MIDIInstrument::OutputTest < Minitest::Test
24
24
 
25
25
  should "output MIDI messages" do
26
26
  @output.devices.first.expects(:puts).times(1)
27
- result = @output.puts(MIDIMessage::NoteOn["C3"].new(0, 100), MIDIMessage::NoteOn["D3"].new(0, 110))
27
+ result = @output.puts(MIDIMessage::NoteOn["C3"].new(1, 100), MIDIMessage::NoteOn["D3"].new(1, 110))
28
28
  end
29
29
 
30
30
  should "output to multiple devices" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midi-instrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Russo