lib/surface_master/orbit/device.rb in surface_master-0.2.0 vs lib/surface_master/orbit/device.rb in surface_master-0.2.1
- old
+ new
@@ -1,7 +1,8 @@
module SurfaceMaster
module Orbit
+ # Low-level interface to Numark Orbit wireless MIDI control surface.
class Device < SurfaceMaster::Device
include MIDICodes
def initialize(opts = nil)
@name = "Numark ORBIT"
@@ -9,95 +10,12 @@
reset!
end
def reset!
# TODO: This... doesn't appear to work. At all.
- mappings = [0x03, 0x01, 0x70,
-
- 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x00,
- 0x00, 0x08, 0x00,
- 0x00, 0x0C, 0x00,
- 0x00, 0x01, 0x00,
- 0x00, 0x05, 0x00,
- 0x00, 0x09, 0x00,
- 0x00, 0x0D, 0x00,
- 0x00, 0x02, 0x00,
- 0x00, 0x06, 0x00,
- 0x00, 0x0A, 0x00,
- 0x00, 0x0E, 0x00,
- 0x00, 0x03, 0x00,
- 0x00, 0x07, 0x00,
- 0x00, 0x0B, 0x00,
- 0x00, 0x0F, 0x00,
- 0x01, 0x00, 0x00,
- 0x01, 0x04, 0x00,
- 0x01, 0x08, 0x00,
- 0x01, 0x0C, 0x00,
- 0x01, 0x01, 0x00,
- 0x01, 0x05, 0x00,
- 0x01, 0x09, 0x00,
- 0x01, 0x0D, 0x00,
- 0x01, 0x02, 0x00,
- 0x01, 0x06, 0x00,
- 0x01, 0x0A, 0x00,
- 0x01, 0x0E, 0x00,
- 0x01, 0x03, 0x00,
- 0x01, 0x07, 0x00,
- 0x01, 0x0B, 0x00,
- 0x01, 0x0F, 0x00,
- 0x02, 0x00, 0x00,
- 0x02, 0x04, 0x00,
- 0x02, 0x08, 0x00,
- 0x02, 0x0C, 0x00,
- 0x02, 0x01, 0x00,
- 0x02, 0x05, 0x00,
- 0x02, 0x09, 0x00,
- 0x02, 0x0D, 0x00,
- 0x02, 0x02, 0x00,
- 0x02, 0x06, 0x00,
- 0x02, 0x0A, 0x00,
- 0x02, 0x0E, 0x00,
- 0x02, 0x03, 0x00,
- 0x02, 0x07, 0x00,
- 0x02, 0x0B, 0x00,
- 0x02, 0x0F, 0x00,
- 0x03, 0x00, 0x00,
- 0x03, 0x04, 0x00,
- 0x03, 0x08, 0x00,
- 0x03, 0x0C, 0x00,
- 0x03, 0x01, 0x00,
- 0x03, 0x05, 0x00,
- 0x03, 0x09, 0x00,
- 0x03, 0x0D, 0x00,
- 0x03, 0x02, 0x00,
- 0x03, 0x06, 0x00,
- 0x03, 0x0A, 0x00,
- 0x03, 0x0E, 0x00,
- 0x03, 0x03, 0x00,
- 0x03, 0x07, 0x00,
- 0x03, 0x0B, 0x00,
- 0x03, 0x0F, 0x00,
- 0x00, 0x00, 0x01,
- 0x00, 0x02, 0x00,
- 0x03, 0x00, 0x00,
- 0x01, 0x01, 0x01,
- 0x02, 0x01, 0x03,
- 0x01, 0x00, 0x02,
- 0x01, 0x02, 0x02,
- 0x02, 0x03, 0x02,
- 0x00, 0x03, 0x01,
- 0x03, 0x02, 0x03,
- 0x03, 0x03, 0x0C,
- 0x00, 0x0D, 0x00,
- 0x0C, 0x00, 0x0D,
- 0x00, 0x0C, 0x00,
- 0x0D, 0x00, 0x0C,
- 0x00, 0x0D, 0x00]
-
- if (result = sysex!(*mappings)) != 0
- raise "Expected success (0) setting mappings, got: #{result}"
+ if (result = sysex!(*MAPPINGS)) != 0
+ fail "Expected success (0) setting mappings, got: #{result}"
end
sysex!(0x01, 0x00, 0x00)
end
def read
@@ -105,9 +23,91 @@
.map { |input| decode_input(input) }
.compact
end
protected
+
+ MAPPINGS = [0x03, 0x01, 0x70,
+ 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00,
+ 0x00, 0x08, 0x00,
+ 0x00, 0x0C, 0x00,
+ 0x00, 0x01, 0x00,
+ 0x00, 0x05, 0x00,
+ 0x00, 0x09, 0x00,
+ 0x00, 0x0D, 0x00,
+ 0x00, 0x02, 0x00,
+ 0x00, 0x06, 0x00,
+ 0x00, 0x0A, 0x00,
+ 0x00, 0x0E, 0x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, 0x01,
+ 0x02, 0x01, 0x03,
+ 0x01, 0x00, 0x02,
+ 0x01, 0x02, 0x02,
+ 0x02, 0x03, 0x02,
+ 0x00, 0x03, 0x01,
+ 0x03, 0x02, 0x03,
+ 0x03, 0x03, 0x0C,
+ 0x00, 0x0D, 0x00,
+ 0x0C, 0x00, 0x0D,
+ 0x00, 0x0C, 0x00,
+ 0x0D, 0x00, 0x0C,
+ 0x00, 0x0D, 0x00]
def sysex_prefix; @sysex_prefix ||= super + [0x00, 0x01, 0x3F, 0x2B]; end
def decode_shoulder(decoded, note, _velocity)
decoded[:control].merge!(SurfaceMaster::Orbit::Device::SHOULDERS[note])