Class: Ruck::Generators::Ramp
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 = {}) ⇒ Ramp
Returns a new instance of Ramp.
287
288
289
290
291
292
293
294
|
# File 'lib/ruck/ugen/general.rb', line 287
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
316
317
318
|
# File 'lib/ruck/ugen/general.rb', line 316
def attr_names
[:from, :to, :duration, :progress, :paused]
end
|
#finished? ⇒ Boolean
312
313
314
|
# File 'lib/ruck/ugen/general.rb', line 312
def finished?
progress == 1.0
end
|
#next(now) ⇒ Object
296
297
298
299
300
301
302
|
# File 'lib/ruck/ugen/general.rb', line 296
def next(now)
return @last if @now == now
@now = now
@last = progress * (to - from) + from
inc_progress
@last
end
|
308
309
310
|
# File 'lib/ruck/ugen/general.rb', line 308
def reset
@progress = 0.0
end
|
304
305
306
|
# File 'lib/ruck/ugen/general.rb', line 304
def reverse
@from, @to = @to, @from
end
|