diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/LICENSE.txt b/modules/juce_audio_processors/format_types/VST3_SDK/LICENSE.txt index 9e57394dde..b5fddfe769 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/LICENSE.txt +++ b/modules/juce_audio_processors/format_types/VST3_SDK/LICENSE.txt @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- This license applies only to files referencing this license, for other files of the Software Development Kit the respective embedded license text diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/README.md b/modules/juce_audio_processors/format_types/VST3_SDK/README.md index baef9aec8b..7be410549f 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/README.md +++ b/modules/juce_audio_processors/format_types/VST3_SDK/README.md @@ -1,253 +1,10 @@ -# Welcome to VST SDK 3.6.x +# Welcome to VST 3 SDK Interfaces -## Table Of Contents - -1. [The VST SDK package](#100) -1. [System requirements](#200) -1. [About VST Plug-ins in general](#300) -1. [About VST 3](#400) -1. [How to build VST 3](#500) -1. [Contributing](#600) -1. [License & Usage guidelines](#700) - -
- -## The VST SDK package contains - -- The VST 3 API -- VST 3 Implementation Helper Classes -- AAX, AU and VST 2 wrappers -- VST 3 Plug-ins Examples - -The full VST 3 SDK is available [here!](https://www.steinberg.net/en/company/developers.html). It contains : - -- a VST 3 Plug-in Test Host Application/Validator, -- the **Steinberg VST 3 Plug-In SDK Licensing Agreement** that you have to sign if you want to develop or host VST 3 Plug-Ins. - -
- -## System requirements - -Supported OS: - -- Microsoft Windows 7-10 -- Apple OSX 10.9-10.13 -- Apple iOS 8-9 -- Linux (Beta version) - -Supported IDE: - -- Visual Studio 2015/2017/2019 -- minimum Xcode 7 -- Qt Creator - ---- -
- -## About VST Plug-ins in general - -A VST Plug-in is an audio processing component that is utilized within a host application. This host application provides the audio or/and event streams that are processed by the Plug-in's code. Generally speaking, a VST Plug-in can take a stream of audio data, apply a process to the audio, and return the result to the host application. A VST Plug-in performs its process normally using the processor of the computer. The audio stream is broken down into a series of blocks. The host supplies the blocks in sequence. The host and its current environment control the block-size. The VST Plug-in maintains the status of all its own parameters relating to the running process: The host does not maintain any information about what the Plug-in did with the last block of data it processed. - -From the host application's point of view, a VST Plug-in is a black box with an arbitrary number of inputs, outputs (Event (MIDI) or Audio), and associated parameters. The host needs no implicit knowledge of the Plug-in's process to be able to use it. The Plug-in process can use whatever parameters it wishes, internally to the process, but depending on the capabilities of the host, it can allow the changes to user parameters to be automated by the host. - -The source code of a VST Plug-in is platform independent, but the delivery system depends on the platform architecture: - -- On **Windows**, a VST Plug-in is a multi-threaded DLL (Dynamic Link Library), recently packaged into a folder structur. -- On **Mac OS X**, a VST Plug-in is a Mach-O Bundle -- On **Linux**, a VST Plug-in is a package - -To learn more about VST you can subscribe to the [VST Developer Forum](https://sdk.steinberg.net) - check the 3rd Party Developer Support section at [www.steinberg.net](http://www.steinberg.net). - - --- -
- -## About VST 3 - -VST 3 is a general rework of the long-serving VST Plug-in interface. It is not compatible with the older VST versions, but it includes some new features and possibilities. We have redesigned the API to make it not only far easier and more reliable for developers to work with, but have also provided completely new possibilities for Plug-ins. These include: - -### 1. Improved Performance with the Silence Flag - -Processing can optionally be applied to Plug-ins only when audio signals are present on their respective inputs, so VST 3 Plug-ins can apply their processing economically and only when it is needed. - -### 2. Multiple Dynamic I/Os - -VST 3 Plug-ins are no longer limited to a fixed number of inputs and outputs, and their I/O configuration can dynamically adapt to the channel configuration. Side-chains are also very easily realizable. This includes the possibility to deactivate unused buses after loading and even reactivate those when needed. This cleans up the mixer and further helps to reduce CPU load. - -### 3. Sample-accurate Automation - -VST 3 also features vastly improved parameter automation with sample accuracy and support for ramped automation data, allowing completely accurate and rapid parameter automation changes. - -### 4. Logical Parameter Organization - -The VST 3 Plug-in parameters are displayed in a tree structure. Parameters are grouped into sections which represent the structure of the Plug-in. Plug-ins can communicate their internal structure for the purpose of overview, but also for some associated functionality (eg. program-lists). - -### 5. Resizeable UI Editor - -VST 3 defines a way to allow resizing of the Plug-in editor by a user. - -### 6. Mouse Over Support - -The Host could ask the Plug-in which parameter is under the mouse. - -### 7. Context Menu Support - -VST 3 defines a way to allow the host to add its own entries in the Plug-in context menu of a specific parameter. - -### 8. Channel Context Information - -A VST 3 Plug-in could access some channel information where it is instantiated: name, color,... - -### 9. Note Expression - -VST 3 defines with Note Expression a new way of event controller editing. The Plug-in is able to break free from the limitations of MIDI controller events by providing access to new VST 3 controller events that circumvent the laws of MIDI and provide articulation information for each individual note (event) in a polyphonic arrangement according to its noteId. - -### 10. 3D Support - -VST 3 supports new speaker configurations like Ambisonic, Atmos, Auro 3D or 22.2. - -### 11. Factory Concept - -VST 3 Plug-in library could export multiple Plug-ins and in this way replaces the shell concept of VST 2 (kPlugCategShell). - -### 12. Support Remote control Representation - -VST 3 Plug-in can deliver a specific parameter mapping for remote controls like Nuage. - -### 13. Others - -While designing VST 3, we performed a careful analysis of the existing functionality of VST and rewrote the interfaces from scratch. In doing so, we focused a lot on providing clear interfaces and their documentation in order to avoid usage errors from the deepest possible layer. -Some more features implemented specifically for developers include: - -- More stable technical Host/Plug-in environment -- Advanced technical definition of the standard -- Modular approach -- Separation of UI and processing -- Advanced Preset System -- Multiple Plug-ins per Library -- Test Host included -- Automated Testing Environment -- Validator (small command line Test Host) and Plug-in examples code included - ---- -
- -## How to build VST3 - -### Get the source code from GitHub - -
git clone --recursive https://github.com/steinbergmedia/vst3sdk.git
-
- -### Adding VST2 version - -The VST2 SDK is not part anymore of the VST3 SDK, you have to use an older version of the SDK and copy the VST2_SDK folder into the VST_SDK folder. -In order to build a VST2 version of the Plug-in and a VST3 at the same time, you need to copy the VST2 folder into the VST3 folder, simply run the following commands: - -- for macOS: - -
-cd TheFolderWhereYouDownloadTheSDK
-./copy_vst2_to_vst3_sdk.sh
-
- -- for Windows: - -
-cd TheFolderWhereYouDownloadTheSDK
-copy_vst2_to_vst3_sdk.bat
-
- -### Build the examples on Linux - -- Create a folder for the build and move to this folder (using cd): - -
-    mkdir build
-    cd build
-
- -- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located: - -
-    cmake ../vst3sdk
-
- -- Now you can build the Plug-in: - -
-    make 
- (or alternatively for example for release)
-    cmake --build . --config Release
-
- -### Build the examples on macOS - -- Create a folder for the build and move to this folder (using cd): - -
-    mkdir build
-    cd build
-
- -- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located: - -
-  For XCode:
-    cmake -GXcode ../vst3sdk
-  Without XCode (here debug variant):
-    cmake -DCMAKE_BUILD_TYPE=Debug ../
-
- -- Now you can build the Plug-in (you can use XCode too): - -
-    xcodebuild 
- (or alternatively for example for release)
-    cmake --build . --config Release
-
- -### Build the examples on Windows - -- Create a folder for the build and move to this folder (using cd): - -
-    mkdir build
-    cd build
-
- -- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located: - -
-    cmake.exe -G"Visual Studio 15 2017 Win64" ../vst3sdk
-
- -- Now you can build the Plug-in (you can use Visual Studio too): - -
-    msbuild.exe vstsdk.sln
-  (or alternatively for example for release)
-    cmake --build . --config Release
-
- -### Build using cmake-gui - -- start the cmake-gui Application -- "Browse Source...": select the folder VST3_SDK -- "Browse Build...": select a folder where the outputs (projects/...) will be created. Typically a folder named "build" -- you can check the SMTG Options -- Press "Configure" -- Press "Generate" and the project will be created - ---- -
- -## Contributing - -For bug reports and features requests, please visit the [VST Developer Forum](https://sdk.steinberg.net) - ---- -
+Here are located all VST interfaces definitions (including VST Component/Controller, UI, Test). ## License & Usage guidelines -More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) \ No newline at end of file +More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) + +---- +Return to [VST 3 SDK](https://github.com/steinbergmedia/vst3sdk) \ No newline at end of file diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/LICENSE.txt b/modules/juce_audio_processors/format_types/VST3_SDK/base/LICENSE.txt index cf53fd8111..d5d3145b1c 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/LICENSE.txt +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/LICENSE.txt @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/README.md b/modules/juce_audio_processors/format_types/VST3_SDK/base/README.md index 1d7de1fee2..d612400fcb 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/README.md +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/README.md @@ -3,4 +3,7 @@ Here you can find some helper classes useful for developing VST3 Plug-Ins. ## License & Usage guidelines -More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) \ No newline at end of file +More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) + +---- +Return to [VST 3 SDK](https://github.com/steinbergmedia/vst3sdk) \ No newline at end of file diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/baseiids.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/baseiids.cpp index 2c6fdfbc10..d7b1f7b52f 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/baseiids.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/baseiids.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/classfactoryhelpers.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/classfactoryhelpers.h index 70c77b78aa..075c0a738c 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/classfactoryhelpers.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/classfactoryhelpers.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.cpp index c7d745ef42..a67ad5691e 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -37,7 +37,7 @@ #include "base/source/fbuffer.h" #include "base/source/fstring.h" -#include +#include namespace Steinberg { @@ -231,7 +231,6 @@ bool Buffer::prependString8 (const char8* s) return false; uint32 len = (uint32) strlen (s); - if (len > 0) { shiftStart (len); @@ -361,7 +360,7 @@ bool Buffer::fromHexString (const char8* string) else return false; // no hex string if (upper) - data [count >> 1] = d << 4; + data [count >> 1] = static_cast (d << 4); else data [count >> 1] += d; diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.h index e5f3ed6fa6..d0e2f39405 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fbuffer.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -85,7 +85,7 @@ public: /** Destructor - deallocates the internal memory. */ - ~Buffer (); + virtual ~Buffer (); /** Assignment operator - copies contents from a given Buffer and increases the size if necessary. \param[in] buff : the Buffer from which all memory will be copied @@ -210,7 +210,7 @@ public: int8* operator + (uint32 i); ///< \return the internal Buffer's address plus the given offset i, zero if offset is out of range - int32 operator ! () { return buffer == 0; } + int32 operator ! () { return buffer == nullptr; } enum swapSize { diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.cpp index 185954b5ba..6355feba19 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.cpp @@ -11,7 +11,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -39,9 +39,72 @@ #include "base/source/fdebug.h" +#if SMTG_OS_WINDOWS +#include + +bool AmIBeingDebugged () +{ + return IsDebuggerPresent (); +} +#endif + +#if SMTG_OS_LINUX +#include +#include +#include +//-------------------------------------------------------------------------- +bool AmIBeingDebugged () +{ + // TODO: check if GDB or LLDB is attached + return true; +} +#endif + +#if SMTG_OS_MACOS + +#include +#include +#include +#include + +//------------------------------------------------------------------------ +// from Technical Q&A QA1361 (http://developer.apple.com/qa/qa2004/qa1361.html) +//------------------------------------------------------------------------ +bool AmIBeingDebugged () +// Returns true if the current process is being debugged (either +// running under the debugger or has a debugger attached post facto). +{ + int mib[4]; + struct kinfo_proc info; + size_t size; + + // Initialize the flags so that, if sysctl fails for some bizarre + // reason, we get a predictable result. + + info.kp_proc.p_flag = 0; + + // Initialize mib, which tells sysctl the info we want, in this case + // we're looking for information about a specific process ID. + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid (); + + // Call sysctl. + + size = sizeof (info); + sysctl (mib, sizeof (mib) / sizeof (*mib), &info, &size, NULL, 0); + + // We're being debugged if the P_TRACED flag is set. + return ((info.kp_proc.p_flag & P_TRACED) != 0); +} + +#endif // SMTG_OS_MACOS + #if DEVELOPMENT -#include +#include #include #include @@ -49,8 +112,9 @@ #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif +#if _MSC_VER #include -#include +#endif #define vsnprintf _vsnprintf #define snprintf _snprintf @@ -60,12 +124,6 @@ #include #include #include -#include -#include -#include -#include - -static bool AmIBeingDebugged (void); #define THREAD_ALLOC_WATCH 0 // check allocations on specific threads @@ -79,27 +137,6 @@ AssertionHandler gAssertionHandler = nullptr; AssertionHandler gPreAssertionHook = nullptr; DebugPrintLogger gDebugPrintLogger = nullptr; -namespace boost { -// Define the boost assertion handler to redirect to our assertion handler, -// otherwise it just calls abort(). Note that we don't need to include any boost -// headers for this, it just provides the handler. -void assertion_failed (char const* expr, char const* function, char const* file, long line) -{ -#if DEVELOPMENT - char message[512]; - snprintf (message, 512, "%s at %s, %s:%ld", expr, function, file, line); - if (gAssertionHandler) - { - FDebugBreak (message); - } - else - { - assert (!(const char *)message); - } -#endif -} -} - //-------------------------------------------------------------------------- static const int kDebugPrintfBufferSize = 10000; static bool neverDebugger = false; // so I can switch it off in the debugger... @@ -116,7 +153,7 @@ static void printDebugString (const char* string) } else { -#if SMTG_OS_MACOS +#if SMTG_OS_MACOS || defined(__MINGW32__) fprintf (stderr, "%s", string); #elif SMTG_OS_WINDOWS OutputDebugStringA (string); @@ -137,22 +174,6 @@ void FDebugPrint (const char* format, ...) printDebugString (string); } -#if SMTG_OS_WINDOWS -#define AmIBeingDebugged IsDebuggerPresent -#endif - -#if SMTG_OS_LINUX -#include -#include -#include -//-------------------------------------------------------------------------- -static inline bool AmIBeingDebugged () -{ - // TODO: check if GDB or LLDB is attached - return true; -} -#endif - //-------------------------------------------------------------------------- // printf style debugging output //-------------------------------------------------------------------------- @@ -187,8 +208,11 @@ void FDebugBreak (const char* format, ...) if (breakIntoDebugger) { -#if SMTG_OS_WINDOWS +#if SMTG_OS_WINDOWS && _MSC_VER __debugbreak (); // intrinsic version of DebugBreak() +#elif SMTG_OS_MACOS && __arm64__ + raise (SIGSTOP); + #elif __ppc64__ || __ppc__ || __arm__ kill (getpid (), SIGINT); #elif __i386__ || __x86_64__ @@ -205,9 +229,9 @@ void FPrintLastError (const char* file, int line) { #if SMTG_OS_WINDOWS LPVOID lpMessageBuffer; - FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, + FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError (), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)&lpMessageBuffer, 0, NULL); + (LPSTR)&lpMessageBuffer, 0, nullptr); FDebugPrint ("%s(%d) : %s\n", file, line, lpMessageBuffer); LocalFree (lpMessageBuffer); #endif @@ -276,39 +300,20 @@ void operator delete[] (void* p, int, const char* file, int line) ::operator delete[] (p); } -//------------------------------------------------------------------------ -// from Technical Q&A QA1361 (http://developer.apple.com/qa/qa2004/qa1361.html) -//------------------------------------------------------------------------ -bool AmIBeingDebugged (void) -// Returns true if the current process is being debugged (either -// running under the debugger or has a debugger attached post facto). -{ - int mib[4]; - struct kinfo_proc info; - size_t size; - - // Initialize the flags so that, if sysctl fails for some bizarre - // reason, we get a predictable result. - - info.kp_proc.p_flag = 0; - - // Initialize mib, which tells sysctl the info we want, in this case - // we're looking for information about a specific process ID. - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = getpid (); +#endif // SMTG_OS_MACOS - // Call sysctl. +#endif // DEVELOPMENT - size = sizeof (info); - sysctl (mib, sizeof (mib) / sizeof (*mib), &info, &size, NULL, 0); +static bool smtg_unit_testing_active = false; // ugly hack to unit testing ... - // We're being debugged if the P_TRACED flag is set. - return ((info.kp_proc.p_flag & P_TRACED) != 0); +//------------------------------------------------------------------------ +bool isSmtgUnitTesting () +{ + return smtg_unit_testing_active; } -#endif // SMTG_OS_MACOS - -#endif // DEVELOPMENT +//------------------------------------------------------------------------ +void setSmtgUnitTesting () +{ + smtg_unit_testing_active = true; +} diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.h index 197d4b33cb..a5d9923f82 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fdebug.h @@ -11,7 +11,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -51,12 +51,15 @@ #pragma once #include "pluginterfaces/base/ftypes.h" -#include +#include #if SMTG_OS_MACOS #include #endif +/** Returns true if a debugger is attached. */ +bool AmIBeingDebugged (); + //----------------------------------------------------------------------------- // development / release //----------------------------------------------------------------------------- @@ -152,10 +155,10 @@ void FPrintLastError (const char* file, int line); the debug output to a file or stream. */ ///@{ -typedef bool (*AssertionHandler) (const char* message); +using AssertionHandler = bool (*) (const char* message); extern AssertionHandler gAssertionHandler; extern AssertionHandler gPreAssertionHook; -typedef void (*DebugPrintLogger) (const char* message); +using DebugPrintLogger = void (*) (const char* message); extern DebugPrintLogger gDebugPrintLogger; ///@} @@ -212,11 +215,9 @@ void* operator new (size_t, int, const char*, int); #endif #endif -#if SMTG_CPPUNIT_TESTING -#define SMTG_IS_TEST true -#else -#define SMTG_IS_TEST false -#endif +// replace #if SMTG_CPPUNIT_TESTING +bool isSmtgUnitTesting (); +void setSmtgUnitTesting (); #if !SMTG_RENAME_ASSERT #if SMTG_OS_WINDOWS diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.cpp index dd9afe5d2d..e085a3435c 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -42,7 +42,7 @@ namespace Steinberg { -IUpdateHandler* FObject::gUpdateHandler = 0; +IUpdateHandler* FObject::gUpdateHandler = nullptr; //------------------------------------------------------------------------ const FUID FObject::iid; @@ -84,7 +84,7 @@ tresult PLUGIN_API FObject::queryInterface (const TUID _iid, void** obj) QUERY_INTERFACE (_iid, obj, FUnknown::iid, FUnknown) QUERY_INTERFACE (_iid, obj, IDependent::iid, IDependent) QUERY_INTERFACE (_iid, obj, FObject::iid, FObject) - *obj = 0; + *obj = nullptr; return kNoInterface; } @@ -125,8 +125,8 @@ void FObject::deferUpdate (int32 msg) //------------------------------------------------------------------------ namespace Singleton { - typedef std::vector ObjectVector; - ObjectVector* singletonInstances = 0; + using ObjectVector = std::vector; + ObjectVector* singletonInstances = nullptr; bool singletonsTerminated = false; Steinberg::Base::Thread::FLock* singletonsLock; @@ -148,7 +148,7 @@ namespace Singleton SMTG_ASSERT (singletonsTerminated == false) if (singletonsTerminated == false) { - if (singletonInstances == 0) + if (singletonInstances == nullptr) singletonInstances = NEW std::vector; singletonInstances->push_back (o); } @@ -167,15 +167,15 @@ namespace Singleton { FObject** obj = (*it); (*obj)->release (); - *obj = 0; - obj = 0; + *obj = nullptr; + obj = nullptr; } delete singletonInstances; - singletonInstances = 0; + singletonInstances = nullptr; } delete singletonsLock; - singletonsLock = 0; + singletonsLock = nullptr; } } deleter; } diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.h index fabf025802..9bcf4435ce 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fobject.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -43,41 +43,39 @@ #include "pluginterfaces/base/funknown.h" #include "pluginterfaces/base/iupdatehandler.h" -//#include "base/source/basefwd.h" -#include "base/source/fdebug.h" // NEW - +#include "base/source/fdebug.h" // use of NEW namespace Steinberg { //---------------------------------- -typedef FIDString FClassID; +using FClassID = FIDString; //------------------------------------------------------------------------ // Basic FObject - implements FUnknown + IDependent //------------------------------------------------------------------------ /** Implements FUnknown and IDependent. -FObject is a polymorphic class that implements IDependent (of SKI module) -and therefore derived from FUnknown, which is the most abstract base class of all. - -All COM-like virtual methods of FUnknown such as queryInterface(), addRef(), release() -are implemented here. On top of that, dependency-related methods are implemented too. +FObject is a polymorphic class that implements IDependent (of SKI module) and therefore derived from +FUnknown, which is the most abstract base class of all. -Pointer casting is done via the template methods FCast, either FObject to FObject or -FUnknown to FObject. +All COM-like virtual methods of FUnknown such as queryInterface(), addRef(), release() are +implemented here. On top of that, dependency-related methods are implemented too. -FObject supports a new singleton concept, therefore these objects are deleted automatically upon program termination. +Pointer casting is done via the template methods FCast, either FObject to FObject or FUnknown to +FObject. -- Runtime type information: An object can be queried at runtime, of what class -it is. To do this correctly, every class must override some methods. This -is simplified by using the OBJ_METHODS macros +FObject supports a new singleton concept, therefore these objects are deleted automatically upon +program termination. +- Runtime type information: An object can be queried at runtime, of what class it is. To do this +correctly, every class must override some methods. This is simplified by using the OBJ_METHODS +macros -@see - - FUnknown - - IDependent - - IUpdateHandler +@see + - FUnknown + - IDependent + - IUpdateHandler */ //------------------------------------------------------------------------ class FObject : public IDependent @@ -99,19 +97,19 @@ public: FUnknown* unknownCast () {return this;} ///< get FUnknown interface from object // FUnknown - virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE; ///< please refer to FUnknown::queryInterface () - virtual uint32 PLUGIN_API addRef () SMTG_OVERRIDE; ///< please refer to FUnknown::addref () - virtual uint32 PLUGIN_API release () SMTG_OVERRIDE; ///< please refer to FUnknown::release () + tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE; ///< please refer to FUnknown::queryInterface () + uint32 PLUGIN_API addRef () SMTG_OVERRIDE; ///< please refer to FUnknown::addref () + uint32 PLUGIN_API release () SMTG_OVERRIDE; ///< please refer to FUnknown::release () // IDependent - virtual void PLUGIN_API update (FUnknown* /*changedUnknown*/, int32 /*message*/) SMTG_OVERRIDE {} + void PLUGIN_API update (FUnknown* /*changedUnknown*/, int32 /*message*/) SMTG_OVERRIDE {} ///< empty virtual method that should be overridden by derived classes for data updates upon changes // IDependency virtual void addDependent (IDependent* dep); ///< adds dependency to the object virtual void removeDependent (IDependent* dep); ///< removes dependency from the object virtual void changed (int32 msg = kChanged); ///< Inform all dependents, that the object has changed. virtual void deferUpdate (int32 msg = kChanged); ///< Similar to triggerUpdates, except only delivered in idle (usefull in collecting updates). - virtual void updateDone (int32 /* msg */) {} ///< empty virtual method that should be overridden by derived classes + virtual void updateDone (int32 /* msg */) {} ///< empty virtual method that should be overridden by derived classes virtual bool isEqualInstance (FUnknown* d) {return this == d;} static void setUpdateHandler (IUpdateHandler* handler) {gUpdateHandler = handler;} ///< set method for the local attribute @@ -137,7 +135,7 @@ protected: //------------------------------------------------------------------------ inline FObject* FObject::unknownToObject (FUnknown* unknown) { - FObject* object = 0; + FObject* object = nullptr; if (unknown) { unknown->queryInterface (FObject::iid, (void**)&object); @@ -180,7 +178,7 @@ inline C* FCast (FUnknown* unknown) template inline C* FUCast (FObject* object) { - return FUnknownPtr (object ? object->unknownCast () : 0); + return FUnknownPtr (object ? object->unknownCast () : nullptr); } template diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.cpp index 2781c786ce..b9af91e086 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -687,13 +687,13 @@ char8* FStreamer::readStr8 () { int32 length; if (!readInt32 (length)) - return 0; + return nullptr; // check corruption if (length > 262144) - return 0; + return nullptr; - char8* s = (length > 0) ? NEWVEC char8[length] : 0; + char8* s = (length > 0) ? NEWVEC char8[length] : nullptr; if (s) readRaw (s, length * sizeof (char8)); return s; diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.h index a7e00afbcb..750e5e183c 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstreamer.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -217,7 +217,7 @@ class IBStream; // IBStreamer //------------------------------------------------------------------------ /** Wrapper class for typed reading/writing from or to IBStream. - Can be used framework-independent in Plug-ins. */ + Can be used framework-independent in plug-ins. */ //------------------------------------------------------------------------ class IBStreamer: public FStreamer { diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.cpp index 1f294c1ab7..55e86ee119 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -48,6 +48,7 @@ #if SMTG_OS_WINDOWS #include +#ifdef _MSC_VER #pragma warning (disable : 4244) #pragma warning (disable : 4267) #pragma warning (disable : 4996) @@ -59,9 +60,9 @@ #define realloc(p,s) _realloc_dbg(p,s, _NORMAL_BLOCK, __FILE__, __LINE__) #define free(p) _free_dbg(p, _NORMAL_BLOCK) -#endif - -#endif +#endif // DEVELOPMENT +#endif // _MSC_VER +#endif // SMTG_OS_WINDOWS #ifndef kPrintfBufferSize #define kPrintfBufferSize 4096 @@ -175,7 +176,7 @@ static CFStringDebugAllocator gDebugAllocator; #else static const CFAllocatorRef kCFAllocator = ::kCFAllocatorDefault; -#endif +#endif // SMTG_DEBUG_CFALLOCATOR } //----------------------------------------------------------------------------- @@ -287,6 +288,7 @@ static inline int strnicmp16 (const Steinberg::char16* s1, const Steinberg::char //----------------------------------------------------------------------------- static inline int sprintf16 (Steinberg::char16* wcs, const Steinberg::char16* format, ...) { +#warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); return 0; } @@ -310,6 +312,7 @@ static inline int vsnwprintf (Steinberg::char16* wcs, size_t maxlen, //----------------------------------------------------------------------------- static inline Steinberg::char16* strrchr16 (const Steinberg::char16* str, Steinberg::char16 c) { +#warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); return nullptr; } @@ -327,7 +330,7 @@ static inline Steinberg::int32 strnicmp16 (const Steinberg::char16* str1, const CFIndex str1Len = Steinberg::strlen16 (str1); CFIndex str2Len = Steinberg::strlen16 (str2); - if (size < str2Len) // range is not applied to second string + if (static_cast (size) < str2Len) // range is not applied to second string str2Len = size; CFStringRef cfStr1 = CFStringCreateWithCharactersNoCopy (Steinberg::kCFAllocator, (UniChar*)str1, str1Len, kCFAllocatorNull); CFStringRef cfStr2 = CFStringCreateWithCharactersNoCopy (Steinberg::kCFAllocator, (UniChar*)str2, str2Len, kCFAllocatorNull); @@ -414,7 +417,7 @@ static inline Steinberg::int32 sprintf16 (Steinberg::char16* str, const Steinber return vsnwprintf (str, -1, format, marker); } -#endif +#endif // SMTG_OS_LINUX /* UTF-8 EF BB BF @@ -467,7 +470,7 @@ ConstString::ConstString (const ConstString& str, int32 offset, int32 length) //----------------------------------------------------------------------------- ConstString::ConstString (const FVariant& var) -: buffer (0) +: buffer (nullptr) , len (0) , isWide (0) { @@ -489,7 +492,7 @@ ConstString::ConstString (const FVariant& var) //----------------------------------------------------------------------------- ConstString::ConstString () -: buffer (0) +: buffer (nullptr) , len (0) , isWide (0) { @@ -1584,6 +1587,7 @@ char16 ConstString::toLower (char16 c) } return c; #elif SMTG_OS_LINUX + #warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); return c; #else @@ -1612,6 +1616,7 @@ char16 ConstString::toUpper (char16 c) } return c; #elif SMTG_OS_LINUX + #warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); return c; #else @@ -1629,7 +1634,7 @@ char8 ConstString::toLower (char8 c) ::CharLowerA (temp); return temp[0]; #else - return tolower (c); + return static_cast (tolower (c)); #endif } @@ -1643,7 +1648,7 @@ char8 ConstString::toUpper (char8 c) ::CharUpperA (temp); return temp[0]; #else - return toupper (c); + return static_cast (toupper (c)); #endif } @@ -1856,7 +1861,7 @@ static CFStringEncoding MBCodePageToCFStringEncoding (uint32 codePage) //----------------------------------------------------------------------------- int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int32 charCount, uint32 sourceCodePage) { - if (source == 0 || source[0] == 0) + if (source == nullptr || source[0] == 0) { if (dest && charCount > 0) { @@ -1889,7 +1894,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int #endif #if SMTG_OS_LINUX - if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_Utf8) + if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_US_ASCII || sourceCodePage == kCP_Utf8) { if (dest == nullptr) { @@ -1909,7 +1914,8 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int } } else - { + { +#warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); } @@ -1923,7 +1929,7 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage) { #if SMTG_OS_WINDOWS - return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, 0, 0); + return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, nullptr, nullptr); #elif SMTG_OS_MACOS int32 result = 0; @@ -1966,7 +1972,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, } } } - else if (destCodePage == kCP_ANSI) + else if (destCodePage == kCP_ANSI || destCodePage == kCP_US_ASCII) { if (dest == nullptr) { @@ -1989,7 +1995,8 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, } } else - { + { +#warning DEPRECATED No Linux implementation assert(false && "DEPRECATED No Linux implementation"); } return result; @@ -2012,7 +2019,7 @@ bool ConstString::isNormalized (UnicodeNormalization n) #ifdef UNICODE if (n != kUnicodeNormC) return false; - uint32 normCharCount = static_cast (FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0)); + uint32 normCharCount = static_cast (FoldString (MAP_PRECOMPOSED, buffer16, len, nullptr, 0)); return (normCharCount == len); #else return false; @@ -2115,7 +2122,7 @@ String::String (String&& str) //----------------------------------------------------------------------------- String& String::operator= (String&& str) { - SMTG_ASSERT (buffer == 0 || buffer != str.buffer); + SMTG_ASSERT (buffer == nullptr || buffer != str.buffer); tryFreeBuffer (); isWide = str.isWide; @@ -2143,7 +2150,7 @@ bool String::toWideString (uint32 sourceCodePage) { if (buffer8 && len > 0) { - int32 bytesNeeded = multiByteToWideString (0, buffer8, 0, sourceCodePage) * sizeof (char16); + int32 bytesNeeded = multiByteToWideString (nullptr, buffer8, 0, sourceCodePage) * sizeof (char16); if (bytesNeeded) { bytesNeeded += sizeof (char16); @@ -2227,7 +2234,7 @@ bool String::toMultiByte (uint32 destCodePage) { if (buffer16 && len > 0) { - int32 numChars = wideStringToMultiByte (0, buffer16, 0, destCodePage) + sizeof (char8); + int32 numChars = wideStringToMultiByte (nullptr, buffer16, 0, destCodePage) + sizeof (char8); char8* newStr = (char8*) malloc (numChars * sizeof (char8)); if (wideStringToMultiByte (newStr, buffer16, numChars, destCodePage) <= 0) { @@ -2263,7 +2270,7 @@ bool String::normalize (UnicodeNormalization n) if (isWide == false) return false; - if (buffer16 == 0) + if (buffer16 == nullptr) return true; #if SMTG_OS_WINDOWS @@ -2271,7 +2278,7 @@ bool String::normalize (UnicodeNormalization n) if (n != kUnicodeNormC) return false; - uint32 normCharCount = static_cast (FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0)); + uint32 normCharCount = static_cast (FoldString (MAP_PRECOMPOSED, buffer16, len, nullptr, 0)); if (normCharCount == len) return true; @@ -2320,7 +2327,7 @@ void String::tryFreeBuffer () if (buffer) { free (buffer); - buffer = 0; + buffer = nullptr; } } @@ -2348,7 +2355,7 @@ bool String::resize (uint32 newLength, bool wide, bool fill) if (newBufferSize != oldBufferSize) { void* newstr = realloc (buffer, newBufferSize); - if (newstr == 0) + if (newstr == nullptr) return false; buffer = newstr; if (isWide) @@ -2362,7 +2369,7 @@ bool String::resize (uint32 newLength, bool wide, bool fill) else { void* newstr = malloc (newBufferSize); - if (newstr == 0) + if (newstr == nullptr) return false; buffer = newstr; if (isWide) @@ -2520,7 +2527,7 @@ String& String::assign (const char8* str, int32 n, bool isTerminated) if (resize (n, false)) { - if (buffer8 && n > 0) + if (buffer8 && n > 0 && str) { memcpy (buffer8, str, n * sizeof (char8)); SMTG_ASSERT (buffer8[n] == 0) @@ -2547,7 +2554,7 @@ String& String::assign (const char16* str, int32 n, bool isTerminated) if (resize (n, true)) { - if (buffer16 && n > 0) + if (buffer16 && n > 0 && str) { memcpy (buffer16, str, n * sizeof (char16)); SMTG_ASSERT (buffer16[n] == 0) @@ -2628,7 +2635,7 @@ String& String::append (const char8* str, int32 n) if (!resize (newlen, false)) return *this; - if (buffer) + if (buffer && str) { memcpy (buffer8 + len, str, n * sizeof (char8)); SMTG_ASSERT (buffer8[newlen] == 0) @@ -2663,7 +2670,7 @@ String& String::append (const char16* str, int32 n) if (!resize (newlen, true)) return *this; - if (buffer16) + if (buffer16 && str) { memcpy (buffer16 + len, str, n * sizeof (char16)); SMTG_ASSERT (buffer16[newlen] == 0) @@ -2772,7 +2779,7 @@ String& String::insertAt (uint32 idx, const char8* str, int32 n) if (!resize (newlen, false)) return *this; - if (buffer) + if (buffer && str) { if (idx < len) memmove (buffer8 + idx + n, buffer8 + idx, (len - idx) * sizeof (char8)); @@ -2806,7 +2813,7 @@ String& String::insertAt (uint32 idx, const char16* str, int32 n) if (!resize (newlen, true)) return *this; - if (buffer) + if (buffer && str) { if (idx < len) memmove (buffer16 + idx + n, buffer16 + idx, (len - idx) * sizeof (char16)); @@ -2833,7 +2840,7 @@ String& String::replace (uint32 idx, int32 n1, const ConstString& str, int32 n2) //----------------------------------------------------------------------------- String& String::replace (uint32 idx, int32 n1, const char8* str, int32 n2) { - if (idx > len || str == 0) + if (idx > len || str == nullptr) return *this; if (isWide) @@ -2874,7 +2881,7 @@ String& String::replace (uint32 idx, int32 n1, const char8* str, int32 n2) //----------------------------------------------------------------------------- String& String::replace (uint32 idx, int32 n1, const char16* str, int32 n2) { - if (idx > len || str == 0) + if (idx > len || str == nullptr) return *this; if (!isWide) @@ -2911,7 +2918,7 @@ String& String::replace (uint32 idx, int32 n1, const char16* str, int32 n2) //----------------------------------------------------------------------------- int32 String::replace (const char8* toReplace, const char8* toReplaceWith, bool all, CompareMode m) { - if (toReplace == 0 || toReplaceWith == 0) + if (toReplace == nullptr || toReplaceWith == nullptr) return 0; int32 result = 0; @@ -2939,7 +2946,7 @@ int32 String::replace (const char8* toReplace, const char8* toReplaceWith, bool //----------------------------------------------------------------------------- int32 String::replace (const char16* toReplace, const char16* toReplaceWith, bool all, CompareMode m) { - if (toReplace == 0 || toReplaceWith == 0) + if (toReplace == nullptr || toReplaceWith == nullptr) return 0; int32 result = 0; @@ -3264,7 +3271,7 @@ static uint32 performRemoveChars (T* str, uint32 length, const T* toRemove) //----------------------------------------------------------------------------- bool String::removeChars8 (const char8* toRemove) { - if (isEmpty () || toRemove == 0) + if (isEmpty () || toRemove == nullptr) return true; if (isWide) @@ -3288,7 +3295,7 @@ bool String::removeChars8 (const char8* toRemove) //----------------------------------------------------------------------------- bool String::removeChars16 (const char16* toRemove) { - if (isEmpty () || toRemove == 0) + if (isEmpty () || toRemove == nullptr) return true; if (!isWide) @@ -3649,7 +3656,7 @@ void String::take (String& other) buffer = other.buffer; len = other.len; - other.buffer = 0; + other.buffer = nullptr; other.len = 0; } @@ -3667,7 +3674,7 @@ void* String::pass () { void* res = buffer; len = 0; - buffer = 0; + buffer = nullptr; return res; } @@ -3857,11 +3864,11 @@ uint32 hashString16 (const char16* s, uint32 m) //------------------------------------------------------------------------ template int32 tstrnatcmp (const T* s1, const T* s2, bool caseSensitive = true) { - if (s1 == 0 && s2 == 0) + if (s1 == nullptr && s2 == nullptr) return 0; - else if (s1 == 0) + else if (s1 == nullptr) return -1; - else if (s2 == 0) + else if (s2 == nullptr) return 1; while (*s1 && *s2) @@ -3907,8 +3914,8 @@ template int32 tstrnatcmp (const T* s1, const T* s2, bool caseSensitiv { if (caseSensitive == false) { - T srcToUpper = toupper (*s1); - T dstToUpper = toupper (*s2); + T srcToUpper = static_cast (toupper (*s1)); + T dstToUpper = static_cast (toupper (*s2)); if (srcToUpper != dstToUpper) return (int32)(srcToUpper - dstToUpper); } diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.h index d1ba2b3897..80ff82acfc 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/fstring.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -44,7 +44,7 @@ #include "base/source/fobject.h" -#include +#include namespace Steinberg { @@ -126,7 +126,7 @@ public: // access ----------------------------------------------------------------- virtual int32 length () const {return static_cast (len);} ///< Return length of string - inline bool isEmpty () const {return buffer == 0 || len == 0;} ///< Return true if string is empty + inline bool isEmpty () const {return buffer == nullptr || len == 0;} ///< Return true if string is empty operator const char8* () const {return text8 ();} ///< Returns pointer to string of type char8 (no modification allowed) operator const char16* () const {return text16 ();} ///< Returns pointer to string of type char16(no modification allowed) @@ -307,6 +307,7 @@ Extends class ConstString by operations which allow modifications. class String : public ConstString { public: + //----------------------------------------------------------------------------- String (); String (const char8* str, MBCodePage codepage, int32 n = -1, bool isTerminated = true); ///< assign n characters of str and convert to wide string by using the specified codepage @@ -325,10 +326,10 @@ public: // access------------------------------------------------------------------ void updateLength (); ///< Call this when the string is truncated outside (not recommended though) - virtual const char8* text8 () const SMTG_OVERRIDE; - virtual const char16* text16 () const SMTG_OVERRIDE; - virtual char8 getChar8 (uint32 index) const SMTG_OVERRIDE; - virtual char16 getChar16 (uint32 index) const SMTG_OVERRIDE; + const char8* text8 () const SMTG_OVERRIDE; + const char16* text16 () const SMTG_OVERRIDE; + char8 getChar8 (uint32 index) const SMTG_OVERRIDE; + char16 getChar16 (uint32 index) const SMTG_OVERRIDE; bool setChar8 (uint32 index, char8 c); bool setChar16 (uint32 index, char16 c); @@ -725,18 +726,18 @@ public: using String::operator=; // IStringResult ---------------------------------------------------------- - virtual void PLUGIN_API setText (const char8* text) SMTG_OVERRIDE; + void PLUGIN_API setText (const char8* text) SMTG_OVERRIDE; //------------------------------------------------------------------------- // IString----------------------------------------------------------------- - virtual void PLUGIN_API setText8 (const char8* text) SMTG_OVERRIDE; - virtual void PLUGIN_API setText16 (const char16* text) SMTG_OVERRIDE; + void PLUGIN_API setText8 (const char8* text) SMTG_OVERRIDE; + void PLUGIN_API setText16 (const char16* text) SMTG_OVERRIDE; - virtual const char8* PLUGIN_API getText8 () SMTG_OVERRIDE; - virtual const char16* PLUGIN_API getText16 () SMTG_OVERRIDE; + const char8* PLUGIN_API getText8 () SMTG_OVERRIDE; + const char16* PLUGIN_API getText16 () SMTG_OVERRIDE; - virtual void PLUGIN_API take (void* s, bool _isWide) SMTG_OVERRIDE; - virtual bool PLUGIN_API isWideString () const SMTG_OVERRIDE; + void PLUGIN_API take (void* s, bool _isWide) SMTG_OVERRIDE; + bool PLUGIN_API isWideString () const SMTG_OVERRIDE; //------------------------------------------------------------------------- OBJ_METHODS (StringObject, FObject) diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.cpp index 904e75ccd2..9213ebc95a 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -128,28 +128,28 @@ struct UpdateData }; //------------------------------------------------------------------------ -typedef std::deque DeferedChangeList; -typedef DeferedChangeList::const_iterator DeferedChangeListIterConst; -typedef DeferedChangeList::iterator DeferedChangeListIter; +using DeferedChangeList = std::deque; +using DeferedChangeListIterConst = DeferedChangeList::const_iterator; +using DeferedChangeListIter = DeferedChangeList::iterator; -typedef std::deque UpdateDataList; -typedef UpdateDataList::const_iterator UpdateDataListIterConst; +using UpdateDataList = std::deque; +using UpdateDataListIterConst = UpdateDataList::const_iterator; #if CLASS_NAME_TRACKED -typedef std::vector DependentList; +using DependentList = std::vector; #else typedef std::vector DependentList; #endif -typedef DependentList::iterator DependentListIter; -typedef DependentList::const_iterator DependentListIterConst; +using DependentListIter = DependentList::iterator; +using DependentListIterConst = DependentList::const_iterator; #if SMTG_CPP11_STDLIBSUPPORT -typedef std::unordered_map DependentMap; +using DependentMap = std::unordered_map; #else typedef std::map DependentMap; #endif -typedef DependentMap::iterator DependentMapIter; -typedef DependentMap::const_iterator DependentMapIterConst; +using DependentMapIter = DependentMap::iterator; +using DependentMapIterConst = DependentMap::const_iterator; struct Table { @@ -261,7 +261,7 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe for (uint32 count = 0; count < (*iter).count; count++) { if ((*iter).dependents[count] == dependent) - (*iter).dependents[count] = 0; + (*iter).dependents[count] = nullptr; } } ++iter; @@ -277,6 +277,8 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe { Update::DependentList& list = (*iterMap).second; Update::DependentListIter iterList = list.begin (); + bool listIsEmpty = false; + while (iterList != list.end ()) { #if CLASS_NAME_TRACKED @@ -285,14 +287,24 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe if ((*iterList) == dependent) #endif { - iterList = list.erase (iterList); + if (list.size () == 1u) + { + listIsEmpty = true; + break; + } + else + iterList = list.erase (iterList); } else { ++iterList; } } - ++iterMap; + + if (listIsEmpty) + iterMap = map.erase (iterMap); + else + ++iterMap; } } } @@ -594,7 +606,7 @@ tresult PLUGIN_API UpdateHandler::cancelUpdates (FUnknown* u) FGuard guard (lock); Update::DeferedChange change (unknown, 0); - while (1) + while (true) { auto iter = std::find (table->defered.begin (), table->defered.end (), change); if (iter != table->defered.end ()) diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.h index 59d8126381..538022e62f 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/source/updatehandler.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -57,7 +57,7 @@ public: /** cancel pending messages send by \param object or by any if object is 0 */ virtual tresult PLUGIN_API cancelUpdates (FUnknown* object) = 0; /** send pending messages send by \param object or by any if object is 0 */ - virtual tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = 0) = 0; + virtual tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = nullptr) = 0; static const FUID iid; }; @@ -86,20 +86,20 @@ public: // IUpdateHandler /** register \param dependent to get messages from \param object */ - virtual tresult PLUGIN_API addDependent (FUnknown* object, IDependent* dependent) SMTG_OVERRIDE; + tresult PLUGIN_API addDependent (FUnknown* object, IDependent* dependent) SMTG_OVERRIDE; /** unregister \param dependent to get no messages from \param object */ - virtual tresult PLUGIN_API removeDependent (FUnknown* object, + tresult PLUGIN_API removeDependent (FUnknown* object, IDependent* dependent) SMTG_OVERRIDE; /** send \param message to all dependents of \param object immediately */ - virtual tresult PLUGIN_API triggerUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE; + tresult PLUGIN_API triggerUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE; /** send \param message to all dependents of \param object when idle */ - virtual tresult PLUGIN_API deferUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE; + tresult PLUGIN_API deferUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE; // IUpdateManager /** cancel pending messages send by \param object or by any if object is 0 */ - virtual tresult PLUGIN_API cancelUpdates (FUnknown* object) SMTG_OVERRIDE; + tresult PLUGIN_API cancelUpdates (FUnknown* object) SMTG_OVERRIDE; /** send pending messages send by \param object or by any if object is 0 */ - virtual tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = 0) SMTG_OVERRIDE; + tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = nullptr) SMTG_OVERRIDE; /// @cond ignore // obsolete functions kept for compatibility diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/include/flock.h b/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/include/flock.h index ae26df6967..bc452502a2 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/include/flock.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/include/flock.h @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -102,9 +102,9 @@ public: ~FLock (); //-- ILock ----------------------------------------------------------- - virtual void lock () SMTG_OVERRIDE; - virtual void unlock () SMTG_OVERRIDE; - virtual bool trylock () SMTG_OVERRIDE; + void lock () SMTG_OVERRIDE; + void unlock () SMTG_OVERRIDE; + bool trylock () SMTG_OVERRIDE; //------------------------------------------------------------------------ protected: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/source/flock.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/source/flock.cpp index a0e735b60e..8135cb6c7e 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/source/flock.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/base/thread/source/flock.cpp @@ -9,7 +9,7 @@ // //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -55,7 +55,7 @@ #define INIT_CS(cs) \ InitializeCriticalSection ((LPCRITICAL_SECTION)&cs); -#endif +#endif // SMTG_OS_WINDOWS namespace Steinberg { namespace Base { diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/LICENSE.txt b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/LICENSE.txt index 9e57394dde..b5fddfe769 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/LICENSE.txt +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/LICENSE.txt @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- // LICENSE -// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved +// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved //----------------------------------------------------------------------------- This license applies only to files referencing this license, for other files of the Software Development Kit the respective embedded license text diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/README.md b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/README.md index d799955a3d..7be410549f 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/README.md +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/README.md @@ -1,7 +1,10 @@ -# Welcome to VST SDK 3 Interfaces +# Welcome to VST 3 SDK Interfaces Here are located all VST interfaces definitions (including VST Component/Controller, UI, Test). ## License & Usage guidelines -More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) \ No newline at end of file +More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3) + +---- +Return to [VST 3 SDK](https://github.com/steinbergmedia/vst3sdk) \ No newline at end of file diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/conststringtable.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/conststringtable.h index 177d32712a..e19cae6512 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/conststringtable.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/conststringtable.h @@ -24,7 +24,6 @@ namespace Steinberg { /** Constant unicode string table. Used for conversion from ASCII string literals to char16. */ -//------------------------------------------------------------------------ class ConstStringTable { public: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/falignpush.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/falignpush.h index bd768939bf..5ff11f22ce 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/falignpush.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/falignpush.h @@ -16,15 +16,13 @@ //---------------------------------------------------------------------------------------------- #if SMTG_OS_MACOS - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wunknown-warning-option" + #pragma GCC diagnostic ignored "-Wunknown-warning-option" #pragma GCC diagnostic ignored "-Wpragma-pack" #if SMTG_PLATFORM_64 #pragma pack(push, 16) #else #pragma pack(push, 1) #endif - #pragma GCC diagnostic pop #elif defined __BORLANDC__ #pragma -a8 #elif SMTG_OS_WINDOWS diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h index 3a93738937..dea70d0f79 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h @@ -49,22 +49,31 @@ #define SMTG_OS_IOS 0 #define SMTG_OS_OSX 0 + #define SMTG_CPU_X86 _M_IX86 + #define SMTG_CPU_X86_64 _M_AMD64 + #define SMTG_CPU_ARM (_M_ARM && !_M_ARM64) + #define SMTG_CPU_ARM_64 _M_ARM64 + #define BYTEORDER kLittleEndian #define COM_COMPATIBLE 1 #define PLUGIN_API __stdcall #define SMTG_PTHREADS 0 + #define SMTG_EXPORT_SYMBOL __declspec (dllexport) + #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif - #pragma warning (disable : 4244) // Conversion from 'type1' to 'type2', possible loss of data. - #pragma warning (disable : 4250) // Inheritance via dominance is allowed - #pragma warning (disable : 4996) // deprecated functions + #ifdef _MSC_VER + #pragma warning (disable : 4244) // Conversion from 'type1' to 'type2', possible loss of data. + #pragma warning (disable : 4250) // Inheritance via dominance is allowed + #pragma warning (disable : 4996) // deprecated functions - #pragma warning (3 : 4189) // local variable is initialized but not referenced - #pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue + #pragma warning (3 : 4189) // local variable is initialized but not referenced + #pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue + #endif #if defined (_WIN64) || defined (_M_ARM64) #define SMTG_PLATFORM_64 1 @@ -86,13 +95,18 @@ //----------------------------------------------------------------------------- // LINUX //----------------------------------------------------------------------------- -#elif __gnu_linux__ +#elif __gnu_linux__ || __linux__ #define SMTG_OS_LINUX 1 #define SMTG_OS_MACOS 0 #define SMTG_OS_WINDOWS 0 #define SMTG_OS_IOS 0 #define SMTG_OS_OSX 0 + #define SMTG_CPU_X86 __i386__ + #define SMTG_CPU_X86_64 __x86_64__ + #define SMTG_CPU_ARM __arm__ + #define SMTG_CPU_ARM_64 __aarch64__ + #include #if __BYTE_ORDER == __LITTLE_ENDIAN #define BYTEORDER kLittleEndian @@ -104,6 +118,8 @@ #define PLUGIN_API #define SMTG_PTHREADS 1 + #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default"))) + #if __LP64__ #define SMTG_PLATFORM_64 1 #else @@ -115,7 +131,11 @@ #ifndef SMTG_CPP11 #error unsupported compiler #endif - #define SMTG_CPP11_STDLIBSUPPORT 1 + #if defined(__GNUG__) && __GNUG__ < 8 + #define SMTG_CPP11_STDLIBSUPPORT 0 + #else + #define SMTG_CPP11_STDLIBSUPPORT 1 + #endif #define SMTG_HAS_NOEXCEPT 1 #endif //----------------------------------------------------------------------------- @@ -129,6 +149,11 @@ #define SMTG_OS_IOS TARGET_OS_IPHONE #define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE + #define SMTG_CPU_X86 TARGET_CPU_X86 + #define SMTG_CPU_X86_64 TARGET_CPU_X86_64 + #define SMTG_CPU_ARM TARGET_CPU_ARM + #define SMTG_CPU_ARM_64 TARGET_CPU_ARM64 + #if !SMTG_OS_IOS #ifndef __CF_USE_FRAMEWORK_INCLUDES__ #define __CF_USE_FRAMEWORK_INCLUDES__ @@ -152,6 +177,8 @@ #define PLUGIN_API #define SMTG_PTHREADS 1 + #define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default"))) + #if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS) #ifdef __clang__ #pragma GCC diagnostic ignored "-Wswitch-enum" @@ -209,8 +236,10 @@ //----------------------------------------------------------------------------- #if SMTG_CPP11 #define SMTG_OVERRIDE override +#define SMTG_CONSTEXPR constexpr #else #define SMTG_OVERRIDE +#define SMTG_CONSTEXPR #endif #if SMTG_HAS_NOEXCEPT #define SMTG_NOEXCEPT noexcept diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fstrdefs.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fstrdefs.h index 2a5882a051..00eaa1de98 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fstrdefs.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fstrdefs.h @@ -19,7 +19,7 @@ #include "ftypes.h" //---------------------------------------------------------------------------- -// string methods defines unicode / ASCII +/** string methods defines unicode / ASCII */ //---------------------------------------------------------------------------- // 16 bit string operations @@ -265,10 +265,8 @@ inline void str8ToStr16 (char16* dst, const char8* src, int32 n = -1) #else dst[i] = static_cast (src[i]); #endif - if (src[i] == 0) break; - i++; } diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ftypes.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ftypes.h index feda6b0b9b..1f95bd116d 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ftypes.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ftypes.h @@ -93,6 +93,8 @@ namespace Steinberg typedef char char8; #ifdef _NATIVE_WCHAR_T_DEFINED typedef __wchar_t char16; +#elif defined(__MINGW32__) + typedef wchar_t char16; #elif SMTG_CPP11 typedef char16_t char16; #else @@ -137,8 +139,8 @@ namespace Steinberg //---------------------------------------------------------------------------- -/** Byte-order Conversion Macros */ -//---------------------------------------------------------------------------- +/** Byte-order Conversion Macros +*/ #define SWAP_32(l) { \ unsigned char* p = (unsigned char*)& (l); \ unsigned char t; \ @@ -170,7 +172,7 @@ namespace Steinberg // always inline macros (only when RELEASE is 1) //---------------------------------------------------------------------------- #if RELEASE - #if SMTG_OS_MACOS || SMTG_OS_LINUX + #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__) #define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__)) #define SMTG_NEVER_INLINE __attribute__((noinline)) #elif SMTG_OS_WINDOWS diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp index 206a64afcf..23ca64e6cb 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp @@ -18,7 +18,7 @@ #include "fstrdefs.h" -#include +#include #if SMTG_OS_WINDOWS #include @@ -26,18 +26,38 @@ #if SMTG_OS_MACOS #include -#include +#if !defined (SMTG_USE_STDATOMIC_H) +#if defined(MAC_OS_X_VERSION_10_11) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) +#define SMTG_USE_STDATOMIC_H (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11) +#else +#define SMTG_USE_STDATOMIC_H 0 +#endif +#endif // !defined (SMTG_USE_STDATOMIC_H) + +#if !SMTG_USE_STDATOMIC_H +#include #if defined(__GNUC__) && (__GNUC__ >= 4) && !__LP64__ // on 32 bit Mac OS X we can safely ignore the format warnings as sizeof(int) == sizeof(long) #pragma GCC diagnostic ignored "-Wformat" -#endif - -#endif +#endif +#endif // !SMTG_USE_STDATOMIC_H +#endif // SMTG_OS_MACOS #if SMTG_OS_LINUX +#if !defined (SMTG_USE_STDATOMIC_H) +#if defined (__ANDROID__) || defined(_LIBCPP_VERSION) +#define SMTG_USE_STDATOMIC_H 1 +#else #include #endif +#endif // !defined (SMTG_USE_STDATOMIC_H) +#include +#endif + +#if defined (SMTG_USE_STDATOMIC_H) && SMTG_USE_STDATOMIC_H +#include +#endif namespace Steinberg { @@ -67,10 +87,19 @@ namespace FUnknownPrivate { //------------------------------------------------------------------------ int32 PLUGIN_API atomicAdd (int32& var, int32 d) { +#if SMTG_USE_STDATOMIC_H + return atomic_fetch_add (reinterpret_cast (&var), d) + d; +#else #if SMTG_OS_WINDOWS - return InterlockedExchangeAdd (&var, d) + d; +#ifdef __MINGW32__ + return InterlockedExchangeAdd (reinterpret_cast(&var), d) + d; +#else + return InterlockedExchangeAdd ((LONG*)&var, d) + d; +#endif #elif SMTG_OS_MACOS return OSAtomicAdd32Barrier (d, (int32_t*)&var); +#elif defined(__ANDROID__) + return atomic_fetch_add ((atomic_int*)&var, d) + d; #elif SMTG_OS_LINUX __gnu_cxx::__atomic_add (&var, d); return var; @@ -79,6 +108,7 @@ int32 PLUGIN_API atomicAdd (int32& var, int32 d) var += d; return var; #endif +#endif } } // FUnknownPrivate @@ -131,7 +161,7 @@ bool FUID::generate () { case RPC_S_OK: memcpy (data, (char*)&guid, sizeof (TUID)); return true; - case RPC_S_UUID_LOCAL_ONLY: + case (HRESULT)RPC_S_UUID_LOCAL_ONLY: default: return false; } #endif @@ -147,7 +177,13 @@ bool FUID::generate () } return false; +#elif SMTG_OS_LINUX + srand ((size_t)this); + for (int32 i = 0; i < 16; i++) + data[i] = static_cast(rand ()); + return true; #else +#warning implement me! return false; #endif } @@ -263,7 +299,7 @@ void FUID::toString (char8* string) const return; #if COM_COMPATIBLE - GuidStruct* g = (GuidStruct*)data; + auto* g = (GuidStruct*)data; char8 s[17]; Steinberg::toString8 (s, data, 8, 16); @@ -349,7 +385,7 @@ void FUID::toRegistryString (char8* string) const // e.g. {c200e360-38c5-11ce-ae62-08002b2b79ef} #if COM_COMPATIBLE - GuidStruct* g = (GuidStruct*)data; + auto* g = (GuidStruct*)data; char8 s1[5]; Steinberg::toString8 (s1, data, 8, 10); diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.h index 98df20e7b5..d5a5cfc62f 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.h @@ -19,12 +19,15 @@ #include "pluginterfaces/base/fplatform.h" #include "pluginterfaces/base/ftypes.h" #include "pluginterfaces/base/smartpointer.h" -#include +#include + +#if SMTG_CPP11_STDLIBSUPPORT +#include +#endif //------------------------------------------------------------------------ /*! \defgroup pluginBase Basic Interfaces */ -//------------------------------------------------------------------------ //------------------------------------------------------------------------ // Unique Identifier macros @@ -33,26 +36,26 @@ #if COM_COMPATIBLE #define INLINE_UID(l1, l2, l3, l4) \ { \ - (::Steinberg::int8)((l1 & 0x000000FF) ), (::Steinberg::int8)((l1 & 0x0000FF00) >> 8), \ - (::Steinberg::int8)((l1 & 0x00FF0000) >> 16), (::Steinberg::int8)((l1 & 0xFF000000) >> 24), \ - (::Steinberg::int8)((l2 & 0x00FF0000) >> 16), (::Steinberg::int8)((l2 & 0xFF000000) >> 24), \ - (::Steinberg::int8)((l2 & 0x000000FF) ), (::Steinberg::int8)((l2 & 0x0000FF00) >> 8), \ - (::Steinberg::int8)((l3 & 0xFF000000) >> 24), (::Steinberg::int8)((l3 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l3 & 0x0000FF00) >> 8), (::Steinberg::int8)((l3 & 0x000000FF) ), \ - (::Steinberg::int8)((l4 & 0xFF000000) >> 24), (::Steinberg::int8)((l4 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l4 & 0x0000FF00) >> 8), (::Steinberg::int8)((l4 & 0x000000FF) ) \ + (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x000000FF) ), (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x0000FF00) >> 8), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x00FF0000) >> 16), (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0xFF000000) >> 24), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x00FF0000) >> 16), (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0xFF000000) >> 24), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x000000FF) ), (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x0000FF00) >> 8), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x000000FF) ), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x000000FF) ) \ } #else #define INLINE_UID(l1, l2, l3, l4) \ { \ - (::Steinberg::int8)((l1 & 0xFF000000) >> 24), (::Steinberg::int8)((l1 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l1 & 0x0000FF00) >> 8), (::Steinberg::int8)((l1 & 0x000000FF) ), \ - (::Steinberg::int8)((l2 & 0xFF000000) >> 24), (::Steinberg::int8)((l2 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l2 & 0x0000FF00) >> 8), (::Steinberg::int8)((l2 & 0x000000FF) ), \ - (::Steinberg::int8)((l3 & 0xFF000000) >> 24), (::Steinberg::int8)((l3 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l3 & 0x0000FF00) >> 8), (::Steinberg::int8)((l3 & 0x000000FF) ), \ - (::Steinberg::int8)((l4 & 0xFF000000) >> 24), (::Steinberg::int8)((l4 & 0x00FF0000) >> 16), \ - (::Steinberg::int8)((l4 & 0x0000FF00) >> 8), (::Steinberg::int8)((l4 & 0x000000FF) ) \ + (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l1) & 0x000000FF) ), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l2) & 0x000000FF) ), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l3) & 0x000000FF) ), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0xFF000000) >> 24), (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x00FF0000) >> 16), \ + (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x0000FF00) >> 8), (::Steinberg::int8)(((::Steinberg::uint32)(l4) & 0x000000FF) ) \ } #endif @@ -117,7 +120,12 @@ public: \ //------------------------------------------------------------------------ #define FUNKNOWN_CTOR { __funknownRefCount = 1; } +#if SMTG_FUNKNOWN_DTOR_ASSERT +#include +#define FUNKNOWN_DTOR { assert (__funknownRefCount == 0); } +#else #define FUNKNOWN_DTOR +#endif //------------------------------------------------------------------------ #define QUERY_INTERFACE(iid, obj, InterfaceIID, InterfaceName) \ @@ -221,7 +229,6 @@ int32 PLUGIN_API atomicAdd (int32& value, int32 amount); Each interface declares its identifier as static member inside the interface namespace (e.g. FUnknown::iid). */ -//------------------------------------------------------------------------ class FUID { public: @@ -258,14 +265,14 @@ public: void from4Int (uint32 d1, uint32 d2, uint32 d3, uint32 d4); void to4Int (uint32& d1, uint32& d2, uint32& d3, uint32& d4) const; - typedef char8 String[64]; + typedef char8 String[33]; /** Converts UID to a string. The string will be 32 characters long, representing the hexadecimal values of each data byte (e.g. "9127BE30160E4BB69966670AA6087880"). Typical use-case is: - \code + \code{.cpp} char8[33] strUID = {0}; FUID uid; if (uid.generate ()) @@ -279,11 +286,11 @@ public: the ASCII-encoded hexadecimal value of the corresponding data byte. */ bool fromString (const char8* string); - /** Converts UID to a string in Microsoft® OLE format. + /** Converts UID to a string in Microsoft(R) OLE format. (e.g. "{c200e360-38c5-11ce-ae62-08002b2b79ef}") */ void toRegistryString (char8* string) const; - /** Sets the UID data from a string in Microsoft® OLE format. */ + /** Sets the UID data from a string in Microsoft(R) OLE format. */ bool fromRegistryString (const char8* string); enum UIDPrintStyle @@ -348,8 +355,8 @@ inline bool operator== (const FUID& f1, T f2) Interfaces are identified by 16 byte Globally Unique Identifiers. The SDK provides a class called FUID for this purpose. -\ref howtoClass */ -//------------------------------------------------------------------------ +\ref howtoClass +*/ class FUnknown { public: @@ -362,12 +369,12 @@ public: \param obj : (out) On return, *obj points to the requested interface */ virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) = 0; - /** Adds a reference and return the new reference count. + /** Adds a reference and returns the new reference count. \par Remarks: The initial reference count after creating an object is 1. */ virtual uint32 PLUGIN_API addRef () = 0; - /** Releases a reference and return the new reference count. + /** Releases a reference and returns the new reference count. If the reference count reaches zero, the object will be destroyed in memory. */ virtual uint32 PLUGIN_API release () = 0; @@ -384,14 +391,13 @@ DECLARE_CLASS_IID (FUnknown, 0x00000000, 0x00000000, 0xC0000000, 0x00000046) //------------------------------------------------------------------------ /** FUnknownPtr - automatic interface conversion and smart pointer in one. This template class can be used for interface conversion like this: - \code - IPtr path = owned (FHostCreate (IPath, hostClasses)); - FUnknownPtr path2 (path); // does a query interface for IPath2 - if (path2) - ... + \code{.cpp} +IPtr path = owned (FHostCreate (IPath, hostClasses)); +FUnknownPtr path2 (path); // does a query interface for IPath2 +if (path2) + ... \endcode */ -//------------------------------------------------------------------------ template class FUnknownPtr : public IPtr { @@ -408,13 +414,83 @@ public: } inline I* operator= (FUnknown* unknown); inline I* getInterface () { return this->ptr; } + +#if SMTG_CPP11_STDLIBSUPPORT + inline FUnknownPtr (FUnknownPtr&& p) SMTG_NOEXCEPT : IPtr (std::move (p)) {} + inline FUnknownPtr& operator= (FUnknownPtr&& p) SMTG_NOEXCEPT + { + IPtr::operator= (std::move (p)); + return *this; + } +#endif +}; + +#if SMTG_CPP11_STDLIBSUPPORT + +//------------------------------------------------------------------------ +namespace FUnknownPrivate { + +template +struct Void : std::false_type +{ + using Type = void; +}; + +template +using VoidT = typename Void::Type; + +//------------------------------------------------------------------------ +/** + * This type trait detects if a class has an @c iid member variable. It is used to detect if + * the FUID and DECLARE_CLASS_IID method or the SKI::UID method is used. + */ +template +struct HasIIDType : std::false_type +{ +}; + +//------------------------------------------------------------------------ +template +struct HasIIDType> : std::true_type +{ }; +//------------------------------------------------------------------------ +} // FUnknownPrivate + +//------------------------------------------------------------------------ +/** @return the TUID for a SKI interface which uses the SKI::UID method. */ +template ::value>::type* = nullptr> +const TUID& getTUID () +{ + return T::IID::toTUID (); +} + +//------------------------------------------------------------------------ +/** @return the TUID for a SKI interface which uses the FUID and DECLARE_CLASS_IID method. */ +template ::value>::type* = nullptr> +const TUID& getTUID () +{ + return T::iid.toTUID (); +} + +#else // SMTG_CPP11_STDLIBSUPPORT + +template +const TUID& getTUID () +{ + return T::iid.toTUID (); +} + +#endif // SMTG_CPP11_STDLIBSUPPORT + //------------------------------------------------------------------------ template inline FUnknownPtr::FUnknownPtr (FUnknown* unknown) { - if (unknown && unknown->queryInterface (I::iid, (void**)&this->ptr) != kResultOk) + if (unknown && unknown->queryInterface (getTUID (), (void**)&this->ptr) != kResultOk) this->ptr = 0; } @@ -423,7 +499,7 @@ template inline I* FUnknownPtr::operator= (FUnknown* unknown) { I* newPtr = 0; - if (unknown && unknown->queryInterface (I::iid, (void**)&newPtr) == kResultOk) + if (unknown && unknown->queryInterface (getTUID (), (void**)&newPtr) == kResultOk) { OPtr rel (newPtr); return IPtr::operator= (newPtr); @@ -440,26 +516,25 @@ This class is obsolete and is only kept for compatibility. The replacement for FReleaser is OPtr. Usage example with FReleaser: - \code - void someFunction () - { - IPath* path = pathCreateMethod (); - FReleaser releaser (path); - .... do something with path... - .... path not used anymore, releaser will destroy it when leaving function scope - } - \endcode +\code{.cpp} +void someFunction () +{ + IPath* path = pathCreateMethod (); + FReleaser releaser (path); + .... do something with path... + .... path not used anymore, releaser will destroy it when leaving function scope +} +\endcode Usage example with OPtr: - \code - void someFunction () - { - OPtr path = pathCreateMethod (); - .... do something with path... - .... path not used anymore, OPtr will destroy it when leaving function scope - } - \endcode +\code{.cpp} +void someFunction () +{ + OPtr path = pathCreateMethod (); + .... do something with path... + .... path not used anymore, OPtr will destroy it when leaving function scope +} +\endcode */ -//------------------------------------------------------------------------ struct FReleaser { FReleaser (FUnknown* u) : u (u) {} diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fvariant.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fvariant.h index a0008b62f7..491c93fbf0 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fvariant.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fvariant.h @@ -138,10 +138,10 @@ public: return (type & kInteger) ? static_cast (intValue) : (type & kFloat) ? floatValue : 0.; } - inline const char8* getString8 () const { return (type & kString8) ? string8 : 0; } - inline const char16* getString16 () const { return (type & kString16) ? string16 : 0; } + inline const char8* getString8 () const { return (type & kString8) ? string8 : nullptr; } + inline const char16* getString16 () const { return (type & kString16) ? string16 : nullptr; } - inline FUnknown* getObject () const { return (type & kObject) ? object : 0; } + inline FUnknown* getObject () const { return (type & kObject) ? object : nullptr; } inline uint16 getType () const { return static_cast (type & ~(kOwner)); } inline bool isEmpty () const { return getType () == kEmpty; } @@ -274,7 +274,7 @@ inline FVariant& FVariant::operator= (const FVariant& variant) } else if ((type & kString16) && variant.string16) { - int32 len = strlen16 (variant.string16); + auto len = static_cast (strlen16 (variant.string16)); string16 = new char16[len + 1]; char16* tmp = const_cast (string16); memcpy (tmp, variant.string16, len * sizeof (char16)); diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ibstream.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ibstream.h index 6219255014..f25fd78bd2 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ibstream.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ibstream.h @@ -26,8 +26,6 @@ namespace Steinberg { - read/write binary data from/to stream - get/set stream read-write position (read and write position is the same) */ -//------------------------------------------------------------------------ - class IBStream: public FUnknown { public: @@ -43,19 +41,19 @@ public: \param buffer : destination buffer \param numBytes : amount of bytes to be read \param numBytesRead : result - how many bytes have been read from stream (set to 0 if this is of no interest) */ - virtual tresult PLUGIN_API read (void* buffer, int32 numBytes, int32* numBytesRead = 0) = 0; + virtual tresult PLUGIN_API read (void* buffer, int32 numBytes, int32* numBytesRead = nullptr) = 0; /** Writes binary data to stream. \param buffer : source buffer \param numBytes : amount of bytes to write \param numBytesWritten : result - how many bytes have been written to stream (set to 0 if this is of no interest) */ - virtual tresult PLUGIN_API write (void* buffer, int32 numBytes, int32* numBytesWritten = 0) = 0; + virtual tresult PLUGIN_API write (void* buffer, int32 numBytes, int32* numBytesWritten = nullptr) = 0; /** Sets stream read-write position. \param pos : new stream position (dependent on mode) \param mode : value of enum IStreamSeekMode \param result : new seek position (set to 0 if this is of no interest) */ - virtual tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result = 0) = 0; + virtual tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result = nullptr) = 0; /** Gets current stream read-write position. \param pos : is assigned the current position if function succeeds */ @@ -69,8 +67,8 @@ DECLARE_CLASS_IID (IBStream, 0xC3BF6EA2, 0x30994752, 0x9B6BF990, 0x1EE33E9B) //------------------------------------------------------------------------ /** Stream with a size. \ingroup pluginBase -[extends IBStream] when stream type supports it (like file and memory stream) */ -//------------------------------------------------------------------------ +[extends IBStream] when stream type supports it (like file and memory stream) +*/ class ISizeableStream: public FUnknown { public: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/icloneable.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/icloneable.h index 98b62821e3..f698a69241 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/icloneable.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/icloneable.h @@ -22,10 +22,9 @@ namespace Steinberg { //------------------------------------------------------------------------ /** Interface allowing an object to be copied. -[plug & host imp] \n -[released: N4.12] \n +- [plug & host imp] +- [released: N4.12] */ -//------------------------------------------------------------------------ class ICloneable : public FUnknown { public: diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ipersistent.h b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ipersistent.h index 5da3cc7802..9572d0f2cf 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ipersistent.h +++ b/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/ipersistent.h @@ -29,9 +29,9 @@ This interface is used to store/restore attributes of an object. An IPlugController can implement this interface to handle presets. The gui-xml for a preset control looks like this: \code - .... - - .... +.... + +....