patch 0.4.16 → 0.4.17
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 +4 -4
- data/lib/patch/io/midi/output.rb +4 -1
- data/lib/patch.rb +1 -1
- data/test/config/nodes.yml +4 -0
- data/test/config/patches.yml +10 -1
- data/test/node/map_test.rb +9 -2
- data/test/patch_test.rb +8 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57cdbd5fc6c84c49884f573ebc4d307c6d2da26a
|
4
|
+
data.tar.gz: 7920f3af576d962866a3336db4e21911128be09b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e4dc8bf364aa9442a2eba2ef92ce9008fb35d71370d8478dc61210bf7b89af367a0cca3bc5971a4c18b55aa08090b768638c5f2bb67738d4b4ea983e7d4da0
|
7
|
+
data.tar.gz: 756b93eaef61822913acb9e178fa893fa695ac04a3b1698ff7a5e8855b8ba103ff2b8b2ac8f7f4b2397ccf98d2a83f96f34f7a0d714ed9498f0a81d7d4af0f31
|
data/lib/patch/io/midi/output.rb
CHANGED
@@ -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
|
-
|
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
data/test/config/nodes.yml
CHANGED
data/test/config/patches.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
:patches:
|
2
2
|
:test_patch:
|
3
3
|
:node_map:
|
4
|
-
[2,
|
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:
|
data/test/node/map_test.rb
CHANGED
@@ -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.
|
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
|
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
|
-
|
60
|
-
|
61
|
-
|
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 @
|
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.
|
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-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|