commit a8af6b72821ce5e3be05657f08f8ce7217a0ddc5
parent 7fcfe3d9cc9fa14f7795ef2c1f69372631e7804d
Author: falkTX <falktx@falktx.com>
Date: Tue, 18 May 2021 11:19:40 +0100
Fix in-place processing in cairoui example; Cleanup
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
7 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp
@@ -20,6 +20,16 @@
#include "extra/LeakDetector.hpp"
#include "src/DistrhoPluginChecks.h"
+#ifdef DGL_CAIRO
+# include "Cairo.hpp"
+#endif
+#ifdef DGL_OPENGL
+# include "OpenGL.hpp"
+#endif
+#ifdef DGL_VULKAN
+# include "Vulkan.hpp"
+#endif
+
#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI
# include "../dgl/Base.hpp"
# include "extra/ExternalWindow.hpp"
@@ -38,13 +48,6 @@ typedef DGL_NAMESPACE::NanoTopLevelWidget UIWidget;
typedef DGL_NAMESPACE::TopLevelWidget UIWidget;
#endif
-#ifdef DGL_CAIRO
-# include "Cairo.hpp"
-#endif
-#ifdef DGL_OPENGL
-# include "OpenGL.hpp"
-#endif
-
START_NAMESPACE_DISTRHO
/* ------------------------------------------------------------------------------------------------------------
diff --git a/examples/CairoUI/CairoExamplePlugin.cpp b/examples/CairoUI/CairoExamplePlugin.cpp
@@ -77,7 +77,13 @@ public:
void run(const float** inputs, float** outputs, uint32_t frames)
{
- memcpy(outputs[0], inputs[0], frames * sizeof(float));
+ /**
+ This plugin does nothing, it just demonstrates cairo UI usage.
+ So here we directly copy inputs over outputs, leaving the audio untouched.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
+ */
+ if (outputs[0] != inputs[0])
+ std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
}
};
diff --git a/examples/ExternalUI/ExternalExamplePlugin.cpp b/examples/ExternalUI/ExternalExamplePlugin.cpp
@@ -157,7 +157,7 @@ protected:
/**
This plugin does nothing, it just demonstrates information usage.
So here we directly copy inputs over outputs, leaving the audio untouched.
- We need to be careful in case the host re-uses the same buffer for both ins and outs.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
*/
if (outputs[0] != inputs[0])
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
diff --git a/examples/FileHandling/FileHandlingPlugin.cpp b/examples/FileHandling/FileHandlingPlugin.cpp
@@ -227,7 +227,7 @@ protected:
/**
This plugin doesn't do audio, it just demonstrates file handling usage.
So here we directly copy inputs over outputs, leaving the audio untouched.
- We need to be careful in case the host re-uses the same buffer for both ins and outs.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
*/
if (outputs[0] != inputs[0])
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
diff --git a/examples/Info/InfoExamplePlugin.cpp b/examples/Info/InfoExamplePlugin.cpp
@@ -208,7 +208,7 @@ protected:
/**
This plugin does nothing, it just demonstrates information usage.
So here we directly copy inputs over outputs, leaving the audio untouched.
- We need to be careful in case the host re-uses the same buffer for both ins and outs.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
*/
if (outputs[0] != inputs[0])
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
diff --git a/examples/Parameters/ExamplePluginParameters.cpp b/examples/Parameters/ExamplePluginParameters.cpp
@@ -251,7 +251,7 @@ The plugin will be treated as an effect, but it will not change the host audio."
/**
This plugin does nothing, it just demonstrates parameter usage.
So here we directly copy inputs over outputs, leaving the audio untouched.
- We need to be careful in case the host re-uses the same buffer for both ins and outs.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
*/
if (outputs[0] != inputs[0])
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
diff --git a/examples/States/ExamplePluginStates.cpp b/examples/States/ExamplePluginStates.cpp
@@ -279,7 +279,7 @@ The plugin will be treated as an effect, but it will not change the host audio."
/**
This plugin does nothing, it just demonstrates state usage.
So here we directly copy inputs over outputs, leaving the audio untouched.
- We need to be careful in case the host re-uses the same buffer for both ins and outs.
+ We need to be careful in case the host re-uses the same buffer for both inputs and outputs.
*/
if (outputs[0] != inputs[0])
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);