Class: Ruck::UGen::Generators::Delay
- Defined in:
- lib/ruck/ugen/basic.rb
Instance Attribute Summary
Attributes included from UGenBase
Instance Method Summary collapse
- #attr_names ⇒ Object
-
#initialize(attrs = {}) ⇒ Delay
constructor
A new instance of Delay.
- #next(now) ⇒ Object
Methods included from Source
#<<, #>>, #last, #out, #out_channels
Methods included from Target
Methods included from UGenBase
Constructor Details
#initialize(attrs = {}) ⇒ Delay
Returns a new instance of Delay.
63 64 65 66 67 68 69 70 |
# File 'lib/ruck/ugen/basic.rb', line 63 def initialize(attrs = {}) require_attrs attrs, [:time] samples = attrs.delete(:time) parse_attrs attrs @ins = [] @last = 0.0 @queue = [0.0] * samples end |
Instance Method Details
#attr_names ⇒ Object
80 81 82 |
# File 'lib/ruck/ugen/basic.rb', line 80 def attr_names [:time] end |
#next(now) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/ruck/ugen/basic.rb', line 72 def next(now) return @last if @now == now @now = now @queue << @ins.inject(0) { |samp, ugen| samp += ugen.next(now) } * gain @last = @queue.shift end |