Browse Source

Try to prevent noise when removing plugins; Update juce based code

tags/1.9.4
falkTX 12 years ago
parent
commit
1aba64d911
13 changed files with 77 additions and 64 deletions
  1. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +3
    -0
      source/backend/plugin/BridgePlugin.cpp
  3. +2
    -2
      source/backend/plugin/CarlaPlugin.cpp
  4. +8
    -6
      source/backend/plugin/CarlaPluginInternal.hpp
  5. +3
    -0
      source/backend/plugin/DssiPlugin.cpp
  6. +3
    -0
      source/backend/plugin/FluidSynthPlugin.cpp
  7. +3
    -0
      source/backend/plugin/LadspaPlugin.cpp
  8. +3
    -0
      source/backend/plugin/LinuxSamplerPlugin.cpp
  9. +8
    -3
      source/backend/plugin/Lv2Plugin.cpp
  10. +3
    -0
      source/backend/plugin/NativePlugin.cpp
  11. +3
    -0
      source/backend/plugin/Vst3Plugin.cpp
  12. +3
    -0
      source/backend/plugin/VstPlugin.cpp
  13. +34
    -52
      source/utils/CarlaJuceUtils.hpp

+ 1
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -648,7 +648,7 @@ bool CarlaEngine::close()

void CarlaEngine::idle()
{
CARLA_ASSERT(kData->plugins != nullptr);
CARLA_ASSERT(kData->plugins != nullptr); // this one too maybe
CARLA_ASSERT(kData->nextAction.opcode == kEnginePostActionNull); // TESTING, remove later
CARLA_ASSERT(kData->nextPluginId == kData->maxPluginNumber); // TESTING, remove later



+ 3
- 0
source/backend/plugin/BridgePlugin.cpp View File

@@ -142,6 +142,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 2
- 2
source/backend/plugin/CarlaPlugin.cpp View File

@@ -227,7 +227,7 @@ unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options,

unsigned int newOptions = 0x0;

#define CHECK_AND_SET_OPTION(STR, BIT) \
#define CHECK_AND_SET_OPTION(STR, BIT) \
if ((availOptions & BIT) != 0 || BIT == PLUGIN_OPTION_FORCE_STEREO) \
{ \
if (settings.contains(STR)) \
@@ -249,7 +249,7 @@ unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options,
CHECK_AND_SET_OPTION("SendPitchbend", PLUGIN_OPTION_SEND_PITCHBEND);
CHECK_AND_SET_OPTION("SendAllSoundOff", PLUGIN_OPTION_SEND_ALL_SOUND_OFF);

#undef CHECK_AND_SET_OPTION
#undef CHECK_AND_SET_OPTION

settings.endGroup();



+ 8
- 6
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -360,10 +360,10 @@ struct PluginPostRtEvent {
value2(-1),
value3(0.0f) {}

#if 1//def DEBUG
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(PluginPostRtEvent)
#else
#ifndef DEBUG
CARLA_DECLARE_NON_COPY_STRUCT(PluginPostRtEvent)
#else
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(PluginPostRtEvent)
#endif
};

@@ -379,10 +379,10 @@ struct ExternalMidiNote {
note(0),
velo(0) {}

#if 1//def DEBUG
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(ExternalMidiNote)
#else
#ifndef DEBUG
CARLA_DECLARE_NON_COPY_STRUCT(ExternalMidiNote)
#else
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(ExternalMidiNote)
#endif
};

@@ -574,6 +574,8 @@ struct CarlaPluginProtectedData {

if (client != nullptr)
{
CARLA_ASSERT(! client->isActive());

if (client->isActive())
client->deactivate();



+ 3
- 0
source/backend/plugin/DssiPlugin.cpp View File

@@ -68,6 +68,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 3
- 0
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -96,6 +96,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 3
- 0
source/backend/plugin/LadspaPlugin.cpp View File

@@ -50,6 +50,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 3
- 0
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -185,6 +185,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 8
- 3
source/backend/plugin/Lv2Plugin.cpp View File

@@ -17,13 +17,15 @@

#include "CarlaPluginInternal.hpp"

#define WANT_LV2
#ifdef WANT_LV2

#include "CarlaPluginGui.hpp"
#include "../engine/CarlaEngineOsc.hpp"
#include "CarlaLv2Utils.hpp"
#include "Lv2AtomQueue.hpp"

#include "../engine/CarlaEngineOsc.hpp"

#include <QtCore/QDir>

extern "C" {
@@ -234,7 +236,7 @@ struct Lv2PluginEventData {
CARLA_ASSERT_INT(count == 0, count);
CARLA_ASSERT(data == nullptr);
CARLA_ASSERT(ctrl == nullptr);
CARLA_ASSERT(ctrlIndex == 0);
CARLA_ASSERT_INT(ctrlIndex == 0, ctrlIndex);
}

void createNew(const uint32_t newCount)
@@ -242,7 +244,7 @@ struct Lv2PluginEventData {
CARLA_ASSERT_INT(count == 0, count);
CARLA_ASSERT(data == nullptr);
CARLA_ASSERT(ctrl == nullptr);
CARLA_ASSERT(ctrlIndex == 0);
CARLA_ASSERT_INT(ctrlIndex == 0, ctrlIndex);
CARLA_ASSERT_INT(newCount > 0, newCount);

if (data != nullptr || newCount == 0)
@@ -446,6 +448,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

if (kData->active)
{
deactivate();


+ 3
- 0
source/backend/plugin/NativePlugin.cpp View File

@@ -213,6 +213,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

CARLA_ASSERT(! fIsProcessing);

if (kData->active)


+ 3
- 0
source/backend/plugin/Vst3Plugin.cpp View File

@@ -38,6 +38,9 @@ public:

kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();
}

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


+ 3
- 0
source/backend/plugin/VstPlugin.cpp View File

@@ -94,6 +94,9 @@ public:
kData->singleMutex.lock();
kData->masterMutex.lock();

if (kData->client != nullptr && kData->client->isActive())
kData->client->deactivate();

CARLA_ASSERT(! fIsProcessing);

if (kData->active)


+ 34
- 52
source/utils/CarlaJuceUtils.hpp View File

@@ -1,19 +1,18 @@
/*
* Carla misc utils imported from Juce source code
* Copyright (C) 2004-11 Raw Material Software Ltd.
* Copyright (c) 2013 Raw Material Software Ltd.
* Copyright (C) 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.
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* 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
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef __CARLA_JUCE_UTILS_HPP__
@@ -75,7 +74,7 @@ private: \
it can check whether there are any left-over instances that may have been leaked.

To use it, use the CARLA_LEAK_DETECTOR macro as a simple way to put one in your
class declaration. Have a look through the juce codebase for examples, it's used
class declaration. Have a look through the carla codebase for examples, it's used
in most of the classes.
*/
template <class OwnerClass>
@@ -83,15 +82,8 @@ class LeakedObjectDetector
{
public:
//==============================================================================
LeakedObjectDetector()
{
++(getCounter().numObjects);
}

LeakedObjectDetector(const LeakedObjectDetector&)
{
++(getCounter().numObjects);
}
LeakedObjectDetector() noexcept { ++(getCounter().numObjects); }
LeakedObjectDetector (const LeakedObjectDetector&) noexcept { ++(getCounter().numObjects); }

~LeakedObjectDetector()
{
@@ -119,7 +111,7 @@ private:
class LeakCounter
{
public:
LeakCounter()
LeakCounter() noexcept
{
numObjects = 0;
}
@@ -141,7 +133,7 @@ private:
}
}

int numObjects;
volatile int numObjects;
};

static const char* getLeakedObjectClassName()
@@ -149,7 +141,7 @@ private:
return OwnerClass::getLeakedObjectClassName();
}

static LeakCounter& getCounter()
static LeakCounter& getCounter() noexcept
{
static LeakCounter counter;
return counter;
@@ -158,7 +150,7 @@ private:

#define CARLA_LEAK_DETECTOR(OwnerClass) \
friend class LeakedObjectDetector<OwnerClass>; \
static const char* getLeakedObjectClassName() { return #OwnerClass; } \
static const char* getLeakedObjectClassName() noexcept { return #OwnerClass; } \
LeakedObjectDetector<OwnerClass> CARLA_JOIN_MACRO (leakDetector, __LINE__);


@@ -205,13 +197,13 @@ class ScopedPointer
public:
//==============================================================================
/** Creates a ScopedPointer containing a null pointer. */
ScopedPointer()
ScopedPointer() noexcept
: object(nullptr)
{
}

/** Creates a ScopedPointer that owns the specified object. */
ScopedPointer(ObjectType* const objectToTakePossessionOf)
ScopedPointer(ObjectType* const objectToTakePossessionOf) noexcept
: object(objectToTakePossessionOf)
{
}
@@ -222,7 +214,7 @@ public:
the pointer from the other object to this one, and the other object is reset to
be a null pointer.
*/
ScopedPointer(ScopedPointer& objectToTransferFrom)
ScopedPointer(ScopedPointer& objectToTransferFrom) noexcept
: object(objectToTransferFrom.object)
{
objectToTransferFrom.object = nullptr;
@@ -283,33 +275,28 @@ public:

//==============================================================================
/** Returns the object that this ScopedPointer refers to. */
operator ObjectType*() const { return object; }
operator ObjectType*() const noexcept { return object; }

/** Returns the object that this ScopedPointer refers to. */
ObjectType* get() const { return object; }
ObjectType* get() const noexcept { return object; }

/** Returns the object that this ScopedPointer refers to. */
ObjectType& operator*() const { return *object; }
ObjectType& operator*() const noexcept { return *object; }

/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
ObjectType* operator->() const { return object; }
ObjectType* operator->() const noexcept { return object; }

//==============================================================================
/** Removes the current object from this ScopedPointer without deleting it.
This will return the current object, and set the ScopedPointer to a null pointer.
*/
ObjectType* release()
{
ObjectType* const o = object;
object = nullptr;
return o;
}
ObjectType* release() noexcept { ObjectType* const o = object; object = nullptr; return o; }

//==============================================================================
/** Swaps this object with that of another ScopedPointer.
The two objects simply exchange their pointers.
*/
void swapWith(ScopedPointer<ObjectType>& other)
void swapWith(ScopedPointer<ObjectType>& other) noexcept
{
// Two ScopedPointers should never be able to refer to the same object - if
// this happens, you must have done something dodgy!
@@ -323,17 +310,14 @@ private:
ObjectType* object;

// (Required as an alternative to the overloaded & operator).
const ScopedPointer* getAddress() const
{
return this;
}
const ScopedPointer* getAddress() const { return this; }

#if ! defined(CARLA_CC_MSVC) // (MSVC can't deal with multiple copy constructors)
/* These are private to stop people accidentally copying a const ScopedPointer (the compiler
would let you do so by implicitly casting the source to its raw object pointer).
/* The copy constructors are private to stop people accidentally copying a const ScopedPointer
(the compiler would let you do so by implicitly casting the source to its raw object pointer).

A side effect of this is that you may hit a puzzling compiler error when you write something
like this:
A side effect of this is that in a compiler that doesn't support C++11, you may hit an
error when you write something like this:

ScopedPointer<MyClass> m = new MyClass(); // Compile error: copy constructor is private.

@@ -342,12 +326,10 @@ private:

ScopedPointer<MyClass> m (new MyClass()); // Compiles OK

It's good practice to always use the latter form when writing your object declarations anyway,
rather than writing them as assignments and assuming (or hoping) that the compiler will be
smart enough to replace your construction + assignment with a single constructor.
It's probably best to use the latter form when writing your object declarations anyway, as
this is a better representation of the code that you actually want the compiler to produce.
*/
ScopedPointer(const ScopedPointer&);
ScopedPointer& operator=(const ScopedPointer&);
CARLA_DECLARE_NON_COPYABLE(ScopedPointer)
#endif
};



Loading…
Cancel
Save