HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
|
base class for oscillators. More...
#include <Oscillator.h>
Public Member Functions | |
virtual | ~Oscillator ()=default |
virtual double | operator[] (size_t n) const =0 |
Heph::DoubleBuffer | GenerateBuffer () const |
Heph::DoubleBuffer | GenerateBuffer (size_t size) const |
Heph::DoubleBuffer | GenerateBuffer (size_t index, size_t size) const |
Public Attributes | |
double | peakAmplitude |
double | frequency |
double | phase_rad |
uint32_t | sampleRate |
Protected Member Functions | |
Oscillator () | |
Oscillator (double peakAmplitude, double frequency, uint32_t sampleRate, double phase_rad) | |
base class for oscillators.
|
protected |
creates a new instance and initializes it with default values.
|
protected |
creates a new instance and initializes it with the provided values.
peakAmplitude | maximum amplitude of the periodic signal. |
frequency | frequency of the periodic signal. |
sampleRate | sampling rate of the periodic signal. |
phase_rad | phase angle, in radians, of the periodic signal. |
|
virtualdefault |
releases the resources and destroys the instance.
|
pure virtual |
calculates the sample at index n.
Implemented in HephAudio::SawToothWaveOscillator, HephAudio::SineWaveOscillator, HephAudio::SquareWaveOscillator, and HephAudio::TriangleWaveOscillator.
Heph::DoubleBuffer HephAudio::Oscillator::GenerateBuffer | ( | ) | const |
generates a one-period-long buffer.
Heph::DoubleBuffer HephAudio::Oscillator::GenerateBuffer | ( | size_t | size | ) | const |
generates a buffer with the provided size.
size | size of the buffer in samples. |
Heph::DoubleBuffer HephAudio::Oscillator::GenerateBuffer | ( | size_t | index, |
size_t | size ) const |
generates a buffer with the provided size.
index | index of the first sample. |
size | size of the buffer in samples. |
double HephAudio::Oscillator::peakAmplitude |
maximum amplitude of the periodic signal.
double HephAudio::Oscillator::frequency |
frequency of the periodic signal.
double HephAudio::Oscillator::phase_rad |
phase angle, in radians, of the periodic signal.
uint32_t HephAudio::Oscillator::sampleRate |
sampling rate of the periodic signal.