Browse Source

Start small plugin code cleanup/rework

tags/1.9.4
falkTX 11 years ago
parent
commit
e5057a1c48
13 changed files with 361 additions and 302 deletions
  1. +48
    -47
      source/backend/CarlaPlugin.hpp
  2. +1
    -1
      source/backend/plugin/BridgePlugin.cpp
  3. +1
    -132
      source/backend/plugin/CarlaPlugin.cpp
  4. +1
    -0
      source/backend/plugin/CarlaPlugin.pro
  5. +198
    -0
      source/backend/plugin/CarlaPluginGui.cpp
  6. +48
    -80
      source/backend/plugin/CarlaPluginInternal.hpp
  7. +9
    -5
      source/backend/plugin/DssiPlugin.cpp
  8. +4
    -4
      source/backend/plugin/FluidSynthPlugin.cpp
  9. +9
    -5
      source/backend/plugin/LadspaPlugin.cpp
  10. +10
    -10
      source/backend/plugin/LinuxSamplerPlugin.cpp
  11. +8
    -4
      source/backend/plugin/NativePlugin.cpp
  12. +15
    -14
      source/backend/plugin/VstPlugin.cpp
  13. +9
    -0
      source/utils/CarlaJuceUtils.hpp

+ 48
- 47
source/backend/CarlaPlugin.hpp View File

@@ -451,7 +451,7 @@ public:
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
*/
void setActive(const bool active, const bool sendOsc, const bool sendCallback);
virtual void setActive(const bool active, const bool sendOsc, const bool sendCallback);

/*!
* Set the plugin's dry/wet signal value to \a value.\n
@@ -539,7 +539,7 @@ public:
* \see setBalanceLeft()
* \see setBalanceRight()
*/
void setParameterValueByRIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback);
void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback);

/*!
* Set parameter's \a parameterId MIDI channel to \a channel.\n
@@ -659,11 +659,6 @@ public:
*/
virtual void sampleRateChanged(const double newSampleRate);

/*!
* Recreate latency audio buffers.
*/
void recreateLatencyBuffers();

/*!
* TODO.
*/
@@ -711,7 +706,7 @@ public:

/*!
* Send all midi notes off for the next audio callback.\n
* This doesn't send the actual MIDI All-Notes-Off event, but 128 note-offs instead.
* This doesn't send the actual MIDI All-Notes-Off event, but 128 note-offs instead (if ctrlChannel is valid).
* \note RT call
*/
void sendMidiAllNotesOff();
@@ -732,6 +727,50 @@ public:
*/
void postRtEventsRun();

// -------------------------------------------------------------------
// Plugin initializers

struct Initializer {
CarlaEngine* const engine;
const unsigned int id;
const char* const filename;
const char* const name;
const char* const label;
};

static size_t getNativePluginCount();
static const PluginDescriptor* getNativePluginDescriptor(const size_t index);

static CarlaPlugin* newNative(const Initializer& init);
static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeBinary);

static CarlaPlugin* newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* const rdfDescriptor);
static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename);
static CarlaPlugin* newLV2(const Initializer& init);
static CarlaPlugin* newVST(const Initializer& init);
static CarlaPlugin* newVST3(const Initializer& init);
static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs);

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

protected:
unsigned int fId; //!< Plugin Id, as passed in the constructor, returned in id(). \see setId()
unsigned int fHints; //!< Hints, as returned in hints().
unsigned int fOptions; //!< Defined and currently in-use options, returned in options(). \see availableOptions()

bool fEnabled; //!< Wherever the plugin is ready for usage

CarlaString fName; //!< Plugin name
CarlaString fFilename; //!< Plugin filename, if applicable

friend struct CarlaPluginProtectedData;
CarlaPluginProtectedData* const kData; //!< Internal data, for CarlaPlugin subclasses only.

// -------------------------------------------------------------------
// Post-poned UI Stuff

/*!
* Tell the UI a parameter has changed.
*/
@@ -794,45 +833,7 @@ public:
const char* libError(const char* const filename);

// -------------------------------------------------------------------
// Plugin initializers

struct Initializer {
CarlaEngine* const engine;
const unsigned int id;
const char* const filename;
const char* const name;
const char* const label;
};

static size_t getNativePluginCount();
static const PluginDescriptor* getNativePluginDescriptor(const size_t index);

static CarlaPlugin* newNative(const Initializer& init);
static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeBinary);

static CarlaPlugin* newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* const rdfDescriptor);
static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename);
static CarlaPlugin* newLV2(const Initializer& init);
static CarlaPlugin* newVST(const Initializer& init);
static CarlaPlugin* newVST3(const Initializer& init);
static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs);

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

protected:
unsigned int fId;
unsigned int fHints;
unsigned int fOptions;

bool fEnabled;

CarlaString fName;
CarlaString fFilename;

friend struct CarlaPluginProtectedData;
CarlaPluginProtectedData* const kData;
// Helper classes

// Fully disable plugin in scope and also its engine client
// May wait-block on constructor for plugin process to end


+ 1
- 1
source/backend/plugin/BridgePlugin.cpp View File

@@ -1007,7 +1007,7 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
return;
}



+ 1
- 132
source/backend/plugin/CarlaPlugin.cpp View File

@@ -21,11 +21,6 @@

#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtGui/QCloseEvent>

#ifdef Q_WS_X11
# include <QtGui/QX11EmbedContainer>
#endif

CARLA_BACKEND_START_NAMESPACE

@@ -1061,7 +1056,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu
#endif
}

void CarlaPlugin::setParameterValueByRIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback)
{
CARLA_ASSERT(rindex > PARAMETER_MAX && rindex != PARAMETER_NULL);

@@ -1369,34 +1364,6 @@ void CarlaPlugin::sampleRateChanged(const double)
{
}

void CarlaPlugin::recreateLatencyBuffers()
{
if (kData->latencyBuffers != nullptr)
{
for (uint32_t i=0; i < kData->audioIn.count; i++)
{
CARLA_ASSERT(kData->latencyBuffers[i] != nullptr);

if (kData->latencyBuffers[i] != nullptr)
delete[] kData->latencyBuffers[i];
}

delete[] kData->latencyBuffers;
kData->latencyBuffers = nullptr;
}

if (kData->audioIn.count > 0 && kData->latency > 0)
{
kData->latencyBuffers = new float*[kData->audioIn.count];

for (uint32_t i=0; i < kData->audioIn.count; i++)
{
kData->latencyBuffers[i] = new float[kData->latency];
carla_zeroFloat(kData->latencyBuffers[i], kData->latency);
}
}
}

bool CarlaPlugin::tryLock()
{
return kData->masterMutex.tryLock();
@@ -2006,104 +1973,6 @@ CarlaPlugin::ScopedProcessLocker::~ScopedProcessLocker()
}
}

// -------------------------------------------------------------------
// CarlaPluginGUI

CarlaPluginGUI::CarlaPluginGUI(QWidget* const parent, Callback* const callback)
: QMainWindow(parent),
kCallback(callback),
fContainer(nullptr),
fNextWidth(0),
fNextHeight(0)
{
CARLA_ASSERT(callback != nullptr);
carla_debug("CarlaPluginGUI::CarlaPluginGUI(%p, %p)", parent, callback);
}

CarlaPluginGUI::~CarlaPluginGUI()
{
carla_debug("CarlaPluginGUI::~CarlaPluginGUI()");

closeContainer();
}

void CarlaPluginGUI::idle()
{
if (fNextWidth > 0 && fNextHeight > 0)
{
setFixedSize(fNextWidth, fNextHeight);
fNextWidth = 0;
fNextHeight = 0;
}
}

void CarlaPluginGUI::resizeLater(int width, int height)
{
CARLA_ASSERT_INT(width > 0, width);
CARLA_ASSERT_INT(height > 0, height);

if (width <= 0)
return;
if (height <= 0)
return;

fNextWidth = width;
fNextHeight = height;
}

void* CarlaPluginGUI::getContainerWinId()
{
carla_debug("CarlaPluginGUI::getContainerWinId()");

if (fContainer == nullptr)
{
#ifdef Q_WS_X11
QX11EmbedContainer* container(new QX11EmbedContainer(this));
#else
QWidget* container(new QWidget(this));
#endif
setCentralWidget(container);
fContainer = container;
}

return (void*)fContainer->winId();
}

void CarlaPluginGUI::closeContainer()
{
carla_debug("CarlaPluginGUI::closeContainer()");

if (fContainer != nullptr)
{
#ifdef Q_WS_X11
delete (QX11EmbedContainer*)fContainer;
#else
delete (QWidget*)fContainer;
#endif
fContainer = nullptr;
}
}

void CarlaPluginGUI::closeEvent(QCloseEvent* const event)
{
carla_debug("CarlaPluginGUI::closeEvent(%p)", event);
CARLA_ASSERT(event != nullptr);

if (event == nullptr)
return;

if (! event->spontaneous())
{
event->ignore();
return;
}

if (kCallback != nullptr)
kCallback->guiClosedCallback();

QMainWindow::closeEvent(event);
}

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

CARLA_BACKEND_END_NAMESPACE

+ 1
- 0
source/backend/plugin/CarlaPlugin.pro View File

@@ -46,6 +46,7 @@ PKGCONFIG += linuxsampler

SOURCES = \
CarlaPlugin.cpp \
CarlaPluginGui.cpp \
CarlaPluginThread.cpp \
BridgePlugin.cpp \
NativePlugin.cpp \


+ 198
- 0
source/backend/plugin/CarlaPluginGui.cpp View File

@@ -0,0 +1,198 @@
/*
* Carla Plugin
* Copyright (C) 2011-2013 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
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "CarlaPluginInternal.hpp"

#include <QtGui/QMainWindow>
#include <QtGui/QCloseEvent>

#ifdef Q_WS_X11
# include <QtGui/QX11EmbedContainer>
#endif

CARLA_BACKEND_START_NAMESPACE

// -----------------------------------------------------------------------
// Engine Helpers, defined in CarlaEngine.cpp

extern QMainWindow* getEngineHostWindow(CarlaEngine* const engine);

class CarlaPluginGUI : public QMainWindow
{
public:
class Callback
{
public:
virtual ~Callback() {}
virtual void guiClosedCallback() = 0;
};

CarlaPluginGUI(CarlaEngine* const engine, Callback* const callback);
~CarlaPluginGUI();

void idle();
void resizeLater(int width, int height);

// Parent UIs
void* getContainerWinId();
void closeContainer();

// Qt4 UIs, TODO

protected:
void closeEvent(QCloseEvent* const event);

private:
Callback* const kCallback;
QWidget* fContainer;

int fNextWidth;
int fNextHeight;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginGUI)
};

// -------------------------------------------------------------------
// CarlaPluginGUI

CarlaPluginGUI::CarlaPluginGUI(CarlaEngine* const engine, Callback* const callback)
: QMainWindow(getEngineHostWindow(engine)),
kCallback(callback),
fContainer(nullptr),
fNextWidth(0),
fNextHeight(0)
{
CARLA_ASSERT(callback != nullptr);
carla_debug("CarlaPluginGUI::CarlaPluginGUI(%p, %p)", engine, callback);
}

CarlaPluginGUI::~CarlaPluginGUI()
{
carla_debug("CarlaPluginGUI::~CarlaPluginGUI()");

closeContainer();
}

void CarlaPluginGUI::idle()
{
if (fNextWidth > 0 && fNextHeight > 0)
{
setFixedSize(fNextWidth, fNextHeight);
fNextWidth = 0;
fNextHeight = 0;
}
}

void CarlaPluginGUI::resizeLater(int width, int height)
{
CARLA_ASSERT_INT(width > 0, width);
CARLA_ASSERT_INT(height > 0, height);

if (width <= 0)
return;
if (height <= 0)
return;

fNextWidth = width;
fNextHeight = height;
}

void* CarlaPluginGUI::getContainerWinId()
{
carla_debug("CarlaPluginGUI::getContainerWinId()");

if (fContainer == nullptr)
{
#ifdef Q_WS_X11
QX11EmbedContainer* container(new QX11EmbedContainer(this));
#else
QWidget* container(new QWidget(this));
#endif
setCentralWidget(container);
fContainer = container;
}

return (void*)fContainer->winId();
}

void CarlaPluginGUI::closeContainer()
{
carla_debug("CarlaPluginGUI::closeContainer()");

if (fContainer != nullptr)
{
#ifdef Q_WS_X11
delete (QX11EmbedContainer*)fContainer;
#else
delete (QWidget*)fContainer;
#endif
fContainer = nullptr;
}
}

void CarlaPluginGUI::closeEvent(QCloseEvent* const event)
{
carla_debug("CarlaPluginGUI::closeEvent(%p)", event);
CARLA_ASSERT(event != nullptr);

if (event == nullptr)
return;

if (! event->spontaneous())
{
event->ignore();
return;
}

if (kCallback != nullptr)
kCallback->guiClosedCallback();

QMainWindow::closeEvent(event);
}

// -------------------------------------------------------------------
// CarlaPluginGUI

#if 0
void createUiIfNeeded(CarlaPluginGUI::Callback* const callback)
{
if (gui != nullptr)
return;

gui = new CarlaPluginGUI(engine, callback);
}

void destroyUiIfNeeded()
{
if (gui == nullptr)
return;

gui->close();
delete gui;
gui = nullptr;
}

void resizeUiLater(int width, int height)
{
if (gui == nullptr)
return;

gui->resizeLater(width, height);
}
#endif

CARLA_BACKEND_END_NAMESPACE

+ 48
- 80
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -18,7 +18,6 @@
#ifndef __CARLA_PLUGIN_INTERNAL_HPP__
#define __CARLA_PLUGIN_INTERNAL_HPP__

#include "CarlaBackendUtils.hpp"
#include "CarlaPluginThread.hpp"
#include "CarlaPlugin.hpp"
#include "CarlaEngine.hpp"
@@ -28,16 +27,6 @@
#include "CarlaMIDI.h"
#include "RtList.hpp"

#include <QtGui/QMainWindow>

#define CARLA_DECLARE_NON_COPY_STRUCT(structName) \
structName(structName&) = delete; \
structName(const structName&) = delete;

#define CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(structName) \
CARLA_DECLARE_NON_COPY_STRUCT(structName) \
CARLA_LEAK_DETECTOR(structName)

#define CARLA_PROCESS_CONTINUE_CHECK if (! fEnabled) { kData->engine->callback(CALLBACK_DEBUG, fId, 0, 0, 0.0, nullptr); return; }

CARLA_BACKEND_START_NAMESPACE
@@ -368,9 +357,9 @@ struct PluginPostRtEvent {
// -----------------------------------------------------------------------

struct ExternalMidiNote {
int8_t channel; // invalid = -1
int8_t channel; // invalid == -1
uint8_t note;
uint8_t velo;
uint8_t velo; // note-off if 0

ExternalMidiNote()
: channel(-1),
@@ -386,61 +375,26 @@ struct ExternalMidiNote {

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

enum CarlaPluginGuiType {
PLUGIN_GUI_NULL,
PLUGIN_GUI_PARENT,
PLUGIN_GUI_QT
};
class CarlaPluginGui;

class CarlaPluginGUI : public QMainWindow
class CarlaPluginGuiCallback
{
public:
class Callback
{
public:
virtual ~Callback() {}
virtual void guiClosedCallback() = 0;
};

CarlaPluginGUI(QWidget* const parent, Callback* const callback);
~CarlaPluginGUI();

void idle();
void resizeLater(int width, int height);

// Parent UIs
void* getContainerWinId();
void closeContainer();

// Qt4 UIs, TODO
virtual ~CarlaPluginGuiCallback() {}

protected:
void closeEvent(QCloseEvent* const event);

private:
Callback* const kCallback;
QWidget* fContainer;

int fNextWidth;
int fNextHeight;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginGUI)
virtual void guiClosedCallback() = 0;
};

// -----------------------------------------------------------------------
// Engine Helpers, defined in CarlaEngine.cpp

extern ::QMainWindow* getEngineHostWindow(CarlaEngine* const engine);

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

struct CarlaPluginProtectedData {
CarlaEngine* const engine;
CarlaEngineClient* client;
CarlaPluginGUI* gui;
CarlaPluginGui* gui;

bool active;
bool activeBefore;
//bool activeBefore;
bool needsReset;
void* lib;

@@ -487,8 +441,7 @@ struct CarlaPluginProtectedData {
mutex.unlock();
}

ExternalNotes(ExternalNotes&) = delete;
ExternalNotes(const ExternalNotes&) = delete;
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(ExternalNotes)

} extNotes;

@@ -530,8 +483,7 @@ struct CarlaPluginProtectedData {
mutex.unlock();
}

PostRtEvents(PostRtEvents&) = delete;
PostRtEvents(const PostRtEvents&) = delete;
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(PostRtEvents)

} postRtEvents;

@@ -549,8 +501,7 @@ struct CarlaPluginProtectedData {
balanceRight(1.0f),
panning(0.0f) {}

PostProc(PostProc&) = delete;
PostProc(const PostProc&) = delete;
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(PostProc)

} postProc;

@@ -564,6 +515,7 @@ struct CarlaPluginProtectedData {
OSC() = delete;
OSC(OSC&) = delete;
OSC(const OSC&) = delete;
CARLA_LEAK_DETECTOR(OSC)

} osc;

@@ -572,7 +524,7 @@ struct CarlaPluginProtectedData {
client(nullptr),
gui(nullptr),
active(false),
activeBefore(false),
//activeBefore(false),
needsReset(false),
lib(nullptr),
ctrlChannel(0),
@@ -584,33 +536,51 @@ struct CarlaPluginProtectedData {
CarlaPluginProtectedData() = delete;
CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete;
CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete;
CARLA_LEAK_DETECTOR(CarlaPluginProtectedData)

void createUiIfNeeded(CarlaPluginGUI::Callback* const callback)
~CarlaPluginProtectedData()
{
if (gui != nullptr)
return;

gui = new CarlaPluginGUI(getEngineHostWindow(engine), callback);
CARLA_ASSERT(gui == nullptr);
CARLA_ASSERT(! active);
CARLA_ASSERT(! needsReset);
CARLA_ASSERT(lib == nullptr);
CARLA_ASSERT(latency == 0);
CARLA_ASSERT(latencyBuffers == nullptr);
}

void destroyUiIfNeeded()
void recreateLatencyBuffers()
{
if (gui == nullptr)
return;
if (latencyBuffers != nullptr)
{
for (uint32_t i=0; i < audioIn.count; i++)
{
CARLA_ASSERT(latencyBuffers[i] != nullptr);

gui->close();
delete gui;
gui = nullptr;
}
if (latencyBuffers[i] != nullptr)
delete[] latencyBuffers[i];
}

void resizeUiLater(int width, int height)
{
if (gui == nullptr)
return;
delete[] latencyBuffers;
latencyBuffers = nullptr;
}

gui->resizeLater(width, height);
if (audioIn.count > 0 && latency > 0)
{
latencyBuffers = new float*[audioIn.count];

for (uint32_t i=0; i < audioIn.count; i++)
{
latencyBuffers[i] = new float[latency];
carla_zeroFloat(latencyBuffers[i], latency);
}
}
}

// defined in CarlaPluginGui.cpp
void createUiIfNeeded(CarlaPluginGuiCallback* const callback);
void destroyUiIfNeeded();
void resizeUiLater(int width, int height);

static CarlaEngine* getEngine(CarlaPlugin* const plugin)
{
return plugin->kData->engine;
@@ -630,8 +600,6 @@ struct CarlaPluginProtectedData {
{
return (plugin->kData->extraHints & PLUGIN_HINT_CAN_RUN_RACK);
}

CARLA_LEAK_DETECTOR(CarlaPluginProtectedData)
};

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


+ 9
- 5
source/backend/plugin/DssiPlugin.cpp View File

@@ -66,7 +66,7 @@ public:

if (fDescriptor != nullptr)
{
if (fDescriptor->deactivate != nullptr && kData->activeBefore)
if (fDescriptor->deactivate != nullptr && kData->active/*Before*/)
{
if (fHandle != nullptr)
fDescriptor->deactivate(fHandle);
@@ -826,7 +826,7 @@ public:
{
kData->latency = latency;
kData->client->setLatency(latency);
recreateLatencyBuffers();
kData->recreateLatencyBuffers();
}

break;
@@ -947,6 +947,7 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

#if 0
if (kData->activeBefore)
{
if (fDescriptor->deactivate != nullptr)
@@ -959,6 +960,7 @@ public:
}

kData->activeBefore = kData->active;
#endif
return;
}

@@ -967,7 +969,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
@@ -994,6 +996,7 @@ public:
carla_zeroFloat(kData->latencyBuffers[i], kData->latency);
}

#if 0
if (kData->activeBefore)
{
if (fDescriptor->deactivate != nullptr)
@@ -1012,6 +1015,7 @@ public:
if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
}
#endif

kData->needsReset = false;
}
@@ -1019,7 +1023,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->event.portIn != nullptr && kData->activeBefore)
if (kData->event.portIn != nullptr /*&& kData->activeBefore*/)
{
// ----------------------------------------------------------------------------------------------------
// MIDI Input (External)
@@ -1440,7 +1444,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset, const unsigned long midiEventCount)


+ 4
- 4
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -882,14 +882,14 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
return;
}

// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
@@ -911,7 +911,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->activeBefore)
//if (kData->activeBefore)
{
// ----------------------------------------------------------------------------------------------------
// MIDI Input (External)
@@ -1233,7 +1233,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 9
- 5
source/backend/plugin/LadspaPlugin.cpp View File

@@ -48,7 +48,7 @@ public:

if (fDescriptor != nullptr)
{
if (fDescriptor->deactivate != nullptr && kData->activeBefore)
if (fDescriptor->deactivate != nullptr && kData->active/*Before*/)
{
if (fHandle != nullptr)
fDescriptor->deactivate(fHandle);
@@ -769,7 +769,7 @@ public:
{
kData->latency = latency;
kData->client->setLatency(latency);
recreateLatencyBuffers();
kData->recreateLatencyBuffers();
}

break;
@@ -797,6 +797,7 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

#if 0
if (kData->activeBefore)
{
if (fDescriptor->deactivate != nullptr)
@@ -809,13 +810,14 @@ public:
}

kData->activeBefore = kData->active;
#endif
return;
}

// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (kData->latency > 0)
{
@@ -823,6 +825,7 @@ public:
carla_zeroFloat(kData->latencyBuffers[i], kData->latency);
}

#if 0
if (kData->activeBefore)
{
if (fDescriptor->deactivate != nullptr)
@@ -841,6 +844,7 @@ public:
if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
}
#endif

kData->needsReset = false;
}
@@ -848,7 +852,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->event.portIn != nullptr && kData->activeBefore)
if (kData->event.portIn != nullptr /*&& kData->activeBefore*/)
{
// ----------------------------------------------------------------------------------------------------
// Event Input (System)
@@ -1080,7 +1084,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 10
- 10
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -191,7 +191,7 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->activeBefore)
if (kData->active/*Before*/)
fAudioOutputDevice->Stop();

if (fEngine != nullptr)
@@ -465,17 +465,17 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

if (kData->activeBefore)
fAudioOutputDevice->Stop();
//if (kData->activeBefore)
// fAudioOutputDevice->Stop();

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
return;
}

// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
@@ -486,10 +486,10 @@ public:
}
}

if (kData->activeBefore)
fAudioOutputDevice->Stop();
//if (kData->activeBefore)
// fAudioOutputDevice->Stop();

fAudioOutputDevice->Play();
//fAudioOutputDevice->Play();

kData->needsReset = false;
}
@@ -497,7 +497,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->event.portIn != nullptr && kData->activeBefore)
if (kData->event.portIn != nullptr /*&& kData->activeBefore*/)
{
// ----------------------------------------------------------------------------------------------------
// MIDI Input (External)
@@ -804,7 +804,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 8
- 4
source/backend/plugin/NativePlugin.cpp View File

@@ -185,7 +185,7 @@ public:
if (fDescriptor->ui_show != nullptr && fIsUiVisible)
fDescriptor->ui_show(fHandle, false);

if (fDescriptor->deactivate != nullptr && kData->activeBefore)
if (fDescriptor->deactivate != nullptr && kData->active/*Before*/)
{
if (fHandle != nullptr)
fDescriptor->deactivate(fHandle);
@@ -1128,6 +1128,7 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

#if 0
if (kData->activeBefore)
{
if (fDescriptor->deactivate != nullptr)
@@ -1140,6 +1141,7 @@ public:
}

kData->activeBefore = kData->active;
#endif
return;
}

@@ -1149,7 +1151,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
@@ -1165,6 +1167,7 @@ public:
fMidiEventCount = MAX_MIDI_CHANNELS*2;
}

#if 0
if (fDescriptor->activate != nullptr)
{
fDescriptor->activate(fHandle);
@@ -1172,6 +1175,7 @@ public:
if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
}
#endif
}

CARLA_PROCESS_CONTINUE_CHECK;
@@ -1208,7 +1212,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->event.portIn != nullptr && kData->activeBefore)
if (kData->event.portIn != nullptr /*&& kData->activeBefore*/)
{
// ----------------------------------------------------------------------------------------------------
// MIDI Input (External)
@@ -1578,7 +1582,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 15
- 14
source/backend/plugin/VstPlugin.cpp View File

@@ -38,7 +38,7 @@ const unsigned int PLUGIN_WANTS_MIDI_INPUT = 0x8000; //!< VST Plugin wants
/**@}*/

class VstPlugin : public CarlaPlugin,
public CarlaPluginGUI::Callback
public CarlaPluginGuiCallback
{
public:
VstPlugin(CarlaEngine* const engine, const unsigned short id)
@@ -366,7 +366,8 @@ public:
#ifdef Q_WS_X11
//value = (intptr_t)QX11Info::display();
#endif
void* const ptr = kData->gui->getContainerWinId();
// TODO!!
void* const ptr = nullptr; //kData->gui->getContainerWinId();

if (dispatcher(effEditOpen, 0, value, ptr, 0.0f) != 0)
{
@@ -379,14 +380,14 @@ public:
const int16_t width = vstRect->right - vstRect->left;
const int16_t height = vstRect->bottom - vstRect->top;

if (width > 0 && height > 0)
{
kData->gui->setFixedSize(width, height);
}
//if (width > 0 && height > 0)
//{
// kData->gui->setFixedSize(width, height);
//}
}

kData->gui->setWindowTitle(QString("%1 (GUI)").arg((const char*)fName).toUtf8().constData());
kData->gui->show();
//kData->gui->setWindowTitle(QString("%1 (GUI)").arg((const char*)fName).toUtf8().constData());
//kData->gui->show();
}
else
{
@@ -420,7 +421,7 @@ public:
if (fGui.isVisible && ! fGui.isOsc)
{
dispatcher(effEditIdle, 0, 0, nullptr, 0.0f);
kData->gui->idle();
//kData->gui->idle();
}
}

@@ -805,7 +806,7 @@ public:
#endif

kData->client->setLatency(kData->latency);
recreateLatencyBuffers();
kData->recreateLatencyBuffers();
}

// special plugin fixes
@@ -943,7 +944,7 @@ public:
for (i=0; i < kData->audioOut.count; i++)
carla_zeroFloat(outBuffer[i], frames);

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
return;
}

@@ -953,7 +954,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Check if not active before

if (kData->needsReset || ! kData->activeBefore)
if (kData->needsReset /*|| ! kData->activeBefore*/)
{
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
@@ -1043,7 +1044,7 @@ public:
// --------------------------------------------------------------------------------------------------------
// Event Input and Processing

if (kData->event.portIn != nullptr && kData->activeBefore)
if (kData->event.portIn != nullptr /*&& kData->activeBefore*/)
{
// ----------------------------------------------------------------------------------------------------
// MIDI Input (External)
@@ -1373,7 +1374,7 @@ public:

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

kData->activeBefore = kData->active;
//kData->activeBefore = kData->active;
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 9
- 0
source/utils/CarlaJuceUtils.hpp View File

@@ -35,6 +35,15 @@ private: \
CARLA_DECLARE_NON_COPYABLE(className) \
CARLA_LEAK_DETECTOR(className)

/** struct versions of the above. */
#define CARLA_DECLARE_NON_COPY_STRUCT(structName) \
structName(structName&) = delete; \
structName(const structName&) = delete;

#define CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(structName) \
CARLA_DECLARE_NON_COPY_STRUCT(structName) \
CARLA_LEAK_DETECTOR(structName)

/** This macro can be added to class definitions to disable the use of new/delete to
allocate the object on the heap, forcing it to only be used as a stack or member variable.
*/


Loading…
Cancel
Save