Class: Ruck::UGen::Generators::Noise

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

Instance Attribute Summary

Attributes included from UGenBase

#name

Instance Method Summary collapse

Methods included from Source

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

Methods included from UGenBase

#to_s

Constructor Details

#initialize(attrs = {}) ⇒ Noise

Returns a new instance of Noise.



91
92
93
94
# File 'lib/ruck/ugen/basic.rb', line 91

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

Instance Method Details

#attr_namesObject



102
103
104
# File 'lib/ruck/ugen/basic.rb', line 102

def attr_names
  [:gain]
end

#next(now) ⇒ Object



96
97
98
99
100
# File 'lib/ruck/ugen/basic.rb', line 96

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