From 96aa94faf00770e248e03f0873856d43faf29e4b Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 23 Aug 2014 22:31:10 +0100 Subject: [PATCH] Misc --- data/copy-juce-carla | 1 + source/backend/engine/CarlaEngineGraph.cpp | 45 +++++++++++++++------- source/backend/engine/CarlaEngineGraph.hpp | 4 +- source/backend/plugin/Lv2Plugin.cpp | 2 +- source/modules/juce_audio_devices.h | 6 ++- source/modules/juce_audio_processors.h | 1 + source/modules/juce_core/AppConfig.h | 4 ++ source/modules/juce_data_structures.h | 6 ++- source/modules/juce_events.h | 10 ++--- source/modules/juce_graphics.h | 6 ++- source/modules/juce_gui_basics.h | 6 ++- source/modules/juce_gui_extra.h | 6 ++- source/utils/CarlaPluginUI.cpp | 3 +- 13 files changed, 66 insertions(+), 34 deletions(-) diff --git a/data/copy-juce-carla b/data/copy-juce-carla index 3c09efefa..76c89c26c 100755 --- a/data/copy-juce-carla +++ b/data/copy-juce-carla @@ -13,3 +13,4 @@ for M in $MODULES; do done find $CARLA_MODULES_DIR -name juce_module_info -delete +rm source/modules/juce_*/juce_*.mm diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index 46d6d00e7..5dbb4e341 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -758,7 +758,8 @@ class CarlaPluginInstance : public AudioPluginInstance public: CarlaPluginInstance(CarlaPlugin* const plugin) : fPlugin(plugin), - fGraph(nullptr) {} + fGraph(nullptr), + leakDetector_CarlaPluginInstance() {} ~CarlaPluginInstance() override { @@ -894,38 +895,41 @@ public: private: CarlaPlugin* const fPlugin; AudioProcessorGraph* fGraph; + + CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginInstance) }; // ----------------------------------------------------------------------- // PatchbayGraph -static const int kAudioInputNodeStart = MAX_PATCHBAY_PLUGINS*1+1; -static const int kAudioOutputNodeStart = MAX_PATCHBAY_PLUGINS*2+1; - -static const int kMidiInputNodeId = MAX_PATCHBAY_PLUGINS*3+1; -static const int kMidiOutputNodeId = MAX_PATCHBAY_PLUGINS*3+2; +static const uint32_t kAudioInputNodeStart = MAX_PATCHBAY_PLUGINS*1+1; +static const uint32_t kAudioOutputNodeStart = MAX_PATCHBAY_PLUGINS*2+1; +static const uint32_t kMidiInputNodeId = MAX_PATCHBAY_PLUGINS*3+1; +static const uint32_t kMidiOutputNodeId = MAX_PATCHBAY_PLUGINS*3+2; PatchbayGraph::PatchbayGraph(const int bufferSize, const double sampleRate, const uint32_t ins, const uint32_t outs) : graph(), audioBuffer(), midiBuffer(), - inputs(static_cast(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS, ins))), - outputs(static_cast(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS, outs))), + inputs(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS, ins)), + outputs(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS, outs)), retCon() { - graph.setPlayConfigDetails(inputs, outputs, sampleRate, bufferSize); + graph.setPlayConfigDetails(static_cast(inputs), static_cast(outputs), sampleRate, bufferSize); graph.prepareToPlay(sampleRate, bufferSize); - audioBuffer.setSize(jmax(inputs, outputs), bufferSize); + + audioBuffer.setSize(static_cast(jmax(inputs, outputs)), bufferSize); + midiBuffer.ensureSize(kMaxEngineEventInternalCount*2); midiBuffer.clear(); - for (int i=0; i(inputs); ++i) FloatVectorOperations::copy(audioBuffer.getWritePointer(i), inBuf[i], frames); // clear remaining channels @@ -1065,7 +1069,7 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float* // put juce audio in carla buffer { - for (int i=0; i(outputs); ++i) FloatVectorOperations::copy(outBuf[i], audioBuffer.getReadPointer(i), frames); } @@ -1340,3 +1344,16 @@ void CarlaEngine::restorePatchbayConnection(const char* const connSource, const // ----------------------------------------------------------------------- CARLA_BACKEND_END_NAMESPACE + +// ----------------------------------------------------------------------- +// need to build juce_audio_processors on non-win/mac OSes + +#if ! (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) +# include "juce_audio_processors.h" +namespace juce { +# include "juce_audio_processors/processors/juce_AudioProcessor.cpp" +# include "juce_audio_processors/processors/juce_AudioProcessorGraph.cpp" +} +#endif + +// ----------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngineGraph.hpp b/source/backend/engine/CarlaEngineGraph.hpp index f69158020..dd4cdd4f7 100644 --- a/source/backend/engine/CarlaEngineGraph.hpp +++ b/source/backend/engine/CarlaEngineGraph.hpp @@ -116,8 +116,8 @@ struct PatchbayGraph { AudioProcessorGraph graph; AudioSampleBuffer audioBuffer; MidiBuffer midiBuffer; - const int inputs; - const int outputs; + const uint32_t inputs; + const uint32_t outputs; mutable CharStringListPtr retCon; PatchbayGraph(const int bufferSize, const double sampleRate, const uint32_t inputs, const uint32_t outputs); diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index a90e9ac83..e7fd43fa8 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -4290,7 +4290,7 @@ public: carla_stdout("Lv2Plugin::handlePluginUIResized(%u, %u)", width, height); if (fUI.handle != nullptr && fExt.uiresize != nullptr) - fExt.uiresize->ui_resize(fUI.handle, width, height); + fExt.uiresize->ui_resize(fUI.handle, static_cast(width), static_cast(height)); } // ------------------------------------------------------------------- diff --git a/source/modules/juce_audio_devices.h b/source/modules/juce_audio_devices.h index 5daa76000..ec78c292d 100644 --- a/source/modules/juce_audio_devices.h +++ b/source/modules/juce_audio_devices.h @@ -22,7 +22,9 @@ #include "juce_audio_basics.h" #include "juce_audio_formats.h" -#include "juce_audio_devices/AppConfig.h" -#include "juce_audio_devices/juce_audio_devices.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_audio_devices/AppConfig.h" +# include "juce_audio_devices/juce_audio_devices.h" +#endif #endif // CARLA_JUCE_AUDIO_DEVICES_H_INCLUDED diff --git a/source/modules/juce_audio_processors.h b/source/modules/juce_audio_processors.h index f67ef17c5..a81527c12 100644 --- a/source/modules/juce_audio_processors.h +++ b/source/modules/juce_audio_processors.h @@ -21,6 +21,7 @@ #include "juce_gui_basics.h" #include "juce_audio_basics.h" +// patched to not use gui on non-win/mac #include "juce_audio_processors/AppConfig.h" #include "juce_audio_processors/juce_audio_processors.h" diff --git a/source/modules/juce_core/AppConfig.h b/source/modules/juce_core/AppConfig.h index cb4b91477..d8fa9a3fc 100755 --- a/source/modules/juce_core/AppConfig.h +++ b/source/modules/juce_core/AppConfig.h @@ -69,6 +69,10 @@ #define JUCE_USE_VFORK 1 +#if ! (JUCE_MAC || JUCE_WINDOWS) +# define JUCE_AUDIO_PROCESSOR_DISABLE_GUI 1 +#endif + // always enabled #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 #define JUCE_MODULE_AVAILABLE_juce_audio_formats 1 diff --git a/source/modules/juce_data_structures.h b/source/modules/juce_data_structures.h index 12f6631f1..16c3436f6 100644 --- a/source/modules/juce_data_structures.h +++ b/source/modules/juce_data_structures.h @@ -20,7 +20,9 @@ #include "juce_events.h" -#include "juce_data_structures/AppConfig.h" -#include "juce_data_structures/juce_data_structures.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_data_structures/AppConfig.h" +# include "juce_data_structures/juce_data_structures.h" +#endif #endif // CARLA_JUCE_DATA_STRUCTURES_H_INCLUDED diff --git a/source/modules/juce_events.h b/source/modules/juce_events.h index 6cd528f7f..d71fba9f6 100644 --- a/source/modules/juce_events.h +++ b/source/modules/juce_events.h @@ -18,13 +18,11 @@ #ifndef CARLA_JUCE_EVENTS_H_INCLUDED #define CARLA_JUCE_EVENTS_H_INCLUDED -#if ! (JUCE_MAC || JUCE_WINDOWS) -# error Don't want juce_events with the current setup -#endif - #include "juce_core.h" -#include "juce_events/AppConfig.h" -#include "juce_events/juce_events.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_events/AppConfig.h" +# include "juce_events/juce_events.h" +#endif #endif // CARLA_JUCE_EVENTS_H_INCLUDED diff --git a/source/modules/juce_graphics.h b/source/modules/juce_graphics.h index 5bcf8e578..8d94cab27 100644 --- a/source/modules/juce_graphics.h +++ b/source/modules/juce_graphics.h @@ -21,7 +21,9 @@ #include "juce_core.h" #include "juce_events.h" -#include "juce_graphics/AppConfig.h" -#include "juce_graphics/juce_graphics.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_graphics/AppConfig.h" +# include "juce_graphics/juce_graphics.h" +#endif #endif // CARLA_JUCE_GRAPHICS_H_INCLUDED diff --git a/source/modules/juce_gui_basics.h b/source/modules/juce_gui_basics.h index e5f2f7f54..17f61ca22 100644 --- a/source/modules/juce_gui_basics.h +++ b/source/modules/juce_gui_basics.h @@ -21,7 +21,9 @@ #include "juce_graphics.h" #include "juce_data_structures.h" -#include "juce_gui_basics/AppConfig.h" -#include "juce_gui_basics/juce_gui_basics.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_gui_basics/AppConfig.h" +# include "juce_gui_basics/juce_gui_basics.h" +#endif #endif // CARLA_JUCE_GUI_BASICS_H_INCLUDED diff --git a/source/modules/juce_gui_extra.h b/source/modules/juce_gui_extra.h index 512a620f3..729ddff44 100644 --- a/source/modules/juce_gui_extra.h +++ b/source/modules/juce_gui_extra.h @@ -20,7 +20,9 @@ #include "juce_gui_basics.h" -#include "juce_gui_extra/AppConfig.h" -#include "juce_gui_extra/juce_gui_extra.h" +#if JUCE_MAC || JUCE_WINDOWS +# include "juce_gui_extra/AppConfig.h" +# include "juce_gui_extra/juce_gui_extra.h" +#endif #endif // CARLA_JUCE_GUI_EXTRA_H_INCLUDED diff --git a/source/utils/CarlaPluginUI.cpp b/source/utils/CarlaPluginUI.cpp index eb1d5fa82..73ab7819e 100644 --- a/source/utils/CarlaPluginUI.cpp +++ b/source/utils/CarlaPluginUI.cpp @@ -183,7 +183,8 @@ public: CARLA_SAFE_ASSERT_CONTINUE(fCallback != nullptr); CARLA_SAFE_ASSERT_CONTINUE(event.xconfigure.width > 0); CARLA_SAFE_ASSERT_CONTINUE(event.xconfigure.height > 0); - fCallback->handlePluginUIResized(event.xconfigure.width, event.xconfigure.height); + fCallback->handlePluginUIResized(static_cast(event.xconfigure.width), + static_cast(event.xconfigure.height)); break; case ClientMessage: