Skip to content

Commit

Permalink
Add test for negative sample counts being returned by external plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Jan 26, 2022
1 parent 1dd25d7 commit 2ddcffa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pedalboard/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ process<float>(const py::array_t<float, py::array::c_style> inputArray,
juce::dsp::ProcessContextReplacing<float> context(ioBlock);

int outputSamples = plugin->process(context);
if (outputSamples < 0) {
throw std::runtime_error(
"A plugin returned a negative number of output samples! "
"This is an internal Pedalboard error and should be reported."
);
}
pluginSamplesReceived += outputSamples;

int missingSamples = blockSize - outputSamples;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_external_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def test_parameter_name_normalization(_input: str, expected: str):


@pytest.mark.skipif(not plugin_named("CHOWTapeModel"), reason="Missing CHOWTapeModel plugin.")
@pytest.mark.parametrize("buffer_size", [128, 8192, 65536])
@pytest.mark.parametrize("buffer_size", [16, 128, 8192, 65536])
@pytest.mark.parametrize("oversampling", [1, 2, 4, 8, 16])
def test_external_plugin_latency_compensation(buffer_size: int, oversampling: int):
"""
Expand Down

0 comments on commit 2ddcffa

Please sign in to comment.