From a40177132e261a90b33317a9b43c5488bbf9ab1f Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 21 Apr 2020 08:34:48 +0100 Subject: [PATCH] Fixup build with new juce Signed-off-by: falkTX --- source/backend/engine/CarlaEngineJuce.cpp | 8 ++++---- source/backend/plugin/CarlaPluginJuce.cpp | 12 ++++-------- source/utils/JucePluginWindow.hpp | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/source/backend/engine/CarlaEngineJuce.cpp b/source/backend/engine/CarlaEngineJuce.cpp index e98db8200..30fe7d1b5 100644 --- a/source/backend/engine/CarlaEngineJuce.cpp +++ b/source/backend/engine/CarlaEngineJuce.cpp @@ -756,11 +756,11 @@ protected: if (! midiIns.contains(portName)) return false; - juce::MidiInput* const juceMidiIn(juce::MidiInput::openDevice(midiIns.indexOf(portName), this)); + std::unique_ptr juceMidiIn(juce::MidiInput::openDevice(midiIns.indexOf(portName), this)); juceMidiIn->start(); MidiInPort midiPort; - midiPort.port = juceMidiIn; + midiPort.port = juceMidiIn.release(); std::strncpy(midiPort.name, portName, STR_MAX); midiPort.name[STR_MAX] = '\0'; @@ -775,11 +775,11 @@ protected: if (! midiOuts.contains(portName)) return false; - juce::MidiOutput* const juceMidiOut(juce::MidiOutput::openDevice(midiOuts.indexOf(portName))); + std::unique_ptr juceMidiOut(juce::MidiOutput::openDevice(midiOuts.indexOf(portName))); juceMidiOut->startBackgroundThread(); MidiOutPort midiPort; - midiPort.port = juceMidiOut; + midiPort.port = juceMidiOut.release(); std::strncpy(midiPort.name, portName, STR_MAX); midiPort.name[STR_MAX] = '\0'; diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index 238628d33..74548ccaa 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -40,6 +40,7 @@ # endif #endif +#define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1 #include "AppConfig.h" #include "juce_audio_processors/juce_audio_processors.h" #include "juce_gui_basics/juce_gui_basics.h" @@ -67,8 +68,8 @@ public: CarlaPluginJuce(CarlaEngine* const engine, const uint id) : CarlaPlugin(engine, id), fDesc(), - fInstance(nullptr), fFormatManager(), + fInstance(), fAudioBuffer(), fMidiBuffer(), fPosInfo(), @@ -103,12 +104,7 @@ public: pData->active = false; } - if (fInstance != nullptr) - { - delete fInstance; - fInstance = nullptr; - } - + fInstance = nullptr; clearBuffers(); } @@ -1407,8 +1403,8 @@ public: private: juce::PluginDescription fDesc; - juce::AudioPluginInstance* fInstance; juce::AudioPluginFormatManager fFormatManager; + std::unique_ptr fInstance; juce::AudioSampleBuffer fAudioBuffer; juce::MidiBuffer fMidiBuffer; diff --git a/source/utils/JucePluginWindow.hpp b/source/utils/JucePluginWindow.hpp index 17327e360..fcc6c93c9 100644 --- a/source/utils/JucePluginWindow.hpp +++ b/source/utils/JucePluginWindow.hpp @@ -99,7 +99,7 @@ private: return; #if defined(CARLA_OS_LINUX) && defined(HAVE_X11) - Display* const display = XWindowSystem::getInstance()->displayRef(); + Display* const display = XWindowSystem::getInstance()->getDisplay(); CARLA_SAFE_ASSERT_RETURN(display != nullptr,); ::Window window = (::Window)getWindowHandle();