11#ifndef MARVIN_OSCILLATOR_H
12#define MARVIN_OSCILLATOR_H
30 template <FloatType SampleType>
44 [[nodiscard]] virtual SampleType operator()() noexcept = 0;
51 [[nodiscard]] virtual SampleType operator()(SampleType phase) noexcept = 0;
79 SampleType
m_phase{
static_cast<SampleType
>(0.0) };
86 template <FloatType SampleType>
90 [[nodiscard]] SampleType operator()() noexcept override;
91 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
101 [[nodiscard]] SampleType operator()() noexcept override;
102 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
105 math::LeakyIntegrator<SampleType> m_integrator;
115 [[nodiscard]] SampleType operator()() noexcept override;
116 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
126 [[nodiscard]] SampleType operator()() noexcept override;
127 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
137 [[nodiscard]] SampleType operator()() noexcept override;
138 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
146 SampleType m_pulsewidth{ 0.5 };
152 template <FloatType SampleType>
161 [[nodiscard]] SampleType operator()() noexcept override;
166 [[nodiscard]] SampleType operator()(SampleType phase) noexcept override;
239 void incrementPhase() noexcept;
240 double m_sampleRate{};
241 Shape m_shape{ Shape::Sine };
242 SampleType m_phase{
static_cast<SampleType
>(0.0) };
243 SampleType m_phaseIncrement{
static_cast<SampleType
>(0.0) };
244 SampleType m_phaseOffset{
static_cast<SampleType
>(0.0) };
245 SineOscillator<SampleType> m_sine;
246 TriOscillator<SampleType, Bandlimit> m_tri;
247 SawOscillator<SampleType, Bandlimit> m_saw;
248 SquareOscillator<SampleType, Bandlimit> m_square;
249 PulseOscillator<SampleType, Bandlimit> m_pulse;
250 NoiseOscillator<SampleType> m_noise;
void setPhaseOffset(SampleType newPhaseOffset) noexcept
SampleType operator()() noexcept
void setShape(Shape shape)
MultiOscillator(std::random_device &rd)
void initialise(double sampleRate)
void setFrequency(SampleType newFrequency) noexcept
Shape
Definition marvin_Oscillator.h:181
@ Triangle
Definition marvin_Oscillator.h:183
@ Sine
Definition marvin_Oscillator.h:182
@ Noise
Definition marvin_Oscillator.h:187
@ Saw
Definition marvin_Oscillator.h:184
@ Square
Definition marvin_Oscillator.h:185
@ Pulse
Definition marvin_Oscillator.h:186
void setPulsewidth(SampleType newPulsewidth) noexcept
MultiOscillator(std::random_device &rd, Shape shape)
NoiseOscillator(std::random_device &rd)
~NoiseOscillator() noexcept override=default
Base class for all single-shape oscillator types.
Definition marvin_Oscillator.h:31
virtual void initialise(double sampleRate)
SampleType m_phaseOffset
Definition marvin_Oscillator.h:80
virtual ~OscillatorBase() noexcept=default
SampleType m_phase
Definition marvin_Oscillator.h:79
SampleType m_phaseIncrement
Definition marvin_Oscillator.h:78
void incrementPhase() noexcept
virtual void reset() noexcept
void setPhaseOffset(SampleType newPhaseOffset) noexcept
double m_sampleRate
Definition marvin_Oscillator.h:77
void setFrequency(SampleType newFrequency) noexcept
A pulse oscillator, with optional BLEP, and pulsewidth control.
Definition marvin_Oscillator.h:134
void setPulsewidth(SampleType newPulsewidth) noexcept
~PulseOscillator() noexcept override=default
A sawtooth oscillator, with optional BLEP.
Definition marvin_Oscillator.h:112
~SawOscillator() noexcept override=default
A sine oscillator.
Definition marvin_Oscillator.h:87
~SineOscillator() noexcept override=default
A square oscillator, with optional BLEP.
Definition marvin_Oscillator.h:123
~SquareOscillator() noexcept override=default
A triangle oscillator, with optional BLAMP.
Definition marvin_Oscillator.h:98
~TriOscillator() noexcept override=default
Contrains T to be either a float or a double.
Definition marvin_Concepts.h:27
Oscillator functions and classes..
Definition marvin_Oscillator.h:17
Bandlimiting
Enum to configure PolyBLEP or BLAMP where applicable, to classes deriving from marvin::oscillators::O...
Definition marvin_Oscillator.h:22
@ On
Definition marvin_Oscillator.h:24
@ Off
Definition marvin_Oscillator.h:23
Math helper functions and classes.
Definition marvin_Math.h:22
Utility helper functions and classes.
Definition marvin_Utils.h:21