1 #ifndef __SquareWaveOscillator_h
2 #define __SquareWaveOscillator_h
57 float sample =
phase <
pw ? 1 : -1;
68 sample += t+t - t*t - 1;
74 sample -= t+t - t*t - 1;
87 sample += t*t + t+t + 1;
92 sample += t+t - t*t - 1;
93 }
else if(sample == 1){
96 sample -= t*t + t+t + 1;
101 sample -= t+t - t*t - 1;
static constexpr float begin_phase
void setPulseWidth(float value)
Set pulse width to a value between 0 and 1.
void generate(FloatArray output)
Produce a block of samples.
static constexpr float end_phase
This class contains useful methods for manipulating arrays of floats.
void setPulseWidth(float value)
Set pulse width to a value between 0 and 1.
static constexpr float end_phase
static constexpr float begin_phase
static float polyblep(float t, float dt)
Calculate poly blep antialiasing compensation on normalised (to range [0, 1]) phase and phase increme...
void setSampleRate(float sr)
T * getData()
Get the data stored in the Array.
static constexpr float end_phase
SquareWaveOscillator(float sr)
static constexpr float begin_phase
void setPulseWidth(float value)
Set pulse width to a value between 0 and 1.