From 04dbc3fbee878043495eb6696979ce0e8f5eb26b Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 22 Aug 2018 19:12:47 +0200 Subject: [PATCH] Nicer printing on out of bounds midi event time --- source/backend/plugin/CarlaPluginDSSI.cpp | 2 +- source/backend/plugin/CarlaPluginFluidSynth.cpp | 2 +- source/backend/plugin/CarlaPluginLADSPA.cpp | 2 +- source/backend/plugin/CarlaPluginLV2.cpp | 2 +- source/backend/plugin/CarlaPluginNative.cpp | 2 +- source/backend/plugin/CarlaPluginSFZero.cpp | 2 +- source/backend/plugin/CarlaPluginVST2.cpp | 2 +- source/includes/CarlaDefines.h | 8 ++++++++ 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/source/backend/plugin/CarlaPluginDSSI.cpp b/source/backend/plugin/CarlaPluginDSSI.cpp index 84598ee3b..34f40e521 100644 --- a/source/backend/plugin/CarlaPluginDSSI.cpp +++ b/source/backend/plugin/CarlaPluginDSSI.cpp @@ -1417,7 +1417,7 @@ public: const EngineEvent& event(pData->event.portIn->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginFluidSynth.cpp b/source/backend/plugin/CarlaPluginFluidSynth.cpp index 611aae1c6..bdc42a51e 100644 --- a/source/backend/plugin/CarlaPluginFluidSynth.cpp +++ b/source/backend/plugin/CarlaPluginFluidSynth.cpp @@ -1130,7 +1130,7 @@ public: const EngineEvent& event(pData->event.portIn->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginLADSPA.cpp b/source/backend/plugin/CarlaPluginLADSPA.cpp index 0726e55b5..92eea47bf 100644 --- a/source/backend/plugin/CarlaPluginLADSPA.cpp +++ b/source/backend/plugin/CarlaPluginLADSPA.cpp @@ -942,7 +942,7 @@ public: const EngineEvent& event(pData->event.portIn->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index f742bfc9d..307c28ecd 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -3044,7 +3044,7 @@ public: const EngineEvent& event(fEventsIn.ctrl->port->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginNative.cpp b/source/backend/plugin/CarlaPluginNative.cpp index dd2b01811..b356958bc 100644 --- a/source/backend/plugin/CarlaPluginNative.cpp +++ b/source/backend/plugin/CarlaPluginNative.cpp @@ -1618,7 +1618,7 @@ public: break; uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginSFZero.cpp b/source/backend/plugin/CarlaPluginSFZero.cpp index 23a45d9eb..13aa87d33 100644 --- a/source/backend/plugin/CarlaPluginSFZero.cpp +++ b/source/backend/plugin/CarlaPluginSFZero.cpp @@ -373,7 +373,7 @@ public: const EngineEvent& event(pData->event.portIn->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 797825b71..4f80c7637 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -1218,7 +1218,7 @@ public: const EngineEvent& event(pData->event.portIn->getEvent(i)); uint32_t eventTime = event.time; - CARLA_SAFE_ASSERT_CONTINUE(eventTime < frames); + CARLA_SAFE_ASSERT_UINT2_CONTINUE(eventTime < frames, eventTime, frames); if (eventTime < timeOffset) { diff --git a/source/includes/CarlaDefines.h b/source/includes/CarlaDefines.h index add76b325..c9807c61a 100644 --- a/source/includes/CarlaDefines.h +++ b/source/includes/CarlaDefines.h @@ -175,6 +175,14 @@ #define CARLA_SAFE_ASSERT_CONTINUE(cond) if (! (cond)) { carla_safe_assert(#cond, __FILE__, __LINE__); continue; } #define CARLA_SAFE_ASSERT_RETURN(cond, ret) if (! (cond)) { carla_safe_assert(#cond, __FILE__, __LINE__); return ret; } +#define CARLA_SAFE_ASSERT_INT2_BREAK(cond, v1, v2) if (! (cond)) { carla_safe_assert_int2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); break; } +#define CARLA_SAFE_ASSERT_INT2_CONTINUE(cond, v1, v2) if (! (cond)) { carla_safe_assert_int2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); continue; } +#define CARLA_SAFE_ASSERT_INT2_RETURN(cond, v1, v2, ret) if (! (cond)) { carla_safe_assert_int2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); return ret; } + +#define CARLA_SAFE_ASSERT_UINT2_BREAK(cond, v1, v2) if (! (cond)) { carla_safe_assert_uint2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); break; } +#define CARLA_SAFE_ASSERT_UINT2_CONTINUE(cond, v1, v2) if (! (cond)) { carla_safe_assert_uint2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); continue; } +#define CARLA_SAFE_ASSERT_UINT2_RETURN(cond, v1, v2, ret) if (! (cond)) { carla_safe_assert_uint2(#cond, __FILE__, __LINE__, static_cast(v1), static_cast(v2)); return ret; } + /* Define CARLA_SAFE_EXCEPTION */ #define CARLA_SAFE_EXCEPTION(msg) catch(...) { carla_safe_exception(msg, __FILE__, __LINE__); }