Class: Synthesizer::OscillatorSource::Pulse
- Inherits:
-
Square
- Object
- Square
- Synthesizer::OscillatorSource::Pulse
- Includes:
- Singleton
- Defined in:
- lib/synthesizer/oscillator_source/pulse.rb
Defined Under Namespace
Classes: Context
Instance Method Summary collapse
- #generate_context(soundinfo, note_perform, init_phase) ⇒ Object
-
#initialize ⇒ Pulse
constructor
A new instance of Pulse.
- #sample(context, phase) ⇒ Object
Constructor Details
#initialize ⇒ Pulse
Returns a new instance of Pulse.
6 7 |
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 6 def initialize end |
Instance Method Details
#generate_context(soundinfo, note_perform, init_phase) ⇒ Object
16 17 18 |
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 16 def generate_context(soundinfo, note_perform, init_phase) Context.new(soundinfo, note_perform, init_phase) end |
#sample(context, phase) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 9 def sample(context, phase) val = super(context, phase) result = context.prev<0.0 && 0.0<val ? 1.0 : 0.0 context.prev = val result end |