Browse Source

Avoid comparing shared_ptr directly to nullptr

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
22a6006c70
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
18 changed files with 568 additions and 623 deletions
  1. +3
    -4
      source/backend/CarlaHost.h
  2. +3
    -4
      source/backend/CarlaPlugin.hpp
  3. +12
    -7
      source/backend/CarlaPluginPtr.hpp
  4. +330
    -401
      source/backend/CarlaStandalone.cpp
  5. +72
    -71
      source/backend/engine/CarlaEngine.cpp
  6. +26
    -27
      source/backend/engine/CarlaEngineBridge.cpp
  7. +3
    -3
      source/backend/engine/CarlaEngineClient.cpp
  8. +12
    -12
      source/backend/engine/CarlaEngineGraph.cpp
  9. +4
    -4
      source/backend/engine/CarlaEngineInternal.cpp
  10. +27
    -17
      source/backend/engine/CarlaEngineJack.cpp
  11. +59
    -61
      source/backend/engine/CarlaEngineNative.cpp
  12. +2
    -2
      source/backend/engine/CarlaEnginePorts.cpp
  13. +6
    -0
      source/backend/engine/CarlaEnginePorts.hpp
  14. +1
    -1
      source/backend/engine/CarlaEngineThread.cpp
  15. +2
    -2
      source/backend/plugin/CarlaPlugin.cpp
  16. +1
    -1
      source/backend/plugin/CarlaPluginInternal.cpp
  17. +1
    -1
      source/backend/plugin/CarlaPluginInternal.hpp
  18. +4
    -5
      source/bridges-plugin/CarlaBridgeSingleLV2.cpp

+ 3
- 4
source/backend/CarlaHost.h View File

@@ -1097,11 +1097,10 @@ CARLA_EXPORT void carla_send_midi_note(CarlaHostHandle handle,
#endif

/*!
* Set a custom format when plugin UI windows created by Carla.
* MUST include one and only one %s, where carla places the plugin name.
* By default this format is "%s (GUI)"
* Set a custom prefix for plugin UI windows created by Carla.
* Carla will then add "%s (GUI)" after the prefix.
*/
CARLA_EXPORT void carla_set_custom_ui_title_format(CarlaHostHandle handle, uint pluginId, const char* format);
CARLA_EXPORT void carla_set_custom_ui_prefix(CarlaHostHandle handle, uint pluginId, const char* prefix);

/*!
* Tell a plugin to show its own custom UI.


+ 3
- 4
source/backend/CarlaPlugin.hpp View File

@@ -790,11 +790,10 @@ public:
// UI Stuff

/*!
* Set a custom format when plugin UI windows created by Carla.
* MUST include one and only one %s, where carla places the plugin name.
* By default this format is "%s (GUI)"
* Set a custom prefix for plugin UI windows created by Carla.
* Carla will then add "%s (GUI)" after the prefix.
*/
void setCustomUiTitleFormat(const char* format);
void setCustomUIPrefix(const char* format);

/*!
* Show (or hide) the plugin's custom UI according to @a yesNo.


+ 12
- 7
source/backend/CarlaPluginPtr.hpp View File

@@ -55,7 +55,7 @@ public:
}

template<class U>
void acquire(U* p) // may throw std::bad_alloc
void acquire(U* p)
{
if (nullptr != p)
{
@@ -63,12 +63,12 @@ public:
{
try
{
pn = new long(1); // may throw std::bad_alloc
pn = new volatile long(1);
}
catch (std::bad_alloc&)
{
delete p;
throw; // rethrow the std::bad_alloc
throw;
}
}
else
@@ -94,7 +94,7 @@ public:
}

public:
long* pn;
volatile long* pn;
};

template<class T>
@@ -150,6 +150,11 @@ public:
release();
}

void reset(void) noexcept
{
release();
}

void swap(shared_ptr& lhs) noexcept
{
std::swap(px, lhs.px);
@@ -176,10 +181,10 @@ public:
}

private:
void acquire(T* p) // may throw std::bad_alloc
void acquire(T* p)
{
pn.acquire(p); // may throw std::bad_alloc
px = p; // here it is safe to acquire the ownership of the provided raw pointer, where exception cannot be thrown any more
pn.acquire(p);
px = p;
}

void release(void) noexcept


+ 330
- 401
source/backend/CarlaStandalone.cpp
File diff suppressed because it is too large
View File


+ 72
- 71
source/backend/engine/CarlaEngine.cpp View File

@@ -364,17 +364,18 @@ void CarlaEngine::idle() noexcept

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
const uint hints(plugin->getHints());

if ((hints & PLUGIN_HAS_CUSTOM_UI) != 0 && (hints & PLUGIN_NEEDS_UI_MAIN_THREAD) != 0)
if (plugin->isEnabled())
{
try {
plugin->uiIdle();
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin uiIdle");
const uint hints(plugin->getHints());

if ((hints & PLUGIN_HAS_CUSTOM_UI) != 0 && (hints & PLUGIN_NEEDS_UI_MAIN_THREAD) != 0)
{
try {
plugin->uiIdle();
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin uiIdle");
}
}
}
}
@@ -475,7 +476,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype,

oldPlugin = pData->plugins[id].plugin;

CARLA_SAFE_ASSERT_RETURN_ERR(oldPlugin != nullptr, "Invalid replace plugin Id");
CARLA_SAFE_ASSERT_RETURN_ERR(oldPlugin.get() != nullptr, "Invalid replace plugin Id");
}
else
#endif
@@ -489,7 +490,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
}

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins[id].plugin == nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins[id].plugin.get() == nullptr, "Invalid engine internal data");
#endif
}

@@ -646,7 +647,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
}
}

if (plugin == nullptr)
if (plugin.get() == nullptr)
return false;

plugin->reload();
@@ -680,7 +681,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
carla_zeroFloats(pluginData.peaks, 4);

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
if (oldPlugin != nullptr)
if (oldPlugin.get() != nullptr)
{
CARLA_SAFE_ASSERT(! pData->loadingProject);

@@ -750,9 +751,9 @@ bool CarlaEngine::removePlugin(const uint id)
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id");
carla_debug("CarlaEngine::removePlugin(%i)", id);

CarlaPluginPtr plugin = pData->plugins[id].plugin;
const CarlaPluginPtr plugin = pData->plugins[id].plugin;

CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to remove");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin.get() != nullptr, "Could not find plugin to remove");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

const ScopedThreadStopper sts(this);
@@ -818,7 +819,7 @@ bool CarlaEngine::removeAllPlugins()
pluginData.plugin->prepareForDeletion();
pData->pluginsToDelete.push_back(pluginData.plugin);

pluginData.plugin = nullptr;
pluginData.plugin.reset();
carla_zeroStruct(pluginData.peaks);

callback(true, true, ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0, 0.0f, nullptr);
@@ -839,8 +840,8 @@ bool CarlaEngine::renamePlugin(const uint id, const char* const newName)
CARLA_SAFE_ASSERT_RETURN_ERR(newName != nullptr && newName[0] != '\0', "Invalid plugin name");
carla_debug("CarlaEngine::renamePlugin(%i, \"%s\")", id, newName);

CarlaPluginPtr plugin = pData->plugins[id].plugin;
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to rename");
const CarlaPluginPtr plugin = pData->plugins[id].plugin;
CARLA_SAFE_ASSERT_RETURN_ERR(plugin.get() != nullptr, "Could not find plugin to rename");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

const char* const uniqueName(getUniquePluginName(newName));
@@ -866,9 +867,9 @@ bool CarlaEngine::clonePlugin(const uint id)
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id");
carla_debug("CarlaEngine::clonePlugin(%i)", id);

CarlaPluginPtr plugin = pData->plugins[id].plugin;
const CarlaPluginPtr plugin = pData->plugins[id].plugin;

CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to clone");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin.get() != nullptr, "Could not find plugin to clone");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

char label[STR_MAX+1];
@@ -909,9 +910,9 @@ bool CarlaEngine::replacePlugin(const uint id) noexcept

CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id");

CarlaPluginPtr plugin = pData->plugins[id].plugin;
const CarlaPluginPtr plugin = pData->plugins[id].plugin;

CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to replace");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin.get() != nullptr, "Could not find plugin to replace");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

pData->nextPluginId = id;
@@ -930,11 +931,11 @@ bool CarlaEngine::switchPlugins(const uint idA, const uint idB) noexcept
CARLA_SAFE_ASSERT_RETURN_ERR(idB < pData->curPluginCount, "Invalid plugin Id");
carla_debug("CarlaEngine::switchPlugins(%i)", idA, idB);

CarlaPluginPtr pluginA = pData->plugins[idA].plugin;
CarlaPluginPtr pluginB = pData->plugins[idB].plugin;
const CarlaPluginPtr pluginA = pData->plugins[idA].plugin;
const CarlaPluginPtr pluginB = pData->plugins[idB].plugin;

CARLA_SAFE_ASSERT_RETURN_ERR(pluginA != nullptr, "Could not find plugin to switch");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA != nullptr, "Could not find plugin to switch");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA.get() != nullptr, "Could not find plugin to switch");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginB.get() != nullptr, "Could not find plugin to switch");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA->getId() == idA, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginB->getId() == idB, "Invalid engine internal data");

@@ -1004,10 +1005,11 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const

for (uint i=0; i < pData->curPluginCount; ++i)
{
CARLA_SAFE_ASSERT_BREAK(pData->plugins[i].plugin != nullptr);
const CarlaPluginPtr plugin = pData->plugins[i].plugin;
CARLA_SAFE_ASSERT_BREAK(plugin.use_count() > 0);

// Check if unique name doesn't exist
if (const char* const pluginName = pData->plugins[i].plugin->getName())
if (const char* const pluginName = plugin->getName())
{
if (sname != pluginName)
continue;
@@ -2030,13 +2032,13 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize)

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
plugin->tryLock(true);
plugin->bufferSizeChanged(newBufferSize);
plugin->unlock();
if (plugin->isEnabled() && plugin->tryLock(true))
{
plugin->bufferSizeChanged(newBufferSize);
plugin->unlock();
}
}
}

@@ -2059,13 +2061,13 @@ void CarlaEngine::sampleRateChanged(const double newSampleRate)

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
plugin->tryLock(true);
plugin->sampleRateChanged(newSampleRate);
plugin->unlock();
if (plugin->isEnabled() && plugin->tryLock(true))
{
plugin->sampleRateChanged(newSampleRate);
plugin->unlock();
}
}
}

@@ -2086,10 +2088,9 @@ void CarlaEngine::offlineModeChanged(const bool isOfflineNow)

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
plugin->offlineModeChanged(isOfflineNow);
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
if (plugin->isEnabled())
plugin->offlineModeChanged(isOfflineNow);
}
}

@@ -2108,16 +2109,17 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons
// send initial prepareForSave first, giving time for bridges to act
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
if (plugin->isEnabled())
{
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
// deactivate bridge client-side ping check, since some plugins block during save
if (plugin->getHints() & PLUGIN_IS_BRIDGE)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "false", false);
// deactivate bridge client-side ping check, since some plugins block during save
if (plugin->getHints() & PLUGIN_IS_BRIDGE)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "false", false);
#endif
plugin->prepareForSave();
plugin->prepareForSave();
}
}
}

@@ -2172,22 +2174,23 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
MemoryOutputStream outPlugin(4096), streamPlugin;
plugin->getStateSave(false).dumpToMemoryStream(streamPlugin);
if (plugin->isEnabled())
{
MemoryOutputStream outPlugin(4096), streamPlugin;
plugin->getStateSave(false).dumpToMemoryStream(streamPlugin);

outPlugin << "\n";
outPlugin << "\n";

if (plugin->getRealName(strBuf))
outPlugin << " <!-- " << xmlSafeString(strBuf, true) << " -->\n";
if (plugin->getRealName(strBuf))
outPlugin << " <!-- " << xmlSafeString(strBuf, true) << " -->\n";

outPlugin << " <Plugin>\n";
outPlugin << streamPlugin;
outPlugin << " </Plugin>\n";
outStream << outPlugin;
outPlugin << " <Plugin>\n";
outPlugin << streamPlugin;
outPlugin << " </Plugin>\n";
outStream << outPlugin;
}
}
}

@@ -2195,10 +2198,9 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons
// tell bridges we're done saving
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
if (plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
}

// save internal connections
@@ -2852,10 +2854,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc)
// tell bridges we're done loading
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
if (plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
}

callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);


+ 26
- 27
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -313,7 +313,7 @@ public:
{
const CarlaPluginPtr plugin = pData->plugins[0].plugin;

if (plugin == nullptr)
if (plugin.get() == nullptr)
{
if (const uint32_t length = static_cast<uint32_t>(pData->lastError.length()))
{
@@ -749,7 +749,7 @@ public:
void handleNonRtData()
{
const CarlaPluginPtr plugin = pData->plugins[0].plugin;
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);

for (; fShmNonRtClientControl.isDataAvailableForReading();)
{
@@ -789,12 +789,12 @@ public:
} break;

case kPluginBridgeNonRtClientActivate:
if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setActive(true, false, false);
break;

case kPluginBridgeNonRtClientDeactivate:
if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setActive(false, false, false);
break;

@@ -808,7 +808,7 @@ public:
const uint32_t index(fShmNonRtClientControl.readUInt());
const float value(fShmNonRtClientControl.readFloat());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setParameterValue(index, value, false, false, false);
break;
}
@@ -817,7 +817,7 @@ public:
const uint32_t index(fShmNonRtClientControl.readUInt());
const uint8_t channel(fShmNonRtClientControl.readByte());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setParameterMidiChannel(index, channel, false, false);
break;
}
@@ -826,7 +826,7 @@ public:
const uint32_t index(fShmNonRtClientControl.readUInt());
const int16_t ctrl(fShmNonRtClientControl.readShort());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setParameterMappedControlIndex(index, ctrl, false, false);
break;
}
@@ -836,7 +836,7 @@ public:
const float minimum = fShmNonRtClientControl.readFloat();
const float maximum = fShmNonRtClientControl.readFloat();

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setParameterMappedRange(index, minimum, maximum, false, false);
break;
}
@@ -844,7 +844,7 @@ public:
case kPluginBridgeNonRtClientSetProgram: {
const int32_t index(fShmNonRtClientControl.readInt());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setProgram(index, true, false, false);
break;
}
@@ -852,7 +852,7 @@ public:
case kPluginBridgeNonRtClientSetMidiProgram: {
const int32_t index(fShmNonRtClientControl.readInt());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setMidiProgram(index, true, false, false);
break;
}
@@ -878,7 +878,7 @@ public:
if (valueSize > 0)
fShmNonRtClientControl.readCustomData(valueStr, valueSize);

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setCustomData(typeStr, keyStr, valueStr, true);
break;
}
@@ -892,7 +892,7 @@ public:
fShmNonRtClientControl.readCustomData(chunkFilePathTry, size);

CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry[0] != '\0');
if (plugin == nullptr || ! plugin->isEnabled()) break;
if (! plugin->isEnabled()) break;

String chunkFilePath(chunkFilePathTry);

@@ -923,7 +923,7 @@ public:
const int16_t channel(fShmNonRtClientControl.readShort());
CARLA_SAFE_ASSERT_BREAK(channel >= -1 && channel < MAX_MIDI_CHANNELS);

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setCtrlChannel(static_cast<int8_t>(channel), false, false);
break;
}
@@ -932,7 +932,7 @@ public:
const uint32_t option(fShmNonRtClientControl.readUInt());
const bool yesNo(fShmNonRtClientControl.readBool());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->setOption(option, yesNo, false);
break;
}
@@ -940,15 +940,14 @@ public:
case kPluginBridgeNonRtClientSetOptions: {
const uint32_t options(fShmNonRtClientControl.readUInt());

if (plugin != nullptr)
plugin->pData->options = options;
plugin->pData->options = options;
break;
}

case kPluginBridgeNonRtClientGetParameterText: {
const int32_t index(fShmNonRtClientControl.readInt());

if (index >= 0 && plugin != nullptr && plugin->isEnabled())
if (index >= 0 && plugin->isEnabled())
{
char bufStr[STR_MAX+1];
carla_zeroChars(bufStr, STR_MAX+1);
@@ -973,7 +972,7 @@ public:
}

case kPluginBridgeNonRtClientPrepareForSave: {
if (plugin == nullptr || ! plugin->isEnabled())
if (! plugin->isEnabled())
break;

plugin->prepareForSave();
@@ -1049,17 +1048,17 @@ public:
}

case kPluginBridgeNonRtClientRestoreLV2State:
if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->restoreLV2State();
break;

case kPluginBridgeNonRtClientShowUI:
if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->showCustomUI(true);
break;

case kPluginBridgeNonRtClientHideUI:
if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->showCustomUI(false);
break;

@@ -1067,7 +1066,7 @@ public:
const uint32_t index(fShmNonRtClientControl.readUInt());
const float value(fShmNonRtClientControl.readFloat());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->uiParameterChange(index, value);
break;
}
@@ -1075,7 +1074,7 @@ public:
case kPluginBridgeNonRtClientUiProgramChange: {
const uint32_t index(fShmNonRtClientControl.readUInt());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->uiProgramChange(index);
break;
}
@@ -1083,7 +1082,7 @@ public:
case kPluginBridgeNonRtClientUiMidiProgramChange: {
const uint32_t index(fShmNonRtClientControl.readUInt());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->uiMidiProgramChange(index);
break;
}
@@ -1093,7 +1092,7 @@ public:
const uint8_t note(fShmNonRtClientControl.readByte());
const uint8_t velo(fShmNonRtClientControl.readByte());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->uiNoteOn(chnl, note, velo);
break;
}
@@ -1102,7 +1101,7 @@ public:
const uint8_t chnl(fShmNonRtClientControl.readByte());
const uint8_t note(fShmNonRtClientControl.readByte());

if (plugin != nullptr && plugin->isEnabled())
if (plugin->isEnabled())
plugin->uiNoteOff(chnl, note);
break;
}
@@ -1311,7 +1310,7 @@ protected:

CARLA_SAFE_ASSERT_BREAK(fShmAudioPool.data != nullptr);

if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(fIsOffline))
if (plugin.get() != nullptr && plugin->isEnabled() && plugin->tryLock(fIsOffline))
{
const BridgeTimeInfo& bridgeTimeInfo(fShmRtClientControl.data->timeInfo);



+ 3
- 3
source/backend/engine/CarlaEngineClient.cpp View File

@@ -112,7 +112,7 @@ CarlaEngineClient::ProtectedData::~ProtectedData()
{
carla_debug("CarlaEngineClient::ProtectedData::~ProtectedData()");
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
CARLA_SAFE_ASSERT(plugin == nullptr);
CARLA_SAFE_ASSERT(plugin.get() == nullptr);
#endif
}

@@ -198,8 +198,8 @@ void CarlaEngineClient::deactivate(const bool willClose) noexcept
if (willClose)
{
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
pData->cvSourcePorts.setGraphAndPlugin(nullptr, nullptr);
pData->plugin = nullptr;
pData->cvSourcePorts.resetGraphAndPlugin();
pData->plugin.reset();
#endif
}
}


+ 12
- 12
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -969,7 +969,7 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB
{
const CarlaPluginPtr plugin = data->plugins[i].plugin;

if (plugin == nullptr || ! plugin->isEnabled() || ! plugin->tryLock(isOffline))
if (plugin.get() == nullptr || ! plugin->isEnabled() || ! plugin->tryLock(isOffline))
continue;

if (processed)
@@ -1471,7 +1471,7 @@ public:

void reconfigure() override
{
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fPlugin.get() != nullptr,);

CarlaEngineClient* const client = fPlugin->getEngineClient();
CARLA_SAFE_ASSERT_RETURN(client != nullptr,);
@@ -1489,7 +1489,7 @@ public:

void invalidatePlugin() noexcept
{
fPlugin = nullptr;
fPlugin.reset();
}

// -------------------------------------------------------------------
@@ -1504,7 +1504,7 @@ public:
AudioSampleBuffer& cvOut,
MidiBuffer& midi) override
{
if (fPlugin == nullptr || ! fPlugin->isEnabled() || ! fPlugin->tryLock(kEngine->isOffline()))
if (fPlugin.get() == nullptr || ! fPlugin->isEnabled() || ! fPlugin->tryLock(kEngine->isOffline()))
{
audio.clear();
cvOut.clear();
@@ -1864,7 +1864,7 @@ void PatchbayGraph::setOffline(const bool offline)

void PatchbayGraph::addPlugin(const CarlaPluginPtr plugin)
{
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);
carla_debug("PatchbayGraph::addPlugin(%p)", plugin.get());

CarlaPluginInstance* const instance(new CarlaPluginInstance(kEngine, plugin));
@@ -1884,8 +1884,8 @@ void PatchbayGraph::addPlugin(const CarlaPluginPtr plugin)

void PatchbayGraph::replacePlugin(const CarlaPluginPtr oldPlugin, const CarlaPluginPtr newPlugin)
{
CARLA_SAFE_ASSERT_RETURN(oldPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(newPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(oldPlugin.get() != nullptr,);
CARLA_SAFE_ASSERT_RETURN(newPlugin.get() != nullptr,);
CARLA_SAFE_ASSERT_RETURN(oldPlugin != newPlugin,);
CARLA_SAFE_ASSERT_RETURN(oldPlugin->getId() == newPlugin->getId(),);

@@ -1916,7 +1916,7 @@ void PatchbayGraph::replacePlugin(const CarlaPluginPtr oldPlugin, const CarlaPlu

void PatchbayGraph::renamePlugin(const CarlaPluginPtr plugin, const char* const newName)
{
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);
carla_debug("PatchbayGraph::renamePlugin(%p)", plugin.get(), newName);

AudioProcessorGraph::Node* const node(graph.getNodeForId(plugin->getPatchbayNodeId()));
@@ -1934,7 +1934,7 @@ void PatchbayGraph::renamePlugin(const CarlaPluginPtr plugin, const char* const

void PatchbayGraph::reconfigureForCV(const CarlaPluginPtr plugin, const uint portIndex, bool added)
{
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);
carla_debug("PatchbayGraph::reconfigureForCV(%p, %u, %s)", plugin.get(), portIndex, bool2str(added));

AudioProcessorGraph::Node* const node = graph.getNodeForId(plugin->getPatchbayNodeId());
@@ -1988,7 +1988,7 @@ void PatchbayGraph::reconfigureForCV(const CarlaPluginPtr plugin, const uint por

void PatchbayGraph::removePlugin(const CarlaPluginPtr plugin)
{
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);
carla_debug("PatchbayGraph::removePlugin(%p)", plugin.get());

AudioProcessorGraph::Node* const node(graph.getNodeForId(plugin->getPatchbayNodeId()));
@@ -2006,7 +2006,7 @@ void PatchbayGraph::removePlugin(const CarlaPluginPtr plugin)
for (uint i=plugin->getId()+1, count=kEngine->getCurrentPluginCount(); i<count; ++i)
{
const CarlaPluginPtr plugin2 = kEngine->getPlugin(i);
CARLA_SAFE_ASSERT_BREAK(plugin2 != nullptr);
CARLA_SAFE_ASSERT_BREAK(plugin2.get() != nullptr);

if (AudioProcessorGraph::Node* const node2 = graph.getNodeForId(plugin2->getPatchbayNodeId()))
{
@@ -2028,7 +2028,7 @@ void PatchbayGraph::removeAllPlugins()
for (uint i=0, count=kEngine->getCurrentPluginCount(); i<count; ++i)
{
const CarlaPluginPtr plugin = kEngine->getPlugin(i);
CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr);
CARLA_SAFE_ASSERT_CONTINUE(plugin.get() != nullptr);

AudioProcessorGraph::Node* const node(graph.getNodeForId(plugin->getPatchbayNodeId()));
CARLA_SAFE_ASSERT_CONTINUE(node != nullptr);


+ 4
- 4
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -598,7 +598,7 @@ void CarlaEngine::ProtectedData::doPluginRemove(const uint pluginId) noexcept
for (uint i=pluginId; i < curPluginCount; ++i)
{
const CarlaPluginPtr plugin = plugins[i+1].plugin;
CARLA_SAFE_ASSERT_BREAK(plugin != nullptr);
CARLA_SAFE_ASSERT_BREAK(plugin.get() != nullptr);

plugin->setId(i);

@@ -609,7 +609,7 @@ void CarlaEngine::ProtectedData::doPluginRemove(const uint pluginId) noexcept
const uint id = curPluginCount;

// reset last plugin (now removed)
plugins[id].plugin = nullptr;
plugins[id].plugin.reset();
carla_zeroFloats(plugins[id].peaks, 4);
}

@@ -621,10 +621,10 @@ void CarlaEngine::ProtectedData::doPluginsSwitch(const uint idA, const uint idB)
CARLA_SAFE_ASSERT_RETURN(idB < curPluginCount,);

const CarlaPluginPtr pluginA = plugins[idA].plugin;
CARLA_SAFE_ASSERT_RETURN(pluginA != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pluginA.get() != nullptr,);

const CarlaPluginPtr pluginB = plugins[idB].plugin;
CARLA_SAFE_ASSERT_RETURN(pluginB != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pluginB.get() != nullptr,);

pluginA->setId(idB);
plugins[idA].plugin = pluginB;


+ 27
- 17
source/backend/engine/CarlaEngineJack.cpp View File

@@ -745,7 +745,13 @@ public:
return pData->cvs[ioffset].cvPort;
}

void setGraphAndPlugin(PatchbayGraph* const graph, CarlaPluginPtr plugin) noexcept
void resetGraphAndPlugin() noexcept
{
pData->graph = nullptr;
pData->plugin.reset();
}

void setGraphAndPlugin(PatchbayGraph* const graph, const CarlaPluginPtr plugin) noexcept
{
pData->graph = graph;
pData->plugin = plugin;
@@ -930,7 +936,7 @@ public:
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
if (willClose)
{
fCVSourcePorts.setGraphAndPlugin(nullptr, nullptr);
fCVSourcePorts.resetGraphAndPlugin();
fReservedPluginPtr = nullptr;
}
#endif
@@ -2008,7 +2014,7 @@ public:
for (uint i=id; i < pData->curPluginCount; ++i)
{
const CarlaPluginPtr plugin = pData->plugins[i].plugin;
CARLA_SAFE_ASSERT_BREAK(plugin != nullptr);
CARLA_SAFE_ASSERT_BREAK(plugin.get() != nullptr);

CarlaEngineJackClient* const client = dynamic_cast<CarlaEngineJackClient*>(plugin->getEngineClient());
CARLA_SAFE_ASSERT_BREAK(client != nullptr);
@@ -2025,10 +2031,10 @@ public:
return false;

CarlaPluginPtr newPluginA = pData->plugins[idA].plugin;
CARLA_SAFE_ASSERT_RETURN(newPluginA != nullptr, true);
CARLA_SAFE_ASSERT_RETURN(newPluginA.get() != nullptr, true);

CarlaPluginPtr newPluginB = pData->plugins[idB].plugin;
CARLA_SAFE_ASSERT_RETURN(newPluginB != nullptr, true);
CARLA_SAFE_ASSERT_RETURN(newPluginB.get() != nullptr, true);

CarlaEngineJackClient* const clientA = dynamic_cast<CarlaEngineJackClient*>(newPluginA->getEngineClient());
CARLA_SAFE_ASSERT_RETURN(clientA != nullptr, true);
@@ -2059,7 +2065,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(newName != nullptr && newName[0] != '\0', false);

CarlaPluginPtr plugin = pData->plugins[id].plugin;
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to rename");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin.get() != nullptr, "Could not find plugin to rename");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

// before we stop the engine thread we might need to get the plugin data
@@ -2769,7 +2775,7 @@ protected:
#ifdef BUILD_BRIDGE
CarlaPluginPtr plugin = pData->plugins[0].plugin;

if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(fFreewheel))
if (plugin.get() != nullptr && plugin->isEnabled() && plugin->tryLock(fFreewheel))
{
plugin->initBuffers();
processPlugin(plugin, nframes);
@@ -2860,13 +2866,14 @@ protected:
{
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(fFreewheel))
if (CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
plugin->initBuffers();
processPlugin(plugin, nframes);
plugin->unlock();
if (plugin->isEnabled() && plugin->tryLock(fFreewheel))
{
plugin->initBuffers();
processPlugin(plugin, nframes);
plugin->unlock();
}
}
}
}
@@ -3394,7 +3401,7 @@ protected:

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

void handlePluginJackShutdownCallback(CarlaPlugin* const plugin)
void handlePluginJackShutdownCallback(const CarlaPluginPtr plugin)
{
CarlaEngineJackClient* const engineClient((CarlaEngineJackClient*)plugin->getEngineClient());
CARLA_SAFE_ASSERT_RETURN(engineClient != nullptr,);
@@ -4268,7 +4275,7 @@ private:
CARLA_SAFE_ASSERT_RETURN(pluginPtr != nullptr, 0);

CarlaPluginPtr plugin = *pluginPtr;
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr && plugin->isEnabled(), 0);
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr && plugin->isEnabled(), 0);

CarlaEngineJack* const engine((CarlaEngineJack*)plugin->getEngine());
CARLA_SAFE_ASSERT_RETURN(engine != nullptr, 0);
@@ -4310,8 +4317,11 @@ private:

static void JACKBRIDGE_API carla_jack_shutdown_callback_plugin(void* arg)
{
CarlaPlugin* const plugin((CarlaPlugin*)arg);
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
CarlaPluginPtr* const pluginPtr = static_cast<CarlaPluginPtr*>(arg);
CARLA_SAFE_ASSERT_RETURN(pluginPtr != nullptr,);

CarlaPluginPtr plugin = *pluginPtr;
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);

CarlaEngineJack* const engine((CarlaEngineJack*)plugin->getEngine());
CARLA_SAFE_ASSERT_RETURN(engine != nullptr,);


+ 59
- 61
source/backend/engine/CarlaEngineNative.cpp View File

@@ -709,62 +709,65 @@ protected:
if (! fUiServer.isPipeRunning())
return;

CarlaPluginPtr plugin;

switch (action)
{
case ENGINE_CALLBACK_UPDATE:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = getPlugin(pluginId))
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginProperties(plugin);
if (plugin->isEnabled())
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginProperties(plugin);
}
}
break;

case ENGINE_CALLBACK_RELOAD_INFO:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = getPlugin(pluginId))
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginInfo(plugin);
if (plugin->isEnabled())
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginInfo(plugin);
}
}
break;

case ENGINE_CALLBACK_RELOAD_PARAMETERS:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = getPlugin(pluginId))
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginParameters(plugin);
if (plugin->isEnabled())
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginParameters(plugin);
}
}
break;

case ENGINE_CALLBACK_RELOAD_PROGRAMS:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = getPlugin(pluginId))
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginPrograms(plugin);
if (plugin->isEnabled())
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginPrograms(plugin);
}
}
break;

case ENGINE_CALLBACK_RELOAD_ALL:
case ENGINE_CALLBACK_PLUGIN_ADDED:
case ENGINE_CALLBACK_PLUGIN_RENAMED:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = getPlugin(pluginId))
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginInfo(plugin);
uiServerSendPluginParameters(plugin);
uiServerSendPluginPrograms(plugin);
uiServerSendPluginProperties(plugin);
if (plugin->isEnabled())
{
CARLA_SAFE_ASSERT_BREAK(plugin->getId() == pluginId);
uiServerSendPluginInfo(plugin);
uiServerSendPluginParameters(plugin);
uiServerSendPluginPrograms(plugin);
uiServerSendPluginProperties(plugin);
}
}
break;

@@ -1287,12 +1290,9 @@ protected:

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
{
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName());
}
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
if (plugin->isEnabled())
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName());
}

if (kIsPatchbay)
@@ -1305,15 +1305,16 @@ protected:
// hide all custom uis
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
if (plugin->getHints() & PLUGIN_HAS_CUSTOM_UI)
if (plugin->isEnabled())
{
try {
plugin->showCustomUI(false);
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin showCustomUI (hide)");
if (plugin->getHints() & PLUGIN_HAS_CUSTOM_UI)
{
try {
plugin->showCustomUI(false);
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin showCustomUI (hide)");
}
}
}
}
@@ -1324,17 +1325,18 @@ protected:
{
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin != nullptr && plugin->isEnabled())
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
{
const uint hints(plugin->getHints());

if ((hints & PLUGIN_HAS_CUSTOM_UI) != 0 && (hints & PLUGIN_NEEDS_UI_MAIN_THREAD) != 0)
if (plugin->isEnabled())
{
try {
plugin->uiIdle();
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin uiIdle");
const uint hints = plugin->getHints();

if ((hints & PLUGIN_HAS_CUSTOM_UI) != 0 && (hints & PLUGIN_NEEDS_UI_MAIN_THREAD) != 0)
{
try {
plugin->uiIdle();
} CARLA_SAFE_EXCEPTION_CONTINUE("Plugin uiIdle");
}
}
}
}
@@ -1693,13 +1695,11 @@ private:
if (pData->curPluginCount == 0 || pData->plugins == nullptr)
return nullptr;

CarlaPluginPtr plugin;

for (uint32_t i=0; i<pData->curPluginCount; ++i)
{
plugin = pData->plugins[i].plugin;
const CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin == nullptr || ! plugin->isEnabled())
if (plugin.get() == nullptr || ! plugin->isEnabled())
break;

if (const uint32_t paramCount = plugin->getParameterCount())
@@ -1722,13 +1722,11 @@ private:
if (pData->curPluginCount == 0 || pluginId >= pData->curPluginCount || pData->plugins == nullptr)
return false;

CarlaPluginPtr plugin;

for (uint32_t i=0; i<pluginId; ++i)
{
plugin = pData->plugins[i].plugin;
const CarlaPluginPtr plugin = pData->plugins[i].plugin;

if (plugin == nullptr || ! plugin->isEnabled())
if (plugin.get() == nullptr || ! plugin->isEnabled())
return false;

rindex += plugin->getParameterCount();
@@ -2151,7 +2149,7 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(parameterId), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(touching), true);

if (fEngine->getPlugin(pluginId) != nullptr)
if (fEngine->getPlugin(pluginId))
fEngine->setParameterTouchFromUI(pluginId, parameterId, touching);
}
else if (std::strcmp(msg, "set_program") == 0)


+ 2
- 2
source/backend/engine/CarlaEnginePorts.cpp View File

@@ -355,7 +355,7 @@ bool CarlaEngineCVSourcePorts::addCVSource(CarlaEngineCVPort* const port, const
if (! pData->cvs.add(ecv))
return false;

if (pData->graph != nullptr && pData->plugin != nullptr)
if (pData->graph != nullptr && pData->plugin.get() != nullptr)
pData->graph->reconfigureForCV(pData->plugin, static_cast<uint>(pData->cvs.size()-1), true);
}

@@ -378,7 +378,7 @@ bool CarlaEngineCVSourcePorts::removeCVSource(const uint32_t portIndexOffset)
delete ecv.cvPort;
pData->cvs.remove(i);

if (pData->graph != nullptr && pData->plugin != nullptr)
if (pData->graph != nullptr && pData->plugin.get() != nullptr)
pData->graph->reconfigureForCV(pData->plugin, static_cast<uint>(i), false);

carla_stdout("found cv source to remove %u", portIndexOffset);


+ 6
- 0
source/backend/engine/CarlaEnginePorts.hpp View File

@@ -76,6 +76,12 @@ public:
CarlaEngineCVSourcePortsForStandalone() : CarlaEngineCVSourcePorts() {}
~CarlaEngineCVSourcePortsForStandalone() override {}

inline void resetGraphAndPlugin() noexcept
{
pData->graph = nullptr;
pData->plugin.reset();
}

inline void setGraphAndPlugin(PatchbayGraph* const graph, const CarlaPluginPtr plugin) noexcept
{
pData->graph = graph;


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

@@ -75,7 +75,7 @@ void CarlaEngineThread::run() noexcept
{
const CarlaPluginPtr plugin = kEngine->getPluginUnchecked(i);

CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr && plugin->isEnabled());
CARLA_SAFE_ASSERT_CONTINUE(plugin.get() != nullptr && plugin->isEnabled());
CARLA_SAFE_ASSERT_UINT2(i == plugin->getId(), i, plugin->getId());

const uint hints(plugin->getHints());


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

@@ -2355,9 +2355,9 @@ void CarlaPlugin::postponeRtAllNotesOff()
// -------------------------------------------------------------------
// UI Stuff

void CarlaPlugin::setCustomUiTitleFormat(const char* format)
void CarlaPlugin::setCustomUIPrefix(const char* format)
{
pData->uiTitleFormat = format;
pData->uiPrefix = format;
}

void CarlaPlugin::showCustomUI(const bool yesNo)


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

@@ -691,7 +691,7 @@ CarlaPlugin::ProtectedData::ProtectedData(CarlaEngine* const eng, const uint idx
masterMutex(),
singleMutex(),
stateSave(),
uiTitleFormat("%s (GUI)"),
uiPrefix(),
extNotes(),
latency(),
postRtEvents(),


+ 1
- 1
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -269,7 +269,7 @@ struct CarlaPlugin::ProtectedData {

CarlaStateSave stateSave;

CarlaString uiTitleFormat;
CarlaString uiPrefix;

struct ExternalNotes {
CarlaMutex mutex;


+ 4
- 5
source/bridges-plugin/CarlaBridgeSingleLV2.cpp View File

@@ -118,7 +118,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(pData->curPluginCount == 1,)

fPlugin = pData->plugins[0].plugin;
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fPlugin.get() != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fPlugin->isEnabled(),);

fPorts.hasUI = false;
@@ -142,17 +142,16 @@ public:

~CarlaEngineSingleLV2()
{
if (fPlugin != nullptr && fIsActive)
if (fPlugin.get() != nullptr && fIsActive)
fPlugin->setActive(false, false, false);

fPlugin = nullptr;

fPlugin.reset();
close();
}

bool hasPlugin() noexcept
{
return fPlugin != nullptr;
return fPlugin.get() != nullptr;
}

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


Loading…
Cancel
Save