MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
marvin::dsp::oscillators::NoiseOscillator< SampleType > Class Template Referencefinal

A white noise oscillator. More...

#include <marvin_Oscillator.h>

Inheritance diagram for marvin::dsp::oscillators::NoiseOscillator< SampleType >:
marvin::dsp::oscillators::OscillatorBase< SampleType >

Public Member Functions

 NoiseOscillator (std::random_device &rd)
 
 ~NoiseOscillator () noexcept override=default
 
SampleType operator() () noexcept override
 
SampleType operator() (SampleType phase) noexcept override
 
- Public Member Functions inherited from marvin::dsp::oscillators::OscillatorBase< SampleType >
virtual ~OscillatorBase () noexcept=default
 
virtual void initialise (double sampleRate)
 
virtual void reset () noexcept
 
void setFrequency (SampleType newFrequency) noexcept
 
void setPhaseOffset (SampleType newPhaseOffset) noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from marvin::dsp::oscillators::OscillatorBase< SampleType >
void incrementPhase () noexcept
 
- Protected Attributes inherited from marvin::dsp::oscillators::OscillatorBase< SampleType >
double m_sampleRate {}
 
SampleType m_phaseIncrement { static_cast<SampleType>(0.0) }
 
SampleType m_phase { static_cast<SampleType>(0.0) }
 
SampleType m_phaseOffset { static_cast<SampleType>(0.0) }
 

Detailed Description

template<FloatType SampleType>
class marvin::dsp::oscillators::NoiseOscillator< SampleType >

A white noise oscillator.

Constructor & Destructor Documentation

◆ NoiseOscillator()

template<FloatType SampleType>
marvin::dsp::oscillators::NoiseOscillator< SampleType >::NoiseOscillator ( std::random_device & rd)
explicit

As it's not recommended to keep multiple instances of std::random_device around, it's necessary to pass one in by reference to the constructor, as a seed for the internal rng.

Parameters
rdThe seed generator to use.

◆ ~NoiseOscillator()

template<FloatType SampleType>
marvin::dsp::oscillators::NoiseOscillator< SampleType >::~NoiseOscillator ( )
overridedefaultnoexcept

Member Function Documentation

◆ operator()() [1/2]

template<FloatType SampleType>
SampleType marvin::dsp::oscillators::NoiseOscillator< SampleType >::operator() ( )
nodiscardoverridevirtualnoexcept

Processes the next sample of the wave, handling phase increments internally. Make sure to call prepareToPlay and setFrequency before calling this function!

Returns
The oscillator's output.

Implements marvin::dsp::oscillators::OscillatorBase< SampleType >.

◆ operator()() [2/2]

template<FloatType SampleType>
SampleType marvin::dsp::oscillators::NoiseOscillator< SampleType >::operator() ( SampleType phase)
nodiscardoverridevirtualnoexcept

As NoiseOscillator has no concept of phase, this overload is exactly identical to the internal phase overload.

Parameters
phaseUnused in this case.

Implements marvin::dsp::oscillators::OscillatorBase< SampleType >.


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