Skip to content

πŸŽ› πŸ”Š A Python library for audio.

Add exceptions for default cases in switches.

Peter Sobotcab34498acc7
diff --git a/pedalboard/process.h b/pedalboard/process.h
index 8692820..45dfd63 100644
--- a/pedalboard/process.h
+++ b/pedalboard/process.h
@@ -134,6 +134,9 @@ copyPyArrayIntoJuceBuffer(const py::array_t<T, py::array::c_style> inputArray) {
ioBuffer.copyFrom(
i, 0, static_cast<T *>(inputInfo.ptr) + (numSamples * i), numSamples);
}
+ break;
+ default:
+ throw std::runtime_error("Internal error: got unexpected channel layout.");
}
return ioBuffer;
@@ -158,6 +161,8 @@ py::array_t<T> copyJuceBufferIntoPyArray(const juce::AudioBuffer<T> juceBuffer,
case ChannelLayout::NotInterleaved:
outputArray = py::array_t<T>({numChannels, outputSampleCount});
break;
+ default:
+ throw std::runtime_error("Internal error: got unexpected channel layout.");
}
} else {
outputArray = py::array_t<T>(outputSampleCount);
@@ -188,6 +193,8 @@ py::array_t<T> copyJuceBufferIntoPyArray(const juce::AudioBuffer<T> juceBuffer,
&outputBasePointer[outputSampleCount * i]);
}
break;
+ default:
+ throw std::runtime_error("Internal error: got unexpected channel layout.");
}
return outputArray;