BogaudioModules

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

commit 3b4cc617d47c560ebb75c5b26e71af3be3c48a46
parent 250e9143b01e4191b3e59a0c5a54d3f27fbd1b3a
Author: Matt Demanett <matt@demanett.net>
Date:   Wed, 17 Jun 2020 21:43:15 -0400

Add a bit of slew limitation on matrix mixers, to smooth out pops, especially with the switch mixers. #122

Diffstat:
Msrc/matrix_base.cpp | 9++++++++-
Msrc/matrix_base.hpp | 4++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/matrix_base.cpp b/src/matrix_base.cpp @@ -54,6 +54,13 @@ void MatrixBaseModuleWidget::appendContextMenu(Menu* menu) { } +void MatrixModule::sampleRateChange() { + float sr = APP->engine->getSampleRate(); + for (int i = 0, n = _n * _n; i < n; ++i) { + _sls[i].setParams(sr, 0.5f, 1.0f); + } +} + int MatrixModule::channels() { return inputs[_firstInputID].getChannels(); } @@ -63,7 +70,7 @@ void MatrixModule::modulate() { for (int i = 0; i < _n; ++i) { for (int j = 0; j < _n; ++j) { int ii = i * _n + j; - _paramValues[ii] = params[_firstParamID + ii].getValue(); + _paramValues[ii] = _sls[ii].next(params[_firstParamID + ii].getValue()); } } } diff --git a/src/matrix_base.hpp b/src/matrix_base.hpp @@ -36,6 +36,7 @@ struct MatrixModule : MatrixBaseModule { int _firstOutputID; float* _paramValues = NULL; + bogaudio::dsp::SlewLimiter* _sls = NULL; Saturator* _saturators = NULL; MatrixModule(int n, int firstParamID, int firstInputID, int firstOutputID) @@ -46,13 +47,16 @@ struct MatrixModule : MatrixBaseModule { { assert(_n <= maxN); _paramValues = new float[_n * _n] {}; + _sls = new bogaudio::dsp::SlewLimiter[_n * _n]; _saturators = new Saturator[_n * maxChannels]; } virtual ~MatrixModule() { delete[] _paramValues; + delete[] _sls; delete[] _saturators; } + void sampleRateChange() override; int channels() override; void modulate() override; void processChannel(const ProcessArgs& args, int c) override;