Class: Arcenciel::Surfaces::Knob::DSL

Inherits:
DSLBase
  • Object
show all
Defined in:
lib/arcenciel/surfaces.rb

Instance Attribute Summary

Attributes inherited from DSLBase

#opts

Instance Method Summary collapse

Methods inherited from DSLBase

eval, #initialize

Constructor Details

This class inherits a constructor from Arcenciel::DSLBase

Instance Method Details

#initial(value) ⇒ Object

Set the initial value of the knob. Default - Minimum value



37
38
39
# File 'lib/arcenciel/surfaces.rb', line 37

def initial(value)
  opts[:initial] = value
end

#max(value) ⇒ Object

Set the maximum value of the knob. Default - 100



55
56
57
# File 'lib/arcenciel/surfaces.rb', line 55

def max(value)
  opts[:max] = value
end

#min(value) ⇒ Object

Set the minimum value of the knob. Default - 0



49
50
51
# File 'lib/arcenciel/surfaces.rb', line 49

def min(value)
  opts[:min] = value
end

#name(name) ⇒ Object

Set the name of this logical knob (encoder).



31
32
33
# File 'lib/arcenciel/surfaces.rb', line 31

def name(name)
  opts[:name] = name
end

#on_push(&blk) ⇒ Object

Set the callback invoked when the knob is depressed.



77
78
79
# File 'lib/arcenciel/surfaces.rb', line 77

def on_push(&blk)
  opts[:on_push] = blk
end

#on_release(&blk) ⇒ Object

Set the callback invoked when the knob is released.



82
83
84
# File 'lib/arcenciel/surfaces.rb', line 82

def on_release(&blk)
  opts[:on_release] = blk
end

#on_value(&blk) ⇒ Object

Set the callback invoked when the value changes.



72
73
74
# File 'lib/arcenciel/surfaces.rb', line 72

def on_value(&blk)
  opts[:on_value] = blk
end

#range(range) ⇒ Object

Set the range of values for the knob.



42
43
44
45
# File 'lib/arcenciel/surfaces.rb', line 42

def range(range)
  opts[:min] = range.begin
  opts[:max] = range.end
end

#sweep(degrees) ⇒ Object

Set the precision of the knob (degrees per sweep). Default - 360 (one rotation per sweep)



67
68
69
# File 'lib/arcenciel/surfaces.rb', line 67

def sweep(degrees)
  opts[:sweep] = degrees
end

#type(type) ⇒ Object

Set the type of value (:integer or :float). Default - :float



61
62
63
# File 'lib/arcenciel/surfaces.rb', line 61

def type(type)
  opts[:type] = type
end