BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit e0c877f2bac705bcb10a3d6b9ff7cec9db391bd3
parent be39f3b287750f187a13cbd1c8b8aca7fda94bf3
Author: Matt Demanett <matt@demanett.net>
Date:   Tue, 17 Dec 2019 23:21:28 -0500

Random fixes for RandomWalk dsp.

Diffstat:
Msrc/dsp/noise.cpp | 6++++--
Msrc/dsp/noise.hpp | 1+
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/dsp/noise.cpp b/src/dsp/noise.cpp @@ -40,11 +40,13 @@ void RandomWalk::setParams(float sampleRate, float change) { } void RandomWalk::jump() { - tell(_noise.next() * 5.0f); + float x = fabsf(_noise.next()) * (_max - _min); + x += _min; + tell(x); } void RandomWalk::tell(float v) { - assert(v >= -5.0f && v <= 5.0f); + assert(v >= _min && v <= _max); _last = _bias = v; _filter.reset(); } diff --git a/src/dsp/noise.hpp b/src/dsp/noise.hpp @@ -106,6 +106,7 @@ struct RandomWalk : Generator { : _min(min) , _max(max) { + assert(_min < _max); setParams(sampleRate, change); }