surface_master 0.4.0 → 0.4.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/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/examples/touchosc_device.rb +42 -0
- data/lib/surface_master/touch_osc/device.rb +29 -0
- data/lib/surface_master/version.rb +1 -1
- data/lib/surface_master.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3c8e66c72e0225a04e8fbe61bbffc2d477de6c6
|
4
|
+
data.tar.gz: c3ac84410c8799b5b345c9692f99ccd91ec562a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03da9f7ecd866d2133fc46b57fa4ad295c46edbe93588c221ce73a8ca11d1d9a3e2de748872769fab960888219d2df3bac9c0e45ff245d864da1d2ced9e51a41
|
7
|
+
data.tar.gz: fcf81c4609204ffdcc882c68c4187f0992ba7f3d9f2a65f2c134798b34557cc74d63550f6f818364e33c6d8bc4070e84dece0480e41bf0c2ece55dfa74210917
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,6 +11,8 @@ Where appropriate this includes setting LEDs and responding to input events.
|
|
11
11
|
* Numark Orbit
|
12
12
|
* At present you need to use the `Numark Orbit Editor` to send a specific mapping to the device, and setting of LEDs doesn't work.
|
13
13
|
* See `mappings/Orbit_Preset.json` for the preset to use with `Numark Orbit Editor`.
|
14
|
+
* TouchOSC Bridge
|
15
|
+
* At the moment only the `Device` interface is implemented, and you can either consume the input raw, or apply a mapping function of your own.
|
14
16
|
|
15
17
|
|
16
18
|
## Requirements
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
Bundler.require(:default, :development)
|
5
|
+
|
6
|
+
require "surface_master"
|
7
|
+
|
8
|
+
SurfaceMaster.init!
|
9
|
+
device = SurfaceMaster::TouchOSC::Device.new do |input|
|
10
|
+
result = { state: input[:state] }
|
11
|
+
case input[:code]
|
12
|
+
when 0xB0
|
13
|
+
result[:type] = :slider
|
14
|
+
result[:index] = input[:note]
|
15
|
+
result[:position] = input[:velocity]
|
16
|
+
result[:state] = :update
|
17
|
+
else
|
18
|
+
result[:type] = :unknown
|
19
|
+
end
|
20
|
+
result
|
21
|
+
end
|
22
|
+
|
23
|
+
input_thread = Thread.new do
|
24
|
+
loop do
|
25
|
+
begin
|
26
|
+
x = STDIN.gets
|
27
|
+
note, velocity = x.split(/ /, 2).map(&:to_i)
|
28
|
+
device.write([{ message: [0xB0, note, velocity], timestamp: 0 }])
|
29
|
+
rescue Exception => e
|
30
|
+
puts e.inspect
|
31
|
+
puts e.backtrace.join("\n")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
loop do
|
37
|
+
device.read.each do |input|
|
38
|
+
puts input.inspect
|
39
|
+
end
|
40
|
+
sleep 0.1
|
41
|
+
end
|
42
|
+
input_thread.join
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SurfaceMaster
|
2
|
+
module TouchOSC
|
3
|
+
# Low-level interface to TouchOSC Bridge
|
4
|
+
class Device < SurfaceMaster::Device
|
5
|
+
def initialize(opts = nil, &mapper)
|
6
|
+
@name = "TouchOSC Bridge"
|
7
|
+
super(opts)
|
8
|
+
@mapper = mapper || proc { |input| input }
|
9
|
+
end
|
10
|
+
|
11
|
+
def reset!
|
12
|
+
end
|
13
|
+
|
14
|
+
def read
|
15
|
+
super
|
16
|
+
.map { |input| @mapper.call(input) }
|
17
|
+
.compact
|
18
|
+
end
|
19
|
+
|
20
|
+
def write(messages)
|
21
|
+
@output.write(Array(messages))
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
# def sysex_prefix; @sysex_prefix ||= super + []; end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/surface_master.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: surface_master
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Frisby
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- examples/orbit_interaction.rb
|
79
79
|
- examples/orbit_playground.rb
|
80
80
|
- examples/system_monitor.rb
|
81
|
+
- examples/touchosc_device.rb
|
81
82
|
- lib/surface_master.rb
|
82
83
|
- lib/surface_master/device.rb
|
83
84
|
- lib/surface_master/errors.rb
|
@@ -90,6 +91,7 @@ files:
|
|
90
91
|
- lib/surface_master/orbit/device.rb
|
91
92
|
- lib/surface_master/orbit/interaction.rb
|
92
93
|
- lib/surface_master/orbit/midi_codes.rb
|
94
|
+
- lib/surface_master/touch_osc/device.rb
|
93
95
|
- lib/surface_master/version.rb
|
94
96
|
- mappings/Orbit_Preset.json
|
95
97
|
- surface_master.gemspec
|