git subrepo clone --branch=sono6good https://github.com/essej/JUCE.git deps/juce

subrepo:
  subdir:   "deps/juce"
  merged:   "b13f9084e"
upstream:
  origin:   "https://github.com/essej/JUCE.git"
  branch:   "sono6good"
  commit:   "b13f9084e"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
This commit is contained in:
essej
2022-04-18 17:51:22 -04:00
parent 63e175fee6
commit 25bd5d8adb
3210 changed files with 1045392 additions and 0 deletions

View File

@ -0,0 +1,103 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
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
/*
This file provides flags for compiler features that aren't supported on all platforms.
*/
//==============================================================================
// GCC
#if JUCE_GCC
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 500
#error "JUCE requires GCC 5.0 or later"
#endif
#ifndef JUCE_EXCEPTIONS_DISABLED
#if ! __EXCEPTIONS
#define JUCE_EXCEPTIONS_DISABLED 1
#endif
#endif
#define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L)
#define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L)
#endif
//==============================================================================
// Clang
#if JUCE_CLANG
#if (__clang_major__ < 3) || (__clang_major__ == 3 && __clang_minor__ < 4)
#error "JUCE requires Clang 3.4 or later"
#endif
#ifndef JUCE_COMPILER_SUPPORTS_ARC
#define JUCE_COMPILER_SUPPORTS_ARC 1
#endif
#ifndef JUCE_EXCEPTIONS_DISABLED
#if ! __has_feature (cxx_exceptions)
#define JUCE_EXCEPTIONS_DISABLED 1
#endif
#endif
#define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L)
#define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L)
#endif
//==============================================================================
// MSVC
#if JUCE_MSVC
#if _MSC_FULL_VER < 190024210 // VS2015
#error "JUCE requires Visual Studio 2015 Update 3 or later"
#endif
#ifndef JUCE_EXCEPTIONS_DISABLED
#if ! _CPPUNWIND
#define JUCE_EXCEPTIONS_DISABLED 1
#endif
#endif
#define JUCE_CXX14_IS_AVAILABLE (_MSVC_LANG >= 201402L)
#define JUCE_CXX17_IS_AVAILABLE (_MSVC_LANG >= 201703L)
#endif
//==============================================================================
#if ! JUCE_CXX14_IS_AVAILABLE
#error "JUCE requires C++14 or later"
#endif
//==============================================================================
#ifndef DOXYGEN
// These are old flags that are now supported on all compatible build targets
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
#define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_DELETED_FUNCTION = delete
#define JUCE_CONSTEXPR constexpr
#endif

View File

@ -0,0 +1,221 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
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 "juce_TargetPlatform.h"
/** Return the Nth argument. By passing a variadic pack followed by N other
parameters, we can select one of those N parameter based on the length of
the parameter pack.
*/
#define JUCE_NTH_ARG_(_00, _01, _02, _03, _04, _05, _06, _07, _08, _09, \
_10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \
_20, _21, _22, _23, _24, _25, _26, _27, _28, _29, \
_30, _31, _32, _33, _34, _35, _36, _37, _38, _39, N, ...)\
N
#define JUCE_EACH_00_(FN)
#define JUCE_EACH_01_(FN, X) FN(X)
#define JUCE_EACH_02_(FN, X, ...) FN(X) JUCE_EACH_01_(FN, __VA_ARGS__)
#define JUCE_EACH_03_(FN, X, ...) FN(X) JUCE_EACH_02_(FN, __VA_ARGS__)
#define JUCE_EACH_04_(FN, X, ...) FN(X) JUCE_EACH_03_(FN, __VA_ARGS__)
#define JUCE_EACH_05_(FN, X, ...) FN(X) JUCE_EACH_04_(FN, __VA_ARGS__)
#define JUCE_EACH_06_(FN, X, ...) FN(X) JUCE_EACH_05_(FN, __VA_ARGS__)
#define JUCE_EACH_07_(FN, X, ...) FN(X) JUCE_EACH_06_(FN, __VA_ARGS__)
#define JUCE_EACH_08_(FN, X, ...) FN(X) JUCE_EACH_07_(FN, __VA_ARGS__)
#define JUCE_EACH_09_(FN, X, ...) FN(X) JUCE_EACH_08_(FN, __VA_ARGS__)
#define JUCE_EACH_10_(FN, X, ...) FN(X) JUCE_EACH_09_(FN, __VA_ARGS__)
#define JUCE_EACH_11_(FN, X, ...) FN(X) JUCE_EACH_10_(FN, __VA_ARGS__)
#define JUCE_EACH_12_(FN, X, ...) FN(X) JUCE_EACH_11_(FN, __VA_ARGS__)
#define JUCE_EACH_13_(FN, X, ...) FN(X) JUCE_EACH_12_(FN, __VA_ARGS__)
#define JUCE_EACH_14_(FN, X, ...) FN(X) JUCE_EACH_13_(FN, __VA_ARGS__)
#define JUCE_EACH_15_(FN, X, ...) FN(X) JUCE_EACH_14_(FN, __VA_ARGS__)
#define JUCE_EACH_16_(FN, X, ...) FN(X) JUCE_EACH_15_(FN, __VA_ARGS__)
#define JUCE_EACH_17_(FN, X, ...) FN(X) JUCE_EACH_16_(FN, __VA_ARGS__)
#define JUCE_EACH_18_(FN, X, ...) FN(X) JUCE_EACH_17_(FN, __VA_ARGS__)
#define JUCE_EACH_19_(FN, X, ...) FN(X) JUCE_EACH_18_(FN, __VA_ARGS__)
#define JUCE_EACH_20_(FN, X, ...) FN(X) JUCE_EACH_19_(FN, __VA_ARGS__)
#define JUCE_EACH_21_(FN, X, ...) FN(X) JUCE_EACH_20_(FN, __VA_ARGS__)
#define JUCE_EACH_22_(FN, X, ...) FN(X) JUCE_EACH_21_(FN, __VA_ARGS__)
#define JUCE_EACH_23_(FN, X, ...) FN(X) JUCE_EACH_22_(FN, __VA_ARGS__)
#define JUCE_EACH_24_(FN, X, ...) FN(X) JUCE_EACH_23_(FN, __VA_ARGS__)
#define JUCE_EACH_25_(FN, X, ...) FN(X) JUCE_EACH_24_(FN, __VA_ARGS__)
#define JUCE_EACH_26_(FN, X, ...) FN(X) JUCE_EACH_25_(FN, __VA_ARGS__)
#define JUCE_EACH_27_(FN, X, ...) FN(X) JUCE_EACH_26_(FN, __VA_ARGS__)
#define JUCE_EACH_28_(FN, X, ...) FN(X) JUCE_EACH_27_(FN, __VA_ARGS__)
#define JUCE_EACH_29_(FN, X, ...) FN(X) JUCE_EACH_28_(FN, __VA_ARGS__)
#define JUCE_EACH_30_(FN, X, ...) FN(X) JUCE_EACH_29_(FN, __VA_ARGS__)
#define JUCE_EACH_31_(FN, X, ...) FN(X) JUCE_EACH_30_(FN, __VA_ARGS__)
#define JUCE_EACH_32_(FN, X, ...) FN(X) JUCE_EACH_31_(FN, __VA_ARGS__)
#define JUCE_EACH_33_(FN, X, ...) FN(X) JUCE_EACH_32_(FN, __VA_ARGS__)
#define JUCE_EACH_34_(FN, X, ...) FN(X) JUCE_EACH_33_(FN, __VA_ARGS__)
#define JUCE_EACH_35_(FN, X, ...) FN(X) JUCE_EACH_34_(FN, __VA_ARGS__)
#define JUCE_EACH_36_(FN, X, ...) FN(X) JUCE_EACH_35_(FN, __VA_ARGS__)
#define JUCE_EACH_37_(FN, X, ...) FN(X) JUCE_EACH_36_(FN, __VA_ARGS__)
#define JUCE_EACH_38_(FN, X, ...) FN(X) JUCE_EACH_37_(FN, __VA_ARGS__)
#define JUCE_EACH_39_(FN, X, ...) FN(X) JUCE_EACH_38_(FN, __VA_ARGS__)
/** Apply the macro FN to each of the other arguments. */
#define JUCE_EACH(FN, ...) \
JUCE_NTH_ARG_(, __VA_ARGS__, \
JUCE_EACH_39_, \
JUCE_EACH_38_, \
JUCE_EACH_37_, \
JUCE_EACH_36_, \
JUCE_EACH_35_, \
JUCE_EACH_34_, \
JUCE_EACH_33_, \
JUCE_EACH_32_, \
JUCE_EACH_31_, \
JUCE_EACH_30_, \
JUCE_EACH_29_, \
JUCE_EACH_28_, \
JUCE_EACH_27_, \
JUCE_EACH_26_, \
JUCE_EACH_25_, \
JUCE_EACH_24_, \
JUCE_EACH_23_, \
JUCE_EACH_22_, \
JUCE_EACH_21_, \
JUCE_EACH_20_, \
JUCE_EACH_19_, \
JUCE_EACH_18_, \
JUCE_EACH_17_, \
JUCE_EACH_16_, \
JUCE_EACH_15_, \
JUCE_EACH_14_, \
JUCE_EACH_13_, \
JUCE_EACH_12_, \
JUCE_EACH_11_, \
JUCE_EACH_10_, \
JUCE_EACH_09_, \
JUCE_EACH_08_, \
JUCE_EACH_07_, \
JUCE_EACH_06_, \
JUCE_EACH_05_, \
JUCE_EACH_04_, \
JUCE_EACH_03_, \
JUCE_EACH_02_, \
JUCE_EACH_01_, \
JUCE_EACH_00_) \
(FN, __VA_ARGS__)
/** Concatenate two tokens to form a new token. */
#define JUCE_CONCAT_(a, b) a##b
#define JUCE_CONCAT(a, b) JUCE_CONCAT_(a, b)
/** Quote the argument, turning it into a string. */
#define JUCE_TO_STRING(x) #x
#if JUCE_CLANG || JUCE_GCC || JUCE_MINGW
#define JUCE_IGNORE_GCC_IMPL_(compiler, warning)
#define JUCE_IGNORE_GCC_IMPL_0(compiler, warning)
#define JUCE_IGNORE_GCC_IMPL_1(compiler, warning) \
_Pragma(JUCE_TO_STRING(compiler diagnostic ignored warning))
/** If 'warning' is recognised by this compiler, ignore it. */
#if defined (__has_warning)
#define JUCE_IGNORE_GCC_LIKE(compiler, warning) \
JUCE_CONCAT(JUCE_IGNORE_GCC_IMPL_, __has_warning(warning))(compiler, warning)
#else
#define JUCE_IGNORE_GCC_LIKE(compiler, warning) \
JUCE_IGNORE_GCC_IMPL_1(compiler, warning)
#endif
/** Ignore GCC/clang-specific warnings. */
#define JUCE_IGNORE_GCC(warning) JUCE_IGNORE_GCC_LIKE(GCC, warning)
#define JUCE_IGNORE_clang(warning) JUCE_IGNORE_GCC_LIKE(clang, warning)
#define JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, ...) \
_Pragma(JUCE_TO_STRING(compiler diagnostic push)) \
JUCE_EACH(JUCE_CONCAT(JUCE_IGNORE_, compiler), __VA_ARGS__)
/** Push a new warning scope, and then ignore each warning for either clang
or gcc. If the compiler doesn't support __has_warning, we add -Wpragmas
as the first disabled warning because otherwise we might get complaints
about unknown warning options.
*/
#if defined (__has_warning)
#define JUCE_PUSH_WARNINGS_GCC_LIKE(compiler, ...) \
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, __VA_ARGS__)
#else
#define JUCE_PUSH_WARNINGS_GCC_LIKE(compiler, ...) \
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, "-Wpragmas", __VA_ARGS__)
#endif
/** Pop the current warning scope. */
#define JUCE_POP_WARNINGS_GCC_LIKE(compiler) \
_Pragma(JUCE_TO_STRING(compiler diagnostic pop))
/** Push/pop warnings on compilers with gcc-like warning flags.
These macros expand to nothing on other compilers (like MSVC).
*/
#if JUCE_CLANG
#define JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE(...) JUCE_PUSH_WARNINGS_GCC_LIKE(clang, __VA_ARGS__)
#define JUCE_END_IGNORE_WARNINGS_GCC_LIKE JUCE_POP_WARNINGS_GCC_LIKE(clang)
#else
#define JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE(...) JUCE_PUSH_WARNINGS_GCC_LIKE(GCC, __VA_ARGS__)
#define JUCE_END_IGNORE_WARNINGS_GCC_LIKE JUCE_POP_WARNINGS_GCC_LIKE(GCC)
#endif
#else
#define JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE(...)
#define JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif
/** Push/pop warnings on MSVC. These macros expand to nothing on other
compilers (like clang and gcc).
*/
#if JUCE_MSVC
#define JUCE_IGNORE_MSVC(warnings) __pragma(warning(disable:warnings))
#define JUCE_BEGIN_IGNORE_WARNINGS_LEVEL_MSVC(level, warnings) \
__pragma(warning(push, level)) JUCE_IGNORE_MSVC(warnings)
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings) \
__pragma(warning(push)) JUCE_IGNORE_MSVC(warnings)
#define JUCE_END_IGNORE_WARNINGS_MSVC __pragma(warning(pop))
#else
#define JUCE_IGNORE_MSVC(warnings)
#define JUCE_BEGIN_IGNORE_WARNINGS_LEVEL_MSVC(level, warnings)
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings)
#define JUCE_END_IGNORE_WARNINGS_MSVC
#endif
#if JUCE_MAC || JUCE_IOS
#define JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION 10
#else
#define JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION 5
#endif
/** Disable sanitizers for a range of functions.
This functionality doesn't seem to exist on GCC yet, so at the moment this only works for clang.
*/
#if JUCE_CLANG && __clang_major__ >= JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION
#define JUCE_BEGIN_NO_SANITIZE(warnings) \
_Pragma(JUCE_TO_STRING(clang attribute push(__attribute__((no_sanitize(warnings))), apply_to=function)))
#define JUCE_END_NO_SANITIZE _Pragma(JUCE_TO_STRING(clang attribute pop))
#else
#define JUCE_BEGIN_NO_SANITIZE(warnings)
#define JUCE_END_NO_SANITIZE
#endif
#undef JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION

View File

@ -0,0 +1,325 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
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
namespace juce
{
//==============================================================================
/* This file defines miscellaneous macros for debugging, assertions, etc.
*/
//==============================================================================
#ifdef JUCE_FORCE_DEBUG
#undef JUCE_DEBUG
#if JUCE_FORCE_DEBUG
#define JUCE_DEBUG 1
#endif
#endif
/** This macro defines the C calling convention used as the standard for JUCE calls. */
#if JUCE_WINDOWS
#define JUCE_CALLTYPE __stdcall
#define JUCE_CDECL __cdecl
#else
#define JUCE_CALLTYPE
#define JUCE_CDECL
#endif
//==============================================================================
// Debugging and assertion macros
#ifndef JUCE_LOG_CURRENT_ASSERTION
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
#define JUCE_LOG_CURRENT_ASSERTION juce::logAssertion (__FILE__, __LINE__);
#else
#define JUCE_LOG_CURRENT_ASSERTION
#endif
#endif
//==============================================================================
#if JUCE_IOS || JUCE_LINUX || JUCE_BSD
/** This will try to break into the debugger if the app is currently being debugged.
If called by an app that's not being debugged, the behaviour isn't defined - it may
crash or not, depending on the platform.
@see jassert()
*/
#define JUCE_BREAK_IN_DEBUGGER { ::kill (0, SIGTRAP); }
#elif JUCE_MSVC
#ifndef __INTEL_COMPILER
#pragma intrinsic (__debugbreak)
#endif
#define JUCE_BREAK_IN_DEBUGGER { __debugbreak(); }
#elif JUCE_INTEL && (JUCE_GCC || JUCE_MAC)
#if JUCE_NO_INLINE_ASM
#define JUCE_BREAK_IN_DEBUGGER { }
#else
#define JUCE_BREAK_IN_DEBUGGER { asm ("int $3"); }
#endif
#elif JUCE_ARM && JUCE_MAC
#define JUCE_BREAK_IN_DEBUGGER { __builtin_debugtrap(); }
#elif JUCE_ANDROID
#define JUCE_BREAK_IN_DEBUGGER { __builtin_trap(); }
#else
#define JUCE_BREAK_IN_DEBUGGER { __asm int 3 }
#endif
#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
#if __has_feature (attribute_analyzer_noreturn)
inline void __attribute__((analyzer_noreturn)) juce_assert_noreturn() {}
#define JUCE_ANALYZER_NORETURN juce::juce_assert_noreturn();
#endif
#endif
#ifndef JUCE_ANALYZER_NORETURN
#define JUCE_ANALYZER_NORETURN
#endif
/** Used to silence Wimplicit-fallthrough on Clang and GCC where available
as there are a few places in the codebase where we need to do this
deliberately and want to ignore the warning.
*/
#if JUCE_CLANG
#if __has_cpp_attribute(clang::fallthrough)
#define JUCE_FALLTHROUGH [[clang::fallthrough]];
#else
#define JUCE_FALLTHROUGH
#endif
#elif JUCE_GCC
#if __GNUC__ >= 7
#define JUCE_FALLTHROUGH [[gnu::fallthrough]];
#else
#define JUCE_FALLTHROUGH
#endif
#else
#define JUCE_FALLTHROUGH
#endif
//==============================================================================
#if JUCE_MSVC && ! defined (DOXYGEN)
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { x } while (false) \
__pragma(warning(pop))
#else
/** This is the good old C++ trick for creating a macro that forces the user to put
a semicolon after it when they use it.
*/
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
#endif
//==============================================================================
#if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || DOXYGEN
/** Writes a string to the standard error stream.
Note that as well as a single string, you can use this to write multiple items
as a stream, e.g.
@code
DBG ("foo = " << foo << "bar = " << bar);
@endcode
The macro is only enabled in a debug build, so be careful not to use it with expressions
that have important side-effects!
@see Logger::outputDebugString
*/
#define DBG(textToWrite) JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)
//==============================================================================
/** This will always cause an assertion failure.
It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled for your build).
@see jassert
*/
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
//==============================================================================
/** Platform-independent assertion macro.
This macro gets turned into a no-op when you're building with debugging turned off, so be
careful that the expression you pass to it doesn't perform any actions that are vital for the
correct behaviour of your program!
@see jassertfalse
*/
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
/** Platform-independent assertion macro which suppresses ignored-variable
warnings in all build modes. You should probably use a plain jassert()
by default, and only replace it with jassertquiet() once you've
convinced yourself that any unused-variable warnings emitted by the
compiler are harmless.
*/
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
#else
//==============================================================================
// If debugging is disabled, these dummy debug and assertion macros are used..
#define DBG(textToWrite)
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION)
#if JUCE_LOG_ASSERTIONS
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
#else
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( ; )
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (false) (void) (expression);)
#endif
#endif
//==============================================================================
#ifndef DOXYGEN
#define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
#define JUCE_STRINGIFY_MACRO_HELPER(a) #a
#endif
/** A good old-fashioned C macro concatenation helper.
This combines two items (which may themselves be macros) into a single string,
avoiding the pitfalls of the ## macro operator.
*/
#define JUCE_JOIN_MACRO(item1, item2) JUCE_JOIN_MACRO_HELPER (item1, item2)
/** A handy C macro for stringifying any symbol, rather than just a macro parameter. */
#define JUCE_STRINGIFY(item) JUCE_STRINGIFY_MACRO_HELPER (item)
//==============================================================================
/** This is a shorthand macro for deleting a class's copy constructor and
copy assignment operator.
For example, instead of
@code
class MyClass
{
etc..
private:
MyClass (const MyClass&);
MyClass& operator= (const MyClass&);
};@endcode
..you can just write:
@code
class MyClass
{
etc..
private:
JUCE_DECLARE_NON_COPYABLE (MyClass)
};@endcode
*/
#define JUCE_DECLARE_NON_COPYABLE(className) \
className (const className&) = delete;\
className& operator= (const className&) = delete;
/** This is a shorthand macro for deleting a class's move constructor and
move assignment operator.
*/
#define JUCE_DECLARE_NON_MOVEABLE(className) \
className (className&&) = delete;\
className& operator= (className&&) = delete;
/** This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and
JUCE_LEAK_DETECTOR macro for a class.
*/
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \
JUCE_DECLARE_NON_COPYABLE(className) \
JUCE_LEAK_DETECTOR(className)
/** This macro can be added to class definitions to disable the use of new/delete to
allocate the object on the heap, forcing it to only be used as a stack or member variable.
*/
#define JUCE_PREVENT_HEAP_ALLOCATION \
private: \
static void* operator new (size_t) = delete; \
static void operator delete (void*) = delete;
//==============================================================================
#if JUCE_MSVC && ! defined (DOXYGEN)
#define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess)
#define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message))
#else
#ifndef DOXYGEN
#define JUCE_WARNING_HELPER(mess) message(#mess)
#endif
/** This macro allows you to emit a custom compiler warning message.
Very handy for marking bits of code as "to-do" items, or for shaming
code written by your co-workers in a way that's hard to ignore.
GCC and Clang provide the \#warning directive, but MSVC doesn't, so this macro
is a cross-compiler way to get the same functionality as \#warning.
*/
#define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
#endif
//==============================================================================
#if JUCE_DEBUG || DOXYGEN
/** A platform-independent way of forcing an inline function.
Use the syntax: @code
forcedinline void myfunction (int x)
@endcode
*/
#define forcedinline inline
#else
#if JUCE_MSVC
#define forcedinline __forceinline
#else
#define forcedinline inline __attribute__((always_inline))
#endif
#endif
#if JUCE_MSVC || DOXYGEN
/** This can be placed before a stack or member variable declaration to tell the compiler
to align it to the specified number of bytes. */
#define JUCE_ALIGN(bytes) __declspec (align (bytes))
#else
#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
#endif
//==============================================================================
#if JUCE_ANDROID && ! defined (DOXYGEN)
#define JUCE_MODAL_LOOPS_PERMITTED 0
#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
/** Some operating environments don't provide a modal loop mechanism, so this flag can be
used to disable any functions that try to run a modal loop. */
#define JUCE_MODAL_LOOPS_PERMITTED 0
#endif
//==============================================================================
#if JUCE_GCC || JUCE_CLANG
#define JUCE_PACKED __attribute__((packed))
#elif ! defined (DOXYGEN)
#define JUCE_PACKED
#endif
//==============================================================================
#if JUCE_GCC || DOXYGEN
/** This can be appended to a function declaration to tell gcc to disable associative
math optimisations which break some floating point algorithms. */
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS __attribute__((__optimize__("no-associative-math")))
#else
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS
#endif
} // namespace juce

View File

@ -0,0 +1,158 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
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
//==============================================================================
/** Current JUCE version number.
See also SystemStats::getJUCEVersion() for a string version.
*/
#define JUCE_MAJOR_VERSION 6
#define JUCE_MINOR_VERSION 1
#define JUCE_BUILDNUMBER 2
/** Current JUCE version number.
Bits 16 to 32 = major version.
Bits 8 to 16 = minor version.
Bits 0 to 8 = point release.
See also SystemStats::getJUCEVersion() for a string version.
*/
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
//==============================================================================
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <condition_variable>
#include <cstddef>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <unordered_map>
#include <memory>
#include <mutex>
#include <numeric>
#include <queue>
#include <sstream>
#include <typeindex>
#include <unordered_set>
#include <vector>
//==============================================================================
#include "juce_CompilerSupport.h"
#include "juce_CompilerWarnings.h"
#include "juce_PlatformDefs.h"
//==============================================================================
// Now we'll include some common OS headers..
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4245 4100)
#if JUCE_MSVC
#include <intrin.h>
#endif
#if JUCE_MAC || JUCE_IOS
#include <libkern/OSAtomic.h>
#include <xlocale.h>
#include <signal.h>
#endif
#if JUCE_LINUX || JUCE_BSD
#include <cstring>
#include <signal.h>
#if __INTEL_COMPILER
#if __ia64__
#include <ia64intrin.h>
#else
#include <ia32intrin.h>
#endif
#endif
#endif
#if JUCE_MSVC && JUCE_DEBUG
#include <crtdbg.h>
#endif
JUCE_END_IGNORE_WARNINGS_MSVC
#if JUCE_MINGW
#include <cstring>
#include <sys/types.h>
#endif
#if JUCE_ANDROID
#include <cstring>
#include <byteswap.h>
#endif
// undef symbols that are sometimes set by misguided 3rd-party headers..
#undef TYPE_BOOL
#undef max
#undef min
#undef major
#undef minor
#undef KeyPress
//==============================================================================
// DLL building settings on Windows
#if JUCE_MSVC
#ifdef JUCE_DLL_BUILD
#define JUCE_API __declspec (dllexport)
#pragma warning (disable: 4251)
#elif defined (JUCE_DLL)
#define JUCE_API __declspec (dllimport)
#pragma warning (disable: 4251)
#endif
#ifdef __INTEL_COMPILER
#pragma warning (disable: 1125) // (virtual override warning)
#endif
#elif defined (JUCE_DLL) || defined (JUCE_DLL_BUILD)
#define JUCE_API __attribute__ ((visibility("default")))
#endif
//==============================================================================
#ifndef JUCE_API
#define JUCE_API /**< This macro is added to all JUCE public class declarations. */
#endif
#if JUCE_MSVC && JUCE_DLL_BUILD
#define JUCE_PUBLIC_IN_DLL_BUILD(declaration) public: declaration; private:
#else
#define JUCE_PUBLIC_IN_DLL_BUILD(declaration) declaration;
#endif
/** This macro is added to all JUCE public function declarations. */
#define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
#ifndef DOXYGEN
#define JUCE_NAMESPACE juce // This old macro is deprecated: you should just use the juce namespace directly.
#endif

View File

@ -0,0 +1,256 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
String SystemStats::getJUCEVersion()
{
// Some basic tests, to keep an eye on things and make sure these types work ok
// on all platforms. Let me know if any of these assertions fail on your system!
static_assert (sizeof (pointer_sized_int) == sizeof (void*), "Basic sanity test failed: please report!");
static_assert (sizeof (int8) == 1, "Basic sanity test failed: please report!");
static_assert (sizeof (uint8) == 1, "Basic sanity test failed: please report!");
static_assert (sizeof (int16) == 2, "Basic sanity test failed: please report!");
static_assert (sizeof (uint16) == 2, "Basic sanity test failed: please report!");
static_assert (sizeof (int32) == 4, "Basic sanity test failed: please report!");
static_assert (sizeof (uint32) == 4, "Basic sanity test failed: please report!");
static_assert (sizeof (int64) == 8, "Basic sanity test failed: please report!");
static_assert (sizeof (uint64) == 8, "Basic sanity test failed: please report!");
return "JUCE v" JUCE_STRINGIFY(JUCE_MAJOR_VERSION)
"." JUCE_STRINGIFY(JUCE_MINOR_VERSION)
"." JUCE_STRINGIFY(JUCE_BUILDNUMBER);
}
#if JUCE_ANDROID && ! defined (JUCE_DISABLE_JUCE_VERSION_PRINTING)
#define JUCE_DISABLE_JUCE_VERSION_PRINTING 1
#endif
#if JUCE_DEBUG && ! JUCE_DISABLE_JUCE_VERSION_PRINTING
struct JuceVersionPrinter
{
JuceVersionPrinter()
{
DBG (SystemStats::getJUCEVersion());
}
};
static JuceVersionPrinter juceVersionPrinter;
#endif
StringArray SystemStats::getDeviceIdentifiers()
{
StringArray ids;
#if JUCE_WINDOWS
File f (File::getSpecialLocation (File::windowsSystemDirectory));
#else
File f ("~");
#endif
if (auto num = f.getFileIdentifier())
{
ids.add (String::toHexString ((int64) num));
}
else
{
for (auto& address : MACAddress::getAllAddresses())
ids.add (address.toString());
}
jassert (! ids.isEmpty()); // Failed to create any IDs!
return ids;
}
//==============================================================================
struct CPUInformation
{
CPUInformation() noexcept { initialise(); }
void initialise() noexcept;
int numLogicalCPUs = 0, numPhysicalCPUs = 0;
bool hasMMX = false, hasSSE = false, hasSSE2 = false, hasSSE3 = false,
has3DNow = false, hasFMA3 = false, hasFMA4 = false, hasSSSE3 = false,
hasSSE41 = false, hasSSE42 = false, hasAVX = false, hasAVX2 = false,
hasAVX512F = false, hasAVX512BW = false, hasAVX512CD = false,
hasAVX512DQ = false, hasAVX512ER = false, hasAVX512IFMA = false,
hasAVX512PF = false, hasAVX512VBMI = false, hasAVX512VL = false,
hasAVX512VPOPCNTDQ = false,
hasNeon = false;
};
static const CPUInformation& getCPUInformation() noexcept
{
static CPUInformation info;
return info;
}
int SystemStats::getNumCpus() noexcept { return getCPUInformation().numLogicalCPUs; }
int SystemStats::getNumPhysicalCpus() noexcept { return getCPUInformation().numPhysicalCPUs; }
bool SystemStats::hasMMX() noexcept { return getCPUInformation().hasMMX; }
bool SystemStats::has3DNow() noexcept { return getCPUInformation().has3DNow; }
bool SystemStats::hasFMA3() noexcept { return getCPUInformation().hasFMA3; }
bool SystemStats::hasFMA4() noexcept { return getCPUInformation().hasFMA4; }
bool SystemStats::hasSSE() noexcept { return getCPUInformation().hasSSE; }
bool SystemStats::hasSSE2() noexcept { return getCPUInformation().hasSSE2; }
bool SystemStats::hasSSE3() noexcept { return getCPUInformation().hasSSE3; }
bool SystemStats::hasSSSE3() noexcept { return getCPUInformation().hasSSSE3; }
bool SystemStats::hasSSE41() noexcept { return getCPUInformation().hasSSE41; }
bool SystemStats::hasSSE42() noexcept { return getCPUInformation().hasSSE42; }
bool SystemStats::hasAVX() noexcept { return getCPUInformation().hasAVX; }
bool SystemStats::hasAVX2() noexcept { return getCPUInformation().hasAVX2; }
bool SystemStats::hasAVX512F() noexcept { return getCPUInformation().hasAVX512F; }
bool SystemStats::hasAVX512BW() noexcept { return getCPUInformation().hasAVX512BW; }
bool SystemStats::hasAVX512CD() noexcept { return getCPUInformation().hasAVX512CD; }
bool SystemStats::hasAVX512DQ() noexcept { return getCPUInformation().hasAVX512DQ; }
bool SystemStats::hasAVX512ER() noexcept { return getCPUInformation().hasAVX512ER; }
bool SystemStats::hasAVX512IFMA() noexcept { return getCPUInformation().hasAVX512IFMA; }
bool SystemStats::hasAVX512PF() noexcept { return getCPUInformation().hasAVX512PF; }
bool SystemStats::hasAVX512VBMI() noexcept { return getCPUInformation().hasAVX512VBMI; }
bool SystemStats::hasAVX512VL() noexcept { return getCPUInformation().hasAVX512VL; }
bool SystemStats::hasAVX512VPOPCNTDQ() noexcept { return getCPUInformation().hasAVX512VPOPCNTDQ; }
bool SystemStats::hasNeon() noexcept { return getCPUInformation().hasNeon; }
//==============================================================================
String SystemStats::getStackBacktrace()
{
String result;
#if JUCE_ANDROID || JUCE_MINGW || JUCE_WASM
jassertfalse; // sorry, not implemented yet!
#elif JUCE_WINDOWS
HANDLE process = GetCurrentProcess();
SymInitialize (process, nullptr, TRUE);
void* stack[128];
int frames = (int) CaptureStackBackTrace (0, numElementsInArray (stack), stack, nullptr);
HeapBlock<SYMBOL_INFO> symbol;
symbol.calloc (sizeof (SYMBOL_INFO) + 256, 1);
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
for (int i = 0; i < frames; ++i)
{
DWORD64 displacement = 0;
if (SymFromAddr (process, (DWORD64) stack[i], &displacement, symbol))
{
result << i << ": ";
IMAGEHLP_MODULE64 moduleInfo;
zerostruct (moduleInfo);
moduleInfo.SizeOfStruct = sizeof (moduleInfo);
if (::SymGetModuleInfo64 (process, symbol->ModBase, &moduleInfo))
result << moduleInfo.ModuleName << ": ";
result << symbol->Name << " + 0x" << String::toHexString ((int64) displacement) << newLine;
}
}
#else
void* stack[128];
auto frames = backtrace (stack, numElementsInArray (stack));
char** frameStrings = backtrace_symbols (stack, frames);
for (int i = 0; i < frames; ++i)
result << frameStrings[i] << newLine;
::free (frameStrings);
#endif
return result;
}
//==============================================================================
#if ! JUCE_WASM
static SystemStats::CrashHandlerFunction globalCrashHandler = nullptr;
#if JUCE_WINDOWS
static LONG WINAPI handleCrash (LPEXCEPTION_POINTERS ep)
{
globalCrashHandler (ep);
return EXCEPTION_EXECUTE_HANDLER;
}
#else
static void handleCrash (int signum)
{
globalCrashHandler ((void*) (pointer_sized_int) signum);
::kill (getpid(), SIGKILL);
}
int juce_siginterrupt (int sig, int flag);
#endif
void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
{
jassert (handler != nullptr); // This must be a valid function.
globalCrashHandler = handler;
#if JUCE_WINDOWS
SetUnhandledExceptionFilter (handleCrash);
#else
const int signals[] = { SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGSYS };
for (int i = 0; i < numElementsInArray (signals); ++i)
{
::signal (signals[i], handleCrash);
juce_siginterrupt (signals[i], 1);
}
#endif
}
#endif
bool SystemStats::isRunningInAppExtensionSandbox() noexcept
{
#if JUCE_MAC || JUCE_IOS
static bool firstQuery = true;
static bool isRunningInAppSandbox = false;
if (firstQuery)
{
firstQuery = false;
File bundle = File::getSpecialLocation (File::invokedExecutableFile).getParentDirectory();
#if JUCE_MAC
bundle = bundle.getParentDirectory().getParentDirectory();
#endif
if (bundle.isDirectory())
isRunningInAppSandbox = (bundle.getFileExtension() == ".appex");
}
return isRunningInAppSandbox;
#else
return false;
#endif
}
} // namespace juce

View File

@ -0,0 +1,247 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
/**
Contains methods for finding out about the current hardware and OS configuration.
@tags{Core}
*/
class JUCE_API SystemStats final
{
public:
//==============================================================================
/** Returns the current version of JUCE,
See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros.
*/
static String getJUCEVersion();
//==============================================================================
/** The set of possible results of the getOperatingSystemType() method. */
enum OperatingSystemType
{
UnknownOS = 0,
MacOSX = 0x0100, /**< To test whether any version of OSX is running,
you can use the expression ((getOperatingSystemType() & MacOSX) != 0). */
Windows = 0x0200, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
Linux = 0x0400,
Android = 0x0800,
iOS = 0x1000,
WASM = 0x2000,
MacOSX_10_7 = MacOSX | 7,
MacOSX_10_8 = MacOSX | 8,
MacOSX_10_9 = MacOSX | 9,
MacOSX_10_10 = MacOSX | 10,
MacOSX_10_11 = MacOSX | 11,
MacOSX_10_12 = MacOSX | 12,
MacOSX_10_13 = MacOSX | 13,
MacOSX_10_14 = MacOSX | 14,
MacOSX_10_15 = MacOSX | 15,
MacOS_11 = MacOSX | 16,
MacOS_12 = MacOSX | 17,
Win2000 = Windows | 1,
WinXP = Windows | 2,
WinVista = Windows | 3,
Windows7 = Windows | 4,
Windows8_0 = Windows | 5,
Windows8_1 = Windows | 6,
Windows10 = Windows | 7
};
/** Returns the type of operating system we're running on.
@returns one of the values from the OperatingSystemType enum.
@see getOperatingSystemName
*/
static OperatingSystemType getOperatingSystemType();
/** Returns the name of the type of operating system we're running on.
@returns a string describing the OS type.
@see getOperatingSystemType
*/
static String getOperatingSystemName();
/** Returns true if the OS is 64-bit, or false for a 32-bit OS. */
static bool isOperatingSystem64Bit();
/** Returns an environment variable.
If the named value isn't set, this will return the defaultValue string instead.
*/
static String getEnvironmentVariable (const String& name, const String& defaultValue);
//==============================================================================
/** Returns the current user's name, if available.
@see getFullUserName()
*/
static String getLogonName();
/** Returns the current user's full name, if available.
On some OSes, this may just return the same value as getLogonName().
@see getLogonName()
*/
static String getFullUserName();
/** Returns the host-name of the computer. */
static String getComputerName();
/** Returns the language of the user's locale.
The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2)
*/
static String getUserLanguage();
/** Returns the region of the user's locale.
The return value is a 2 letter country code (ISO 3166-1 alpha-2).
*/
static String getUserRegion();
/** Returns the user's display language.
The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2).
Note that depending on the OS and region, this may also be followed by a dash
and a sub-region code, e.g "en-GB"
*/
static String getDisplayLanguage();
/** This will attempt to return some kind of string describing the device.
If no description is available, it'll just return an empty string. You may
want to use this for things like determining the type of phone/iPad, etc.
*/
static String getDeviceDescription();
/** This will attempt to return the manufacturer of the device.
If no description is available, it'll just return an empty string.
*/
static String getDeviceManufacturer();
/** This method calculates some IDs to uniquely identify the device.
The first choice for an ID is a filesystem ID for the user's home folder or
windows directory. If that fails then this function returns the MAC addresses.
*/
static StringArray getDeviceIdentifiers();
//==============================================================================
// CPU and memory information..
/** Returns the number of logical CPU cores. */
static int getNumCpus() noexcept;
/** Returns the number of physical CPU cores. */
static int getNumPhysicalCpus() noexcept;
/** Returns the approximate CPU speed.
@returns the speed in megahertz, e.g. 1500, 2500, 32000 (depending on
what year you're reading this...)
*/
static int getCpuSpeedInMegahertz();
/** Returns a string to indicate the CPU vendor.
Might not be known on some systems.
*/
static String getCpuVendor();
/** Attempts to return a string describing the CPU model.
May not be available on some systems.
*/
static String getCpuModel();
static bool hasMMX() noexcept; /**< Returns true if Intel MMX instructions are available. */
static bool has3DNow() noexcept; /**< Returns true if AMD 3DNOW instructions are available. */
static bool hasFMA3() noexcept; /**< Returns true if AMD FMA3 instructions are available. */
static bool hasFMA4() noexcept; /**< Returns true if AMD FMA4 instructions are available. */
static bool hasSSE() noexcept; /**< Returns true if Intel SSE instructions are available. */
static bool hasSSE2() noexcept; /**< Returns true if Intel SSE2 instructions are available. */
static bool hasSSE3() noexcept; /**< Returns true if Intel SSE3 instructions are available. */
static bool hasSSSE3() noexcept; /**< Returns true if Intel SSSE3 instructions are available. */
static bool hasSSE41() noexcept; /**< Returns true if Intel SSE4.1 instructions are available. */
static bool hasSSE42() noexcept; /**< Returns true if Intel SSE4.2 instructions are available. */
static bool hasAVX() noexcept; /**< Returns true if Intel AVX instructions are available. */
static bool hasAVX2() noexcept; /**< Returns true if Intel AVX2 instructions are available. */
static bool hasAVX512F() noexcept; /**< Returns true if Intel AVX-512 Foundation instructions are available. */
static bool hasAVX512BW() noexcept; /**< Returns true if Intel AVX-512 Byte and Word instructions are available. */
static bool hasAVX512CD() noexcept; /**< Returns true if Intel AVX-512 Conflict Detection instructions are available. */
static bool hasAVX512DQ() noexcept; /**< Returns true if Intel AVX-512 Doubleword and Quadword instructions are available. */
static bool hasAVX512ER() noexcept; /**< Returns true if Intel AVX-512 Exponential and Reciprocal instructions are available. */
static bool hasAVX512IFMA() noexcept; /**< Returns true if Intel AVX-512 Integer Fused Multiply-Add instructions are available. */
static bool hasAVX512PF() noexcept; /**< Returns true if Intel AVX-512 Prefetch instructions are available. */
static bool hasAVX512VBMI() noexcept; /**< Returns true if Intel AVX-512 Vector Bit Manipulation instructions are available. */
static bool hasAVX512VL() noexcept; /**< Returns true if Intel AVX-512 Vector Length instructions are available. */
static bool hasAVX512VPOPCNTDQ() noexcept; /**< Returns true if Intel AVX-512 Vector Population Count Double and Quad-word instructions are available. */
static bool hasNeon() noexcept; /**< Returns true if ARM NEON instructions are available. */
//==============================================================================
/** Finds out how much RAM is in the machine.
@returns the approximate number of megabytes of memory, or zero if
something goes wrong when finding out.
*/
static int getMemorySizeInMegabytes();
/** Returns the system page-size.
This is only used by programmers with beards.
*/
static int getPageSize();
//==============================================================================
/** Returns a backtrace of the current call-stack.
The usefulness of the result will depend on the level of debug symbols
that are available in the executable.
*/
static String getStackBacktrace();
/** A function type for use in setApplicationCrashHandler().
When called, its void* argument will contain platform-specific data about the crash.
*/
using CrashHandlerFunction = void(*)(void*);
/** Sets up a global callback function that will be called if the application
executes some kind of illegal instruction.
You may want to call getStackBacktrace() in your handler function, to find out
where the problem happened and log it, etc.
*/
static void setApplicationCrashHandler (CrashHandlerFunction);
/** Returns true if this code is running inside an app extension sandbox.
This function will always return false on windows, linux and android.
*/
static bool isRunningInAppExtensionSandbox() noexcept;
//==============================================================================
#ifndef DOXYGEN
[[deprecated ("This method was spelt wrong! Please change your code to use getCpuSpeedInMegahertz instead.")]]
static int getCpuSpeedInMegaherz() { return getCpuSpeedInMegahertz(); }
#endif
private:
SystemStats() = delete; // uses only static methods
JUCE_DECLARE_NON_COPYABLE (SystemStats)
};
} // namespace juce

View File

@ -0,0 +1,198 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. 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.
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
//==============================================================================
/* This file figures out which platform is being built, and defines some macros
that the rest of the code can use for OS-specific compilation.
Macros that will be set here are:
- One of JUCE_WINDOWS, JUCE_MAC JUCE_LINUX, JUCE_IOS, JUCE_ANDROID, etc.
- Either JUCE_32BIT or JUCE_64BIT, depending on the architecture.
- Either JUCE_LITTLE_ENDIAN or JUCE_BIG_ENDIAN.
- Either JUCE_INTEL or JUCE_ARM
- Either JUCE_GCC or JUCE_CLANG or JUCE_MSVC
*/
//==============================================================================
#ifdef JUCE_APP_CONFIG_HEADER
#include JUCE_APP_CONFIG_HEADER
#elif ! defined (JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED)
/*
Most projects will contain a global header file containing various settings that
should be applied to all the code in your project. If you use the projucer, it'll
set up a global header file for you automatically, but if you're doing things manually,
you may want to set the JUCE_APP_CONFIG_HEADER macro with the name of a file to include,
or just include one before all the module cpp files, in which you set
JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 to silence this error.
(Or if you don't need a global header, then you can just define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED
globally to avoid this error).
Note for people who hit this error when trying to compile a JUCE project created by
a pre-v4.2 version of the Introjucer/Projucer, it's very easy to fix: just re-save
your project with the latest version of the Projucer, and it'll magically fix this!
*/
#error "No global header file was included!"
#endif
//==============================================================================
#if defined (_WIN32) || defined (_WIN64)
#define JUCE_WINDOWS 1
#elif defined (JUCE_ANDROID)
#undef JUCE_ANDROID
#define JUCE_ANDROID 1
#elif defined (__FreeBSD__) || (__OpenBSD__)
#define JUCE_BSD 1
#elif defined (LINUX) || defined (__linux__)
#define JUCE_LINUX 1
#elif defined (__APPLE_CPP__) || defined (__APPLE_CC__)
#define CF_EXCLUDE_CSTD_HEADERS 1
#include <TargetConditionals.h> // (needed to find out what platform we're using)
#include <AvailabilityMacros.h>
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define JUCE_IPHONE 1
#define JUCE_IOS 1
#else
#define JUCE_MAC 1
#endif
#elif defined (__wasm__)
#define JUCE_WASM 1
#else
#error "Unknown platform!"
#endif
//==============================================================================
#if JUCE_WINDOWS
#ifdef _MSC_VER
#ifdef _WIN64
#define JUCE_64BIT 1
#else
#define JUCE_32BIT 1
#endif
#endif
#ifdef _DEBUG
#define JUCE_DEBUG 1
#endif
#ifdef __MINGW32__
#define JUCE_MINGW 1
#ifdef __MINGW64__
#define JUCE_64BIT 1
#else
#define JUCE_32BIT 1
#endif
#endif
/** If defined, this indicates that the processor is little-endian. */
#define JUCE_LITTLE_ENDIAN 1
#define JUCE_INTEL 1
#endif
//==============================================================================
#if JUCE_MAC || JUCE_IOS
#if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
#define JUCE_DEBUG 1
#endif
#if ! (defined (DEBUG) || defined (_DEBUG) || defined (NDEBUG) || defined (_NDEBUG))
#warning "Neither NDEBUG or DEBUG has been defined - you should set one of these to make it clear whether this is a release build,"
#endif
#ifdef __LITTLE_ENDIAN__
#define JUCE_LITTLE_ENDIAN 1
#else
#define JUCE_BIG_ENDIAN 1
#endif
#ifdef __LP64__
#define JUCE_64BIT 1
#else
#define JUCE_32BIT 1
#endif
#if defined (__ppc__) || defined (__ppc64__)
#error "PowerPC is no longer supported by JUCE!"
#elif defined (__arm__) || defined (__arm64__)
#define JUCE_ARM 1
#else
#define JUCE_INTEL 1
#endif
#if JUCE_MAC
#if ! defined (MAC_OS_X_VERSION_10_11)
#error "The 10.11 SDK (Xcode 7.3.1+) is required to build JUCE apps. You can create apps that run on macOS 10.7+ by changing the deployment target."
#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
#error "Building for OSX 10.6 is no longer supported!"
#endif
#endif
#endif
//==============================================================================
#if JUCE_LINUX || JUCE_ANDROID || JUCE_BSD
#ifdef _DEBUG
#define JUCE_DEBUG 1
#endif
// Allow override for big-endian Linux platforms
#if defined (__LITTLE_ENDIAN__) || ! defined (JUCE_BIG_ENDIAN)
#define JUCE_LITTLE_ENDIAN 1
#undef JUCE_BIG_ENDIAN
#else
#undef JUCE_LITTLE_ENDIAN
#define JUCE_BIG_ENDIAN 1
#endif
#if defined (__LP64__) || defined (_LP64) || defined (__arm64__)
#define JUCE_64BIT 1
#else
#define JUCE_32BIT 1
#endif
#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
#define JUCE_ARM 1
#elif __MMX__ || __SSE__ || __amd64__
#define JUCE_INTEL 1
#endif
#endif
//==============================================================================
// Compiler type macros.
#if defined (__clang__)
#define JUCE_CLANG 1
#elif defined (__GNUC__)
#define JUCE_GCC 1
#elif defined (_MSC_VER)
#define JUCE_MSVC 1
#else
#error unknown compiler
#endif