Class: Scruby::Audio::ControlName

Inherits:
Object
  • Object
show all
Defined in:
lib/scruby/audio/control_name.rb

Constant Summary collapse

RATES =
{ 'n_' => :noncontrol, 'i_' => :scalar, 'k_' => :control, 't_' => :trigger }

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#indexObject

Returns the value of attribute index.



4
5
6
# File 'lib/scruby/audio/control_name.rb', line 4

def index
  @index
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/scruby/audio/control_name.rb', line 4

def name
  @name
end

#rateObject

Returns the value of attribute rate.



4
5
6
# File 'lib/scruby/audio/control_name.rb', line 4

def rate
  @rate
end

#valueObject

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

Returns:

  • (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

Returns:

  • (Boolean)


23
24
25
# File 'lib/scruby/audio/control_name.rb', line 23

def valid_ugen_input?
  true
end