Browse Source

Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 1 year ago
parent
commit
5adae9496f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 25 additions and 34 deletions
  1. +24
    -33
      source/backend/plugin/CarlaPluginBridge.cpp
  2. +1
    -1
      source/includes/CarlaDefines.h

+ 24
- 33
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -35,7 +35,7 @@
#include "water/misc/Time.h" #include "water/misc/Time.h"
#include "water/threads/ChildProcess.h" #include "water/threads/ChildProcess.h"


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


using water::ChildProcess; using water::ChildProcess;
using water::File; using water::File;
@@ -45,12 +45,12 @@ using water::Time;


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


// ---------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Fallback data // Fallback data


static const ExternalMidiNote kExternalMidiNoteFallback = { -1, 0, 0 }; static const ExternalMidiNote kExternalMidiNoteFallback = { -1, 0, 0 };


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


static String findWinePrefix(const String filename, const int recursionLimit = 10) static String findWinePrefix(const String filename, const int recursionLimit = 10)
{ {
@@ -65,7 +65,7 @@ static String findWinePrefix(const String filename, const int recursionLimit = 1
return findWinePrefix(path, recursionLimit-1); return findWinePrefix(path, recursionLimit-1);
} }


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


struct BridgeParamInfo { struct BridgeParamInfo {
float value; float value;
@@ -82,7 +82,7 @@ struct BridgeParamInfo {
CARLA_DECLARE_NON_COPYABLE(BridgeParamInfo) CARLA_DECLARE_NON_COPYABLE(BridgeParamInfo)
}; };


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


class CarlaPluginBridgeThread : public CarlaThread class CarlaPluginBridgeThread : public CarlaThread
{ {
@@ -2325,17 +2325,14 @@ public:
const uint32_t hints = fShmNonRtServerControl.readUInt(); const uint32_t hints = fShmNonRtServerControl.readUInt();
const int16_t ctrl = fShmNonRtServerControl.readShort(); const int16_t ctrl = fShmNonRtServerControl.readShort();


CARLA_SAFE_ASSERT_BREAK(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED);
CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count);
CARLA_SAFE_ASSERT_INT_BREAK(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED, ctrl);
CARLA_SAFE_ASSERT_UINT2_BREAK(index < pData->param.count, index, pData->param.count);


if (index < pData->param.count)
{
pData->param.data[index].type = static_cast<ParameterType>(type);
pData->param.data[index].index = static_cast<int32_t>(index);
pData->param.data[index].rindex = rindex;
pData->param.data[index].hints = hints;
pData->param.data[index].mappedControlIndex = ctrl;
}
pData->param.data[index].type = static_cast<ParameterType>(type);
pData->param.data[index].index = static_cast<int32_t>(index);
pData->param.data[index].rindex = rindex;
pData->param.data[index].hints = hints;
pData->param.data[index].mappedControlIndex = ctrl;
} break; } break;


case kPluginBridgeNonRtServerParameterData2: { case kPluginBridgeNonRtServerParameterData2: {
@@ -2360,14 +2357,11 @@ public:
carla_zeroChars(unit, unitSize+1); carla_zeroChars(unit, unitSize+1);
fShmNonRtServerControl.readCustomData(unit, unitSize); fShmNonRtServerControl.readCustomData(unit, unitSize);


CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count);
CARLA_SAFE_ASSERT_UINT2_BREAK(index < pData->param.count, index, pData->param.count);


if (index < pData->param.count)
{
fParams[index].name = name;
fParams[index].symbol = symbol;
fParams[index].unit = unit;
}
fParams[index].name = name;
fParams[index].symbol = symbol;
fParams[index].unit = unit;
} break; } break;


case kPluginBridgeNonRtServerParameterRanges: { case kPluginBridgeNonRtServerParameterRanges: {
@@ -2383,17 +2377,14 @@ public:
CARLA_SAFE_ASSERT_BREAK(min < max); CARLA_SAFE_ASSERT_BREAK(min < max);
CARLA_SAFE_ASSERT_BREAK(def >= min); CARLA_SAFE_ASSERT_BREAK(def >= min);
CARLA_SAFE_ASSERT_BREAK(def <= max); CARLA_SAFE_ASSERT_BREAK(def <= max);
CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count);

if (index < pData->param.count)
{
pData->param.ranges[index].def = def;
pData->param.ranges[index].min = min;
pData->param.ranges[index].max = max;
pData->param.ranges[index].step = step;
pData->param.ranges[index].stepSmall = stepSmall;
pData->param.ranges[index].stepLarge = stepLarge;
}
CARLA_SAFE_ASSERT_UINT2_BREAK(index < pData->param.count, index, pData->param.count);

pData->param.ranges[index].def = def;
pData->param.ranges[index].min = min;
pData->param.ranges[index].max = max;
pData->param.ranges[index].step = step;
pData->param.ranges[index].stepSmall = stepSmall;
pData->param.ranges[index].stepLarge = stepLarge;
} break; } break;


case kPluginBridgeNonRtServerParameterValue: { case kPluginBridgeNonRtServerParameterValue: {


+ 1
- 1
source/includes/CarlaDefines.h View File

@@ -196,7 +196,7 @@
#define CARLA_CUSTOM_SAFE_ASSERT_ONCE_CONTINUE(msg, cond) if (__builtin_expect(!(cond),0)) { static bool _p; if (!_p) { _p = true; carla_custom_safe_assert(msg, #cond, __FILE__, __LINE__); } continue; } #define CARLA_CUSTOM_SAFE_ASSERT_ONCE_CONTINUE(msg, cond) if (__builtin_expect(!(cond),0)) { static bool _p; if (!_p) { _p = true; carla_custom_safe_assert(msg, #cond, __FILE__, __LINE__); } continue; }
#define CARLA_CUSTOM_SAFE_ASSERT_ONCE_RETURN(msg, cond, ret) if (__builtin_expect(!(cond),0)) { static bool _p; if (!_p) { _p = true; carla_custom_safe_assert(msg, #cond, __FILE__, __LINE__); } return ret; } #define CARLA_CUSTOM_SAFE_ASSERT_ONCE_RETURN(msg, cond, ret) if (__builtin_expect(!(cond),0)) { static bool _p; if (!_p) { _p = true; carla_custom_safe_assert(msg, #cond, __FILE__, __LINE__); } return ret; }


#define CARLA_SAFE_ASSERT_INT_BREAK(cond, value) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value); break; }
#define CARLA_SAFE_ASSERT_INT_BREAK(cond, value) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value)); break; }
#define CARLA_SAFE_ASSERT_INT_CONTINUE(cond, value) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value)); continue; } #define CARLA_SAFE_ASSERT_INT_CONTINUE(cond, value) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value)); continue; }
#define CARLA_SAFE_ASSERT_INT_RETURN(cond, value, ret) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value)); return ret; } #define CARLA_SAFE_ASSERT_INT_RETURN(cond, value, ret) if (__builtin_expect(!(cond),0)) { carla_safe_assert_int(#cond, __FILE__, __LINE__, static_cast<int>(value)); return ret; }




Loading…
Cancel
Save