Skip to content

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

Add exception if rendering a misbehaving plugin.

Peter Sobot5877c85711c1
diff --git a/pedalboard/process.h b/pedalboard/process.h
index 5ff269f..81ee6f1 100644
--- a/pedalboard/process.h
+++ b/pedalboard/process.h
@@ -328,6 +328,12 @@ process<float>(const py::array_t<float, py::array::c_style> inputArray,
pluginSamplesReceived += outputSamples;
int missingSamples = blockSize - outputSamples;
+ if (missingSamples < 0) {
+ throw std::runtime_error(
+ "A plugin returned more samples than were asked for! "
+ "This is an internal Pedalboard error and should be reported.");
+ }
+
if (missingSamples > 0 && pluginSamplesReceived > 0) {
// This can only happen if the plugin we're using is returning us more
// than one chunk of audio that's not completely full, which can