diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 6557ca0c..1e110a86 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: 'v0.5.8', + VERSION: 'v0.5.9', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/compatibility.html b/docs/compatibility.html index 9895379c..b0173d78 100644 --- a/docs/compatibility.html +++ b/docs/compatibility.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - Plugin Compatibility - Pedalboard v0.5.8 Documentation + Plugin Compatibility - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/faq.html b/docs/faq.html index 5e09ebaf..879685b7 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - Frequently Asked Questions - Pedalboard v0.5.8 Documentation + Frequently Asked Questions - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/genindex.html b/docs/genindex.html index d46a02cd..3b63d5f5 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -4,7 +4,7 @@ - Index - Pedalboard v0.5.8 Documentation + Index - Pedalboard v0.5.9 Documentation @@ -122,7 +122,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -148,7 +148,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/index.html b/docs/index.html index 2e343cd3..d9a2a04c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/internals.html b/docs/internals.html index 9baeedbd..25aefad1 100644 --- a/docs/internals.html +++ b/docs/internals.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - Pedalboard Internals - Pedalboard v0.5.8 Documentation + Pedalboard Internals - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/license.html b/docs/license.html index 202008d8..f5f171f9 100644 --- a/docs/license.html +++ b/docs/license.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - License - Pedalboard v0.5.8 Documentation + License - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/py-modindex.html b/docs/py-modindex.html index f9eb1a3d..d74673f3 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -4,7 +4,7 @@ - Python Module Index - Pedalboard v0.5.8 Documentation + Python Module Index - Pedalboard v0.5.9 Documentation @@ -122,7 +122,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -148,7 +148,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/reference/pedalboard.html b/docs/reference/pedalboard.html index 3d964b32..47d5a5d0 100644 --- a/docs/reference/pedalboard.html +++ b/docs/reference/pedalboard.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - The pedalboard API - Pedalboard v0.5.8 Documentation + The pedalboard API - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/reference/pedalboard.io.html b/docs/reference/pedalboard.io.html index 639eaf25..fa76825b 100644 --- a/docs/reference/pedalboard.io.html +++ b/docs/reference/pedalboard.io.html @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - The pedalboard.io API - Pedalboard v0.5.8 Documentation + The pedalboard.io API - Pedalboard v0.5.9 Documentation @@ -138,7 +138,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -164,7 +164,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/docs/search.html b/docs/search.html index 4eb01126..d16802e1 100644 --- a/docs/search.html +++ b/docs/search.html @@ -4,7 +4,7 @@ - Search - Pedalboard v0.5.8 Documentation + Search - Pedalboard v0.5.9 Documentation @@ -121,7 +121,7 @@
-
Pedalboard v0.5.8 Documentation
+
Pedalboard v0.5.9 Documentation
@@ -147,7 +147,7 @@
- Pedalboard v0.5.8 Documentation + Pedalboard v0.5.9 Documentation diff --git a/pedalboard/PluginContainer.h b/pedalboard/PluginContainer.h index 989786ae..137479c9 100644 --- a/pedalboard/PluginContainer.h +++ b/pedalboard/PluginContainer.h @@ -42,6 +42,10 @@ class PluginContainer : public Plugin { std::vector> getAllPlugins() { std::vector> flatList; for (auto plugin : plugins) { + if (!plugin) { + continue; + } + flatList.push_back(plugin); if (auto *pluginContainer = dynamic_cast(plugin.get())) { diff --git a/pedalboard/plugins/Chain.h b/pedalboard/plugins/Chain.h index ec1add10..d2824c18 100644 --- a/pedalboard/plugins/Chain.h +++ b/pedalboard/plugins/Chain.h @@ -34,8 +34,11 @@ class Chain : public PluginContainer { virtual ~Chain(){}; virtual void prepare(const juce::dsp::ProcessSpec &spec) { - for (auto plugin : plugins) - plugin->prepare(spec); + for (auto plugin : plugins) { + if (plugin) { + plugin->prepare(spec); + } + } lastSpec = spec; } @@ -56,14 +59,20 @@ class Chain : public PluginContainer { } virtual void reset() { - for (auto plugin : plugins) - plugin->reset(); + for (auto plugin : plugins) { + if (plugin) { + plugin->reset(); + } + } } virtual int getLatencyHint() { int hint = 0; - for (auto plugin : plugins) - hint += plugin->getLatencyHint(); + for (auto plugin : plugins) { + if (plugin) { + hint += plugin->getLatencyHint(); + } + } return hint; } }; diff --git a/pedalboard/plugins/Mix.h b/pedalboard/plugins/Mix.h index 9efc830d..16ddc1eb 100644 --- a/pedalboard/plugins/Mix.h +++ b/pedalboard/plugins/Mix.h @@ -35,8 +35,11 @@ class Mix : public PluginContainer { virtual ~Mix(){}; virtual void prepare(const juce::dsp::ProcessSpec &spec) { - for (auto plugin : plugins) - plugin->prepare(spec); + for (auto plugin : plugins) { + if (plugin) { + plugin->prepare(spec); + } + } int maximumBufferSize = getLatencyHint() + spec.maximumBlockSize; for (auto &buffer : pluginBuffers) @@ -75,7 +78,12 @@ class Mix : public PluginContainer { channelPointers, buffer.getNumChannels(), ioBlock.getNumSamples()); juce::dsp::ProcessContextReplacing subContext(subBlock); - int samplesRendered = plugin->process(subContext); + + int samplesRendered = subBlock.getNumSamples(); + + if (plugin) { + samplesRendered = plugin->process(subContext); + } samplesAvailablePerPlugin[i] += samplesRendered; if (samplesRendered < subBlock.getNumSamples()) { @@ -135,16 +143,23 @@ class Mix : public PluginContainer { } virtual void reset() { - for (auto plugin : plugins) - plugin->reset(); + for (auto plugin : plugins) { + if (plugin) { + plugin->reset(); + } + } + for (auto buffer : pluginBuffers) buffer.clear(); } virtual int getLatencyHint() { int maxHint = 0; - for (auto plugin : plugins) - maxHint = std::max(maxHint, plugin->getLatencyHint()); + for (auto plugin : plugins) { + if (plugin) { + maxHint = std::max(maxHint, plugin->getLatencyHint()); + } + } return maxHint; } diff --git a/pedalboard/version.py b/pedalboard/version.py index d7b0b6e9..fda3e3ec 100644 --- a/pedalboard/version.py +++ b/pedalboard/version.py @@ -17,6 +17,6 @@ MAJOR = 0 MINOR = 5 -PATCH = 8 +PATCH = 9 __version__ = "%d.%d.%d" % (MAJOR, MINOR, PATCH) diff --git a/tests/test_mix_and_chain.py b/tests/test_mix_and_chain.py index a2a536b5..fa4a3703 100644 --- a/tests/test_mix_and_chain.py +++ b/tests/test_mix_and_chain.py @@ -298,3 +298,14 @@ def test_empty_list_is_valid_constructor_arg(cls): @pytest.mark.parametrize("cls", [Mix, Chain, Pedalboard]) def test_no_arg_constructor(cls): assert len(cls()) == 0 + + +@pytest.mark.parametrize("cls", [Mix, Chain, Pedalboard]) +def test_none_as_argument(cls): + container = cls([None]) + assert len(container) == 1 + assert container[0] is None + sample_rate = 44100 + noise = np.random.rand(int(NUM_SECONDS * sample_rate)) + output = container(noise, sample_rate) + np.testing.assert_allclose(noise, output)