mrjoy-launchpad 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +8 -0
- data/Gemfile +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +136 -0
- data/Rakefile +10 -0
- data/examples/binary_clock.rb +29 -0
- data/examples/color_picker.rb +96 -0
- data/examples/colors.rb +21 -0
- data/examples/doodle.rb +68 -0
- data/examples/double_buffering.rb +104 -0
- data/examples/drawing_board.rb +25 -0
- data/examples/feedback.rb +34 -0
- data/examples/reset.rb +6 -0
- data/launchpad.gemspec +34 -0
- data/lib/launchpad.rb +34 -0
- data/lib/launchpad/device.rb +574 -0
- data/lib/launchpad/errors.rb +37 -0
- data/lib/launchpad/interaction.rb +336 -0
- data/lib/launchpad/logging.rb +27 -0
- data/lib/launchpad/midi_codes.rb +53 -0
- data/lib/launchpad/version.rb +3 -0
- data/monitor.rb +88 -0
- data/test/helper.rb +44 -0
- data/test/test_device.rb +530 -0
- data/test/test_interaction.rb +456 -0
- data/testbed.rb +48 -0
- metadata +146 -0
data/testbed.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# require "bignum"
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
Bundler.require(:default, :development)
|
6
|
+
|
7
|
+
require "launchpad"
|
8
|
+
|
9
|
+
def init_board(interaction)
|
10
|
+
(0..7).each do |x|
|
11
|
+
(0..7).each do |y|
|
12
|
+
interaction.device.change_grid(x, y, 0x00, x + 0x10, y + 0x10)
|
13
|
+
sleep 0.001
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def goodbye(interaction)
|
19
|
+
(0..64).step(4).each do |i|
|
20
|
+
ii = 64 - i
|
21
|
+
(0..7).each do |x|
|
22
|
+
(0..7).each do |y|
|
23
|
+
interaction.device.change_grid(x, y, ii, 0x00, ii)
|
24
|
+
sleep 0.001
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
interaction = Launchpad::Interaction.new
|
31
|
+
interaction.response_to(:grid) do |inter, action|
|
32
|
+
x = action[:x]
|
33
|
+
y = action[:y]
|
34
|
+
if action[:state] == :down
|
35
|
+
r, g, b = 0x3F, 0x00, 0x00
|
36
|
+
else
|
37
|
+
r, g, b = 0x00, x + 0x10, y + 0x10
|
38
|
+
end
|
39
|
+
inter.device.change_grid(x, y, r, g, b)
|
40
|
+
end
|
41
|
+
|
42
|
+
interaction.response_to(:mixer, :down) do |_interaction, action|
|
43
|
+
puts "STAHP!"
|
44
|
+
goodbye(interaction)
|
45
|
+
interaction.stop
|
46
|
+
end
|
47
|
+
init_board(interaction)
|
48
|
+
interaction.start
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mrjoy-launchpad
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Frisby
|
8
|
+
- Thomas Jachmann
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: portmidi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.0.6
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.0.6
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: ffi
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: minitest-reporters
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: mocha
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: This gem provides an interface to access Novation's LaunchPad programmatically.
|
85
|
+
LEDs can be lighted and button presses can be evaluated using launchpad's MIDI input/output.
|
86
|
+
email:
|
87
|
+
- jfrisby@mrjoy.com
|
88
|
+
- self@thomasjachmann.com
|
89
|
+
executables: []
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- ".gitignore"
|
94
|
+
- ".travis.yml"
|
95
|
+
- Gemfile
|
96
|
+
- LICENSE
|
97
|
+
- README.rdoc
|
98
|
+
- Rakefile
|
99
|
+
- examples/binary_clock.rb
|
100
|
+
- examples/color_picker.rb
|
101
|
+
- examples/colors.rb
|
102
|
+
- examples/doodle.rb
|
103
|
+
- examples/double_buffering.rb
|
104
|
+
- examples/drawing_board.rb
|
105
|
+
- examples/feedback.rb
|
106
|
+
- examples/reset.rb
|
107
|
+
- launchpad.gemspec
|
108
|
+
- lib/launchpad.rb
|
109
|
+
- lib/launchpad/device.rb
|
110
|
+
- lib/launchpad/errors.rb
|
111
|
+
- lib/launchpad/interaction.rb
|
112
|
+
- lib/launchpad/logging.rb
|
113
|
+
- lib/launchpad/midi_codes.rb
|
114
|
+
- lib/launchpad/version.rb
|
115
|
+
- monitor.rb
|
116
|
+
- test/helper.rb
|
117
|
+
- test/test_device.rb
|
118
|
+
- test/test_interaction.rb
|
119
|
+
- testbed.rb
|
120
|
+
homepage: https://github.com/MrJoy/launchpad
|
121
|
+
licenses: []
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project: launchpad
|
139
|
+
rubygems_version: 2.4.8
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: A gem for accessing Novation's LaunchPad programmatically and easily.
|
143
|
+
test_files:
|
144
|
+
- test/helper.rb
|
145
|
+
- test/test_device.rb
|
146
|
+
- test/test_interaction.rb
|