patch 0.4.16 → 0.4.17

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: 8cd3946117fb996ae07fa615cf94829cdcb468ab
4
- data.tar.gz: b3e66f89dac3bfdd964ab87d2ad762dfb4f0cb4a
3
+ metadata.gz: 57cdbd5fc6c84c49884f573ebc4d307c6d2da26a
4
+ data.tar.gz: 7920f3af576d962866a3336db4e21911128be09b
5
5
  SHA512:
6
- metadata.gz: e8ff22748c79b1f1f06807180c4612496235641ff494eac18ec0121e36242e06a160147bef510c8e7b3d0addd246831d4fca69142575b2e32f688913b504e07f
7
- data.tar.gz: af543eee31a85c35e59d797ee6c4d60cb869b46b624d1a5c940dd57d12a31888a48ae0a8c1f16c47fa7771d03171f435743a1759590e84884d8578635e15807c
6
+ metadata.gz: e0e4dc8bf364aa9442a2eba2ef92ce9008fb35d71370d8478dc61210bf7b89af367a0cca3bc5971a4c18b55aa08090b768638c5f2bb67738d4b4ea983e7d4da0
7
+ data.tar.gz: 756b93eaef61822913acb9e178fa893fa695ac04a3b1698ff7a5e8855b8ba103ff2b8b2ac8f7f4b2397ccf98d2a83f96f34f7a0d714ed9498f0a81d7d4af0f31
@@ -26,7 +26,10 @@ module Patch
26
26
  def puts(patch, patch_messages)
27
27
  patch_messages = [patch_messages].flatten
28
28
  messages = ::Patch::IO::MIDI::Message.to_midi_messages(patch, patch_messages)
29
- @device.puts(messages) unless messages.empty?
29
+ unless messages.empty?
30
+ bytes = messages.map(&:to_a)
31
+ @device.puts(*bytes)
32
+ end
30
33
  messages
31
34
  end
32
35
 
data/lib/patch.rb CHANGED
@@ -37,6 +37,6 @@ require "patch/em_patch"
37
37
 
38
38
  module Patch
39
39
 
40
- VERSION = "0.4.16"
40
+ VERSION = "0.4.17"
41
41
 
42
42
  end
@@ -8,6 +8,10 @@
8
8
  :direction: input
9
9
  :name: Apple Inc. IAC Driver
10
10
  - :id: 3
11
+ :type: midi
12
+ :direction: output
13
+ :name: Apple Inc. IAC Driver
14
+ - :id: 4
11
15
  :type: osc
12
16
  :server:
13
17
  :port: 8000
@@ -1,7 +1,7 @@
1
1
  :patches:
2
2
  :test_patch:
3
3
  :node_map:
4
- [2, 3]: 1
4
+ [2, 4]: [1, 3]
5
5
  :actions:
6
6
  - :name: Zoom
7
7
  :key: zoom
@@ -20,6 +20,9 @@
20
20
  :default:
21
21
  :scale: !ruby/range 0..5.0
22
22
  :value: 0.5
23
+ :midi:
24
+ :channel: 0
25
+ :index: 1
23
26
  :osc:
24
27
  :address: /1/rotaryD
25
28
  :scale: !ruby/range 0..1.0
@@ -29,6 +32,9 @@
29
32
  :default:
30
33
  :scale: !ruby/range 0..2.0
31
34
  :value: 1
35
+ :midi:
36
+ :channel: 0
37
+ :index: 2
32
38
  :osc:
33
39
  :address: /faderM
34
40
  :scale:
@@ -39,6 +45,9 @@
39
45
  :default:
40
46
  :scale: !ruby/range 0..1000
41
47
  :value: 200
48
+ :midi:
49
+ :channel: 0
50
+ :index: 3
42
51
  :osc:
43
52
  :address: /1/faderA
44
53
  :scale:
@@ -1,6 +1,7 @@
1
1
  require "helper"
2
2
 
3
3
  class Patch::Node::MapTest < Minitest::Test
4
+ include Mocha::ParameterMatchers
4
5
 
5
6
  context "Map" do
6
7
 
@@ -34,14 +35,20 @@ class Patch::Node::MapTest < Minitest::Test
34
35
  refute_empty @nodes
35
36
  assert [Patch::IO::MIDI::Input, Patch::IO::OSC::Server, Patch::IO::Websocket::Node].all? { |klass| @nodes.map(&:class).include?(klass) }
36
37
  ::Patch::Thread.expects(:new).times(@nodes.count)
38
+ refute_empty @maps
37
39
  @maps.each do |map|
38
- map.to.expects(:puts).at_least_once.with(@patch, @patch.default_messages)
40
+ refute_empty map.to.nodes
41
+ map.to.nodes.each do |node|
42
+ #node.expects(:puts).at_least_once.with(is_a(Patch::Patch), is_a(Array))
43
+ end
39
44
  end
40
45
  end
41
46
 
42
47
  teardown do
43
48
  ::Patch::Thread.unstub(:new)
44
- @maps.each { |map| map.to.unstub(:puts) }
49
+ @maps.each do |map|
50
+ map.to.nodes.each { |node| node.unstub(:puts) }
51
+ end
45
52
  end
46
53
 
47
54
  should "create node start threads" do
data/test/patch_test.rb CHANGED
@@ -36,10 +36,10 @@ class Patch::PatchTest < Minitest::Test
36
36
 
37
37
  setup do
38
38
  @patch = @patches.first
39
- @messages = @patch.default_messages
40
39
  @actions_with_default = @patch.actions.select do |action|
41
40
  !action[:default].nil? && !action[:default][:value].nil?
42
41
  end
42
+ @messages = @patch.default_messages
43
43
  end
44
44
 
45
45
  should "populate messages from defaults" do
@@ -56,9 +56,12 @@ class Patch::PatchTest < Minitest::Test
56
56
  context "#enable" do
57
57
 
58
58
  setup do
59
- Patch::IO::MIDI::Input.any_instance.expects(:listen).once
60
- Patch::IO::OSC::Server.any_instance.expects(:listen).once
61
- Patch::IO::Websocket::Node.any_instance.expects(:listen).once
59
+ @patch = @patches.first
60
+ outputs = @patch.maps.map(&:to).map(&:nodes).flatten
61
+ @num_outputs = outputs.count
62
+ Patch::IO::MIDI::Input.any_instance.expects(:listen).times(@num_outputs)
63
+ Patch::IO::OSC::Server.any_instance.expects(:listen).times(@num_outputs)
64
+ Patch::IO::Websocket::Node.any_instance.expects(:listen).times(@num_outputs)
62
65
  end
63
66
 
64
67
  teardown do
@@ -68,7 +71,7 @@ class Patch::PatchTest < Minitest::Test
68
71
  end
69
72
 
70
73
  should "map nodes together" do
71
- assert @patches.first.enable
74
+ assert @patch.enable
72
75
  end
73
76
 
74
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.16
4
+ version: 0.4.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Russo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest