surface_master 0.2.0 → 0.2.1
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/.rubocop.yml +107 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.md +16 -0
- data/Gemfile +5 -1
- data/Rakefile +73 -5
- data/debug_tools/decode.rb +1 -1
- data/examples/launchpad_testbed.rb +67 -28
- data/examples/monitor.rb +23 -11
- data/examples/orbit_testbed.rb +1 -42
- data/lib/surface_master/device.rb +40 -39
- data/lib/surface_master/interaction.rb +81 -55
- data/lib/surface_master/launchpad/device.rb +70 -58
- data/lib/surface_master/launchpad/errors.rb +8 -9
- data/lib/surface_master/launchpad/interaction.rb +24 -42
- data/lib/surface_master/orbit/device.rb +85 -85
- data/lib/surface_master/orbit/interaction.rb +1 -0
- data/lib/surface_master/orbit/midi_codes.rb +3 -1
- data/lib/surface_master/version.rb +2 -1
- data/lib/{control_center.rb → surface_master.rb} +0 -0
- data/surface_master.gemspec +7 -5
- data/test/helper.rb +16 -17
- data/test/test_device.rb +167 -355
- data/test/test_interaction.rb +177 -188
- metadata +5 -3
@@ -5,6 +5,7 @@ module SurfaceMaster
|
|
5
5
|
# This is all predicated upon our fixed mapping being applied.
|
6
6
|
module MIDICodes
|
7
7
|
# TODO: Use a lib to do a deep-freeze.
|
8
|
+
# rubocop:disable Metrics/LineLength
|
8
9
|
CONTROLS = { 0x90 => { 0x00 => { type: :pad, action: :down, control: { bank: 1 } },
|
9
10
|
0x01 => { type: :pad, action: :down, control: { bank: 2 } },
|
10
11
|
0x02 => { type: :pad, action: :down, control: { bank: 3 } },
|
@@ -21,7 +22,8 @@ module SurfaceMaster
|
|
21
22
|
0x03 => { type: :knob, action: :update, control: { vknob: 4 } },
|
22
23
|
0x0C => { type: :accelerometer, action: :tilt, control: { axis: :x } },
|
23
24
|
0x0D => { type: :accelerometer, action: :tilt, control: { axis: :y } },
|
24
|
-
0x0F => { type: :control, action: :switch, control: {
|
25
|
+
0x0F => { type: :control, action: :switch, control: {} } } }.freeze
|
26
|
+
# rubocop:enable Metrics/LineLength
|
25
27
|
SHOULDERS = { 0x03 => { button: :left },
|
26
28
|
0x04 => { button: :right } }.freeze
|
27
29
|
SELECTORS = { 0x01 => { selector: :banks },
|
File without changes
|
data/surface_master.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "surface_master/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
@@ -8,9 +8,11 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Jon Frisby"]
|
9
9
|
s.email = ["jfrisby@mrjoy.com"]
|
10
10
|
s.homepage = "https://github.com/MrJoy/surface_master"
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
13
|
-
|
11
|
+
s.summary = "A gem for accessing various MIDI control surfaces programmatically."
|
12
|
+
s.description = "This gem provides an interface to access Novation's LaunchPad Mark 2, and"\
|
13
|
+
" Numark's Orbit programmatically. LEDs can be lit and button presses can be read."
|
14
|
+
# TODO: Update docs to give credit to Thomas Jachmann (self@thomasjachmann.com) for his
|
15
|
+
# TODO: `launchpad` gem.
|
14
16
|
|
15
17
|
s.required_ruby_version = ">= 2.2.0"
|
16
18
|
|
@@ -21,6 +23,6 @@ Gem::Specification.new do |s|
|
|
21
23
|
|
22
24
|
s.files = `git ls-files`.split("\n")
|
23
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
25
27
|
s.require_paths = ["lib"]
|
26
28
|
end
|
data/test/helper.rb
CHANGED
@@ -1,44 +1,43 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'minitest/reporters'
|
6
|
-
MiniTest::Reporters.use!
|
7
|
-
rescue LoadError
|
8
|
-
# ignore when it's not there - must be ruby 1.8
|
9
|
-
end
|
1
|
+
require "minitest/spec"
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "minitest/reporters"
|
10
4
|
|
11
|
-
|
5
|
+
MiniTest::Reporters.use!
|
12
6
|
|
13
|
-
require
|
7
|
+
require "mocha/setup"
|
14
8
|
|
15
|
-
|
16
|
-
module Portmidi
|
9
|
+
require "surface_master"
|
17
10
|
|
11
|
+
# Mock for tests
|
12
|
+
module Portmidi
|
13
|
+
# Mock for tests
|
18
14
|
class Input
|
19
15
|
attr_accessor :device_id
|
20
16
|
def initialize(device_id)
|
21
17
|
self.device_id = device_id
|
22
18
|
end
|
23
|
-
|
19
|
+
|
20
|
+
def read(*_args); nil; end
|
24
21
|
def close; nil; end
|
25
22
|
end
|
26
23
|
|
24
|
+
# Mock for tests
|
27
25
|
class Output
|
28
26
|
attr_accessor :device_id
|
29
27
|
def initialize(device_id)
|
30
28
|
self.device_id = device_id
|
31
29
|
end
|
32
|
-
|
30
|
+
|
31
|
+
def write(*_args); nil; end
|
32
|
+
def write_sysex(*_args); nil; end
|
33
33
|
def close; nil; end
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.input_devices; mock_devices; end
|
37
37
|
def self.output_devices; mock_devices; end
|
38
38
|
def self.start; end
|
39
|
-
|
40
39
|
end
|
41
40
|
|
42
41
|
def mock_devices(opts = {})
|
43
|
-
[Portmidi::Device.new(opts[:id] || 1, 0, 0, opts[:name] ||
|
42
|
+
[Portmidi::Device.new(opts[:id] || 1, 0, 0, opts[:name] || "Launchpad MK2")]
|
44
43
|
end
|