9#include "signals/hart_signal.hpp"
17template<
typename SampleType>
26 m_randomSeed (randomSeed)
33 void prepare (
double , size_t numOutputChannels, size_t )
override
35 this->setNumChannels (numOutputChannels);
40 for (size_t frame = 0; frame < output.getNumFrames(); ++frame)
41 for (size_t channel = 0; channel <
this->getNumChannels(); ++channel)
42 output[channel][frame] = m_uniformRealDistribution (m_randomNumberGenerator);
49 m_randomNumberGenerator = std::mt19937 (m_randomSeed);
50 m_uniformRealDistribution.reset();
53 void represent (std::ostream& stream)
const override
55 stream <<
"WhiteNoise (" << m_randomSeed <<
")";
61 const uint_fast32_t m_randomSeed;
62 std::mt19937 m_randomNumberGenerator;
63 std::uniform_real_distribution<SampleType> m_uniformRealDistribution {(SampleType) -1, (SampleType) 1};
Produces deterministic white noise.
void renderNextBlock(AudioBuffer< SampleType > &output) override
Renders next block audio for the signal.
void prepare(double, size_t numOutputChannels, size_t) override
Prepare the signal for rendering.
void represent(std::ostream &stream) const override
Makes a text representation of this Signal for test failure outputs.
bool supportsNumChannels(size_t) const override
Tells the host whether this Signal is capable of generating audio for a certain amount of cchannels.
WhiteNoise(uint_fast32_t randomSeed=CLIConfig::getInstance().getRandomSeed())
Creates a Signal that produces white noise.
void reset() override
Resets the Signal to initial state.
#define HART_SIGNAL_DEFINE_COPY_AND_MOVE(ClassName)
Defines hart::Signal::copy() and hart::Signal::move() methods.
#define HART_SIGNAL_DECLARE_ALIASES_FOR(ClassName)
uint_fast32_t getRandomSeed()
static CLIConfig & getInstance()