Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Sine< Tv, Ts > Class Template Reference

Computed sine wave oscillator. More...

#include <Oscillator.h>

Inheritance diagram for Sine< Tv, Ts >:
AccumPhase< Tv, Ts >

List of all members.

Public Member Functions

 Sine (Tv frq=440, Tv phs=0)
Tv operator() (Tv frqOffset=Tv(0))
 Generate next sample with a frequency offset.
Tv nextPhase ()
 Generate next sample. Stored phase is post-incremented.
Tv nextPhase (Tv frqOffset)
 Generate next sample with a frequency offset.
void freq (Tv v)
 Set frequency.
Tv freq ()
 Get frequency.
void period (Tv v)
 Set period length.
Tv period ()
 Get period.
void phase (Tv v)
 Set phase from [0, 1) of one period.
Tv phase ()
 Get normalized phase in [0, 1)
void phaseAdd (Tv v)
 Add value to unit phase.

Detailed Description

template<class Tv = gam::real, class Ts = Synced>
class gam::Sine< Tv, Ts >

Computed sine wave oscillator.

This oscillator uses a 7th order Taylor series approximation to compute sine values. Computation time is about as much as a linearly-interpolating table lookup. In most cases, Taylor series are also more spectrally pure than table lookup methods since the distortion arises as harmonics.


Constructor & Destructor Documentation

Sine ( Tv  frq = 440,
Tv  phs = 0 
)
Parameters:
[in]frqFrequency
[in]phsPhase in [0, 1)

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