Skip to content

Commit

Permalink
Merge pull request #191 from electro-smith/noise_seed
Browse files Browse the repository at this point in the history
Seed setter for `WhiteNoise`
  • Loading branch information
beserge authored Dec 11, 2023
2 parents 37f4f8b + f53f7d4 commit a06f087
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Source/Noise/whitenoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class WhiteNoise
return (randseed_ * coeff_) * amp_;
}

/** sets the seed (and corrects a seed of 0 to 1) */
inline void SetSeed(int32_t s) { randseed_ = s == 0 ? 1 : s; }

private:
static constexpr float coeff_ = 4.6566129e-010f;
float amp_;
Expand Down
2 changes: 1 addition & 1 deletion Source/Utility/dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ inline float fastroot(float f, int n)
lp = (long *)(&f);
l = *lp;
l -= 0x3F800000;
l >>= (n = 1);
l >>= (n - 1);
l += 0x3F800000;
*lp = l;
return f;
Expand Down

0 comments on commit a06f087

Please sign in to comment.