commit 8df0f4632e97213b73931789ebabbbaa58280b9c
parent 4c29ffa4e404c2e1b5c80ba0fcdd6e198353debe
Author: Steven Atkinson <steven@atkinson.mn>
Date: Sun, 30 Apr 2023 20:06:33 -0700
Support stereo inputs via summing (#166)
* Update config.h
Support stereo input
* Sum inputs
Diffstat:
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp
@@ -863,18 +863,22 @@ void NeuralAmpModeler::_PrepareIOPointers(const size_t numChannels)
void NeuralAmpModeler::_ProcessInput(iplug::sample** inputs, const size_t nFrames, const size_t nChansIn,
const size_t nChansOut)
{
+ // We'll assume that the main processing is mono for now. We'll handle dual amps later.
+ // See also: this->mNUM_INTERNAL_CHANNELS
+ if (nChansOut != 1) {
+ std::stringstream ss;
+ ss << "Expected mono output, but " << nChansOut << " output channels are requested!";
+ throw std::runtime_error(ss.str());
+ }
+
// Assume _PrepareBuffers() was already called
const double gain = pow(10.0, GetParam(kInputLevel)->Value() / 20.0);
- if (nChansOut <= nChansIn) // Many->few: Drop additional channels
- for (size_t c = 0; c < nChansOut; c++)
- for (size_t s = 0; s < nFrames; s++)
- this->mInputArray[c][s] = gain * inputs[c][s];
- else
- {
- // Something is wrong--this is a mono plugin. How could there be fewer
- // incoming channels?
- throw std::runtime_error("Unexpected input processing--sees fewer than 1 incoming channel?");
- }
+ for (size_t c = 0; c < nChansIn; c++)
+ for (size_t s = 0; s < nFrames; s++)
+ if (c == 0)
+ this->mInputArray[0][s] = gain * inputs[c][s];
+ else
+ this->mInputArray[0][s] += gain * inputs[c][s];
}
void NeuralAmpModeler::_ProcessOutput(iplug::sample** inputs, iplug::sample** outputs, const size_t nFrames,
diff --git a/NeuralAmpModeler/config.h b/NeuralAmpModeler/config.h
@@ -14,7 +14,7 @@
#define SHARED_RESOURCES_SUBPATH "NeuralAmpModeler"
-#define PLUG_CHANNEL_IO "1-1 1-2"
+#define PLUG_CHANNEL_IO "1-1 1-2 2-2"
#define PLUG_LATENCY 0
#define PLUG_TYPE 0