Browse Source

Init (fake) juce events if using custom plugin entries (for LMMS)

tags/1.9.5
falkTX 10 years ago
parent
commit
b7c8deccc1
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      source/backend/engine/CarlaEngineNative.cpp

+ 25
- 0
source/backend/engine/CarlaEngineNative.cpp View File

@@ -38,6 +38,14 @@

#include "juce_audio_basics.h"

#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
# include "juce_gui_basics.h"
#else
namespace juce {
# include "juce_events/messages/juce_Initialisation.h"
} // namespace juce
#endif

using juce::File;
using juce::FloatVectorOperations;
using juce::MemoryOutputStream;
@@ -46,6 +54,9 @@ using juce::String;
using juce::XmlDocument;
using juce::XmlElement;

static bool gNeedsJuceHandling = false;
static int gJuceReferenceCounter = 0;

CARLA_BACKEND_START_NAMESPACE

// -----------------------------------------------------------------------
@@ -561,6 +572,11 @@ public:
{
carla_debug("CarlaEngineNative::CarlaEngineNative()");

CARLA_SAFE_ASSERT_INT(gJuceReferenceCounter >= 0, gJuceReferenceCounter);

if (gNeedsJuceHandling && ++gJuceReferenceCounter == 1)
juce::initialiseJuce_GUI();

carla_zeroChar(fTmpBuf, STR_MAX+1);

// set-up engine
@@ -610,6 +626,9 @@ public:

pData->graph.destroy();

if (gNeedsJuceHandling && --gJuceReferenceCounter == 0)
juce::shutdownJuce_GUI();

carla_debug("CarlaEngineNative::~CarlaEngineNative() - END");
}

@@ -1583,6 +1602,9 @@ CARLA_EXPORT
const NativePluginDescriptor* carla_get_native_rack_plugin();
const NativePluginDescriptor* carla_get_native_rack_plugin()
{
// if this is called then we're running as special plugin
gNeedsJuceHandling = true;

CARLA_BACKEND_USE_NAMESPACE;
return &carlaRackDesc;
}
@@ -1591,6 +1613,9 @@ CARLA_EXPORT
const NativePluginDescriptor* carla_get_native_patchbay_plugin();
const NativePluginDescriptor* carla_get_native_patchbay_plugin()
{
// if this is called then we're running as special plugin
gNeedsJuceHandling = true;

CARLA_BACKEND_USE_NAMESPACE;
return &carlaPatchbayDesc;
}


Loading…
Cancel
Save