Browse Source

Setup juce gui on relevant parts

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha1-winvst
parent
commit
dc7c89c042
3 changed files with 88 additions and 6 deletions
  1. +68
    -4
      source/bridges-plugin/CarlaBridgePlugin.cpp
  2. +10
    -1
      source/plugin/carla-lv2.cpp
  3. +10
    -1
      source/plugin/carla-vst.cpp

+ 68
- 4
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge Plugin
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -42,6 +42,15 @@
# include <X11/Xlib.h>
#endif

#ifdef USING_JUCE
# include "AppConfig.h"
# if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
# include "juce_gui_basics/juce_gui_basics.h"
# else
# include "juce_events/juce_events.h"
# endif
#endif

#include "jackbridge/JackBridge.hpp"

#include "water/files/File.h"
@@ -123,6 +132,52 @@ static void gIdle()
}
}

// -------------------------------------------------------------------------

#if defined(USING_JUCE) && (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN))
class CarlaJuceApp : public juce::JUCEApplication,
private juce::Timer
{
public:
CarlaJuceApp() {}
~CarlaJuceApp() {}

void initialise(const juce::String&) override
{
startTimer(8);
}

void shutdown() override
{
gCloseNow = true;
stopTimer();
}

const juce::String getApplicationName() override
{
return "CarlaPlugin";
}

const juce::String getApplicationVersion() override
{
return CARLA_VERSION_STRING;
}

void timerCallback() override
{
gIdle();

if (gCloseNow)
{
quit();
gCloseNow = false;
}
}
};

static juce::JUCEApplicationBase* juce_CreateApplication() { return new CarlaJuceApp(); }
#endif

// -------------------------------------------------------------------------

class CarlaBridgePlugin
@@ -195,16 +250,21 @@ public:

gIsInitiated = true;

#if defined(USING_JUCE) && (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN))
juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;
juce::JUCEApplicationBase::main(JUCE_MAIN_FUNCTION_ARGS);
#else
for (; runMainLoopOnce() && ! gCloseNow;)
{
gIdle();
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
# if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
// MacOS and Win32 have event-loops to run, so minimize sleep time
carla_msleep(1);
#else
# else
carla_msleep(5);
#endif
# endif
}
#endif

carla_engine_close();
}
@@ -239,6 +299,10 @@ private:
bool fUsingBridge;
bool fUsingExec;

#ifdef USING_JUCE
const juce::ScopedJuceInitialiser_GUI sJuceInitialiser;
#endif

static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr)
{
carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr);


+ 10
- 1
source/plugin/carla-lv2.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2013-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -23,6 +23,11 @@
#include "CarlaPipeUtils.hpp"
#include "CarlaString.hpp"

#ifdef USING_JUCE
# include "AppConfig.h"
# include "juce_events/juce_events.h"
#endif

#include "water/files/File.h"

template<>
@@ -730,6 +735,10 @@ private:

int fWorkerUISignal;

#ifdef USING_JUCE
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> sJuceInitialiser;
#endif

// -------------------------------------------------------------------

#define handlePtr ((NativePlugin*)handle)


+ 10
- 1
source/plugin/carla-vst.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2013-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -42,6 +42,11 @@
#include "CarlaMathUtils.hpp"
#include "CarlaVstUtils.hpp"

#ifdef USING_JUCE
# include "AppConfig.h"
# include "juce_events/juce_events.h"
#endif

static uint32_t d_lastBufferSize = 0;
static double d_lastSampleRate = 0.0;

@@ -613,6 +618,10 @@ private:

char* fStateChunk;

#ifdef USING_JUCE
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> sJuceInitialiser;
#endif

// -------------------------------------------------------------------

#define handlePtr ((NativePlugin*)handle)


Loading…
Cancel
Save