Class: Scruby::Audio::ControlName
- Defined in:
- lib/scruby/audio/control_name.rb
Constant Summary collapse
- RATES =
{ 'n_' => :noncontrol, 'i_' => :scalar, 'k_' => :control, 't_' => :trigger }
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rate ⇒ Object
Returns the value of attribute rate.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value, rate, index) ⇒ ControlName
constructor
A new instance of ControlName.
- #non_control? ⇒ Boolean
- #rate_from_name(name) ⇒ Object
- #set_rate(name, rate) ⇒ Object
- #valid_ugen_input? ⇒ Boolean
Constructor Details
#initialize(name, value, rate, index) ⇒ ControlName
Returns a new instance of ControlName.
7 8 9 |
# File 'lib/scruby/audio/control_name.rb', line 7 def initialize( name, value, rate, index ) @name, @value, @rate, @index = name.to_s, value.to_f, set_rate( name, rate ), index end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/scruby/audio/control_name.rb', line 4 def index @index end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/scruby/audio/control_name.rb', line 4 def name @name end |
#rate ⇒ Object
Returns the value of attribute rate.
4 5 6 |
# File 'lib/scruby/audio/control_name.rb', line 4 def rate @rate end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/scruby/audio/control_name.rb', line 4 def value @value end |
Instance Method Details
#non_control? ⇒ Boolean
19 20 21 |
# File 'lib/scruby/audio/control_name.rb', line 19 def non_control? @rate == :noncontrol end |
#rate_from_name(name) ⇒ Object
15 16 17 |
# File 'lib/scruby/audio/control_name.rb', line 15 def rate_from_name( name ) RATES[ name.to_s[0..1] ] || :control end |
#set_rate(name, rate) ⇒ Object
11 12 13 |
# File 'lib/scruby/audio/control_name.rb', line 11 def set_rate( name, rate ) RATES.has_value?( rate ) ? rate : rate_from_name( name ) end |
#valid_ugen_input? ⇒ Boolean
23 24 25 |
# File 'lib/scruby/audio/control_name.rb', line 23 def valid_ugen_input? true end |