Module: Ruck::Oscillator

Includes:
UGen
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 UGen

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods included from UGen

#to_s

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
# File 'lib/ruck/ugen/oscillators.rb', line 8

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

Instance Method Details

#phase_forwardObject



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

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