Class: Ruck::Generators::Gain

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

Instance Attribute Summary

Attributes included from UGen

#name

Instance Method Summary collapse

Methods included from Target

#add_source, #remove_source

Methods included from Source

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

Methods included from UGen

#to_s

Constructor Details

#initialize(attrs = {}) ⇒ Gain

Returns a new instance of Gain.



187
188
189
190
191
# File 'lib/ruck/ugen/general.rb', line 187

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

Instance Method Details

#attr_namesObject



199
200
201
# File 'lib/ruck/ugen/general.rb', line 199

def attr_names
  [:gain]
end

#next(now) ⇒ Object



193
194
195
196
197
# File 'lib/ruck/ugen/general.rb', line 193

def next(now)
  return @last if @now == now
  @now = now
  @last = @ins.inject(0) { |samp, ugen| samp += ugen.next(now) } * gain
end