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(arpeggiator, 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(arpeggiator, 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(arpeggiator, map) start_server maps = map.map do |item| property = item[:property] osc_range = item[:value] || (0..1.0) @server.add_method(item[:address]) do || value = .to_a[0] parameter_range = arpeggiator.parameter.constraints(property) value = Scale.transform(value).from(osc_range).to(parameter_range) puts "[DEBUG]: OSC: #{property}= #{value}" if @debug arpeggiator.parameter.send("#{property}=", value) true end true end maps.any? end |