18 SampleType
value() const noexcept {
19 return static_cast<SampleType
>(
sign);
25template <
typename SampleType =
double>
27 std::uint64_t index)
noexcept {
30 (
mix64(seed, index, 1u) & 1ull) ? 1 : -1,
37template <
typename SampleType>
39 SampleType grid_samples)
noexcept {
40 if (!(std::isfinite(grid_samples) && grid_samples > SampleType{1}))
42 const auto width = std::max(SampleType{}, grid_samples - SampleType{1});
43 return std::max(0,
static_cast<int>(std::lround(draw.jitter * width)));
61 std::uint64_t
index() const noexcept {
64 std::uint64_t
seed() const noexcept {
70 std::uint64_t index_ = 0;
Sequential convenience wrapper over the coordinate-keyed pure draw.
Definition velvet_noise.hpp:50
std::uint64_t seed() const noexcept
Definition velvet_noise.hpp:64
std::uint64_t index() const noexcept
Definition velvet_noise.hpp:61
void set_seed(std::uint64_t seed) noexcept
Definition velvet_noise.hpp:52
VelvetNoiseDrawT< SampleType > next() noexcept
Definition velvet_noise.hpp:58
void reset() noexcept
Definition velvet_noise.hpp:55
Definition additive_bank.hpp:218
constexpr std::uint64_t kGoldenGamma
The 64-bit golden-ratio odd constant that splitmix64 steps its state by.
Definition rng.hpp:180
int velvet_noise_offset(const VelvetNoiseDrawT< SampleType > &draw, SampleType grid_samples) noexcept
Converts a grid draw to its zero-based sample offset.
Definition velvet_noise.hpp:38
constexpr std::uint64_t mix64(std::uint64_t z)
splitmix64 finalizer (Steele, Lea & Flood, OOPSLA 2014).
Definition rng.hpp:140
VelvetNoiseGridT< float > VelvetNoiseGrid
Definition velvet_noise.hpp:73
VelvetNoiseGridT< double > VelvetNoiseGrid64
Definition velvet_noise.hpp:74
@ u
Definition formant_filter_bank.hpp:20
VelvetNoiseDrawT< SampleType > velvet_noise_draw(std::uint64_t seed, std::uint64_t index) noexcept
Pure draw for one velvet grid cell.
Definition velvet_noise.hpp:26
float unit_from(std::uint64_t key)
Stateless purpose-keyed draw in [0, 1).
Definition rng.hpp:164
Deterministic randomness for modulation: a counter-free PRNG, a Gaussian draw, a stateless purpose-ke...
Definition velvet_noise.hpp:14
SampleType value() const noexcept
Definition velvet_noise.hpp:18
SampleType jitter
Definition velvet_noise.hpp:15
int sign
Definition velvet_noise.hpp:16