Class: Ruck::UGen::Generators::Gain
- Defined in:
- lib/ruck/ugen/basic.rb
Instance Attribute Summary
Attributes included from UGenBase
Instance Method Summary collapse
- #attr_names ⇒ Object
-
#initialize(attrs = {}) ⇒ Gain
constructor
A new instance of Gain.
- #next(now) ⇒ Object
Methods included from Target
Methods included from Source
#<<, #>>, #last, #out, #out_channels
Methods included from UGenBase
Constructor Details
#initialize(attrs = {}) ⇒ Gain
Returns a new instance of Gain.
17 18 19 20 21 |
# File 'lib/ruck/ugen/basic.rb', line 17 def initialize(attrs = {}) parse_attrs({ :gain => 1.0 }.merge(attrs)) @ins = [] @last = 0.0 end |
Instance Method Details
#attr_names ⇒ Object
29 30 31 |
# File 'lib/ruck/ugen/basic.rb', line 29 def attr_names [:gain] end |
#next(now) ⇒ Object
23 24 25 26 27 |
# File 'lib/ruck/ugen/basic.rb', line 23 def next(now) return @last if @now == now @now = now @last = @ins.inject(0) { |samp, ugen| samp += ugen.next(now) } * gain end |