28 const int fint =
static_cast<int>(std::floor(
beta));
57 samples /
static_cast<std::size_t
>(std::pow(10.0,
static_cast<double>(
skip_branches)));
71 for (std::size_t i = 0; i < samples; ++i)
73 _topbranch->getSample();
81 for (
unsigned i = 0; i <
branches; ++i)
102 for (
const auto&
b : std::ranges::reverse_view(
branches))
115 for (
size_t i = 0; i <
alpha.size(); ++i)
117 auto mgen = std::make_unique<MultirateGenerator>(_rng_engine.get(),
alpha[i],
branches);
118 _generators.push_back(std::move(
mgen));
120 switch (
static_cast<int>(
alpha[i]))
123 _weights[i] *= std::pow(10.0, 1.225);
126 _weights[i] *= std::pow(10.0, 0.25);
129 _weights[i] *= std::pow(10.0, -0.25);
132 _weights[i] *= std::pow(10.0, -0.5);
135 _weights[i] *= std::pow(10.0, -1.0);
146 for (
size_t i = 0; i < _generators.size(); ++i)
148 sample += _generators[i]->getSample() * _weights[i];
151 sample += _phase_offset;
152 sample += 2 *
PI * _freq_offset *
static_cast<double>(_count) /
params::rate();
160 for (
const auto&
generator : _generators)
171 for (
const auto&
generator : _generators)
180 return !_generators.empty() || _freq_offset != 0 || _phase_offset != 0;
void reset()
Resets the noise generator state.
bool enabled() const
Checks if the noise generator is enabled.
ClockModelGenerator(std::mt19937 &rngEngine, const std::vector< RealType > &alpha, const std::vector< RealType > &inWeights, RealType frequency, RealType phaseOffset, RealType freqOffset, int branches) noexcept
Constructor to initialize the clock model generator.
RealType getSample() override
Generates a clock model noise sample.
void skipSamples(std::size_t samples)
Skips a number of samples in the noise sequence.
Class responsible for generating fractional and integer noise components.
MultirateGenerator(std::mt19937 &rngEngine, RealType alpha, unsigned branches)
Constructor to initialize the multirate generator.
void reset() noexcept
Resets the noise generator state.
void skipSamples(std::size_t samples) noexcept
Skips a number of samples in the noise sequence.
double RealType
Type for real numbers.
constexpr RealType PI
Mathematical constant π (pi).
Implementation of the FAlphaBranch class for noise generation.
RealType rate() noexcept
Get the rendering sample rate.
Header file for noise generator classes.
Defines the Parameters struct and provides methods for managing simulation parameters.