From 22209d1816dace52fa6f4073205e8aaff0d3a6e8 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 16 Jul 2019 09:40:47 -0700 Subject: [PATCH] Use minimum of 1 channel for VCAs. --- src/VCA.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VCA.cpp b/src/VCA.cpp index 5ea6dd9..6aa7fda 100644 --- a/src/VCA.cpp +++ b/src/VCA.cpp @@ -30,7 +30,7 @@ struct VCA : Module { void processChannel(Input &in, Param &level, Input &lin, Input &exp, Output &out) { // Get input - int channels = in.getChannels(); + int channels = std::max(in.getChannels(), 1); simd::float_4 v[4]; for (int c = 0; c < channels; c += 4) { v[c / 4] = simd::float_4::load(in.getVoltages(c)); @@ -153,7 +153,7 @@ struct VCA_1 : Module { } void process(const ProcessArgs &args) override { - int channels = inputs[IN_INPUT].getChannels(); + int channels = std::max(inputs[IN_INPUT].getChannels(), 1); float amplitudeSum = 0.f; float level = params[LEVEL_PARAM].getValue();