Module: Ruck::UGen::Oscillator

Includes:
UGenBase
Included in:
Generators::SawOsc, Generators::SinOsc, Generators::TriOsc
Defined in:
lib/ruck/ugen/oscillators.rb

Constant Summary collapse

TWO_PI =
2 * Math::PI

Instance Attribute Summary

Attributes included from UGenBase

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods included from UGenBase

#to_s

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
18
# File 'lib/ruck/ugen/oscillators.rb', line 13

def self.included(base)
  base.instance_eval do
    linkable_attr :freq
    linkable_attr :phase
  end
end

Instance Method Details

#phase_forwardObject



20
21
22
# File 'lib/ruck/ugen/oscillators.rb', line 20

def phase_forward
  @phase = (@phase + freq.to_f / SAMPLE_RATE.to_f) % 1.0
end