Skip to content

Commit

Permalink
Really?
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Jul 23, 2024
1 parent d0f8b10 commit 69ee312
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pedalboard/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,19 @@ processFloat32(const py::array_t<float, py::array::c_style> 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.
py::array_t<float> outputArray;
if (inputArray.request().ndim == 2) {
switch (inputChannelLayout) {
case ChannelLayout::Interleaved:
outputArray = py::array_t<float>({ioBuffer.getNumSamples(), 0});
outputArray = py::array_t<float>({numSamples, numChannels});
break;
case ChannelLayout::NotInterleaved:
outputArray = py::array_t<float>({0, ioBuffer.getNumSamples()});
outputArray = py::array_t<float>({numChannels, numSamples});
break;
default:
throw std::runtime_error(
Expand Down

0 comments on commit 69ee312

Please sign in to comment.