VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_core / juce_core.h
blob416bb391017e99979cd7de42cf845e3caaa641ba
1 /*
2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
20 ==============================================================================
24 /*******************************************************************************
25 The block below describes the properties of this module, and is read by
26 the Projucer to automatically generate project code that uses it.
27 For details about the syntax and how to create or use a module, see the
28 JUCE Module Format.md file.
31 BEGIN_JUCE_MODULE_DECLARATION
33 ID: juce_core
34 vendor: juce
35 version: 7.0.1
36 name: JUCE core classes
37 description: The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.
38 website: http://www.juce.com/juce
39 license: ISC
40 minimumCppStandard: 14
42 dependencies:
43 OSXFrameworks: Cocoa Foundation IOKit
44 iOSFrameworks: Foundation
45 linuxLibs: rt dl pthread
46 mingwLibs: uuid wsock32 wininet version ole32 ws2_32 oleaut32 imm32 comdlg32 shlwapi rpcrt4 winmm
48 END_JUCE_MODULE_DECLARATION
50 *******************************************************************************/
53 #pragma once
54 #define JUCE_CORE_H_INCLUDED
56 //==============================================================================
57 #ifdef _MSC_VER
58 #pragma warning (push)
59 // Disable warnings for long class names, padding, and undefined preprocessor definitions.
60 #pragma warning (disable: 4251 4786 4668 4820)
61 #ifdef __INTEL_COMPILER
62 #pragma warning (disable: 1125)
63 #endif
64 #endif
66 #include "system/juce_TargetPlatform.h"
68 //==============================================================================
69 /** Config: JUCE_FORCE_DEBUG
71 Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and project settings,
72 but if you define this value, you can override this to force it to be true or false.
74 #ifndef JUCE_FORCE_DEBUG
75 //#define JUCE_FORCE_DEBUG 0
76 #endif
78 //==============================================================================
79 /** Config: JUCE_LOG_ASSERTIONS
81 If this flag is enabled, the jassert and jassertfalse macros will always use Logger::writeToLog()
82 to write a message when an assertion happens.
84 Enabling it will also leave this turned on in release builds. When it's disabled,
85 however, the jassert and jassertfalse macros will not be compiled in a
86 release build.
88 @see jassert, jassertfalse, Logger
90 #ifndef JUCE_LOG_ASSERTIONS
91 #if JUCE_ANDROID
92 #define JUCE_LOG_ASSERTIONS 1
93 #else
94 #define JUCE_LOG_ASSERTIONS 0
95 #endif
96 #endif
98 //==============================================================================
99 /** Config: JUCE_CHECK_MEMORY_LEAKS
101 Enables a memory-leak check for certain objects when the app terminates. See the LeakedObjectDetector
102 class and the JUCE_LEAK_DETECTOR macro for more details about enabling leak checking for specific classes.
104 #if JUCE_DEBUG && ! defined (JUCE_CHECK_MEMORY_LEAKS)
105 #define JUCE_CHECK_MEMORY_LEAKS 1
106 #endif
108 //==============================================================================
109 /** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
111 In a Windows build, this can be used to stop the required system libs being
112 automatically added to the link stage.
114 #ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
115 #define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
116 #endif
118 /** Config: JUCE_INCLUDE_ZLIB_CODE
119 This can be used to disable Juce's embedded 3rd-party zlib code.
120 You might need to tweak this if you're linking to an external zlib library in your app,
121 but for normal apps, this option should be left alone.
123 If you disable this, you might also want to set a value for JUCE_ZLIB_INCLUDE_PATH, to
124 specify the path where your zlib headers live.
126 #ifndef JUCE_INCLUDE_ZLIB_CODE
127 #define JUCE_INCLUDE_ZLIB_CODE 1
128 #endif
130 #ifndef JUCE_ZLIB_INCLUDE_PATH
131 #define JUCE_ZLIB_INCLUDE_PATH <zlib.h>
132 #endif
134 /** Config: JUCE_USE_CURL
135 Enables http/https support via libcurl (Linux only). Enabling this will add an additional
136 run-time dynamic dependency to libcurl.
138 If you disable this then https/ssl support will not be available on Linux.
140 #ifndef JUCE_USE_CURL
141 #define JUCE_USE_CURL 1
142 #endif
144 /** Config: JUCE_LOAD_CURL_SYMBOLS_LAZILY
145 If enabled, JUCE will load libcurl lazily when required (for example, when WebInputStream
146 is used). Enabling this flag may also help with library dependency errors as linking
147 libcurl at compile-time may instruct the linker to hard depend on a specific version
148 of libcurl. It's also useful if you want to limit the amount of JUCE dependencies and
149 you are not using WebInputStream or the URL classes.
151 #ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY
152 #define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0
153 #endif
155 /** Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS
156 If enabled, this will add some exception-catching code to forward unhandled exceptions
157 to your JUCEApplicationBase::unhandledException() callback.
159 #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
160 #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 0
161 #endif
163 /** Config: JUCE_ALLOW_STATIC_NULL_VARIABLES
164 If disabled, this will turn off dangerous static globals like String::empty, var::null, etc
165 which can cause nasty order-of-initialisation problems if they are referenced during static
166 constructor code.
168 #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
169 #define JUCE_ALLOW_STATIC_NULL_VARIABLES 0
170 #endif
172 /** Config: JUCE_STRICT_REFCOUNTEDPOINTER
173 If enabled, this will make the ReferenceCountedObjectPtr class stricter about allowing
174 itself to be cast directly to a raw pointer. By default this is disabled, for compatibility
175 with old code, but if possible, you should always enable it to improve code safety!
177 #ifndef JUCE_STRICT_REFCOUNTEDPOINTER
178 #define JUCE_STRICT_REFCOUNTEDPOINTER 0
179 #endif
181 /** Config: JUCE_ENABLE_ALLOCATION_HOOKS
182 If enabled, this will add global allocation functions with built-in assertions, which may
183 help when debugging allocations in unit tests.
185 #ifndef JUCE_ENABLE_ALLOCATION_HOOKS
186 #define JUCE_ENABLE_ALLOCATION_HOOKS 0
187 #endif
189 #ifndef JUCE_STRING_UTF_TYPE
190 #define JUCE_STRING_UTF_TYPE 8
191 #endif
193 //==============================================================================
194 //==============================================================================
196 #if JUCE_CORE_INCLUDE_NATIVE_HEADERS
197 #include "native/juce_BasicNativeHeaders.h"
198 #endif
200 #if JUCE_WINDOWS
201 #undef small
202 #endif
204 #include "system/juce_StandardHeader.h"
206 namespace juce
208 class StringRef;
209 class MemoryBlock;
210 class File;
211 class InputStream;
212 class OutputStream;
213 class DynamicObject;
214 class FileInputStream;
215 class FileOutputStream;
216 class XmlElement;
218 extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept;
219 extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
222 #include "memory/juce_Memory.h"
223 #include "maths/juce_MathsFunctions.h"
224 #include "memory/juce_ByteOrder.h"
225 #include "memory/juce_Atomic.h"
226 #include "text/juce_CharacterFunctions.h"
228 JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4996)
230 #include "text/juce_CharPointer_UTF8.h"
231 #include "text/juce_CharPointer_UTF16.h"
232 #include "text/juce_CharPointer_UTF32.h"
233 #include "text/juce_CharPointer_ASCII.h"
235 JUCE_END_IGNORE_WARNINGS_MSVC
237 #include "text/juce_String.h"
238 #include "text/juce_StringRef.h"
239 #include "logging/juce_Logger.h"
240 #include "memory/juce_LeakedObjectDetector.h"
241 #include "memory/juce_ContainerDeletePolicy.h"
242 #include "memory/juce_HeapBlock.h"
243 #include "memory/juce_MemoryBlock.h"
244 #include "memory/juce_ReferenceCountedObject.h"
245 #include "memory/juce_ScopedPointer.h"
246 #include "memory/juce_OptionalScopedPointer.h"
247 #include "containers/juce_Optional.h"
248 #include "containers/juce_ScopedValueSetter.h"
249 #include "memory/juce_Singleton.h"
250 #include "memory/juce_WeakReference.h"
251 #include "threads/juce_ScopedLock.h"
252 #include "threads/juce_CriticalSection.h"
253 #include "maths/juce_Range.h"
254 #include "maths/juce_NormalisableRange.h"
255 #include "maths/juce_StatisticsAccumulator.h"
256 #include "containers/juce_ElementComparator.h"
257 #include "containers/juce_ArrayAllocationBase.h"
258 #include "containers/juce_ArrayBase.h"
259 #include "containers/juce_Array.h"
260 #include "containers/juce_LinkedListPointer.h"
261 #include "containers/juce_ListenerList.h"
262 #include "containers/juce_OwnedArray.h"
263 #include "containers/juce_ReferenceCountedArray.h"
264 #include "containers/juce_SortedSet.h"
265 #include "containers/juce_SparseSet.h"
266 #include "containers/juce_AbstractFifo.h"
267 #include "containers/juce_SingleThreadedAbstractFifo.h"
268 #include "text/juce_NewLine.h"
269 #include "text/juce_StringPool.h"
270 #include "text/juce_Identifier.h"
271 #include "text/juce_StringArray.h"
272 #include "system/juce_SystemStats.h"
273 #include "memory/juce_HeavyweightLeakedObjectDetector.h"
274 #include "text/juce_StringPairArray.h"
275 #include "text/juce_TextDiff.h"
276 #include "text/juce_LocalisedStrings.h"
277 #include "text/juce_Base64.h"
278 #include "misc/juce_Functional.h"
279 #include "misc/juce_Result.h"
280 #include "misc/juce_Uuid.h"
281 #include "misc/juce_ConsoleApplication.h"
282 #include "containers/juce_Variant.h"
283 #include "containers/juce_NamedValueSet.h"
284 #include "containers/juce_DynamicObject.h"
285 #include "containers/juce_HashMap.h"
286 #include "time/juce_RelativeTime.h"
287 #include "time/juce_Time.h"
288 #include "streams/juce_InputStream.h"
289 #include "streams/juce_OutputStream.h"
290 #include "streams/juce_BufferedInputStream.h"
291 #include "streams/juce_MemoryInputStream.h"
292 #include "streams/juce_MemoryOutputStream.h"
293 #include "streams/juce_SubregionStream.h"
294 #include "streams/juce_InputSource.h"
295 #include "files/juce_File.h"
296 #include "files/juce_DirectoryIterator.h"
297 #include "files/juce_RangedDirectoryIterator.h"
298 #include "files/juce_FileInputStream.h"
299 #include "files/juce_FileOutputStream.h"
300 #include "files/juce_FileSearchPath.h"
301 #include "files/juce_MemoryMappedFile.h"
302 #include "files/juce_TemporaryFile.h"
303 #include "files/juce_FileFilter.h"
304 #include "files/juce_WildcardFileFilter.h"
305 #include "streams/juce_FileInputSource.h"
306 #include "logging/juce_FileLogger.h"
307 #include "javascript/juce_JSON.h"
308 #include "javascript/juce_Javascript.h"
309 #include "maths/juce_BigInteger.h"
310 #include "maths/juce_Expression.h"
311 #include "maths/juce_Random.h"
312 #include "misc/juce_RuntimePermissions.h"
313 #include "misc/juce_WindowsRegistry.h"
314 #include "threads/juce_ChildProcess.h"
315 #include "threads/juce_DynamicLibrary.h"
316 #include "threads/juce_HighResolutionTimer.h"
317 #include "threads/juce_InterProcessLock.h"
318 #include "threads/juce_Process.h"
319 #include "threads/juce_SpinLock.h"
320 #include "threads/juce_WaitableEvent.h"
321 #include "threads/juce_Thread.h"
322 #include "threads/juce_ThreadLocalValue.h"
323 #include "threads/juce_ThreadPool.h"
324 #include "threads/juce_TimeSliceThread.h"
325 #include "threads/juce_ReadWriteLock.h"
326 #include "threads/juce_ScopedReadLock.h"
327 #include "threads/juce_ScopedWriteLock.h"
328 #include "network/juce_NamedPipe.h"
329 #include "network/juce_URL.h"
330 #include "time/juce_PerformanceCounter.h"
331 #include "unit_tests/juce_UnitTest.h"
332 #include "xml/juce_XmlDocument.h"
333 #include "xml/juce_XmlElement.h"
334 #include "zip/juce_GZIPCompressorOutputStream.h"
335 #include "zip/juce_GZIPDecompressorInputStream.h"
336 #include "zip/juce_ZipFile.h"
337 #include "containers/juce_PropertySet.h"
338 #include "memory/juce_SharedResourcePointer.h"
339 #include "memory/juce_AllocationHooks.h"
340 #include "memory/juce_Reservoir.h"
342 #if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS)
343 #include "native/juce_mac_ObjCHelpers.h"
344 #endif
346 #if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS
347 #include "native/juce_win32_ComSmartPtr.h"
348 #endif
350 #if JUCE_CORE_INCLUDE_JNI_HELPERS && JUCE_ANDROID
351 #include <jni.h>
352 #include "native/juce_android_JNIHelpers.h"
353 #endif
355 #if JUCE_UNIT_TESTS
356 #include "unit_tests/juce_UnitTestCategories.h"
357 #endif
359 #ifndef DOXYGEN
360 namespace juce
363 As the very long class names here try to explain, the purpose of this code is to cause
364 a linker error if not all of your compile units are consistent in the options that they
365 enable before including JUCE headers. The reason this is important is that if you have
366 two cpp files, and one includes the juce headers with debug enabled, and another does so
367 without that, then each will be generating code with different class layouts, and you'll
368 get subtle and hard-to-track-down memory corruption!
370 #if JUCE_DEBUG
371 struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
372 { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
373 static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
374 #else
375 struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
376 { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
377 static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
378 #endif
380 #endif
382 JUCE_END_IGNORE_WARNINGS_MSVC
384 // In DLL builds, need to disable this warnings for other modules
385 #if defined (JUCE_DLL_BUILD) || defined (JUCE_DLL)
386 JUCE_IGNORE_MSVC (4251)
387 #endif