commit eeff3c5d208b6e078ab6f9d4b2c37b2a7635aa34
parent 99c3b47f53a3a2a784d45339c68d1466916d4874
Author: Steven Atkinson <steven@atkinson.mn>
Date: Mon, 1 May 2023 21:40:42 -0700
Sum inputs on standalone; average elsewhere
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp
@@ -874,8 +874,16 @@ void NeuralAmpModeler::_ProcessInput(iplug::sample** inputs, const size_t nFrame
throw std::runtime_error(ss.str());
}
- // Assume _PrepareBuffers() was already called
+ // On the standalone, we can probably assume that the user has plugged into only one input and they expect it to be
+ // carried straight through. Don't apply any division over nCahnsIn because we're just "catching anything out there."
+ // However, in a DAW, it's probably something providing stereo, and we want to take the average in order to avoid
+ // doubling the loudness.
+#ifdef APP_API
const double gain = pow(10.0, GetParam(kInputLevel)->Value() / 20.0);
+#else
+ const double gain = pow(10.0, GetParam(kInputLevel)->Value() / 20.0) / (float)nChansIn;
+#endif
+ // Assume _PrepareBuffers() was already called
for (size_t c = 0; c < nChansIn; c++)
for (size_t s = 0; s < nFrames; s++)
if (c == 0)