From 9d73008dc24b34bbf22caa78ef05e9ec552a82c3 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 5 Aug 2022 19:01:05 +0200 Subject: [PATCH] ARA: Fix ARA debug configuration The ARA SDK's debug functionality is included in the audio_processors module, hence the configuration had to be moved there from juce_plugin_client. --- .../ARA/juce_ARA_Wrapper.cpp | 24 ------- .../ARA/juce_ARA_Wrapper.h | 55 --------------- .../juce_audio_plugin_client.h | 4 -- .../format_types/juce_ARACommon.cpp | 2 - .../format_types/juce_ARAHosting.cpp | 1 - .../juce_audio_processors.h | 1 + .../juce_audio_processors_ara.cpp | 2 + .../utilities/ARA/juce_ARADebug.h | 67 +++++++++++++++++++ .../utilities/ARA/juce_ARA_utils.cpp | 24 +++++++ 9 files changed, 94 insertions(+), 86 deletions(-) delete mode 100644 modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.h create mode 100644 modules/juce_audio_processors/utilities/ARA/juce_ARADebug.h diff --git a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp b/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp index f9aaafe5c9..d1b055e697 100644 --- a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp @@ -41,28 +41,4 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4100) JUCE_END_IGNORE_WARNINGS_MSVC JUCE_END_IGNORE_WARNINGS_GCC_LIKE -namespace juce -{ - -#if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || JUCE_LOG_ASSERTIONS -JUCE_API void JUCE_CALLTYPE handleARAAssertion (const char* file, const int line, const char* diagnosis) noexcept -{ - #if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) - DBG (diagnosis); - #endif - - logAssertion (file, line); - - #if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) - if (juce_isRunningUnderDebugger()) - JUCE_BREAK_IN_DEBUGGER; - JUCE_ANALYZER_NORETURN - #endif -} -#endif - -ARA_SETUP_DEBUG_MESSAGE_PREFIX(JucePlugin_Name); - -} // namespace juce - #endif diff --git a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.h b/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.h deleted file mode 100644 index 766c39c660..0000000000 --- a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2022 - Raw Material Software Limited - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 7 End-User License - Agreement and JUCE Privacy Policy. - - End User License Agreement: www.juce.com/juce-7-licence - Privacy Policy: www.juce.com/juce-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - -#if JucePlugin_Enable_ARA -// Configure ARA debug support prior to including ARA SDK headers -namespace juce -{ - -#if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || JUCE_LOG_ASSERTIONS - -#define ARA_ENABLE_INTERNAL_ASSERTS 1 - -extern JUCE_API void JUCE_CALLTYPE handleARAAssertion (const char* file, const int line, const char* diagnosis) noexcept; - -#if !defined(ARA_HANDLE_ASSERT) -#define ARA_HANDLE_ASSERT(file, line, diagnosis) juce::handleARAAssertion (file, line, diagnosis) -#endif - -#if JUCE_LOG_ASSERTIONS -#define ARA_ENABLE_DEBUG_OUTPUT 1 -#endif - -#else - -#define ARA_ENABLE_INTERNAL_ASSERTS 0 - -#endif // (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || JUCE_LOG_ASSERTIONS - -} // namespace juce - -#endif diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h index 3e4cdbb576..aa17224d0c 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h @@ -128,7 +128,3 @@ #endif #include "utility/juce_CreatePluginFilter.h" - -#if JucePlugin_Enable_ARA - #include "ARA/juce_ARA_Wrapper.h" -#endif diff --git a/modules/juce_audio_processors/format_types/juce_ARACommon.cpp b/modules/juce_audio_processors/format_types/juce_ARACommon.cpp index 67a6dfb960..2deb3f823f 100644 --- a/modules/juce_audio_processors/format_types/juce_ARACommon.cpp +++ b/modules/juce_audio_processors/format_types/juce_ARACommon.cpp @@ -25,8 +25,6 @@ #if (JUCE_PLUGINHOST_ARA && (JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_AU) && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)) -#include - namespace juce { diff --git a/modules/juce_audio_processors/format_types/juce_ARAHosting.cpp b/modules/juce_audio_processors/format_types/juce_ARAHosting.cpp index a5c6c7fbc0..46204dea43 100644 --- a/modules/juce_audio_processors/format_types/juce_ARAHosting.cpp +++ b/modules/juce_audio_processors/format_types/juce_ARAHosting.cpp @@ -26,7 +26,6 @@ #if (JUCE_PLUGINHOST_ARA && (JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_AU) && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX)) #include "juce_ARAHosting.h" -#include #include diff --git a/modules/juce_audio_processors/juce_audio_processors.h b/modules/juce_audio_processors/juce_audio_processors.h index 1664b90aea..dbdc9b9d91 100644 --- a/modules/juce_audio_processors/juce_audio_processors.h +++ b/modules/juce_audio_processors/juce_audio_processors.h @@ -167,6 +167,7 @@ #include "utilities/juce_ParameterAttachments.h" #include "utilities/juce_AudioProcessorValueTreeState.h" #include "utilities/juce_PluginHostType.h" +#include "utilities/ARA/juce_ARADebug.h" #include "utilities/ARA/juce_ARA_utils.h" //============================================================================== diff --git a/modules/juce_audio_processors/juce_audio_processors_ara.cpp b/modules/juce_audio_processors/juce_audio_processors_ara.cpp index 71e11b54be..55ac39e46c 100644 --- a/modules/juce_audio_processors/juce_audio_processors_ara.cpp +++ b/modules/juce_audio_processors/juce_audio_processors_ara.cpp @@ -26,6 +26,8 @@ #include #include +#include "utilities/ARA/juce_ARADebug.h" + /* Having WIN32_LEAN_AND_MEAN defined at the point of including ARADebug.c will produce warnings. To prevent such problems it's easiest to have it in its own translation unit. diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARADebug.h b/modules/juce_audio_processors/utilities/ARA/juce_ARADebug.h new file mode 100644 index 0000000000..1f80a51003 --- /dev/null +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARADebug.h @@ -0,0 +1,67 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#pragma once + +#include + +#ifndef JUCE_API + #define JUCE_API +#endif + +#if (JucePlugin_Enable_ARA || (JUCE_PLUGINHOST_ARA && (JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_AU))) && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) + +namespace juce +{ + +//============================================================================== + #if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || JUCE_LOG_ASSERTIONS + #define ARA_ENABLE_INTERNAL_ASSERTS 1 + #else + #define ARA_ENABLE_INTERNAL_ASSERTS 0 + #endif // (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || JUCE_LOG_ASSERTIONS + +//============================================================================== + #if ARA_ENABLE_INTERNAL_ASSERTS + +JUCE_API void JUCE_CALLTYPE handleARAAssertion (const char* file, const int line, const char* diagnosis) noexcept; + + #if !defined(ARA_HANDLE_ASSERT) + #define ARA_HANDLE_ASSERT(file, line, diagnosis) juce::handleARAAssertion (file, line, diagnosis) + #endif + + #if JUCE_LOG_ASSERTIONS + #define ARA_ENABLE_DEBUG_OUTPUT 1 + #endif + + #endif + +} // namespace juce + +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wgnu-zero-variadic-macro-arguments", "-Wmissing-prototypes") + #include +JUCE_END_IGNORE_WARNINGS_GCC_LIKE + +#endif diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARA_utils.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARA_utils.cpp index ed91402694..9109d198b8 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARA_utils.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARA_utils.cpp @@ -23,10 +23,34 @@ ============================================================================== */ +#if (JucePlugin_Enable_ARA || (JUCE_PLUGINHOST_ARA && (JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_AU))) && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) +namespace juce +{ + #if ARA_ENABLE_INTERNAL_ASSERTS +JUCE_API void JUCE_CALLTYPE handleARAAssertion (const char* file, const int line, const char* diagnosis) noexcept +{ + #if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) + DBG (diagnosis); + #endif + + logAssertion (file, line); + + #if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) + if (juce_isRunningUnderDebugger()) + JUCE_BREAK_IN_DEBUGGER; + JUCE_ANALYZER_NORETURN + #endif +} + #endif +} +#endif + #if JucePlugin_Enable_ARA #include "juce_ARADocumentControllerCommon.cpp" #include "juce_ARADocumentController.cpp" #include "juce_ARAModelObjects.cpp" #include "juce_ARAPlugInInstanceRoles.cpp" #include "juce_AudioProcessor_ARAExtensions.cpp" + +ARA_SETUP_DEBUG_MESSAGE_PREFIX(JucePlugin_Name); #endif