BogaudioModules

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

commit 060e4f1728df34fb07c561d9bf709c65e96d3f32
parent 0b7003e22c6cfc48bc444fa6e012e67b019a4e9b
Author: Matt Demanett <matt@demanett.net>
Date:   Thu, 11 Jun 2020 16:23:03 -0400

MIX4: fix channel level indicator staying on after channel input is disconnected. #121

Diffstat:
Msrc/Mix4.cpp | 11+++++++----
Msrc/Mix4.hpp | 1+
Msrc/Mix8.cpp | 13++++++-------
Msrc/Mix8.hpp | 1+
4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/Mix4.cpp b/src/Mix4.cpp @@ -73,19 +73,22 @@ void Mix4::processAll(const ProcessArgs& args) { for (int i = 1; i < 4; ++i) { float sample = 0.0f; - bool channelActive = false; if (inputs[IN1_INPUT + 3 * i].isConnected()) { sample = inputs[IN1_INPUT + 3 * i].getVoltageSum(); _channels[i]->next(sample, solo); - channelActive = true; + _channelActive[i] = true; } else if (_polyChannelOffset >= 0) { sample = inputs[IN1_INPUT].getPolyVoltage(_polyChannelOffset + i); _channels[i]->next(sample, solo); - channelActive = true; + _channelActive[i] = true; + } + else if (_channelActive[i]) { + _channels[i]->reset(); + _channelActive[i] = false; } toExp->preFader[i] = sample; - toExp->active[i] = channelActive; + toExp->active[i] = _channelActive[i]; } } diff --git a/src/Mix4.hpp b/src/Mix4.hpp @@ -59,6 +59,7 @@ struct Mix4 : ExpandableModule<Mix4ExpanderMessage, BGModule> { int _polyChannelOffset = -1; MixerChannel* _channels[4] {}; + bool _channelActive[4] {}; Panner _panners[4]; bogaudio::dsp::SlewLimiter _panSLs[4]; Amplifier _amplifier; diff --git a/src/Mix8.cpp b/src/Mix8.cpp @@ -81,23 +81,22 @@ void Mix8::processAll(const ProcessArgs& args) { for (int i = 1; i < 8; ++i) { float sample = 0.0f; - bool channelActive = false; if (inputs[IN1_INPUT + 3 * i].isConnected()) { sample = inputs[IN1_INPUT + 3 * i].getVoltageSum(); _channels[i]->next(sample, solo); - channelActive = true; + _channelActive[i] = true; } else if (_polyChannelOffset >= 0) { sample = inputs[IN1_INPUT].getPolyVoltage(_polyChannelOffset + i); _channels[i]->next(sample, solo); - channelActive = true; + _channelActive[i] = true; } - else { - _channels[i]->out = 0.0f; - _channels[i]->rms = 0.0f; + else if (_channelActive[i]) { + _channels[i]->reset(); + _channelActive[i] = false; } toExp->preFader[i] = sample; - toExp->active[i] = channelActive; + toExp->active[i] = _channelActive[i]; } } diff --git a/src/Mix8.hpp b/src/Mix8.hpp @@ -83,6 +83,7 @@ struct Mix8 : ExpandableModule<Mix8ExpanderMessage, BGModule> { int _polyChannelOffset = -1; MixerChannel* _channels[8] {}; + bool _channelActive[8] {}; Panner _panners[8]; bogaudio::dsp::SlewLimiter _panSLs[8]; Amplifier _amplifier;