Class: Ruck::Generators::Noise

Inherits:
Object
  • Object
show all
Includes:
Source, UGen
Defined in:
lib/ruck/ugen/general.rb

Instance Attribute Summary

Attributes included from UGen

#name

Instance Method Summary collapse

Methods included from Source

#<<, #>>, #last, #out, #out_channels

Methods included from UGen

#to_s

Constructor Details

#initialize(attrs = {}) ⇒ Noise

Returns a new instance of Noise.



261
262
263
264
# File 'lib/ruck/ugen/general.rb', line 261

def initialize(attrs = {})
  parse_attrs({ :gain => 1.0 }.merge(attrs))
  @last = 0.0
end

Instance Method Details

#attr_namesObject



272
273
274
# File 'lib/ruck/ugen/general.rb', line 272

def attr_names
  [:gain]
end

#next(now) ⇒ Object



266
267
268
269
270
# File 'lib/ruck/ugen/general.rb', line 266

def next(now)
  return @last if @now == now
  @now = now
  @last = rand * gain
end