surface_master 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2b72c0db5f531114165b1bf813b7723de8daa62
4
- data.tar.gz: 816e060bcc90c233e3fe80f994295a0d04222334
3
+ metadata.gz: b3c8e66c72e0225a04e8fbe61bbffc2d477de6c6
4
+ data.tar.gz: c3ac84410c8799b5b345c9692f99ccd91ec562a6
5
5
  SHA512:
6
- metadata.gz: 7d7e478d03cb7f4bfbb8dd29c527c374d4ad798054b04a3a9c6326d4ed42e56cd971c2830642715df5e9d851de8631342f6d02f215b4cd6c0394ec83e6af7206
7
- data.tar.gz: 3252e00acc136cf55dee085e073266f65f7cdb63494f84ddcead0fb6bac150e73598fa9e922fc8aefdc58ec6cb9e5e7a608b6c8a4798e2b0141bfc66b8ca0147
6
+ metadata.gz: 03da9f7ecd866d2133fc46b57fa4ad295c46edbe93588c221ce73a8ca11d1d9a3e2de748872769fab960888219d2df3bac9c0e45ff245d864da1d2ced9e51a41
7
+ data.tar.gz: fcf81c4609204ffdcc882c68c4187f0992ba7f3d9f2a65f2c134798b34557cc74d63550f6f818364e33c6d8bc4070e84dece0480e41bf0c2ece55dfa74210917
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## v0.4.1
4
+
5
+ * Add a simple driver for the TouchOSC Bridge.
6
+
7
+
3
8
  ## v0.4.0
4
9
 
5
10
  * Jettison threaded input handling.
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
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module SurfaceMaster
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
@@ -25,3 +25,5 @@ require "surface_master/launchpad/interaction"
25
25
  require "surface_master/orbit/midi_codes"
26
26
  require "surface_master/orbit/device"
27
27
  require "surface_master/orbit/interaction"
28
+
29
+ require "surface_master/touch_osc/device"
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.0
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