Class: Diamond::OSC::Node
- Inherits:
-
Object
- Object
- Diamond::OSC::Node
- Defined in:
- lib/diamond/osc.rb
Overview
An access point for dealing with all OSC functionality for the instrument
Instance Method Summary collapse
-
#enable_parameter_control(subject, map) ⇒ Boolean
Enable controlling the instrument via OSC.
-
#initialize(options = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
Instance Method Details
#enable_parameter_control(subject, map) ⇒ Boolean
Enable controlling the instrument via OSC
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/diamond/osc.rb', line 22 def enable_parameter_control(subject, map) start_server maps = map.map do |item| property = item[:property] from_range = item[:value] || (0..1.0) to_range = SequenceParameters::RANGE[property] @server.add_method(item[:address]) do || value = .to_a[0] value = Scale.transform(value).from(from_range).to(to_range) puts "[DEBUG]: OSC: #{property}= #{value}" if @debug subject.send("#{property}=", value) true end true end maps.any? end |