From 69ee3123d5c0b0d024f2eb621f1a319552a5c792 Mon Sep 17 00:00:00 2001 From: Peter Sobot Date: Tue, 25 Jun 2024 20:35:11 -0400 Subject: [PATCH] Really? --- pedalboard/process.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pedalboard/process.h b/pedalboard/process.h index 1f3589f7..22e0e265 100644 --- a/pedalboard/process.h +++ b/pedalboard/process.h @@ -175,6 +175,8 @@ processFloat32(const py::array_t inputArray, copyPyArrayIntoJuceBuffer(inputArray, {inputChannelLayout}); if (ioBuffer.getNumChannels() == 0) { + unsigned int numChannels = 0; + unsigned int numSamples = ioBuffer.getNumSamples(); // We have no channels to process; just return an empty output array with // the same shape. Passing zero channels into JUCE breaks some assumptions // all over the place. @@ -182,10 +184,10 @@ processFloat32(const py::array_t inputArray, if (inputArray.request().ndim == 2) { switch (inputChannelLayout) { case ChannelLayout::Interleaved: - outputArray = py::array_t({ioBuffer.getNumSamples(), 0}); + outputArray = py::array_t({numSamples, numChannels}); break; case ChannelLayout::NotInterleaved: - outputArray = py::array_t({0, ioBuffer.getNumSamples()}); + outputArray = py::array_t({numChannels, numSamples}); break; default: throw std::runtime_error(