Yet Another Synthesizer Engine
 
Loading...
Searching...
No Matches
yase::Oscillator Class Reference

#include <oscillator.hh>

+ Inheritance diagram for yase::Oscillator:
+ Collaboration diagram for yase::Oscillator:

Detailed Description

An abstract base class from which oscillators like Sine, Saw, and Triangle are derived.

This module provides methods and I/O that most oscillators need. It also updates a basic phasor in the protected variable phase which can be used by derived classes to build more complex signal outputs. For a simple example see include/square.hh and include/square.hh which define a raw square wave oscillator.

Parameters
[input]frequency The frequency of the phasor
[input]amplitude The amplitude of the oscillator (derived classes should scale their outputs by inputs[amplitude], it is not done automatically)
[input]modulation A modulation input that modules that rate of the phasor
[input]tuning This input has units in Cents. It tunes the input frequency of the oscillator.
[input]harmonic The harmonic of the oscillator. The actual frequency will be frequency * 2^harmonic
[output]signal The output of the oscillator

Public Member Functions

void init ()
 
virtual void update ()
 
- Public Member Functions inherited from yase::Module
virtual void init ()=0
 
virtual void update ()=0
 
int add_input (string name)
 
int add_output (string name)
 
int get_input_index (string name) const
 
string get_input_name (int index) const
 
string get_output_name (int index) const
 
int get_output_index (string name) const
 
void set_input (string name, double value)
 
void set_input (int index, double value)
 
double get_input (int index) const
 
double get_input (string name) const
 
double get_output (string name) const
 
double get_output (int index) const
 
void set_output (int index, double value)
 
void copy_inputs (const Module &source)
 
void copy_outputs (Module &destination) const
 
void configure (std::vector< std::tuple< string, double > > assignments)
 
int num_inputs () const
 
int num_outputs () const
 
void emit (Event e)
 
void set_ts (double s)
 
double get_ts ()
 

Member Function Documentation

◆ init()

void yase::Oscillator::init ( )
virtual

This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.

Implements yase::Module.

◆ update()

void yase::Oscillator::update ( )
virtual

This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.

Implements yase::Module.

Reimplemented in yase::AdditiveSaw, yase::AdditiveSquare, yase::AdditiveTriangle, yase::Clock, yase::Jenny, yase::Noise, yase::OscGroup, yase::Saw, yase::Sine, yase::Square, yase::Triangle, and yase::Wavetable.


The documentation for this class was generated from the following files: