Class: Ruck::Generators::Delay
- Defined in:
- lib/ruck/ugen/general.rb
Instance Attribute Summary
Attributes included from UGen
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 UGen
Constructor Details
#initialize(attrs = {}) ⇒ Delay
Returns a new instance of Delay.
233 234 235 236 237 238 239 240 |
# File 'lib/ruck/ugen/general.rb', line 233 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
250 251 252 |
# File 'lib/ruck/ugen/general.rb', line 250 def attr_names [:time] end |
#next(now) ⇒ Object
242 243 244 245 246 247 248 |
# File 'lib/ruck/ugen/general.rb', line 242 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 |