Class: Ruck::UGen::Generators::Ramp
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 = {}) ⇒ Ramp
Returns a new instance of Ramp.
117
118
119
120
121
122
123
124
|
# File 'lib/ruck/ugen/basic.rb', line 117
def initialize(attrs = {})
parse_attrs({ :from => 0.0,
:to => 1.0,
:duration => 1.second }.merge(attrs))
@progress = 0.0
@paused = false
@last = 0.0
end
|
Instance Method Details
#attr_names ⇒ Object
146
147
148
|
# File 'lib/ruck/ugen/basic.rb', line 146
def attr_names
[:from, :to, :duration, :progress, :paused]
end
|
#finished? ⇒ Boolean
142
143
144
|
# File 'lib/ruck/ugen/basic.rb', line 142
def finished?
progress == 1.0
end
|
#next(now) ⇒ Object
126
127
128
129
130
131
132
|
# File 'lib/ruck/ugen/basic.rb', line 126
def next(now)
return @last if @now == now
@now = now
@last = progress * (to - from) + from
inc_progress
@last
end
|
138
139
140
|
# File 'lib/ruck/ugen/basic.rb', line 138
def reset
@progress = 0.0
end
|
134
135
136
|
# File 'lib/ruck/ugen/basic.rb', line 134
def reverse
@from, @to = @to, @from
end
|