From: IOhannes m zmölnig Date: Sat, 28 Jan 2023 18:41:09 +0000 (+0100) Subject: New upstream version 7.0.5+ds X-Git-Tag: archive/raspbian/7.0.5+ds-1+rpi1^2~14^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d7d4f460a995d5b7a3f866f04e5404c271cce24e;p=juce.git New upstream version 7.0.5+ds --- diff --git a/BREAKING-CHANGES.txt b/BREAKING-CHANGES.txt index 000e4d36..973f3e07 100644 --- a/BREAKING-CHANGES.txt +++ b/BREAKING-CHANGES.txt @@ -1,6 +1,232 @@ JUCE breaking changes ===================== +Version 7.0.3 +============= + +Change +------ +The default macOS and iOS deployment targets set by the Projucer have been +increased to macOS 10.13 and iOS 11 respectively. + +Possible Issues +--------------- +Projects using the Projucer's default minimum deployment target will have their +minimum deployment target increased. + +Workaround +---------- +If you need a lower minimum deployment target then you must set this in the +Projucer's Xcode build configuration settings. + +Rationale +--------- +Xcode 14 no longer supports deployment targets lower than macOS 10.13 and iOS +11. + + +Change +------ +The ARA SDK expected by JUCE has been updated to version 2.2.0. + +Possible Issues +--------------- +Builds using earlier versions of the ARA SDK will fail to compile. + +Workaround +---------- +The ARA SDK configured in JUCE must be updated to version 2.2.0. + +Rationale +--------- +Version 2.2.0 is the latest official release of the ARA SDK. + + +Change +------ +The Thread::startThread (int) and Thread::setPriority (int) methods have been +removed. A new Thread priority API has been introduced. + +Possible Issues +--------------- +Code will fail to compile. + +Workaround +---------- +Rather than using an integer thread priority you must instead use a value from +the Thread::Priority enum. Thread::setPriority and Thread::getPriority should +only be called from the target thread. To start a Thread with a realtime +performance profile you must call startRealtimeThread. + +Rationale +--------- +Operating systems are moving away from a specific thread priority and towards +more granular control over which types of cores can be used and things like +power throttling options. In particular, it is no longer possible to map a 0-10 +integer to a meaningful performance range on macOS ARM using the pthread +interface. Using a more modern interface grants us access to more runtime +options, but also changes how we can work with threads. The two most +significant changes are that we cannot mix operations using the new and old +interfaces, and that changing a priority using the new interface can only be +done on the currently running thread. + + +Change +------ +The constructor of WebBrowserComponent now requires passing in an instance of +a new Options class instead of a single option boolean. The +WindowsWebView2WebBrowserComponent class was removed. + +Possible Issues +--------------- +Code using the WebBrowserComponent's boolean parameter to indicate if a +webpage should be unloaded when the component is hidden, will now fail to +compile. Additionally, any code using the WindowsWebView2WebBrowserComponent +class will fail to compile. Code relying on the default value of the +WebBrowserComponent's constructor are not affected. + +Workaround +---------- +Instead of passing in a single boolean to the WebBrowserComponent's +constructor you should now set this option via tha +WebBrowserComponent::Options::withKeepPageLoadedWhenBrowserIsHidden method. + +If you were previously using WindowsWebView2WebBrowserComponent to indicate to +JUCE that you prefer JUCE to use Windows' Webview2 browser backend, you now do +this by setting the WebBrowserComponent::Options::withBackend method. The +WebView2Preferences can now be modified with the methods in +WebBrowserComponent::Options::WinWebView2. + +Rationale +--------- +The old API made adding further options to the WebBrowserComponent cumbersome +especially as the WindowsWebView2WebBrowserComponent already had a parameter +very similar to the above Options class, whereas the base class did not use +such a parameter. Furthermore, using an option to specify the preferred +browser backend is more intuitive then requiring the user to derive from a +special class, especially if additional browser backends are added in the +future. + + +Change +------ +The function AudioIODeviceCallback::audioDeviceIOCallback() was removed. + +Possible Issues +--------------- +Code overriding audioDeviceIOCallback() will fail to compile. + +Workaround +---------- +Affected classes should override the audioDeviceIOCallbackWithContext() function +instead. + +Rationale +--------- +The audioDeviceIOCallbackWithContext() function fulfills the same role as +audioDeviceIOCallback(), it just has an extra parameter. Hence the +audioDeviceIOCallback() function was superfluous. + + +Change +------ +The type representing multi-channel audio data has been changed from T** to +T* const*. Affected classes are AudioIODeviceCallback, AudioBuffer and +AudioFormatReader. + +Possible Issues +--------------- +Code overriding the affected AudioIODeviceCallback and AudioFormatReader +functions will fail to compile. Code that interacts with the return value of +AudioBuffer::getArrayOfReadPointers() and AudioBuffer::getArrayOfWritePointers() +may fail to compile. + +Workaround +---------- +Functions overriding the affected AudioIODeviceCallback and AudioFormatReader +members will need to be changed to confirm to the new signature. Type +declarations related to getArrayOfReadPointers() and getArrayOfWritePointers() +of AudioBuffer may have to be adjusted. + +Rationale +--------- +While the previous signature permitted it, changing the channel pointers by the +previously used types was already being considered illegal. The earlier type +however prevented passing T** values to parameters with type const T**. In some +places this necessitated the usage of const_cast. The new signature can bind to +T** values and the awkward casting can be avoided. + + +Change +------ +The minimum supported C++ standard is now C++17 and the oldest supported +compilers on Linux are now GCC 7.0 and Clang 6.0. + +Possible Issues +--------------- +Older compilers will no longer be able to compile JUCE. + +Workaround +---------- +No workaround is available. + +Rationale +--------- +This compiler upgrade will allow the use of C++17 within the framework. + + +Change +------ +Resource forks are no longer generated for Audio Unit plug-ins. + +Possible Issues +--------------- +New builds of JUCE Audio Units may no longer load in old hosts that use the +Component Manager to discover plug-ins. + +Workaround +---------- +No workaround is available. + +Rationale +--------- +The Component Manager is deprecated in macOS 10.8 and later, so the majority of +hosts have now implemented support for the new plist-based discovery mechanism. +The new AudioUnitSDK (https://github.com/apple/AudioUnitSDK) provided by Apple +to replace the old Core Audio Utility Classes no longer includes the files +required to generate resource forks. + + +Change +------ +Previously, the AudioProcessorGraph would call processBlockBypassed on any +processor for which setBypassed had previously been called. Now, the +AudioProcessorGraph will now only call processBlockBypassed if those processors +do not have dedicated bypass parameters. + +Possible Issues +--------------- +Processors with non-functional bypass parameters may not bypass in the same way +as before. + +Workaround +---------- +For each AudioProcessor owned by a Graph, ensure that either: the processor has +a working bypass parameter that correctly affects the output of processBlock(); +or, the processor has no bypass parameter, in which case processBlockBypassed() +will be called as before. + +Rationale +--------- +The documentation for AudioProcessor::getBypassParameter() states that if this +function returns non-null, then processBlockBypassed() should never be called, +but the AudioProcessorGraph was breaking this rule. Calling +processBlockBypassed() on AudioProcessors with bypass parameters is likely to +result in incorrect or unexpected output if this function is not overridden. +The new behaviour obeys the contract set out in the AudioProcessor +documentation. + + Version 7.0.2 ============= diff --git a/CMakeLists.txt b/CMakeLists.txt index 438e2bbc..4289d067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.15) -project(JUCE VERSION 7.0.2 LANGUAGES C CXX) +project(JUCE VERSION 7.0.5 LANGUAGES C CXX) include(CMakeDependentOption) @@ -117,10 +117,6 @@ endif() # ================================================================================================== # Install configuration -if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14") - set(extra_version_arg ARCH_INDEPENDENT) -endif() - include(CMakePackageConfigHelpers) write_basic_package_version_file("${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" VERSION ${JUCE_VERSION} @@ -166,4 +162,12 @@ install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp" DESTINATION "${JUCE_INSTALL_DESTINATION}") -install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") +if("${CMAKE_SOURCE_DIR}" STREQUAL "${JUCE_SOURCE_DIR}") + _juce_add_lv2_manifest_helper_target() + + if(TARGET juce_lv2_helper) + install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") + install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") + endif() +endif() + diff --git a/ChangeList.txt b/ChangeList.txt index 43cd12a5..324eebbc 100644 --- a/ChangeList.txt +++ b/ChangeList.txt @@ -3,6 +3,27 @@ This file just lists the more notable headline features. For more detailed info about changes and bugfixes please see the git log and BREAKING-CHANGES.txt. +Version 7.0.5 + - Fixed Windows 7 compatibility + - Fixed dark mode notifications on macOS + - Improved the performance of AudioProcessorGraph + +Version 7.0.4 + - Improved Metal device handling + - Adopted more C++17 features + - Improved input handling on macOS and iOS + - Fixed a GUI display issue on Linux + - Fixed some compiler warnings + +Version 7.0.3 + - Added a unique machine ID + - Added new threading classes + - Improved the performance of multiple OpenGL contexts + - Refactored AudioProcessorGraph + - Improved AudioDeviceManager sample rate handling + - Fixed Studio One drawing performance + - Updated the FLAC library + Version 7.0.2 - Fixed accessibility table navigation - Fixed Android file access on older APIs diff --git a/README.md b/README.md index 5024834c..2f675c44 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,14 @@ of the target you wish to build. #### Building JUCE Projects - __macOS/iOS__: Xcode 10.1 (macOS 10.13.6) -- __Windows__: Windows 8.1 and Visual Studio 2015 Update 3 64-bit -- __Linux__: g++ 5.0 or Clang 3.4 (for a full list of dependencies, see +- __Windows__: Windows 8.1 and Visual Studio 2017 +- __Linux__: g++ 7.0 or Clang 6.0 (for a full list of dependencies, see [here](/docs/Linux%20Dependencies.md)). - __Android__: Android Studio on Windows, macOS or Linux #### Deployment Targets -- __macOS__: macOS 10.7 +- __macOS__: macOS 10.9 - __Windows__: Windows Vista - __Linux__: Mainstream Linux distributions - __iOS__: iOS 9.0 @@ -94,7 +94,7 @@ The JUCE framework contains the following dependencies: - [Oboe](modules/juce_audio_devices/native/oboe/) ([Apache 2.0](modules/juce_audio_devices/native/oboe/LICENSE)) - [FLAC](modules/juce_audio_formats/codecs/flac/) ([BSD](modules/juce_audio_formats/codecs/flac/Flac%20Licence.txt)) - [Ogg Vorbis](modules/juce_audio_formats/codecs/oggvorbis/) ([BSD](modules/juce_audio_formats/codecs/oggvorbis/Ogg%20Vorbis%20Licence.txt)) -- [CoreAudioUtilityClasses](modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/) ([Apple](modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUBase.cpp)) +- [AudioUnitSDK](modules/juce_audio_plugin_client/AU/AudioUnitSDK/) ([Apache 2.0](modules/juce_audio_plugin_client/AU/AudioUnitSDK/LICENSE.txt)) - [AUResources.r](modules/juce_audio_plugin_client/AUResources.r) ([Apple](modules/juce_audio_plugin_client/AUResources.r)) - [LV2](modules/juce_audio_processors/format_types/LV2_SDK/) ([ISC](modules/juce_audio_processors/format_types/LV2_SDK/lv2/COPYING)) - [pslextensions](modules/juce_audio_processors/format_types/pslextensions/ipslcontextinfo.h) ([Public domain](modules/juce_audio_processors/format_types/pslextensions/ipslcontextinfo.h)) diff --git a/docs/ARA.md b/docs/ARA.md index 73e961c3..8eef8fbf 100644 --- a/docs/ARA.md +++ b/docs/ARA.md @@ -5,12 +5,12 @@ in JUCE there are some steps you need to take to enable all ARA related function ## External dependencies -- ARA SDK 2.1.0 +- ARA SDK 2.2.0 You can download the ARA SDK from Celemony's Github. The command below will recursively clone the right version into the `ARA_SDK` directory - git clone --recursive --branch releases/2.1.0 https://github.com/Celemony/ARA_SDK + git clone --recursive --branch releases/2.2.0 https://github.com/Celemony/ARA_SDK ## Enabling ARA features in JUCE diff --git a/docs/Accessibility.md b/docs/Accessibility.md index e15970b4..72e32f02 100644 --- a/docs/Accessibility.md +++ b/docs/Accessibility.md @@ -2,8 +2,9 @@ ## What is supported? -Currently JUCE supports VoiceOver on macOS and Narrator on Windows. The JUCE -accessibility API exposes the following to these clients: +Currently JUCE supports Narrator on Windows, VoiceOver on macOS and iOS, and +TalkBack on Android. The JUCE accessibility API exposes the following to these +clients: - Title, description, and help text for UI elements - Programmatic access to UI elements and text diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 15ec9ea4..9ce59be6 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.8.12 +# Doxyfile 1.9.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,16 +12,26 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -60,16 +70,28 @@ PROJECT_LOGO = OUTPUT_DIRECTORY = -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -179,6 +201,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -199,6 +231,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -222,11 +262,16 @@ TAB_SIZE = 4 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = "tags{1}=" \ "topictag{1}=\1" \ @@ -251,12 +296,6 @@ ALIASES = "tags{1}=" \ "c_new=@s_code{new}" \ "c_typedef=@s_code{typedef}" -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -285,28 +324,40 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = txt=md # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -318,7 +369,7 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 @@ -348,7 +399,7 @@ BUILTIN_STL_SUPPORT = YES CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -434,6 +485,19 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -454,6 +518,12 @@ EXTRACT_ALL = YES EXTRACT_PRIVATE = NO +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -491,6 +561,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -502,14 +579,15 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = YES @@ -528,12 +606,20 @@ HIDE_IN_BODY_DOCS = YES INTERNAL_DOCS = YES -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. CASE_SENSE_NAMES = YES @@ -551,6 +637,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -708,7 +800,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -719,7 +812,7 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -754,23 +847,43 @@ WARNINGS = YES WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = NO +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO @@ -781,13 +894,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -808,12 +935,23 @@ INPUT = build \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -822,11 +960,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = juce_*.h \ juce_*.dox @@ -849,7 +991,7 @@ EXCLUDE = build/juce_graphics/image_formats \ build/juce_audio_formats/codecs/flac \ build/juce_audio_formats/codecs/oggvorbis \ build/juce_audio_devices/native \ - build/juce_audio_plugin_client/AU/CoreAudioUtilityClasses \ + build/juce_audio_plugin_client/AU/AudioUnitSDK \ build/juce_browser_plugin_client/juce_browser_plugin.h \ build/juce_core/native \ build/juce_events/native \ @@ -883,7 +1025,7 @@ EXCLUDE_PATTERNS = juce_GIFLoader* \ # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -931,6 +1073,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -972,6 +1119,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -999,7 +1155,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = YES @@ -1031,12 +1187,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -1069,17 +1225,11 @@ VERBATIM_HEADERS = NO ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = @@ -1158,7 +1308,12 @@ HTML_STYLESHEET = # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -1173,10 +1328,23 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1185,7 +1353,7 @@ HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1212,6 +1380,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = YES +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = NO + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1235,13 +1414,14 @@ HTML_INDEX_NUM_ENTRIES = 32 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1255,6 +1435,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1280,8 +1467,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1311,7 +1502,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1356,7 +1547,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1364,8 +1556,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1373,30 +1565,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1439,16 +1631,28 @@ DISABLE_INDEX = NO # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1473,6 +1677,24 @@ TREEVIEW_WIDTH = 320 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1482,19 +1704,14 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. -FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1504,11 +1721,29 @@ FORMULA_TRANSPARENT = YES USE_MATHJAX = NO +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1521,22 +1756,29 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1564,7 +1806,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1583,7 +1825,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1596,8 +1839,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1648,21 +1892,35 @@ LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. @@ -1678,7 +1936,7 @@ COMPACT_LATEX = NO # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. -PAPER_TYPE = a4wide +PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. The package can be specified just @@ -1692,29 +1950,31 @@ PAPER_TYPE = a4wide EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1747,9 +2007,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = NO -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1757,8 +2019,7 @@ USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# if errors occur, instead of asking the user for help. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1771,19 +2032,9 @@ LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1797,6 +2048,14 @@ LATEX_BIB_STYLE = plain LATEX_TIMESTAMP = NO +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1836,9 +2095,9 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. @@ -1847,22 +2106,12 @@ RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- @@ -1934,6 +2183,13 @@ XML_OUTPUT = xml XML_PROGRAMLISTING = YES +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- @@ -1952,23 +2208,14 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2047,7 +2294,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2153,15 +2401,6 @@ EXTERNAL_PAGES = YES # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2194,35 +2433,50 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" + +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2236,7 +2490,8 @@ CLASS_GRAPH = YES COLLABORATION_GRAPH = NO # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. See also the chapter Grouping +# in the manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2259,10 +2514,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2329,6 +2606,13 @@ GRAPHICAL_HIERARCHY = NO DIRECTORY_GRAPH = NO +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2382,13 +2666,18 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. @@ -2418,18 +2707,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = YES - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2442,14 +2719,18 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = NO -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES diff --git a/docs/doxygen/process_source_files.py b/docs/doxygen/process_source_files.py index c38135da..85ec8ee2 100644 --- a/docs/doxygen/process_source_files.py +++ b/docs/doxygen/process_source_files.py @@ -87,7 +87,7 @@ if __name__ == "__main__": juce_modules = args.subdirs.split(",") else: juce_modules = [] - for item in os.listdir(args.source_dir): + for item in sorted(os.listdir(args.source_dir)): if os.path.isdir(os.path.join(args.source_dir, item)): juce_modules.append(item) @@ -136,7 +136,7 @@ if __name__ == "__main__": # Create a list of the directories in the module that we can use as # subgroups and create the Doxygen group hierarchy string. - dir_contents = os.listdir(module_path) + dir_contents = sorted(os.listdir(module_path)) # Ignore "native" folders as these are excluded by doxygen. try: dir_contents.remove("native") diff --git a/examples/Assets/AudioLiveScrollingDisplay.h b/examples/Assets/AudioLiveScrollingDisplay.h index dc75464e..d706170d 100644 --- a/examples/Assets/AudioLiveScrollingDisplay.h +++ b/examples/Assets/AudioLiveScrollingDisplay.h @@ -45,10 +45,12 @@ public: clear(); } - void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, - int numberOfSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numberOfSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (context); + for (int i = 0; i < numberOfSamples; ++i) { float inputSample = 0; diff --git a/examples/Assets/DSPDemos_Common.h b/examples/Assets/DSPDemos_Common.h index 49ccc278..9fa1d5c3 100644 --- a/examples/Assets/DSPDemos_Common.h +++ b/examples/Assets/DSPDemos_Common.h @@ -25,7 +25,7 @@ using namespace dsp; struct DSPDemoParameterBase : public ChangeBroadcaster { DSPDemoParameterBase (const String& labelName) : name (labelName) {} - virtual ~DSPDemoParameterBase() {} + virtual ~DSPDemoParameterBase() = default; virtual Component* getComponent() = 0; @@ -142,7 +142,7 @@ public: loadURL (u); } - URL getCurrentURL() { return currentURL; } + URL getCurrentURL() const { return currentURL; } void setTransportSource (AudioTransportSource* newSource) { @@ -189,21 +189,7 @@ private: currentURL = u; - InputSource* inputSource = nullptr; - - #if ! JUCE_IOS - if (u.isLocalFile()) - { - inputSource = new FileInputSource (u.getLocalFile()); - } - else - #endif - { - if (inputSource == nullptr) - inputSource = new URLInputSource (u); - } - - thumbnail.setSource (inputSource); + thumbnail.setSource (makeInputSource (u).release()); if (notify) sendChangeMessage(); @@ -407,33 +393,27 @@ public: transportSource.reset(); readerSource.reset(); - AudioFormatReader* newReader = nullptr; + auto source = makeInputSource (fileToPlay); - #if ! JUCE_IOS - if (fileToPlay.isLocalFile()) - { - newReader = formatManager.createReaderFor (fileToPlay.getLocalFile()); - } - else - #endif - { - if (newReader == nullptr) - newReader = formatManager.createReaderFor (fileToPlay.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress))); - } + if (source == nullptr) + return false; - reader.reset (newReader); + auto stream = rawToUniquePtr (source->createInputStream()); - if (reader.get() != nullptr) - { - readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); - readerSource->setLooping (loopState.getValue()); + if (stream == nullptr) + return false; - init(); + reader = rawToUniquePtr (formatManager.createReaderFor (std::move (stream))); - return true; - } + if (reader == nullptr) + return false; + + readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); + readerSource->setLooping (loopState.getValue()); + + init(); - return false; + return true; } void togglePlay() @@ -613,7 +593,7 @@ private: { if (fc.getURLResults().size() > 0) { - auto u = fc.getURLResult(); + const auto u = fc.getURLResult(); if (! audioFileReader.loadURL (u)) NativeMessageBox::showAsync (MessageBoxOptions() diff --git a/examples/Assets/DemoUtilities.h b/examples/Assets/DemoUtilities.h index bfc1c5d2..ffdfc363 100644 --- a/examples/Assets/DemoUtilities.h +++ b/examples/Assets/DemoUtilities.h @@ -242,4 +242,19 @@ struct SlowerBouncingNumber : public BouncingNumber } }; +inline std::unique_ptr makeInputSource (const URL& url) +{ + #if JUCE_ANDROID + if (auto doc = AndroidDocument::fromDocument (url)) + return std::make_unique (doc); + #endif + + #if ! JUCE_IOS + if (url.isLocalFile()) + return std::make_unique (url.getLocalFile()); + #endif + + return std::make_unique (url); +} + #endif // PIP_DEMO_UTILITIES_INCLUDED diff --git a/examples/Audio/AudioLatencyDemo.h b/examples/Audio/AudioLatencyDemo.h index 171accb4..cd47e94a 100644 --- a/examples/Audio/AudioLatencyDemo.h +++ b/examples/Audio/AudioLatencyDemo.h @@ -136,9 +136,12 @@ public: void audioDeviceStopped() override {} - void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, int numSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (context); + const ScopedLock sl (lock); if (testIsRunning) diff --git a/examples/Audio/AudioPlaybackDemo.h b/examples/Audio/AudioPlaybackDemo.h index dd457ce5..6d317f44 100644 --- a/examples/Audio/AudioPlaybackDemo.h +++ b/examples/Audio/AudioPlaybackDemo.h @@ -48,22 +48,6 @@ #include "../Assets/DemoUtilities.h" -inline std::unique_ptr makeInputSource (const URL& url) -{ - #if JUCE_ANDROID - if (auto doc = AndroidDocument::fromDocument (url)) - return std::make_unique (doc); - #endif - - #if ! JUCE_IOS - if (url.isLocalFile()) - return std::make_unique (url.getLocalFile()); - #endif - - return std::make_unique (url); -} - -//============================================================================== class DemoThumbnailComp : public Component, public ChangeListener, public FileDragAndDropTarget, @@ -325,7 +309,7 @@ public: // audio setup formatManager.registerBasicFormats(); - thread.startThread (3); + thread.startThread (Thread::Priority::normal); #ifndef JUCE_DEMO_RUNNER RuntimePermissions::request (RuntimePermissions::recordAudio, diff --git a/examples/Audio/AudioRecordingDemo.h b/examples/Audio/AudioRecordingDemo.h index 6bfa622e..38bf15b7 100644 --- a/examples/Audio/AudioRecordingDemo.h +++ b/examples/Audio/AudioRecordingDemo.h @@ -134,10 +134,12 @@ public: sampleRate = 0; } - void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, - int numSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (context); + const ScopedLock sl (writerLock); if (activeWriter.load() != nullptr && numInputChannels >= thumbnail.getNumChannels()) diff --git a/examples/Audio/MPEDemo.h b/examples/Audio/MPEDemo.h index 35a51c4b..10615ee7 100644 --- a/examples/Audio/MPEDemo.h +++ b/examples/Audio/MPEDemo.h @@ -689,10 +689,12 @@ public: } //============================================================================== - void audioDeviceIOCallback (const float** /*inputChannelData*/, int /*numInputChannels*/, - float** outputChannelData, int numOutputChannels, - int numSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (inputChannelData, numInputChannels, context); + AudioBuffer buffer (outputChannelData, numOutputChannels, numSamples); buffer.clear(); diff --git a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt index 585547ff..5b9e9645 100644 --- a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt +++ b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt @@ -1,8 +1,10 @@ -# Automatically generated makefile, created by the Projucer +# Automatically generated CMakeLists, created by the Projucer # Don't edit this file! Your changes will be overwritten when you re-save the Projucer project! cmake_minimum_required(VERSION 3.4.1) +project(juce_jni_project) + set(BINARY_NAME "juce_jni") set(OBOE_DIR "../../../../../modules/juce_audio_devices/native/oboe") @@ -12,7 +14,7 @@ add_subdirectory (${OBOE_DIR} ./oboe) add_library("cpufeatures" STATIC "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c") set_source_files_properties("${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c" PROPERTIES COMPILE_FLAGS "-Wno-sign-conversion -Wno-gnu-statement-expression") -add_definitions([[-DJUCE_ANDROID=1]] [[-DJUCE_ANDROID_API_VERSION=23]] [[-DJUCE_PUSH_NOTIFICATIONS=1]] [[-DJUCE_PUSH_NOTIFICATIONS_ACTIVITY="com/rmsl/juce/JuceActivity"]] [[-DJUCE_CONTENT_SHARING=1]] [[-DJUCE_ANDROID_GL_ES_VERSION_3_0=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.2]] [[-DJUCE_APP_VERSION_HEX=0x70002]]) +add_definitions([[-DJUCE_ANDROID=1]] [[-DJUCE_ANDROID_API_VERSION=23]] [[-DJUCE_PUSH_NOTIFICATIONS=1]] [[-DJUCE_PUSH_NOTIFICATIONS_ACTIVITY="com/rmsl/juce/JuceActivity"]] [[-DJUCE_CONTENT_SHARING=1]] [[-DJUCE_ANDROID_GL_ES_VERSION_3_0=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.5]] [[-DJUCE_APP_VERSION_HEX=0x70005]]) include_directories( AFTER "../../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src" @@ -32,9 +34,9 @@ include_directories( AFTER enable_language(ASM) if(JUCE_BUILD_CONFIGURATION MATCHES "DEBUG") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_analytics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_box2d=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1]] [[-DJUCE_MODULE_AVAILABLE_juce_video=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_USE_MP3AUDIOFORMAT=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0]] [[-DJUCE_STRICT_REFCOUNTEDPOINTER=1]] [[-DJUCE_USE_CAMERA=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.2]] [[-DJUCE_APP_VERSION_HEX=0x70002]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_analytics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_box2d=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1]] [[-DJUCE_MODULE_AVAILABLE_juce_video=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_USE_MP3AUDIOFORMAT=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0]] [[-DJUCE_STRICT_REFCOUNTEDPOINTER=1]] [[-DJUCE_USE_CAMERA=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.5]] [[-DJUCE_APP_VERSION_HEX=0x70005]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) elseif(JUCE_BUILD_CONFIGURATION MATCHES "RELEASE") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_analytics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_box2d=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1]] [[-DJUCE_MODULE_AVAILABLE_juce_video=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_USE_MP3AUDIOFORMAT=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0]] [[-DJUCE_STRICT_REFCOUNTEDPOINTER=1]] [[-DJUCE_USE_CAMERA=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.2]] [[-DJUCE_APP_VERSION_HEX=0x70002]] [[-DNDEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_analytics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_box2d=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1]] [[-DJUCE_MODULE_AVAILABLE_juce_video=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_USE_MP3AUDIOFORMAT=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0]] [[-DJUCE_STRICT_REFCOUNTEDPOINTER=1]] [[-DJUCE_USE_CAMERA=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEMO_RUNNER=1]] [[-DJUCE_UNIT_TESTS=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=7.0.5]] [[-DJUCE_APP_VERSION_HEX=0x70005]] [[-DNDEBUG=1]]) else() message( FATAL_ERROR "No matching build-configuration found." ) endif() @@ -64,6 +66,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_analytics/destinations/juce_ThreadedAnalyticsDestination.h" "../../../../../modules/juce_analytics/juce_analytics.cpp" "../../../../../modules/juce_analytics/juce_analytics.h" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -82,6 +85,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -138,6 +142,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -372,7 +377,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -782,6 +786,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -1046,6 +1051,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -1203,6 +1209,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -1742,6 +1749,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -1761,6 +1769,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -1845,6 +1854,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -1889,6 +1900,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -2036,6 +2048,7 @@ set_source_files_properties( "../../../../../modules/juce_analytics/destinations/juce_ThreadedAnalyticsDestination.h" "../../../../../modules/juce_analytics/juce_analytics.cpp" "../../../../../modules/juce_analytics/juce_analytics.h" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -2054,6 +2067,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -2110,6 +2124,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -2344,7 +2359,6 @@ set_source_files_properties( "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -2754,6 +2768,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -3018,6 +3033,7 @@ set_source_files_properties( "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -3175,6 +3191,7 @@ set_source_files_properties( "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -3714,6 +3731,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -3733,6 +3751,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -3817,6 +3836,8 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -3861,6 +3882,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -3971,14 +3993,12 @@ set_source_files_properties( "../../../JuceLibraryCode/JuceHeader.h" PROPERTIES HEADER_FILE_ONLY TRUE) -target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" ) - if( JUCE_BUILD_CONFIGURATION MATCHES "DEBUG" ) - target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override) + target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override "-fsigned-char" ) endif() if( JUCE_BUILD_CONFIGURATION MATCHES "RELEASE" ) - target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override) + target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override "-fsigned-char" ) endif() find_library(log "log") diff --git a/examples/DemoRunner/Builds/Android/app/build.gradle b/examples/DemoRunner/Builds/Android/app/build.gradle index 6b3be277..a120c191 100644 --- a/examples/DemoRunner/Builds/Android/app/build.gradle +++ b/examples/DemoRunner/Builds/Android/app/build.gradle @@ -1,7 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 31 + compileSdkVersion 33 + namespace "com.rmsl.jucedemorunner" externalNativeBuild { cmake { path "CMakeLists.txt" @@ -20,10 +21,10 @@ android { defaultConfig { applicationId "com.rmsl.jucedemorunner" minSdkVersion 23 - targetSdkVersion 31 + targetSdkVersion 33 externalNativeBuild { cmake { - arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=14", "-DCMAKE_CXX_EXTENSIONS=OFF" + arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=17", "-DCMAKE_CXX_EXTENSIONS=OFF" } } } @@ -51,21 +52,25 @@ android { } externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG", "-DCMAKE_CXX_FLAGS_DEBUG=-O0", "-DCMAKE_C_FLAGS_DEBUG=-O0" + cFlags "-O0" + cppFlags "-O0" + arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG" } } dimension "default" - } + } release_ { externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE", "-DCMAKE_CXX_FLAGS_RELEASE=-O3", "-DCMAKE_C_FLAGS_RELEASE=-O3" + cFlags "-O3" + cppFlags "-O3" + arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE" } } dimension "default" - } + } } variantFilter { variant -> diff --git a/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml b/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml index c8b3a2a6..7500ac43 100644 --- a/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml +++ b/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,22 +1,27 @@ - + - + + + + - - + + + + + - diff --git a/examples/DemoRunner/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h b/examples/DemoRunner/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h index dc75464e..d706170d 100644 --- a/examples/DemoRunner/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h +++ b/examples/DemoRunner/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h @@ -45,10 +45,12 @@ public: clear(); } - void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, - int numberOfSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numberOfSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (context); + for (int i = 0; i < numberOfSamples; ++i) { float inputSample = 0; diff --git a/examples/DemoRunner/Builds/Android/app/src/main/assets/DSPDemos_Common.h b/examples/DemoRunner/Builds/Android/app/src/main/assets/DSPDemos_Common.h index 49ccc278..9fa1d5c3 100644 --- a/examples/DemoRunner/Builds/Android/app/src/main/assets/DSPDemos_Common.h +++ b/examples/DemoRunner/Builds/Android/app/src/main/assets/DSPDemos_Common.h @@ -25,7 +25,7 @@ using namespace dsp; struct DSPDemoParameterBase : public ChangeBroadcaster { DSPDemoParameterBase (const String& labelName) : name (labelName) {} - virtual ~DSPDemoParameterBase() {} + virtual ~DSPDemoParameterBase() = default; virtual Component* getComponent() = 0; @@ -142,7 +142,7 @@ public: loadURL (u); } - URL getCurrentURL() { return currentURL; } + URL getCurrentURL() const { return currentURL; } void setTransportSource (AudioTransportSource* newSource) { @@ -189,21 +189,7 @@ private: currentURL = u; - InputSource* inputSource = nullptr; - - #if ! JUCE_IOS - if (u.isLocalFile()) - { - inputSource = new FileInputSource (u.getLocalFile()); - } - else - #endif - { - if (inputSource == nullptr) - inputSource = new URLInputSource (u); - } - - thumbnail.setSource (inputSource); + thumbnail.setSource (makeInputSource (u).release()); if (notify) sendChangeMessage(); @@ -407,33 +393,27 @@ public: transportSource.reset(); readerSource.reset(); - AudioFormatReader* newReader = nullptr; + auto source = makeInputSource (fileToPlay); - #if ! JUCE_IOS - if (fileToPlay.isLocalFile()) - { - newReader = formatManager.createReaderFor (fileToPlay.getLocalFile()); - } - else - #endif - { - if (newReader == nullptr) - newReader = formatManager.createReaderFor (fileToPlay.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress))); - } + if (source == nullptr) + return false; - reader.reset (newReader); + auto stream = rawToUniquePtr (source->createInputStream()); - if (reader.get() != nullptr) - { - readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); - readerSource->setLooping (loopState.getValue()); + if (stream == nullptr) + return false; - init(); + reader = rawToUniquePtr (formatManager.createReaderFor (std::move (stream))); - return true; - } + if (reader == nullptr) + return false; + + readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); + readerSource->setLooping (loopState.getValue()); + + init(); - return false; + return true; } void togglePlay() @@ -613,7 +593,7 @@ private: { if (fc.getURLResults().size() > 0) { - auto u = fc.getURLResult(); + const auto u = fc.getURLResult(); if (! audioFileReader.loadURL (u)) NativeMessageBox::showAsync (MessageBoxOptions() diff --git a/examples/DemoRunner/Builds/Android/app/src/main/assets/DemoUtilities.h b/examples/DemoRunner/Builds/Android/app/src/main/assets/DemoUtilities.h index bfc1c5d2..ffdfc363 100644 --- a/examples/DemoRunner/Builds/Android/app/src/main/assets/DemoUtilities.h +++ b/examples/DemoRunner/Builds/Android/app/src/main/assets/DemoUtilities.h @@ -242,4 +242,19 @@ struct SlowerBouncingNumber : public BouncingNumber } }; +inline std::unique_ptr makeInputSource (const URL& url) +{ + #if JUCE_ANDROID + if (auto doc = AndroidDocument::fromDocument (url)) + return std::make_unique (doc); + #endif + + #if ! JUCE_IOS + if (url.isLocalFile()) + return std::make_unique (url.getLocalFile()); + #endif + + return std::make_unique (url); +} + #endif // PIP_DEMO_UTILITIES_INCLUDED diff --git a/examples/DemoRunner/Builds/Android/build.gradle b/examples/DemoRunner/Builds/Android/build.gradle index ee98c096..8e2533a6 100644 --- a/examples/DemoRunner/Builds/Android/build.gradle +++ b/examples/DemoRunner/Builds/Android/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' + classpath 'com.android.tools.build:gradle:7.3.0' } } diff --git a/examples/DemoRunner/Builds/Android/gradle/wrapper/gradle-wrapper.properties b/examples/DemoRunner/Builds/Android/gradle/wrapper/gradle-wrapper.properties index 80082ba5..702c227c 100644 --- a/examples/DemoRunner/Builds/Android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/DemoRunner/Builds/Android/gradle/wrapper/gradle-wrapper.properties @@ -1 +1 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip \ No newline at end of file diff --git a/examples/DemoRunner/Builds/LinuxMakefile/Makefile b/examples/DemoRunner/Builds/LinuxMakefile/Makefile index 316d4b10..faa2c752 100644 --- a/examples/DemoRunner/Builds/LinuxMakefile/Makefile +++ b/examples/DemoRunner/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_box2d=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_USE_MP3AUDIOFORMAT=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_USE_CAMERA=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_DEMO_RUNNER=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.2" "-DJUCE_APP_VERSION_HEX=0x70002" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_box2d=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_USE_MP3AUDIOFORMAT=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_USE_CAMERA=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_DEMO_RUNNER=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.5" "-DJUCE_APP_VERSION_HEX=0x70005" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := DemoRunner JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_box2d=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_USE_MP3AUDIOFORMAT=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_USE_CAMERA=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_DEMO_RUNNER=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.2" "-DJUCE_APP_VERSION_HEX=0x70002" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_box2d=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_USE_MP3AUDIOFORMAT=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_USE_CAMERA=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_DEMO_RUNNER=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.5" "-DJUCE_APP_VERSION_HEX=0x70005" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := DemoRunner JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/examples/DemoRunner/Builds/MacOSX/DemoRunner.xcodeproj/project.pbxproj b/examples/DemoRunner/Builds/MacOSX/DemoRunner.xcodeproj/project.pbxproj index c647f0b0..f69455f9 100644 --- a/examples/DemoRunner/Builds/MacOSX/DemoRunner.xcodeproj/project.pbxproj +++ b/examples/DemoRunner/Builds/MacOSX/DemoRunner.xcodeproj/project.pbxproj @@ -467,7 +467,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -496,10 +495,9 @@ 69330F27DD2C71609336C7D2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -511,7 +509,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -542,8 +540,8 @@ "JUCE_DEMO_RUNNER=1", "JUCE_UNIT_TESTS=1", "JUCER_XCODE_MAC_F6D2F4CF=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -572,7 +570,7 @@ INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -588,10 +586,9 @@ B18D059E5616FA729F764229 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -603,7 +600,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -634,8 +631,8 @@ "JUCE_DEMO_RUNNER=1", "JUCE_UNIT_TESTS=1", "JUCER_XCODE_MAC_F6D2F4CF=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -663,7 +660,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -698,7 +695,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; diff --git a/examples/DemoRunner/Builds/MacOSX/Info-App.plist b/examples/DemoRunner/Builds/MacOSX/Info-App.plist index fecf91cc..f2a852d1 100644 --- a/examples/DemoRunner/Builds/MacOSX/Info-App.plist +++ b/examples/DemoRunner/Builds/MacOSX/Info-App.plist @@ -24,9 +24,9 @@ CFBundleSignature ???? CFBundleShortVersionString - 7.0.2 + 7.0.5 CFBundleVersion - 7.0.2 + 7.0.5 NSHumanReadableCopyright Copyright (c) 2020 - Raw Material Software Limited NSHighResolutionCapable diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj index 1d4e3d08..187c40f2 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -161,6 +161,9 @@ true + + true + true @@ -176,6 +179,9 @@ true + + true + true @@ -248,6 +254,9 @@ true + + true + true @@ -989,6 +998,9 @@ true + + true + true @@ -1544,6 +1556,9 @@ true + + true + true @@ -2456,6 +2471,9 @@ true + + true + true @@ -2507,6 +2525,9 @@ true + + true + true @@ -2848,7 +2869,6 @@ - @@ -3235,6 +3255,7 @@ + @@ -3593,9 +3614,11 @@ + + @@ -3639,6 +3662,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters index 8ab0de03..57a30d71 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters @@ -721,6 +721,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -736,6 +739,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -808,6 +814,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1564,6 +1573,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -2158,6 +2170,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -3127,6 +3142,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3181,6 +3199,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3942,9 +3963,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -5103,6 +5121,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6177,6 +6198,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -6186,6 +6210,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6342,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/examples/DemoRunner/Builds/VisualStudio2017/resources.rc b/examples/DemoRunner/Builds/VisualStudio2017/resources.rc index 3adeec39..d1e516af 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/resources.rc +++ b/examples/DemoRunner/Builds/VisualStudio2017/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Copyright (c) 2020 - Raw Material Software Limited\0" VALUE "FileDescription", "DemoRunner\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj index 7bb91c62..08a4d4c8 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -161,6 +161,9 @@ true + + true + true @@ -176,6 +179,9 @@ true + + true + true @@ -248,6 +254,9 @@ true + + true + true @@ -989,6 +998,9 @@ true + + true + true @@ -1544,6 +1556,9 @@ true + + true + true @@ -2456,6 +2471,9 @@ true + + true + true @@ -2507,6 +2525,9 @@ true + + true + true @@ -2848,7 +2869,6 @@ - @@ -3235,6 +3255,7 @@ + @@ -3593,9 +3614,11 @@ + + @@ -3639,6 +3662,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters index 453ecdeb..c91a76b8 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters @@ -721,6 +721,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -736,6 +739,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -808,6 +814,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1564,6 +1573,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -2158,6 +2170,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -3127,6 +3142,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3181,6 +3199,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3942,9 +3963,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -5103,6 +5121,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6177,6 +6198,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -6186,6 +6210,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6342,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/examples/DemoRunner/Builds/VisualStudio2019/resources.rc b/examples/DemoRunner/Builds/VisualStudio2019/resources.rc index 3adeec39..d1e516af 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/resources.rc +++ b/examples/DemoRunner/Builds/VisualStudio2019/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Copyright (c) 2020 - Raw Material Software Limited\0" VALUE "FileDescription", "DemoRunner\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj index 7028be67..678c5348 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_box2d=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_USE_MP3AUDIOFORMAT=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_USE_CAMERA=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DEMO_RUNNER=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\DemoRunner.exe @@ -161,6 +161,9 @@ true + + true + true @@ -176,6 +179,9 @@ true + + true + true @@ -248,6 +254,9 @@ true + + true + true @@ -989,6 +998,9 @@ true + + true + true @@ -1544,6 +1556,9 @@ true + + true + true @@ -2456,6 +2471,9 @@ true + + true + true @@ -2507,6 +2525,9 @@ true + + true + true @@ -2848,7 +2869,6 @@ - @@ -3235,6 +3255,7 @@ + @@ -3593,9 +3614,11 @@ + + @@ -3639,6 +3662,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters index 5a417351..c430519c 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters @@ -721,6 +721,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -736,6 +739,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -808,6 +814,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1564,6 +1573,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -2158,6 +2170,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -3127,6 +3142,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3181,6 +3199,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3942,9 +3963,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -5103,6 +5121,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6177,6 +6198,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -6186,6 +6210,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6342,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/examples/DemoRunner/Builds/VisualStudio2022/resources.rc b/examples/DemoRunner/Builds/VisualStudio2022/resources.rc index 3adeec39..d1e516af 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/resources.rc +++ b/examples/DemoRunner/Builds/VisualStudio2022/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Copyright (c) 2020 - Raw Material Software Limited\0" VALUE "FileDescription", "DemoRunner\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/examples/DemoRunner/Builds/iOS/DemoRunner.xcodeproj/project.pbxproj b/examples/DemoRunner/Builds/iOS/DemoRunner.xcodeproj/project.pbxproj index 8fe50429..1e9d52e0 100644 --- a/examples/DemoRunner/Builds/iOS/DemoRunner.xcodeproj/project.pbxproj +++ b/examples/DemoRunner/Builds/iOS/DemoRunner.xcodeproj/project.pbxproj @@ -452,7 +452,6 @@ 07EA85D22270E8EA13CA0BBE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -490,7 +489,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; PRODUCT_NAME = "DemoRunner"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -502,9 +501,8 @@ 69330F27DD2C71609336C7D2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; CODE_SIGN_ENTITLEMENTS = "App.entitlements"; @@ -519,7 +517,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -550,8 +548,8 @@ "JUCE_DEMO_RUNNER=1", "JUCE_UNIT_TESTS=1", "JUCER_XCODE_IPHONE_5BC26AE3=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -594,9 +592,8 @@ B18D059E5616FA729F764229 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; CODE_SIGN_ENTITLEMENTS = "App.entitlements"; @@ -611,7 +608,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -642,8 +639,8 @@ "JUCE_DEMO_RUNNER=1", "JUCE_UNIT_TESTS=1", "JUCER_XCODE_IPHONE_5BC26AE3=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -685,7 +682,6 @@ C01EC82F42B640CA1E54AD53 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -723,7 +719,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "DemoRunner"; SDKROOT = iphoneos; diff --git a/examples/DemoRunner/Builds/iOS/Info-App.plist b/examples/DemoRunner/Builds/iOS/Info-App.plist index 1e254069..287e0074 100644 --- a/examples/DemoRunner/Builds/iOS/Info-App.plist +++ b/examples/DemoRunner/Builds/iOS/Info-App.plist @@ -30,9 +30,9 @@ CFBundleSignature ???? CFBundleShortVersionString - 7.0.2 + 7.0.5 CFBundleVersion - 7.0.2 + 7.0.5 NSHumanReadableCopyright Copyright (c) 2020 - Raw Material Software Limited NSHighResolutionCapable diff --git a/examples/DemoRunner/DemoRunner.jucer b/examples/DemoRunner/DemoRunner.jucer index 7bb3ab6c..7e9e10dd 100644 --- a/examples/DemoRunner/DemoRunner.jucer +++ b/examples/DemoRunner/DemoRunner.jucer @@ -1,7 +1,7 @@ + androidExternalWriteNeeded="1" androidEnableContentSharing="1" + androidExtraAssetsFolder="../Assets" smallIcon="YyqWd2" bigIcon="YyqWd2" + cameraPermissionNeeded="1" androidReadMediaAudioPermission="1" + androidReadMediaImagesPermission="1" androidReadMediaVideoPermission="1" + androidBluetoothScanNeeded="1" androidBluetoothAdvertiseNeeded="1" + androidBluetoothConnectNeeded="1"> diff --git a/examples/DemoRunner/JuceLibraryCode/JuceHeader.h b/examples/DemoRunner/JuceLibraryCode/JuceHeader.h index 7b3ed11a..3ac40014 100644 --- a/examples/DemoRunner/JuceLibraryCode/JuceHeader.h +++ b/examples/DemoRunner/JuceLibraryCode/JuceHeader.h @@ -54,7 +54,7 @@ namespace ProjectInfo { const char* const projectName = "DemoRunner"; const char* const companyName = "Raw Material Software Limited"; - const char* const versionString = "7.0.2"; - const int versionNumber = 0x70002; + const char* const versionString = "7.0.5"; + const int versionNumber = 0x70005; } #endif diff --git a/examples/GUI/AnimationAppDemo.h b/examples/GUI/AnimationAppDemo.h index ef0d1f39..8d92e06f 100644 --- a/examples/GUI/AnimationAppDemo.h +++ b/examples/GUI/AnimationAppDemo.h @@ -59,7 +59,7 @@ public: AnimationAppDemo() { setSize (800, 600); - setFramesPerSecond (60); + setSynchroniseToVBlank (true); } void update() override diff --git a/examples/GUI/ImagesDemo.h b/examples/GUI/ImagesDemo.h index a03c6840..6a112533 100644 --- a/examples/GUI/ImagesDemo.h +++ b/examples/GUI/ImagesDemo.h @@ -57,7 +57,7 @@ public: { setOpaque (true); imageList.setDirectory (File::getSpecialLocation (File::userPicturesDirectory), true, true); - directoryThread.startThread (1); + directoryThread.startThread (Thread::Priority::background); fileTree.setTitle ("Files"); fileTree.addListener (this); diff --git a/examples/GUI/OpenGLAppDemo.h b/examples/GUI/OpenGLAppDemo.h index ee5cbd65..2fbcc8b1 100644 --- a/examples/GUI/OpenGLAppDemo.h +++ b/examples/GUI/OpenGLAppDemo.h @@ -205,7 +205,7 @@ public: attributes.reset(); uniforms .reset(); - shader.reset (newShader.release()); + shader = std::move (newShader); shader->use(); shape .reset (new Shape()); diff --git a/examples/GUI/VideoDemo.h b/examples/GUI/VideoDemo.h index 3f7d02ed..086f5aa0 100644 --- a/examples/GUI/VideoDemo.h +++ b/examples/GUI/VideoDemo.h @@ -154,7 +154,7 @@ public: setOpaque (true); movieList.setDirectory (File::getSpecialLocation (File::userMoviesDirectory), true, true); - directoryThread.startThread (1); + directoryThread.startThread (Thread::Priority::background); fileTree.setTitle ("Files"); fileTree.addListener (this); diff --git a/examples/Plugins/ARAPluginDemo.h b/examples/Plugins/ARAPluginDemo.h index 9d59439a..17befd7b 100644 --- a/examples/Plugins/ARAPluginDemo.h +++ b/examples/Plugins/ARAPluginDemo.h @@ -49,6 +49,28 @@ #pragma once +#include +#include + +//============================================================================== +class ARADemoPluginAudioModification : public ARAAudioModification +{ +public: + ARADemoPluginAudioModification (ARAAudioSource* audioSource, + ARA::ARAAudioModificationHostRef hostRef, + const ARAAudioModification* optionalModificationToClone) + : ARAAudioModification (audioSource, hostRef, optionalModificationToClone) + { + if (optionalModificationToClone != nullptr) + dimmed = static_cast (optionalModificationToClone)->dimmed; + } + + bool isDimmed() const { return dimmed; } + void setDimmed (bool shouldDim) { dimmed = shouldDim; } + +private: + bool dimmed = false; +}; //============================================================================== struct PreviewState @@ -63,7 +85,7 @@ public: SharedTimeSliceThread() : TimeSliceThread (String (JucePlugin_Name) + " ARA Sample Reading Thread") { - startThread (7); // Above default priority so playback is fluent, but below realtime + startThread (Priority::high); // Above default priority so playback is fluent, but below realtime } }; @@ -95,6 +117,18 @@ private: SpinLock processingFlag; }; +static void crossfade (const float* sourceA, + const float* sourceB, + float aProportionAtStart, + float aProportionAtFinish, + float* destinationBuffer, + int numSamples) +{ + AudioBuffer destination { &destinationBuffer, 1, numSamples }; + destination.copyFromWithRamp (0, 0, sourceA, numSamples, aProportionAtStart, aProportionAtFinish); + destination.addFromWithRamp (0, 0, sourceB, numSamples, 1.0f - aProportionAtStart, 1.0f - aProportionAtFinish); +} + class Looper { public: @@ -110,68 +144,83 @@ public: void writeInto (AudioBuffer& buffer) { if (loopRange.getLength() == 0) + { buffer.clear(); + return; + } const auto numChannelsToCopy = std::min (inputBuffer->getNumChannels(), buffer.getNumChannels()); + const auto actualCrossfadeLengthSamples = std::min (loopRange.getLength() / 2, (int64) desiredCrossfadeLengthSamples); for (auto samplesCopied = 0; samplesCopied < buffer.getNumSamples();) { - const auto numSamplesToCopy = - std::min (buffer.getNumSamples() - samplesCopied, (int) (loopRange.getEnd() - pos)); + const auto [needsCrossfade, samplePosOfNextCrossfadeTransition] = [&]() -> std::pair + { + if (const auto endOfFadeIn = loopRange.getStart() + actualCrossfadeLengthSamples; pos < endOfFadeIn) + return { true, endOfFadeIn }; + + return { false, loopRange.getEnd() - actualCrossfadeLengthSamples }; + }(); + + const auto samplesToNextCrossfadeTransition = samplePosOfNextCrossfadeTransition - pos; + const auto numSamplesToCopy = std::min (buffer.getNumSamples() - samplesCopied, + (int) samplesToNextCrossfadeTransition); + + const auto getFadeInGainAtPos = [this, actualCrossfadeLengthSamples] (auto p) + { + return jmap ((float) p, (float) loopRange.getStart(), (float) loopRange.getStart() + (float) actualCrossfadeLengthSamples - 1.0f, 0.0f, 1.0f); + }; for (int i = 0; i < numChannelsToCopy; ++i) { - buffer.copyFrom (i, samplesCopied, *inputBuffer, i, (int) pos, numSamplesToCopy); + if (needsCrossfade) + { + const auto overlapStart = loopRange.getEnd() - actualCrossfadeLengthSamples + + (pos - loopRange.getStart()); + + crossfade (inputBuffer->getReadPointer (i, (int) pos), + inputBuffer->getReadPointer (i, (int) overlapStart), + getFadeInGainAtPos (pos), + getFadeInGainAtPos (pos + numSamplesToCopy), + buffer.getWritePointer (i, samplesCopied), + numSamplesToCopy); + } + else + { + buffer.copyFrom (i, samplesCopied, *inputBuffer, i, (int) pos, numSamplesToCopy); + } } samplesCopied += numSamplesToCopy; pos += numSamplesToCopy; - jassert (pos <= loopRange.getEnd()); + jassert (pos <= loopRange.getEnd() - actualCrossfadeLengthSamples); - if (pos == loopRange.getEnd()) + if (pos == loopRange.getEnd() - actualCrossfadeLengthSamples) pos = loopRange.getStart(); } } private: + static constexpr int desiredCrossfadeLengthSamples = 50; + const AudioBuffer* inputBuffer; Range loopRange; int64 pos; }; -class OptionalRange -{ -public: - using Type = Range; - - OptionalRange() : valid (false) {} - explicit OptionalRange (Type valueIn) : valid (true), value (std::move (valueIn)) {} - - explicit operator bool() const noexcept { return valid; } - - const auto& operator*() const - { - jassert (valid); - return value; - } - -private: - bool valid; - Type value; -}; - //============================================================================== // Returns the modified sample range in the output buffer. -inline OptionalRange readPlaybackRangeIntoBuffer (Range playbackRange, - const ARAPlaybackRegion* playbackRegion, - AudioBuffer& buffer, - const std::function& getReader) +inline std::optional> readPlaybackRangeIntoBuffer (Range playbackRange, + const ARAPlaybackRegion* playbackRegion, + AudioBuffer& buffer, + const std::function& getReader) { - const auto rangeInAudioModificationTime = playbackRange.movedToStartAt (playbackRange.getStart() - - playbackRegion->getStartInAudioModificationTime()); + const auto rangeInAudioModificationTime = playbackRange - playbackRegion->getStartInPlaybackTime() + + playbackRegion->getStartInAudioModificationTime(); - const auto audioSource = playbackRegion->getAudioModification()->getAudioSource(); + const auto audioModification = playbackRegion->getAudioModification(); + const auto audioSource = audioModification->getAudioSource(); const auto audioModificationSampleRate = audioSource->getSampleRate(); const Range sampleRangeInAudioModification { @@ -181,7 +230,9 @@ inline OptionalRange readPlaybackRangeIntoBuffer (Range playbackRange, const auto inputOffset = jlimit ((int64_t) 0, audioSource->getSampleCount(), sampleRangeInAudioModification.getStart()); - const auto outputOffset = -std::min (sampleRangeInAudioModification.getStart(), (int64_t) 0); + // With the output offset it can always be said of the output buffer, that the zeroth element + // corresponds to beginning of the playbackRange. + const auto outputOffset = std::max (-sampleRangeInAudioModification.getStart(), (int64_t) 0); /* TODO: Handle different AudioSource and playback sample rates. @@ -203,12 +254,17 @@ inline OptionalRange readPlaybackRangeIntoBuffer (Range playbackRange, }(); if (readLength == 0) - return OptionalRange { {} }; + return Range(); auto* reader = getReader (audioSource); if (reader != nullptr && reader->read (&buffer, (int) outputOffset, (int) readLength, inputOffset, true, true)) - return OptionalRange { { outputOffset, readLength } }; + { + if (audioModification->isDimmed()) + buffer.applyGain ((int) outputOffset, (int) readLength, 0.25f); + + return Range::withStartAndLength (outputOffset, readLength); + } return {}; } @@ -363,6 +419,11 @@ public: continue; } + // Apply dim if enabled + if (playbackRegion->getAudioModification()->isDimmed()) + readBuffer.applyGain (startInBuffer, numSamplesToRead, 0.25f); // dim by about 12 dB + + // Mix output of all regions if (didRenderAnyRegion) { // Mix local buffer into the output buffer. @@ -400,7 +461,7 @@ private: // We're subclassing here only to provide a proper default c'tor for our shared resource SharedResourcePointer sharedTimesliceThread; - std::map audioSourceReaders; + std::map audioSourceReaders; bool useBufferedAudioSourceReader = true; int numChannels = 2; double sampleRate = 48000.0; @@ -431,7 +492,7 @@ public: void didAddRegionSequence (ARA::PlugIn::RegionSequence* rs) noexcept override { - auto* sequence = dynamic_cast (rs); + auto* sequence = static_cast (rs); sequence->addListener (this); regionSequences.insert (sequence); asyncConfigCallback.startConfigure(); @@ -493,8 +554,21 @@ public: if (! locked) return true; + const auto fadeOutIfNecessary = [this, &buffer] + { + if (std::exchange (wasPreviewing, false)) + { + previewLooper.writeInto (buffer); + const auto fadeOutStart = std::max (0, buffer.getNumSamples() - 50); + buffer.applyGainRamp (fadeOutStart, buffer.getNumSamples() - fadeOutStart, 1.0f, 0.0f); + } + }; + if (positionInfo.getIsPlaying()) + { + fadeOutIfNecessary(); return true; + } if (const auto previewedRegion = previewState->previewedRegion.load()) { @@ -519,8 +593,12 @@ public: if (regionIsAssignedToEditor) { const auto previewTime = previewState->previewTime.load(); + const auto previewDimmed = previewedRegion->getAudioModification() + ->isDimmed(); - if (lastPreviewTime != previewTime || lastPlaybackRegion != previewedRegion) + if (lastPreviewTime != previewTime + || lastPlaybackRegion != previewedRegion + || lastPreviewDimmed != previewDimmed) { Range previewRangeInPlaybackTime { previewTime - 0.25, previewTime + 0.25 }; previewBuffer->clear(); @@ -537,15 +615,26 @@ public: { lastPreviewTime = previewTime; lastPlaybackRegion = previewedRegion; + lastPreviewDimmed = previewDimmed; previewLooper = Looper (previewBuffer.get(), *rangeInOutput); } } else { previewLooper.writeInto (buffer); + + if (! std::exchange (wasPreviewing, true)) + { + const auto fadeInLength = std::min (50, buffer.getNumSamples()); + buffer.applyGainRamp (0, fadeInLength, 0.0f, 1.0f); + } } } } + else + { + fadeOutIfNecessary(); + } return true; }); @@ -576,12 +665,14 @@ private: AsyncConfigurationCallback asyncConfigCallback { [this] { configure(); } }; double lastPreviewTime = 0.0; ARAPlaybackRegion* lastPlaybackRegion = nullptr; + bool lastPreviewDimmed = false; + bool wasPreviewing = false; std::unique_ptr> previewBuffer; Looper previewLooper; double sampleRate = 48000.0; SharedResourcePointer timeSliceThread; - std::map> audioSourceReaders; + std::map> audioSourceReaders; std::set regionSequences; }; @@ -595,6 +686,15 @@ public: PreviewState previewState; protected: + ARAAudioModification* doCreateAudioModification (ARAAudioSource* audioSource, + ARA::ARAAudioModificationHostRef hostRef, + const ARAAudioModification* optionalModificationToClone) noexcept override + { + return new ARADemoPluginAudioModification (audioSource, + hostRef, + static_cast (optionalModificationToClone)); + } + ARAPlaybackRenderer* doCreatePlaybackRenderer() noexcept override { return new PlaybackRenderer (getDocumentController()); @@ -608,36 +708,108 @@ protected: bool doRestoreObjectsFromStream (ARAInputStream& input, const ARARestoreObjectsFilter* filter) noexcept override { - ignoreUnused (input, filter); - return false; + // Start reading data from the archive, starting with the number of audio modifications in the archive + const auto numAudioModifications = input.readInt64(); + + // Loop over stored audio modification data + for (int64 i = 0; i < numAudioModifications; ++i) + { + const auto progressVal = (float) i / (float) numAudioModifications; + getDocumentController()->getHostArchivingController()->notifyDocumentUnarchivingProgress (progressVal); + + // Read audio modification persistent ID and analysis result from archive + const String persistentID = input.readString(); + const bool dimmed = input.readBool(); + + // Find audio modification to restore the state to (drop state if not to be loaded) + auto audioModification = filter->getAudioModificationToRestoreStateWithID (persistentID.getCharPointer()); + + if (audioModification == nullptr) + continue; + + const bool dimChanged = (dimmed != audioModification->isDimmed()); + audioModification->setDimmed (dimmed); + + // If the dim state changed, send a sample content change notification without notifying the host + if (dimChanged) + { + audioModification->notifyContentChanged (ARAContentUpdateScopes::samplesAreAffected(), false); + + for (auto playbackRegion : audioModification->getPlaybackRegions()) + playbackRegion->notifyContentChanged (ARAContentUpdateScopes::samplesAreAffected(), false); + } + } + + getDocumentController()->getHostArchivingController()->notifyDocumentUnarchivingProgress (1.0f); + + return ! input.failed(); } bool doStoreObjectsToStream (ARAOutputStream& output, const ARAStoreObjectsFilter* filter) noexcept override { - ignoreUnused (output, filter); - return false; + // This example implementation only deals with audio modification states + const auto& audioModificationsToPersist { filter->getAudioModificationsToStore() }; + + const auto reportProgress = [archivingController = getDocumentController()->getHostArchivingController()] (float p) + { + archivingController->notifyDocumentArchivingProgress (p); + }; + + const ScopeGuard scope { [&reportProgress] { reportProgress (1.0f); } }; + + // Write the number of audio modifications we are persisting + const auto numAudioModifications = audioModificationsToPersist.size(); + + if (! output.writeInt64 ((int64) numAudioModifications)) + return false; + + // For each audio modification to persist, persist its ID followed by whether it's dimmed + for (size_t i = 0; i < numAudioModifications; ++i) + { + // Write persistent ID and dim state + if (! output.writeString (audioModificationsToPersist[i]->getPersistentID())) + return false; + + if (! output.writeBool (audioModificationsToPersist[i]->isDimmed())) + return false; + + const auto progressVal = (float) i / (float) numAudioModifications; + reportProgress (progressVal); + } + + return true; } }; struct PlayHeadState { - void update (AudioPlayHead* aph) + void update (const Optional& info) { - const auto info = aph->getPosition(); - - if (info.hasValue() && info->getIsPlaying()) + if (info.hasValue()) { - isPlaying.store (true); - timeInSeconds.store (info->getTimeInSeconds().orFallback (0)); + isPlaying.store (info->getIsPlaying(), std::memory_order_relaxed); + timeInSeconds.store (info->getTimeInSeconds().orFallback (0), std::memory_order_relaxed); + isLooping.store (info->getIsLooping(), std::memory_order_relaxed); + const auto loopPoints = info->getLoopPoints(); + + if (loopPoints.hasValue()) + { + loopPpqStart = loopPoints->ppqStart; + loopPpqEnd = loopPoints->ppqEnd; + } } else { - isPlaying.store (false); + isPlaying.store (false, std::memory_order_relaxed); + isLooping.store (false, std::memory_order_relaxed); } } - std::atomic isPlaying { false }; - std::atomic timeInSeconds { 0.0 }; + std::atomic isPlaying { false }, + isLooping { false }; + std::atomic timeInSeconds { 0.0 }, + loopPpqStart { 0.0 }, + loopPpqEnd { 0.0 }; }; //============================================================================== @@ -655,13 +827,13 @@ public: //============================================================================== void prepareToPlay (double sampleRate, int samplesPerBlock) override { - playHeadState.isPlaying.store (false); + playHeadState.update (nullopt); prepareToPlayForARA (sampleRate, samplesPerBlock, getMainBusNumOutputChannels(), getProcessingPrecision()); } void releaseResources() override { - playHeadState.isPlaying.store (false); + playHeadState.update (nullopt); releaseResourcesForARA(); } @@ -681,7 +853,7 @@ public: ScopedNoDenormals noDenormals; auto* audioPlayHead = getPlayHead(); - playHeadState.update (audioPlayHead); + playHeadState.update (audioPlayHead->getPosition()); if (! processBlockForARA (buffer, isRealtime(), audioPlayHead)) processBlockBypassed (buffer, midiMessages); @@ -693,7 +865,15 @@ public: const String getName() const override { return "ARAPluginDemo"; } bool acceptsMidi() const override { return true; } bool producesMidi() const override { return true; } - double getTailLengthSeconds() const override { return 0.0; } + + double getTailLengthSeconds() const override + { + double tail; + if (getTailLengthSecondsForARA (tail)) + return tail; + + return 0.0; + } //============================================================================== int getNumPrograms() override { return 0; } @@ -719,6 +899,340 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ARADemoPluginAudioProcessorImpl) }; +//============================================================================== +class TimeToViewScaling +{ +public: + class Listener + { + public: + virtual ~Listener() = default; + + virtual void zoomLevelChanged (double newPixelPerSecond) = 0; + }; + + void addListener (Listener* l) { listeners.add (l); } + void removeListener (Listener* l) { listeners.remove (l); } + + TimeToViewScaling() = default; + + void zoom (double factor) + { + zoomLevelPixelPerSecond = jlimit (minimumZoom, minimumZoom * 32, zoomLevelPixelPerSecond * factor); + setZoomLevel (zoomLevelPixelPerSecond); + } + + void setZoomLevel (double pixelPerSecond) + { + zoomLevelPixelPerSecond = pixelPerSecond; + listeners.call ([this] (Listener& l) { l.zoomLevelChanged (zoomLevelPixelPerSecond); }); + } + + int getXForTime (double time) const + { + return roundToInt (time * zoomLevelPixelPerSecond); + } + + double getTimeForX (int x) const + { + return x / zoomLevelPixelPerSecond; + } + +private: + static constexpr auto minimumZoom = 10.0; + + double zoomLevelPixelPerSecond = minimumZoom * 4; + ListenerList listeners; +}; + +class RulersView : public Component, + public SettableTooltipClient, + private Timer, + private TimeToViewScaling::Listener, + private ARAMusicalContext::Listener +{ +public: + class CycleMarkerComponent : public Component + { + void paint (Graphics& g) override + { + g.setColour (Colours::yellow.darker (0.2f)); + const auto bounds = getLocalBounds().toFloat(); + g.drawRoundedRectangle (bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 6.0f, 2.0f); + } + }; + + RulersView (PlayHeadState& playHeadStateIn, TimeToViewScaling& timeToViewScalingIn, ARADocument& document) + : playHeadState (playHeadStateIn), timeToViewScaling (timeToViewScalingIn), araDocument (document) + { + timeToViewScaling.addListener (this); + + addChildComponent (cycleMarker); + cycleMarker.setInterceptsMouseClicks (false, false); + + setTooltip ("Double-click to start playback, click to stop playback or to reposition, drag horizontal range to set cycle."); + + startTimerHz (30); + } + + ~RulersView() override + { + stopTimer(); + + timeToViewScaling.removeListener (this); + selectMusicalContext (nullptr); + } + + void paint (Graphics& g) override + { + auto drawBounds = g.getClipBounds(); + const auto drawStartTime = timeToViewScaling.getTimeForX (drawBounds.getX()); + const auto drawEndTime = timeToViewScaling.getTimeForX (drawBounds.getRight()); + + const auto bounds = getLocalBounds(); + + g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); + g.fillRect (bounds); + g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId).contrasting()); + g.drawRect (bounds); + + const auto rulerHeight = bounds.getHeight() / 3; + g.drawRect (drawBounds.getX(), rulerHeight, drawBounds.getRight(), rulerHeight); + g.setFont (Font (12.0f)); + + const int lightLineWidth = 1; + const int heavyLineWidth = 3; + + if (selectedMusicalContext != nullptr) + { + const ARA::PlugIn::HostContentReader tempoReader (selectedMusicalContext); + const ARA::TempoConverter tempoConverter (tempoReader); + + // chord ruler: one rect per chord, skipping empty "no chords" + const auto chordBounds = drawBounds.removeFromTop (rulerHeight); + const ARA::PlugIn::HostContentReader chordsReader (selectedMusicalContext); + + if (tempoReader && chordsReader) + { + const ARA::ChordInterpreter interpreter (true); + for (auto itChord = chordsReader.begin(); itChord != chordsReader.end(); ++itChord) + { + if (interpreter.isNoChord (*itChord)) + continue; + + const auto chordStartTime = (itChord == chordsReader.begin()) ? 0 : tempoConverter.getTimeForQuarter (itChord->position); + + if (chordStartTime >= drawEndTime) + break; + + auto chordRect = chordBounds; + chordRect.setLeft (timeToViewScaling.getXForTime (chordStartTime)); + + if (std::next (itChord) != chordsReader.end()) + { + const auto nextChordStartTime = tempoConverter.getTimeForQuarter (std::next (itChord)->position); + + if (nextChordStartTime < drawStartTime) + continue; + + chordRect.setRight (timeToViewScaling.getXForTime (nextChordStartTime)); + } + + g.drawRect (chordRect); + g.drawText (convertARAString (interpreter.getNameForChord (*itChord).c_str()), + chordRect.withTrimmedLeft (2), + Justification::centredLeft); + } + } + + // beat ruler: evaluates tempo and bar signatures to draw a line for each beat + const ARA::PlugIn::HostContentReader barSignaturesReader (selectedMusicalContext); + + if (barSignaturesReader) + { + const ARA::BarSignaturesConverter barSignaturesConverter (barSignaturesReader); + + const double beatStart = barSignaturesConverter.getBeatForQuarter (tempoConverter.getQuarterForTime (drawStartTime)); + const double beatEnd = barSignaturesConverter.getBeatForQuarter (tempoConverter.getQuarterForTime (drawEndTime)); + const int endBeat = roundToInt (std::floor (beatEnd)); + RectangleList rects; + + for (int beat = roundToInt (std::ceil (beatStart)); beat <= endBeat; ++beat) + { + const auto quarterPos = barSignaturesConverter.getQuarterForBeat (beat); + const int x = timeToViewScaling.getXForTime (tempoConverter.getTimeForQuarter (quarterPos)); + const auto barSignature = barSignaturesConverter.getBarSignatureForQuarter (quarterPos); + const int lineWidth = (quarterPos == barSignature.position) ? heavyLineWidth : lightLineWidth; + const int beatsSinceBarStart = roundToInt( barSignaturesConverter.getBeatDistanceFromBarStartForQuarter (quarterPos)); + const int lineHeight = (beatsSinceBarStart == 0) ? rulerHeight : rulerHeight / 2; + rects.addWithoutMerging (Rectangle (x - lineWidth / 2, 2 * rulerHeight - lineHeight, lineWidth, lineHeight)); + } + + g.fillRectList (rects); + } + } + + // time ruler: one tick for each second + { + RectangleList rects; + + for (auto time = std::floor (drawStartTime); time <= drawEndTime; time += 1.0) + { + const int lineWidth = (std::fmod (time, 60.0) <= 0.001) ? heavyLineWidth : lightLineWidth; + const int lineHeight = (std::fmod (time, 10.0) <= 0.001) ? rulerHeight : rulerHeight / 2; + rects.addWithoutMerging (Rectangle (timeToViewScaling.getXForTime (time) - lineWidth / 2, + bounds.getHeight() - lineHeight, + lineWidth, + lineHeight)); + } + + g.fillRectList (rects); + } + } + + void mouseDrag (const MouseEvent& m) override + { + isDraggingCycle = true; + + auto cycleRect = getBounds(); + cycleRect.setLeft (jmin (m.getMouseDownX(), m.x)); + cycleRect.setRight (jmax (m.getMouseDownX(), m.x)); + cycleMarker.setBounds (cycleRect); + } + + void mouseUp (const MouseEvent& m) override + { + auto playbackController = araDocument.getDocumentController()->getHostPlaybackController(); + + if (playbackController != nullptr) + { + const auto startTime = timeToViewScaling.getTimeForX (jmin (m.getMouseDownX(), m.x)); + const auto endTime = timeToViewScaling.getTimeForX (jmax (m.getMouseDownX(), m.x)); + + if (playHeadState.isPlaying.load (std::memory_order_relaxed)) + playbackController->requestStopPlayback(); + else + playbackController->requestSetPlaybackPosition (startTime); + + if (isDraggingCycle) + playbackController->requestSetCycleRange (startTime, endTime - startTime); + } + + isDraggingCycle = false; + } + + void mouseDoubleClick (const MouseEvent&) override + { + if (auto* playbackController = araDocument.getDocumentController()->getHostPlaybackController()) + { + if (! playHeadState.isPlaying.load (std::memory_order_relaxed)) + playbackController->requestStartPlayback(); + } + } + + void selectMusicalContext (ARAMusicalContext* newSelectedMusicalContext) + { + if (auto* oldSelection = std::exchange (selectedMusicalContext, newSelectedMusicalContext); + oldSelection != selectedMusicalContext) + { + if (oldSelection != nullptr) + oldSelection->removeListener (this); + + if (selectedMusicalContext != nullptr) + selectedMusicalContext->addListener (this); + + repaint(); + } + } + + void zoomLevelChanged (double) override + { + repaint(); + } + + void doUpdateMusicalContextContent (ARAMusicalContext*, ARAContentUpdateScopes) override + { + repaint(); + } + +private: + void updateCyclePosition() + { + if (selectedMusicalContext != nullptr) + { + const ARA::PlugIn::HostContentReader tempoReader (selectedMusicalContext); + const ARA::TempoConverter tempoConverter (tempoReader); + + const auto loopStartTime = tempoConverter.getTimeForQuarter (playHeadState.loopPpqStart.load (std::memory_order_relaxed)); + const auto loopEndTime = tempoConverter.getTimeForQuarter (playHeadState.loopPpqEnd.load (std::memory_order_relaxed)); + + auto cycleRect = getBounds(); + cycleRect.setLeft (timeToViewScaling.getXForTime (loopStartTime)); + cycleRect.setRight (timeToViewScaling.getXForTime (loopEndTime)); + cycleMarker.setVisible (true); + cycleMarker.setBounds (cycleRect); + } + else + { + cycleMarker.setVisible (false); + } + } + + void timerCallback() override + { + if (! isDraggingCycle) + updateCyclePosition(); + } + +private: + PlayHeadState& playHeadState; + TimeToViewScaling& timeToViewScaling; + ARADocument& araDocument; + ARAMusicalContext* selectedMusicalContext = nullptr; + CycleMarkerComponent cycleMarker; + bool isDraggingCycle = false; +}; + +class RulersHeader : public Component +{ +public: + RulersHeader() + { + chordsLabel.setText ("Chords", NotificationType::dontSendNotification); + addAndMakeVisible (chordsLabel); + + barsLabel.setText ("Bars", NotificationType::dontSendNotification); + addAndMakeVisible (barsLabel); + + timeLabel.setText ("Time", NotificationType::dontSendNotification); + addAndMakeVisible (timeLabel); + } + + void resized() override + { + auto bounds = getLocalBounds(); + const auto rulerHeight = bounds.getHeight() / 3; + + for (auto* label : { &chordsLabel, &barsLabel, &timeLabel }) + label->setBounds (bounds.removeFromTop (rulerHeight)); + } + + void paint (Graphics& g) override + { + auto bounds = getLocalBounds(); + const auto rulerHeight = bounds.getHeight() / 3; + g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); + g.fillRect (bounds); + g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId).contrasting()); + g.drawRect (bounds); + bounds.removeFromTop (rulerHeight); + g.drawRect (bounds.removeFromTop (rulerHeight)); + } + +private: + Label chordsLabel, barsLabel, timeLabel; +}; + //============================================================================== struct WaveformCache : private ARAAudioSource::Listener { @@ -772,21 +1286,37 @@ private: }; class PlaybackRegionView : public Component, - public ChangeListener + public ChangeListener, + public SettableTooltipClient, + private ARAAudioSource::Listener, + private ARAPlaybackRegion::Listener, + private ARAEditorView::Listener { public: - PlaybackRegionView (ARAPlaybackRegion& region, WaveformCache& cache) - : playbackRegion (region), waveformCache (cache) + PlaybackRegionView (ARAEditorView& editorView, ARAPlaybackRegion& region, WaveformCache& cache) + : araEditorView (editorView), playbackRegion (region), waveformCache (cache), previewRegionOverlay (*this) { auto* audioSource = playbackRegion.getAudioModification()->getAudioSource(); waveformCache.getOrCreateThumbnail (audioSource).addChangeListener (this); + + audioSource->addListener (this); + playbackRegion.addListener (this); + araEditorView.addListener (this); + addAndMakeVisible (previewRegionOverlay); + + setTooltip ("Double-click to toggle dim state of the region, click and hold to prelisten region near click."); } ~PlaybackRegionView() override { - waveformCache.getOrCreateThumbnail (playbackRegion.getAudioModification()->getAudioSource()) - .removeChangeListener (this); + auto* audioSource = playbackRegion.getAudioModification()->getAudioSource(); + + audioSource->removeListener (this); + playbackRegion.removeListener (this); + araEditorView.removeListener (this); + + waveformCache.getOrCreateThumbnail (audioSource).removeChangeListener (this); } void mouseDown (const MouseEvent& m) override @@ -797,6 +1327,7 @@ public: auto& previewState = ARADocumentControllerSpecialisation::getSpecialisedDocumentController (playbackRegion.getDocumentController())->previewState; previewState.previewTime.store (previewTime); previewState.previewedRegion.store (&playbackRegion); + previewRegionOverlay.update(); } void mouseUp (const MouseEvent&) override @@ -804,6 +1335,19 @@ public: auto& previewState = ARADocumentControllerSpecialisation::getSpecialisedDocumentController (playbackRegion.getDocumentController())->previewState; previewState.previewTime.store (0.0); previewState.previewedRegion.store (nullptr); + previewRegionOverlay.update(); + } + + void mouseDoubleClick (const MouseEvent&) override + { + // Set the dim flag on our region's audio modification when double-clicked + auto audioModification = playbackRegion.getAudioModification(); + audioModification->setDimmed (! audioModification->isDimmed()); + + // Send a content change notification for the modification and all associated playback regions + audioModification->notifyContentChanged (ARAContentUpdateScopes::samplesAreAffected(), true); + for (auto region : audioModification->getPlaybackRegions()) + region->notifyContentChanged (ARAContentUpdateScopes::samplesAreAffected(), true); } void changeListenerCallback (ChangeBroadcaster*) override @@ -811,17 +1355,69 @@ public: repaint(); } + void didEnableAudioSourceSamplesAccess (ARAAudioSource*, bool) override + { + repaint(); + } + + void willUpdatePlaybackRegionProperties (ARAPlaybackRegion*, + ARAPlaybackRegion::PropertiesPtr newProperties) override + { + if (playbackRegion.getName() != newProperties->name + || playbackRegion.getColor() != newProperties->color) + { + repaint(); + } + } + + void didUpdatePlaybackRegionContent (ARAPlaybackRegion*, ARAContentUpdateScopes) override + { + repaint(); + } + + void onNewSelection (const ARAViewSelection& viewSelection) override + { + const auto& selectedPlaybackRegions = viewSelection.getPlaybackRegions(); + const bool selected = std::find (selectedPlaybackRegions.begin(), selectedPlaybackRegions.end(), &playbackRegion) != selectedPlaybackRegions.end(); + if (selected != isSelected) + { + isSelected = selected; + repaint(); + } + } + void paint (Graphics& g) override { - g.fillAll (Colours::white.darker()); - g.setColour (Colours::darkgrey.darker()); - auto& thumbnail = waveformCache.getOrCreateThumbnail (playbackRegion.getAudioModification()->getAudioSource()); - thumbnail.drawChannels (g, - getLocalBounds(), - playbackRegion.getStartInAudioModificationTime(), - playbackRegion.getEndInAudioModificationTime(), - 1.0f); - g.setColour (Colours::black); + g.fillAll (convertOptionalARAColour (playbackRegion.getEffectiveColor(), Colours::black)); + + const auto* audioModification = playbackRegion.getAudioModification(); + g.setColour (audioModification->isDimmed() ? Colours::darkgrey.darker() : Colours::darkgrey.brighter()); + + if (audioModification->getAudioSource()->isSampleAccessEnabled()) + { + auto& thumbnail = waveformCache.getOrCreateThumbnail (playbackRegion.getAudioModification()->getAudioSource()); + thumbnail.drawChannels (g, + getLocalBounds(), + playbackRegion.getStartInAudioModificationTime(), + playbackRegion.getEndInAudioModificationTime(), + 1.0f); + } + else + { + g.setFont (Font (12.0f)); + g.drawText ("Audio Access Disabled", getLocalBounds(), Justification::centred); + } + + g.setColour (Colours::white.withMultipliedAlpha (0.9f)); + g.setFont (Font (12.0f)); + g.drawText (convertOptionalARAString (playbackRegion.getEffectiveName()), + getLocalBounds(), + Justification::topLeft); + + if (audioModification->isDimmed()) + g.drawText ("DIMMED", getLocalBounds(), Justification::bottomLeft); + + g.setColour (isSelected ? Colours::white : Colours::black); g.drawRect (getLocalBounds()); } @@ -831,18 +1427,70 @@ public: } private: + class PreviewRegionOverlay : public Component + { + static constexpr auto previewLength = 0.5; + + public: + PreviewRegionOverlay (PlaybackRegionView& ownerIn) : owner (ownerIn) + { + } + + void update() + { + const auto& previewState = owner.getDocumentController()->previewState; + + if (previewState.previewedRegion.load() == &owner.playbackRegion) + { + const auto previewStartTime = previewState.previewTime.load() - owner.playbackRegion.getStartInPlaybackTime(); + const auto pixelPerSecond = owner.getWidth() / owner.playbackRegion.getDurationInPlaybackTime(); + + setBounds (roundToInt ((previewStartTime - previewLength / 2) * pixelPerSecond), + 0, + roundToInt (previewLength * pixelPerSecond), + owner.getHeight()); + + setVisible (true); + } + else + { + setVisible (false); + } + + repaint(); + } + + void paint (Graphics& g) override + { + g.setColour (Colours::yellow.withAlpha (0.5f)); + g.fillRect (getLocalBounds()); + } + + private: + PlaybackRegionView& owner; + }; + + ARADemoPluginDocumentControllerSpecialisation* getDocumentController() const + { + return ARADocumentControllerSpecialisation::getSpecialisedDocumentController (playbackRegion.getDocumentController()); + } + + ARAEditorView& araEditorView; ARAPlaybackRegion& playbackRegion; WaveformCache& waveformCache; + PreviewRegionOverlay previewRegionOverlay; + bool isSelected = false; }; class RegionSequenceView : public Component, - public ARARegionSequence::Listener, public ChangeBroadcaster, + private TimeToViewScaling::Listener, + private ARARegionSequence::Listener, private ARAPlaybackRegion::Listener { public: - RegionSequenceView (ARARegionSequence& rs, WaveformCache& cache, double pixelPerSec) - : regionSequence (rs), waveformCache (cache), zoomLevelPixelPerSecond (pixelPerSec) + RegionSequenceView (ARAEditorView& editorView, TimeToViewScaling& scaling, ARARegionSequence& rs, WaveformCache& cache) + : araEditorView (editorView), timeToViewScaling (scaling), regionSequence (rs), waveformCache (cache) { regionSequence.addListener (this); @@ -850,10 +1498,14 @@ public: createAndAddPlaybackRegionView (playbackRegion); updatePlaybackDuration(); + + timeToViewScaling.addListener (this); } ~RegionSequenceView() override { + timeToViewScaling.removeListener (this); + regionSequence.removeListener (this); for (const auto& it : playbackRegionViews) @@ -862,6 +1514,16 @@ public: //============================================================================== // ARA Document change callback overrides + void willUpdateRegionSequenceProperties (ARARegionSequence*, + ARARegionSequence::PropertiesPtr newProperties) override + { + if (regionSequence.getColor() != newProperties->color) + { + for (auto& pbr : playbackRegionViews) + pbr.second->repaint(); + } + } + void willRemovePlaybackRegionFromRegionSequence (ARARegionSequence*, ARAPlaybackRegion* playbackRegion) override { @@ -885,13 +1547,14 @@ public: updatePlaybackDuration(); } - void willUpdatePlaybackRegionProperties (ARAPlaybackRegion*, ARAPlaybackRegion::PropertiesPtr) override + void didUpdatePlaybackRegionProperties (ARAPlaybackRegion*) override { + updatePlaybackDuration(); } - void didUpdatePlaybackRegionProperties (ARAPlaybackRegion*) override + void zoomLevelChanged (double) override { - updatePlaybackDuration(); + resized(); } void resized() override @@ -901,8 +1564,8 @@ public: const auto playbackRegion = pbr.first; pbr.second->setBounds ( getLocalBounds() - .withTrimmedLeft (roundToInt (playbackRegion->getStartInPlaybackTime() * zoomLevelPixelPerSecond)) - .withWidth (roundToInt (playbackRegion->getDurationInPlaybackTime() * zoomLevelPixelPerSecond))); + .withTrimmedLeft (timeToViewScaling.getXForTime (playbackRegion->getStartInPlaybackTime())) + .withWidth (timeToViewScaling.getXForTime (playbackRegion->getDurationInPlaybackTime()))); } } @@ -911,16 +1574,12 @@ public: return playbackDuration; } - void setZoomLevel (double pixelPerSecond) - { - zoomLevelPixelPerSecond = pixelPerSecond; - resized(); - } - private: void createAndAddPlaybackRegionView (ARAPlaybackRegion* playbackRegion) { - playbackRegionViews[playbackRegion] = std::make_unique (*playbackRegion, waveformCache); + playbackRegionViews[playbackRegion] = std::make_unique (araEditorView, + *playbackRegion, + waveformCache); playbackRegion->addListener (this); addAndMakeVisible (*playbackRegionViews[playbackRegion]); } @@ -938,11 +1597,12 @@ private: sendChangeMessage(); } + ARAEditorView& araEditorView; + TimeToViewScaling& timeToViewScaling; ARARegionSequence& regionSequence; WaveformCache& waveformCache; std::unordered_map> playbackRegionViews; double playbackDuration = 0.0; - double zoomLevelPixelPerSecond; }; class ZoomControls : public Component @@ -972,14 +1632,132 @@ private: TextButton zoomInButton { "+" }, zoomOutButton { "-" }; }; -class TrackHeader : public Component +class PlayheadPositionLabel : public Label, + private Timer { public: - explicit TrackHeader (const ARARegionSequence& regionSequenceIn) : regionSequence (regionSequenceIn) + PlayheadPositionLabel (PlayHeadState& playHeadStateIn) + : playHeadState (playHeadStateIn) { - update(); + startTimerHz (30); + } + + ~PlayheadPositionLabel() override + { + stopTimer(); + } + + void selectMusicalContext (ARAMusicalContext* newSelectedMusicalContext) + { + selectedMusicalContext = newSelectedMusicalContext; + } + +private: + void timerCallback() override + { + const auto timePosition = playHeadState.timeInSeconds.load (std::memory_order_relaxed); + + auto text = timeToTimecodeString (timePosition); + + if (playHeadState.isPlaying.load (std::memory_order_relaxed)) + text += " (playing)"; + else + text += " (stopped)"; + + if (selectedMusicalContext != nullptr) + { + const ARA::PlugIn::HostContentReader tempoReader (selectedMusicalContext); + const ARA::PlugIn::HostContentReader barSignaturesReader (selectedMusicalContext); + + if (tempoReader && barSignaturesReader) + { + const ARA::TempoConverter tempoConverter (tempoReader); + const ARA::BarSignaturesConverter barSignaturesConverter (barSignaturesReader); + const auto quarterPosition = tempoConverter.getQuarterForTime (timePosition); + const auto barIndex = barSignaturesConverter.getBarIndexForQuarter (quarterPosition); + const auto beatDistance = barSignaturesConverter.getBeatDistanceFromBarStartForQuarter (quarterPosition); + const auto quartersPerBeat = 4.0 / (double) barSignaturesConverter.getBarSignatureForQuarter (quarterPosition).denominator; + const auto beatIndex = (int) beatDistance; + const auto tickIndex = juce::roundToInt ((beatDistance - beatIndex) * quartersPerBeat * 960.0); + + text += newLine; + text += String::formatted ("bar %d | beat %d | tick %03d", (barIndex >= 0) ? barIndex + 1 : barIndex, beatIndex + 1, tickIndex + 1); + text += " - "; + + const ARA::PlugIn::HostContentReader chordsReader (selectedMusicalContext); + + if (chordsReader && chordsReader.getEventCount() > 0) + { + const auto begin = chordsReader.begin(); + const auto end = chordsReader.end(); + auto it = begin; + + while (it != end && it->position <= quarterPosition) + ++it; + + if (it != begin) + --it; + + const ARA::ChordInterpreter interpreter (true); + text += "chord "; + text += String (interpreter.getNameForChord (*it)); + } + else + { + text += "(no chords provided)"; + } + } + } + + setText (text, NotificationType::dontSendNotification); + } + + // Copied from AudioPluginDemo.h: quick-and-dirty function to format a timecode string + static String timeToTimecodeString (double seconds) + { + auto millisecs = roundToInt (seconds * 1000.0); + auto absMillisecs = std::abs (millisecs); + + return String::formatted ("%02d:%02d:%02d.%03d", + millisecs / 3600000, + (absMillisecs / 60000) % 60, + (absMillisecs / 1000) % 60, + absMillisecs % 1000); + } + + PlayHeadState& playHeadState; + ARAMusicalContext* selectedMusicalContext = nullptr; +}; + +class TrackHeader : public Component, + private ARARegionSequence::Listener, + private ARAEditorView::Listener +{ +public: + TrackHeader (ARAEditorView& editorView, ARARegionSequence& regionSequenceIn) + : araEditorView (editorView), regionSequence (regionSequenceIn) + { + updateTrackName (regionSequence.getName()); + onNewSelection (araEditorView.getViewSelection()); addAndMakeVisible (trackNameLabel); + + regionSequence.addListener (this); + araEditorView.addListener (this); + } + + ~TrackHeader() override + { + araEditorView.removeListener (this); + regionSequence.removeListener (this); + } + + void willUpdateRegionSequenceProperties (ARARegionSequence*, ARARegionSequence::PropertiesPtr newProperties) override + { + if (regionSequence.getName() != newProperties->name) + updateTrackName (newProperties->name); + if (regionSequence.getColor() != newProperties->color) + repaint(); } void resized() override @@ -989,30 +1767,43 @@ public: void paint (Graphics& g) override { - g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); - g.fillRoundedRectangle (getLocalBounds().reduced (2).toType(), 6.0f); - g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId).contrasting()); - g.drawRoundedRectangle (getLocalBounds().reduced (2).toType(), 6.0f, 1.0f); + const auto backgroundColour = getLookAndFeel().findColour (ResizableWindow::backgroundColourId); + g.setColour (isSelected ? backgroundColour.brighter() : backgroundColour); + g.fillRoundedRectangle (getLocalBounds().reduced (2).toFloat(), 6.0f); + g.setColour (backgroundColour.contrasting()); + g.drawRoundedRectangle (getLocalBounds().reduced (2).toFloat(), 6.0f, 1.0f); + + if (auto colour = regionSequence.getColor()) + { + g.setColour (convertARAColour (colour)); + g.fillRect (getLocalBounds().removeFromTop (16).reduced (6)); + g.fillRect (getLocalBounds().removeFromBottom (16).reduced (6)); + } } -private: - void update() + void onNewSelection (const ARAViewSelection& viewSelection) override { - const auto getWithDefaultValue = - [] (const ARA::PlugIn::OptionalProperty& optional, String defaultValue) - { - if (const ARA::ARAUtf8String value = optional) - return String (value); + const auto& selectedRegionSequences = viewSelection.getRegionSequences(); + const bool selected = std::find (selectedRegionSequences.begin(), selectedRegionSequences.end(), ®ionSequence) != selectedRegionSequences.end(); - return defaultValue; - }; + if (selected != isSelected) + { + isSelected = selected; + repaint(); + } + } - trackNameLabel.setText (getWithDefaultValue (regionSequence.getName(), "No track name"), +private: + void updateTrackName (ARA::ARAUtf8String optionalName) + { + trackNameLabel.setText (optionalName ? optionalName : "No track name", NotificationType::dontSendNotification); } - const ARARegionSequence& regionSequence; + ARAEditorView& araEditorView; + ARARegionSequence& regionSequence; Label trackNameLabel; + bool isSelected = false; }; constexpr auto trackHeight = 60; @@ -1030,18 +1821,6 @@ public: component->resized(); } } - - void setOverlayComponent (Component* component) - { - if (overlayComponent != nullptr && overlayComponent != component) - removeChildComponent (overlayComponent); - - addChildComponent (component); - overlayComponent = component; - } - -private: - Component* overlayComponent = nullptr; }; class VerticalLayoutViewport : public Viewport @@ -1069,48 +1848,74 @@ private: }; class OverlayComponent : public Component, - private Timer + private Timer, + private TimeToViewScaling::Listener { public: class PlayheadMarkerComponent : public Component { - void paint (Graphics& g) override { g.fillAll (juce::Colours::yellow.darker (0.2f)); } + void paint (Graphics& g) override { g.fillAll (Colours::yellow.darker (0.2f)); } }; - OverlayComponent (PlayHeadState& playHeadStateIn) - : playHeadState (&playHeadStateIn) + OverlayComponent (PlayHeadState& playHeadStateIn, TimeToViewScaling& timeToViewScalingIn) + : playHeadState (playHeadStateIn), timeToViewScaling (timeToViewScalingIn) { addChildComponent (playheadMarker); setInterceptsMouseClicks (false, false); startTimerHz (30); + + timeToViewScaling.addListener (this); } ~OverlayComponent() override { + timeToViewScaling.removeListener (this); + stopTimer(); } void resized() override { - doResize(); + updatePlayHeadPosition(); } - void setZoomLevel (double pixelPerSecondIn) + void setHorizontalOffset (int offset) { - pixelPerSecond = pixelPerSecondIn; + horizontalOffset = offset; } - void setHorizontalOffset (int offset) + void setSelectedTimeRange (std::optional timeRange) { - horizontalOffset = offset; + selectedTimeRange = timeRange; + repaint(); + } + + void zoomLevelChanged (double) override + { + updatePlayHeadPosition(); + repaint(); + } + + void paint (Graphics& g) override + { + if (selectedTimeRange) + { + auto bounds = getLocalBounds(); + bounds.setLeft (timeToViewScaling.getXForTime (selectedTimeRange->start)); + bounds.setRight (timeToViewScaling.getXForTime (selectedTimeRange->start + selectedTimeRange->duration)); + g.setColour (getLookAndFeel().findColour (ResizableWindow::backgroundColourId).brighter().withAlpha (0.3f)); + g.fillRect (bounds); + g.setColour (Colours::whitesmoke.withAlpha (0.5f)); + g.drawRect (bounds); + } } private: - void doResize() + void updatePlayHeadPosition() { - if (playHeadState->isPlaying.load()) + if (playHeadState.isPlaying.load (std::memory_order_relaxed)) { - const auto markerX = playHeadState->timeInSeconds.load() * pixelPerSecond; + const auto markerX = timeToViewScaling.getXForTime (playHeadState.timeInSeconds.load (std::memory_order_relaxed)); const auto playheadLine = getLocalBounds().withTrimmedLeft ((int) (markerX - markerWidth / 2.0) - horizontalOffset) .removeFromLeft ((int) markerWidth); playheadMarker.setVisible (true); @@ -1124,28 +1929,38 @@ private: void timerCallback() override { - doResize(); + updatePlayHeadPosition(); } static constexpr double markerWidth = 2.0; - PlayHeadState* playHeadState; - double pixelPerSecond = 1.0; + PlayHeadState& playHeadState; + TimeToViewScaling& timeToViewScaling; int horizontalOffset = 0; + std::optional selectedTimeRange; PlayheadMarkerComponent playheadMarker; }; class DocumentView : public Component, public ChangeListener, + public ARAMusicalContext::Listener, private ARADocument::Listener, private ARAEditorView::Listener { public: - explicit DocumentView (ARADocument& document, PlayHeadState& playHeadState) - : araDocument (document), - overlay (playHeadState) + DocumentView (ARAEditorView& editorView, PlayHeadState& playHeadState) + : araEditorView (editorView), + araDocument (*editorView.getDocumentController()->getDocument()), + rulersView (playHeadState, timeToViewScaling, araDocument), + overlay (playHeadState, timeToViewScaling), + playheadPositionLabel (playHeadState) { - addAndMakeVisible (tracksBackground); + if (araDocument.getMusicalContexts().size() > 0) + selectMusicalContext (araDocument.getMusicalContexts().front()); + + addAndMakeVisible (rulersHeader); + + viewport.content.addAndMakeVisible (rulersView); viewport.onVisibleAreaChanged = [this] (const auto& r) { @@ -1155,25 +1970,40 @@ public: }; addAndMakeVisible (viewport); - - overlay.setZoomLevel (zoomLevelPixelPerSecond); addAndMakeVisible (overlay); + addAndMakeVisible (playheadPositionLabel); zoomControls.setZoomInCallback ([this] { zoom (2.0); }); zoomControls.setZoomOutCallback ([this] { zoom (0.5); }); addAndMakeVisible (zoomControls); invalidateRegionSequenceViews(); + araDocument.addListener (this); + araEditorView.addListener (this); } ~DocumentView() override { + araEditorView.removeListener (this); araDocument.removeListener (this); + selectMusicalContext (nullptr); } //============================================================================== // ARADocument::Listener overrides + void didAddMusicalContextToDocument (ARADocument*, ARAMusicalContext* musicalContext) override + { + if (selectedMusicalContext == nullptr) + selectMusicalContext (musicalContext); + } + + void willDestroyMusicalContext (ARAMusicalContext* musicalContext) override + { + if (selectedMusicalContext == musicalContext) + selectMusicalContext (nullptr); + } + void didReorderRegionSequencesInDocument (ARADocument*) override { invalidateRegionSequenceViews(); @@ -1203,12 +2033,32 @@ public: //============================================================================== // ARAEditorView::Listener overrides - void onNewSelection (const ARA::PlugIn::ViewSelection&) override + void onNewSelection (const ARAViewSelection& viewSelection) override { + auto getNewSelectedMusicalContext = [&viewSelection]() -> ARAMusicalContext* + { + if (! viewSelection.getRegionSequences().empty()) + return viewSelection.getRegionSequences().front()->getMusicalContext(); + else if (! viewSelection.getPlaybackRegions().empty()) + return viewSelection.getPlaybackRegions().front()->getRegionSequence()->getMusicalContext(); + + return nullptr; + }; + + if (auto* newSelectedMusicalContext = getNewSelectedMusicalContext()) + if (newSelectedMusicalContext != selectedMusicalContext) + selectMusicalContext (newSelectedMusicalContext); + + if (const auto timeRange = viewSelection.getTimeRange()) + overlay.setSelectedTimeRange (*timeRange); + else + overlay.setSelectedTimeRange (std::nullopt); } - void onHideRegionSequences (const std::vector&) override + void onHideRegionSequences (const std::vector& regionSequences) override { + hiddenRegionSequences = regionSequences; + invalidateRegionSequenceViews(); } //============================================================================== @@ -1220,29 +2070,27 @@ public: void resized() override { auto bounds = getLocalBounds(); - const auto bottomControlsBounds = bounds.removeFromBottom (40); - const auto headerBounds = bounds.removeFromLeft (headerWidth).reduced (2); - - zoomControls.setBounds (bottomControlsBounds); - layOutVertically (headerBounds, trackHeaders, viewportHeightOffset); - tracksBackground.setBounds (bounds); - viewport.setBounds (bounds); - overlay.setBounds (bounds); - } - //============================================================================== - void setZoomLevel (double pixelPerSecond) - { - zoomLevelPixelPerSecond = pixelPerSecond; + FlexBox fb; + fb.justifyContent = FlexBox::JustifyContent::spaceBetween; + fb.items.add (FlexItem (playheadPositionLabel).withWidth (450.0f).withMinWidth (250.0f)); + fb.items.add (FlexItem (zoomControls).withMinWidth (80.0f)); + fb.performLayout (bounds.removeFromBottom (40)); - for (const auto& view : regionSequenceViews) - view.second->setZoomLevel (zoomLevelPixelPerSecond); + auto headerBounds = bounds.removeFromLeft (headerWidth); + rulersHeader.setBounds (headerBounds.removeFromTop (trackHeight)); + layOutVertically (headerBounds, trackHeaders, viewportHeightOffset); - overlay.setZoomLevel (zoomLevelPixelPerSecond); + viewport.setBounds (bounds); + overlay.setBounds (bounds.reduced (1)); - update(); + const auto width = jmax (timeToViewScaling.getXForTime (timelineLength), viewport.getWidth()); + const auto height = (int) (regionSequenceViews.size() + 1) * trackHeight; + viewport.content.setSize (width, height); + viewport.content.resized(); } + //============================================================================== static constexpr int headerWidth = 120; private: @@ -1262,10 +2110,26 @@ private: ARARegionSequence* sequence; }; + void selectMusicalContext (ARAMusicalContext* newSelectedMusicalContext) + { + if (auto oldContext = std::exchange (selectedMusicalContext, newSelectedMusicalContext); + oldContext != selectedMusicalContext) + { + if (oldContext != nullptr) + oldContext->removeListener (this); + + if (selectedMusicalContext != nullptr) + selectedMusicalContext->addListener (this); + + rulersView.selectMusicalContext (selectedMusicalContext); + playheadPositionLabel.selectMusicalContext (selectedMusicalContext); + } + } + void zoom (double factor) { - zoomLevelPixelPerSecond = jlimit (minimumZoom, minimumZoom * 32, zoomLevelPixelPerSecond * factor); - setZoomLevel (zoomLevelPixelPerSecond); + timeToViewScaling.zoom (factor); + update(); } template @@ -1287,11 +2151,6 @@ private: for (const auto& view : regionSequenceViews) timelineLength = std::max (timelineLength, view.second->getPlaybackDuration()); - const Rectangle timelineSize (roundToInt (timelineLength * zoomLevelPixelPerSecond), - (int) regionSequenceViews.size() * trackHeight); - viewport.content.setSize (timelineSize.getWidth(), timelineSize.getHeight()); - viewport.content.resized(); - resized(); } @@ -1306,14 +2165,14 @@ private: auto& regionSequenceView = insertIntoMap ( regionSequenceViews, RegionSequenceViewKey { regionSequence }, - std::make_unique (*regionSequence, waveformCache, zoomLevelPixelPerSecond)); + std::make_unique (araEditorView, timeToViewScaling, *regionSequence, waveformCache)); regionSequenceView.addChangeListener (this); viewport.content.addAndMakeVisible (regionSequenceView); auto& trackHeader = insertIntoMap (trackHeaders, RegionSequenceViewKey { regionSequence }, - std::make_unique (*regionSequence)); + std::make_unique (araEditorView, *regionSequence)); addAndMakeVisible (trackHeader); } @@ -1352,9 +2211,8 @@ private: trackHeaders.clear(); for (auto* regionSequence : araDocument.getRegionSequences()) - { - addTrackViews (regionSequence); - } + if (std::find (hiddenRegionSequences.begin(), hiddenRegionSequences.end(), regionSequence) == hiddenRegionSequences.end()) + addTrackViews (regionSequence); update(); @@ -1362,30 +2220,28 @@ private: } } - class TracksBackgroundComponent : public Component - { - void paint (Graphics& g) override - { - g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId).brighter()); - } - }; - - static constexpr auto minimumZoom = 10.0; - static constexpr auto trackHeight = 60; - + ARAEditorView& araEditorView; ARADocument& araDocument; bool regionSequenceViewsAreValid = false; - double timelineLength = 0; - double zoomLevelPixelPerSecond = minimumZoom * 4; + + TimeToViewScaling timeToViewScaling; + double timelineLength = 0.0; + + ARAMusicalContext* selectedMusicalContext = nullptr; + + std::vector hiddenRegionSequences; WaveformCache waveformCache; - TracksBackgroundComponent tracksBackground; std::map> trackHeaders; std::map> regionSequenceViews; + RulersHeader rulersHeader; + RulersView rulersView; VerticalLayoutViewport viewport; OverlayComponent overlay; ZoomControls zoomControls; + PlayheadPositionLabel playheadPositionLabel; + TooltipWindow tooltip; int viewportHeightOffset = 0; }; @@ -1400,17 +2256,14 @@ public: AudioProcessorEditorARAExtension (&p) { if (auto* editorView = getARAEditorView()) - { - auto* document = ARADocumentControllerSpecialisation::getSpecialisedDocumentController(editorView->getDocumentController())->getDocument(); - documentView = std::make_unique (*document, p.playHeadState ); - } + documentView = std::make_unique (*editorView, p.playHeadState); addAndMakeVisible (documentView.get()); // ARA requires that plugin editors are resizable to support tight integration // into the host UI setResizable (true, false); - setSize (400, 300); + setSize (800, 300); } //============================================================================== diff --git a/examples/Plugins/DSPModulePluginDemo.h b/examples/Plugins/DSPModulePluginDemo.h index a1f20523..6e5c9c36 100644 --- a/examples/Plugins/DSPModulePluginDemo.h +++ b/examples/Plugins/DSPModulePluginDemo.h @@ -120,9 +120,8 @@ namespace ID template constexpr void forEach (Func&& func, Items&&... items) - noexcept (noexcept (std::initializer_list { (func (std::forward (items)), 0)... })) { - (void) std::initializer_list { ((void) func (std::forward (items)), 0)... }; + (func (std::forward (items)), ...); } template diff --git a/examples/Plugins/MultiOutSynthPluginDemo.h b/examples/Plugins/MultiOutSynthPluginDemo.h index cedc674d..a481b9e5 100644 --- a/examples/Plugins/MultiOutSynthPluginDemo.h +++ b/examples/Plugins/MultiOutSynthPluginDemo.h @@ -156,7 +156,7 @@ public: && 1 <= outputs.size() && std::all_of (outputs.begin(), outputs.end(), [] (const auto& bus) { - return bus == AudioChannelSet::stereo(); + return bus.isDisabled() || bus == AudioChannelSet::stereo(); }); } diff --git a/examples/Plugins/SamplerPluginDemo.h b/examples/Plugins/SamplerPluginDemo.h index 2d2882ff..289e9ff3 100644 --- a/examples/Plugins/SamplerPluginDemo.h +++ b/examples/Plugins/SamplerPluginDemo.h @@ -159,7 +159,7 @@ private: template static std::unique_ptr> makeCommand (Func&& func) { - using Decayed = typename std::decay::type; + using Decayed = std::decay_t; return std::make_unique> (std::forward (func)); } diff --git a/examples/Utilities/InAppPurchasesDemo.h b/examples/Utilities/InAppPurchasesDemo.h index 164a98a3..ffc05082 100644 --- a/examples/Utilities/InAppPurchasesDemo.h +++ b/examples/Utilities/InAppPurchasesDemo.h @@ -192,7 +192,7 @@ private: { purchaseInProgress = false; - for (const auto productId : info.purchase.productIds) + for (const auto& productId : info.purchase.productIds) { auto idx = findVoiceIndexFromIdentifier (productId); @@ -218,9 +218,9 @@ private: { if (success) { - for (auto& info : infos) + for (const auto& info : infos) { - for (const auto productId : info.purchase.productIds) + for (const auto& productId : info.purchase.productIds) { auto idx = findVoiceIndexFromIdentifier (productId); @@ -241,7 +241,7 @@ private: havePricesBeenFetched = true; StringArray identifiers; - for (auto& voiceProduct : voiceProducts) + for (const auto& voiceProduct : voiceProducts) identifiers.add (voiceProduct.identifier); InAppPurchases::getInstance()->getProductsInformation (identifiers); diff --git a/examples/Utilities/MultithreadingDemo.h b/examples/Utilities/MultithreadingDemo.h index e2363bad..9b329253 100644 --- a/examples/Utilities/MultithreadingDemo.h +++ b/examples/Utilities/MultithreadingDemo.h @@ -148,9 +148,7 @@ public: : BouncingBall (containerComp), Thread ("JUCE Demo Thread") { - // give the threads a random priority, so some will move more - // smoothly than others.. - startThread (Random::getSystemRandom().nextInt (3) + 3); + startThread(); } ~DemoThread() override diff --git a/examples/Utilities/SystemInfoDemo.h b/examples/Utilities/SystemInfoDemo.h index 41f6dfe8..f4bcddbe 100644 --- a/examples/Utilities/SystemInfoDemo.h +++ b/examples/Utilities/SystemInfoDemo.h @@ -135,6 +135,7 @@ static String getAllSystemInfo() << "Host name: " << SystemStats::getComputerName() << newLine << "Device type: " << SystemStats::getDeviceDescription() << newLine << "Manufacturer: " << SystemStats::getDeviceManufacturer() << newLine + << "Device ID: " << SystemStats::getUniqueDeviceID() << newLine << "User logon name: " << SystemStats::getLogonName() << newLine << "Full user name: " << SystemStats::getFullUserName() << newLine << "User region: " << SystemStats::getUserRegion() << newLine diff --git a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt index b2721c9c..be3f6cd7 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt +++ b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt @@ -1,8 +1,10 @@ -# Automatically generated makefile, created by the Projucer +# Automatically generated CMakeLists, created by the Projucer # Don't edit this file! Your changes will be overwritten when you re-save the Projucer project! cmake_minimum_required(VERSION 3.4.1) +project(juce_jni_project) + set(BINARY_NAME "juce_jni") set(OBOE_DIR "../../../../../modules/juce_audio_devices/native/oboe") @@ -23,9 +25,9 @@ include_directories( AFTER enable_language(ASM) if(JUCE_BUILD_CONFIGURATION MATCHES "DEBUG") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) elseif(JUCE_BUILD_CONFIGURATION MATCHES "RELEASE") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) else() message( FATAL_ERROR "No matching build-configuration found." ) endif() @@ -36,6 +38,7 @@ add_library( ${BINARY_NAME} "../../../Source/Main.cpp" "../../../Source/MainComponent.h" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -54,6 +57,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -110,6 +114,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -344,7 +349,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -754,6 +758,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -922,6 +927,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -1064,6 +1070,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -1519,6 +1526,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -1538,6 +1546,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -1622,6 +1631,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -1666,6 +1677,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -1706,6 +1718,7 @@ add_library( ${BINARY_NAME} set_source_files_properties( "../../../Source/MainComponent.h" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -1724,6 +1737,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -1780,6 +1794,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -2014,7 +2029,6 @@ set_source_files_properties( "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -2424,6 +2438,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -2592,6 +2607,7 @@ set_source_files_properties( "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -2734,6 +2750,7 @@ set_source_files_properties( "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -3189,6 +3206,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -3208,6 +3226,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -3292,6 +3311,8 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -3336,6 +3357,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -3361,14 +3383,12 @@ set_source_files_properties( "../../../JuceLibraryCode/JuceHeader.h" PROPERTIES HEADER_FILE_ONLY TRUE) -target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" [[-mfpu=neon]] [[-mfloat-abi=hard]] [[-ffast-math]] [[-funroll-loops]] [[--param]] [[max-unroll-times=8]] [[-mhard-float]] [[-D_NDK_MATH_NO_SOFTFP=1]] [[-DJUCE_DISABLE_ASSERTIONS=1]] ) - if( JUCE_BUILD_CONFIGURATION MATCHES "DEBUG" ) - target_compile_options( ${BINARY_NAME} PRIVATE) + target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" [[-mfpu=neon]] [[-mfloat-abi=hard]] [[-ffast-math]] [[-funroll-loops]] [[--param]] [[max-unroll-times=8]] [[-mhard-float]] [[-D_NDK_MATH_NO_SOFTFP=1]] [[-DJUCE_DISABLE_ASSERTIONS=1]] ) endif() if( JUCE_BUILD_CONFIGURATION MATCHES "RELEASE" ) - target_compile_options( ${BINARY_NAME} PRIVATE) + target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" [[-mfpu=neon]] [[-mfloat-abi=hard]] [[-ffast-math]] [[-funroll-loops]] [[--param]] [[max-unroll-times=8]] [[-mhard-float]] [[-D_NDK_MATH_NO_SOFTFP=1]] [[-DJUCE_DISABLE_ASSERTIONS=1]] ) endif() find_library(log "log") diff --git a/extras/AudioPerformanceTest/Builds/Android/app/build.gradle b/extras/AudioPerformanceTest/Builds/Android/app/build.gradle index 74166841..d3ce6520 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/build.gradle +++ b/extras/AudioPerformanceTest/Builds/Android/app/build.gradle @@ -1,7 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 33 + namespace "com.juce.audioperformancetest" externalNativeBuild { cmake { path "CMakeLists.txt" @@ -20,10 +21,10 @@ android { defaultConfig { applicationId "com.juce.audioperformancetest" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 33 externalNativeBuild { cmake { - arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=14", "-DCMAKE_CXX_EXTENSIONS=OFF" + arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=17", "-DCMAKE_CXX_EXTENSIONS=OFF" } } } @@ -51,21 +52,25 @@ android { } externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG", "-DCMAKE_CXX_FLAGS_DEBUG=-O0", "-DCMAKE_C_FLAGS_DEBUG=-O0" + cFlags "-O0" + cppFlags "-O0" + arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG" } } dimension "default" - } + } release_ { externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE", "-DCMAKE_CXX_FLAGS_RELEASE=-Ofast", "-DCMAKE_C_FLAGS_RELEASE=-Ofast" + cFlags "-Ofast" + cppFlags "-Ofast" + arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE" } } dimension "default" - } + } } variantFilter { variant -> diff --git a/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml b/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml index de6c234e..7ab456a9 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,19 +1,17 @@ - + - - - - - + + + + - diff --git a/extras/AudioPerformanceTest/Builds/Android/build.gradle b/extras/AudioPerformanceTest/Builds/Android/build.gradle index ee98c096..8e2533a6 100644 --- a/extras/AudioPerformanceTest/Builds/Android/build.gradle +++ b/extras/AudioPerformanceTest/Builds/Android/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' + classpath 'com.android.tools.build:gradle:7.3.0' } } diff --git a/extras/AudioPerformanceTest/Builds/Android/gradle/wrapper/gradle-wrapper.properties b/extras/AudioPerformanceTest/Builds/Android/gradle/wrapper/gradle-wrapper.properties index 80082ba5..702c227c 100644 --- a/extras/AudioPerformanceTest/Builds/Android/gradle/wrapper/gradle-wrapper.properties +++ b/extras/AudioPerformanceTest/Builds/Android/gradle/wrapper/gradle-wrapper.properties @@ -1 +1 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip \ No newline at end of file diff --git a/extras/AudioPerformanceTest/Builds/LinuxMakefile/Makefile b/extras/AudioPerformanceTest/Builds/LinuxMakefile/Makefile index 85998ab5..d4c14bfe 100644 --- a/extras/AudioPerformanceTest/Builds/LinuxMakefile/Makefile +++ b/extras/AudioPerformanceTest/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := AudioPerformanceTest JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := AudioPerformanceTest JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/AudioPerformanceTest/Builds/MacOSX/AudioPerformanceTest.xcodeproj/project.pbxproj b/extras/AudioPerformanceTest/Builds/MacOSX/AudioPerformanceTest.xcodeproj/project.pbxproj index 4b040710..13381754 100644 --- a/extras/AudioPerformanceTest/Builds/MacOSX/AudioPerformanceTest.xcodeproj/project.pbxproj +++ b/extras/AudioPerformanceTest/Builds/MacOSX/AudioPerformanceTest.xcodeproj/project.pbxproj @@ -314,10 +314,9 @@ 19B7C16D592FB25D09022191 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -329,7 +328,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -364,7 +363,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_LDFLAGS = "-weak_framework Metal -weak_framework MetalKit"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.AudioPerformanceTest; @@ -377,10 +376,9 @@ B7A6988E30C0A68B01EDC53B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -392,7 +390,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -428,7 +426,7 @@ INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_LDFLAGS = "-weak_framework Metal -weak_framework MetalKit"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.AudioPerformanceTest; @@ -460,7 +458,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -509,7 +506,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj index 03a877a6..5ef37cc6 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -74,11 +74,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPerformanceTest.exe @@ -106,7 +106,7 @@ Full ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -116,11 +116,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPerformanceTest.exe @@ -142,6 +142,9 @@ + + true + true @@ -157,6 +160,9 @@ true + + true + true @@ -229,6 +235,9 @@ true + + true + true @@ -970,6 +979,9 @@ true + + true + true @@ -1363,6 +1375,9 @@ true + + true + true @@ -2167,6 +2182,9 @@ true + + true + true @@ -2218,6 +2236,9 @@ true + + true + true @@ -2449,7 +2470,6 @@ - @@ -2788,6 +2808,7 @@ + @@ -3092,9 +3113,11 @@ + + @@ -3138,6 +3161,7 @@ + diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters index d8d4fa21..81bc0c6d 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters @@ -571,6 +571,9 @@ AudioPerformanceTest\Source + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -586,6 +589,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -658,6 +664,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1414,6 +1423,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1843,6 +1855,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2701,6 +2716,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2755,6 +2773,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3363,9 +3384,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4380,6 +4398,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5292,6 +5313,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5301,6 +5325,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5430,6 +5457,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/AudioPerformanceTest/Builds/iOS/AudioPerformanceTest.xcodeproj/project.pbxproj b/extras/AudioPerformanceTest/Builds/iOS/AudioPerformanceTest.xcodeproj/project.pbxproj index dd6e81db..841dc526 100644 --- a/extras/AudioPerformanceTest/Builds/iOS/AudioPerformanceTest.xcodeproj/project.pbxproj +++ b/extras/AudioPerformanceTest/Builds/iOS/AudioPerformanceTest.xcodeproj/project.pbxproj @@ -330,9 +330,8 @@ 19B7C16D592FB25D09022191 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -346,7 +345,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -392,9 +391,8 @@ B7A6988E30C0A68B01EDC53B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -408,7 +406,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -455,7 +453,6 @@ B907CDF95622107F20CD7617 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -493,7 +490,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "AudioPerformanceTest"; SDKROOT = iphoneos; @@ -506,7 +503,6 @@ BF82CBDF63CC37CADC61A511 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -544,7 +540,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; PRODUCT_NAME = "AudioPerformanceTest"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/extras/AudioPerformanceTest/Source/Main.cpp b/extras/AudioPerformanceTest/Source/Main.cpp index 292f9efe..c893b151 100644 --- a/extras/AudioPerformanceTest/Source/Main.cpp +++ b/extras/AudioPerformanceTest/Source/Main.cpp @@ -62,7 +62,7 @@ public: : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); - setContentOwned (createMainContentComponent(), true); + setContentOwned (new MainContentComponent(), true); setResizable (false, false); #if JUCE_IOS || JUCE_ANDROID diff --git a/extras/AudioPerformanceTest/Source/MainComponent.h b/extras/AudioPerformanceTest/Source/MainComponent.h index 8785b1cd..28dbcdbf 100644 --- a/extras/AudioPerformanceTest/Source/MainComponent.h +++ b/extras/AudioPerformanceTest/Source/MainComponent.h @@ -271,7 +271,3 @@ private: //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent) }; - - -// (This function is called by the app startup code to create our main component) -Component* createMainContentComponent() { return new MainContentComponent(); } diff --git a/extras/AudioPluginHost/AudioPluginHost.jucer b/extras/AudioPluginHost/AudioPluginHost.jucer index 5e1d2c72..5e56f67f 100644 --- a/extras/AudioPluginHost/AudioPluginHost.jucer +++ b/extras/AudioPluginHost/AudioPluginHost.jucer @@ -150,8 +150,9 @@ + microphonePermissionNeeded="1" smallIcon="c97aUr" bigIcon="c97aUr" + androidExtraAssetsFolder="../../examples/Assets" androidBluetoothScanNeeded="1" + androidBluetoothAdvertiseNeeded="1" androidBluetoothConnectNeeded="1"> diff --git a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt index ced17566..4e41480c 100644 --- a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt +++ b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt @@ -1,8 +1,10 @@ -# Automatically generated makefile, created by the Projucer +# Automatically generated CMakeLists, created by the Projucer # Don't edit this file! Your changes will be overwritten when you re-save the Projucer project! cmake_minimum_required(VERSION 3.4.1) +project(juce_jni_project) + set(BINARY_NAME "juce_jni") set(OBOE_DIR "../../../../../modules/juce_audio_devices/native/oboe") @@ -32,9 +34,9 @@ include_directories( AFTER enable_language(ASM) if(JUCE_BUILD_CONFIGURATION MATCHES "DEBUG") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_WASAPI=1]] [[-DJUCE_DIRECTSOUND=1]] [[-DJUCE_ALSA=1]] [[-DJUCE_USE_FLAC=0]] [[-DJUCE_USE_OGGVORBIS=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_AU=1]] [[-DJUCE_PLUGINHOST_LADSPA=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_USE_CDREADER=0]] [[-DJUCE_USE_CDBURNER=0]] [[-DJUCE_WEB_BROWSER=0]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_WASAPI=1]] [[-DJUCE_DIRECTSOUND=1]] [[-DJUCE_ALSA=1]] [[-DJUCE_USE_FLAC=0]] [[-DJUCE_USE_OGGVORBIS=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_AU=1]] [[-DJUCE_PLUGINHOST_LADSPA=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_USE_CDREADER=0]] [[-DJUCE_USE_CDBURNER=0]] [[-DJUCE_WEB_BROWSER=0]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) elseif(JUCE_BUILD_CONFIGURATION MATCHES "RELEASE") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_WASAPI=1]] [[-DJUCE_DIRECTSOUND=1]] [[-DJUCE_ALSA=1]] [[-DJUCE_USE_FLAC=0]] [[-DJUCE_USE_OGGVORBIS=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_AU=1]] [[-DJUCE_PLUGINHOST_LADSPA=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_USE_CDREADER=0]] [[-DJUCE_USE_CDBURNER=0]] [[-DJUCE_WEB_BROWSER=0]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_dsp=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_WASAPI=1]] [[-DJUCE_DIRECTSOUND=1]] [[-DJUCE_ALSA=1]] [[-DJUCE_USE_FLAC=0]] [[-DJUCE_USE_OGGVORBIS=1]] [[-DJUCE_PLUGINHOST_VST3=1]] [[-DJUCE_PLUGINHOST_AU=1]] [[-DJUCE_PLUGINHOST_LADSPA=1]] [[-DJUCE_PLUGINHOST_LV2=1]] [[-DJUCE_USE_CDREADER=0]] [[-DJUCE_USE_CDBURNER=0]] [[-DJUCE_WEB_BROWSER=0]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) if(NOT (ANDROID_ABI STREQUAL "mips" OR ANDROID_ABI STREQUAL "mips64")) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") @@ -69,6 +71,7 @@ add_library( ${BINARY_NAME} "../../../../../examples/Assets/proaudio.path" "../../../../../examples/Assets/reverb_ir.wav" "../../../../../examples/Assets/singing.ogg" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -87,6 +90,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -143,6 +147,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -377,7 +382,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -787,6 +791,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -955,6 +960,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -1112,6 +1118,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -1651,6 +1658,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -1670,6 +1678,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -1754,6 +1763,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -1798,6 +1809,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -1894,6 +1906,7 @@ set_source_files_properties( "../../../../../examples/Assets/proaudio.path" "../../../../../examples/Assets/reverb_ir.wav" "../../../../../examples/Assets/singing.ogg" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -1912,6 +1925,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -1968,6 +1982,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -2202,7 +2217,6 @@ set_source_files_properties( "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -2612,6 +2626,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -2780,6 +2795,7 @@ set_source_files_properties( "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -2937,6 +2953,7 @@ set_source_files_properties( "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -3476,6 +3493,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -3495,6 +3513,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -3579,6 +3598,8 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -3623,6 +3644,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -3687,14 +3709,12 @@ set_source_files_properties( "../../../JuceLibraryCode/JuceHeader.h" PROPERTIES HEADER_FILE_ONLY TRUE) -target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" ) - if( JUCE_BUILD_CONFIGURATION MATCHES "DEBUG" ) - target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override) + target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override "-fsigned-char" ) endif() if( JUCE_BUILD_CONFIGURATION MATCHES "RELEASE" ) - target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override) + target_compile_options( ${BINARY_NAME} PRIVATE -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override "-fsigned-char" ) endif() find_library(log "log") diff --git a/extras/AudioPluginHost/Builds/Android/app/build.gradle b/extras/AudioPluginHost/Builds/Android/app/build.gradle index 99042080..314b1168 100644 --- a/extras/AudioPluginHost/Builds/Android/app/build.gradle +++ b/extras/AudioPluginHost/Builds/Android/app/build.gradle @@ -1,7 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 33 + namespace "com.juce.pluginhost" externalNativeBuild { cmake { path "CMakeLists.txt" @@ -20,10 +21,10 @@ android { defaultConfig { applicationId "com.juce.pluginhost" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 33 externalNativeBuild { cmake { - arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=14", "-DCMAKE_CXX_EXTENSIONS=OFF" + arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-23", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=17", "-DCMAKE_CXX_EXTENSIONS=OFF" } } } @@ -51,21 +52,25 @@ android { } externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG", "-DCMAKE_CXX_FLAGS_DEBUG=-O0", "-DCMAKE_C_FLAGS_DEBUG=-O0" + cFlags "-O0" + cppFlags "-O0" + arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG" } } dimension "default" - } + } release_ { externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE", "-DCMAKE_CXX_FLAGS_RELEASE=-O3", "-DCMAKE_C_FLAGS_RELEASE=-O3" + cFlags "-O3" + cppFlags "-O3" + arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE" } } dimension "default" - } + } } variantFilter { variant -> diff --git a/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml b/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml index c550fe9d..ed0fcf1b 100644 --- a/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,21 +1,26 @@ - + - + + + + - - + + + + + - diff --git a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h index dc75464e..d706170d 100644 --- a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h +++ b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/AudioLiveScrollingDisplay.h @@ -45,10 +45,12 @@ public: clear(); } - void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, - int numberOfSamples) override + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, + int numberOfSamples, const AudioIODeviceCallbackContext& context) override { + ignoreUnused (context); + for (int i = 0; i < numberOfSamples; ++i) { float inputSample = 0; diff --git a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DSPDemos_Common.h b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DSPDemos_Common.h index 49ccc278..9fa1d5c3 100644 --- a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DSPDemos_Common.h +++ b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DSPDemos_Common.h @@ -25,7 +25,7 @@ using namespace dsp; struct DSPDemoParameterBase : public ChangeBroadcaster { DSPDemoParameterBase (const String& labelName) : name (labelName) {} - virtual ~DSPDemoParameterBase() {} + virtual ~DSPDemoParameterBase() = default; virtual Component* getComponent() = 0; @@ -142,7 +142,7 @@ public: loadURL (u); } - URL getCurrentURL() { return currentURL; } + URL getCurrentURL() const { return currentURL; } void setTransportSource (AudioTransportSource* newSource) { @@ -189,21 +189,7 @@ private: currentURL = u; - InputSource* inputSource = nullptr; - - #if ! JUCE_IOS - if (u.isLocalFile()) - { - inputSource = new FileInputSource (u.getLocalFile()); - } - else - #endif - { - if (inputSource == nullptr) - inputSource = new URLInputSource (u); - } - - thumbnail.setSource (inputSource); + thumbnail.setSource (makeInputSource (u).release()); if (notify) sendChangeMessage(); @@ -407,33 +393,27 @@ public: transportSource.reset(); readerSource.reset(); - AudioFormatReader* newReader = nullptr; + auto source = makeInputSource (fileToPlay); - #if ! JUCE_IOS - if (fileToPlay.isLocalFile()) - { - newReader = formatManager.createReaderFor (fileToPlay.getLocalFile()); - } - else - #endif - { - if (newReader == nullptr) - newReader = formatManager.createReaderFor (fileToPlay.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress))); - } + if (source == nullptr) + return false; - reader.reset (newReader); + auto stream = rawToUniquePtr (source->createInputStream()); - if (reader.get() != nullptr) - { - readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); - readerSource->setLooping (loopState.getValue()); + if (stream == nullptr) + return false; - init(); + reader = rawToUniquePtr (formatManager.createReaderFor (std::move (stream))); - return true; - } + if (reader == nullptr) + return false; + + readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); + readerSource->setLooping (loopState.getValue()); + + init(); - return false; + return true; } void togglePlay() @@ -613,7 +593,7 @@ private: { if (fc.getURLResults().size() > 0) { - auto u = fc.getURLResult(); + const auto u = fc.getURLResult(); if (! audioFileReader.loadURL (u)) NativeMessageBox::showAsync (MessageBoxOptions() diff --git a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DemoUtilities.h b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DemoUtilities.h index bfc1c5d2..ffdfc363 100644 --- a/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DemoUtilities.h +++ b/extras/AudioPluginHost/Builds/Android/app/src/main/assets/DemoUtilities.h @@ -242,4 +242,19 @@ struct SlowerBouncingNumber : public BouncingNumber } }; +inline std::unique_ptr makeInputSource (const URL& url) +{ + #if JUCE_ANDROID + if (auto doc = AndroidDocument::fromDocument (url)) + return std::make_unique (doc); + #endif + + #if ! JUCE_IOS + if (url.isLocalFile()) + return std::make_unique (url.getLocalFile()); + #endif + + return std::make_unique (url); +} + #endif // PIP_DEMO_UTILITIES_INCLUDED diff --git a/extras/AudioPluginHost/Builds/Android/build.gradle b/extras/AudioPluginHost/Builds/Android/build.gradle index ee98c096..8e2533a6 100644 --- a/extras/AudioPluginHost/Builds/Android/build.gradle +++ b/extras/AudioPluginHost/Builds/Android/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' + classpath 'com.android.tools.build:gradle:7.3.0' } } diff --git a/extras/AudioPluginHost/Builds/Android/gradle/wrapper/gradle-wrapper.properties b/extras/AudioPluginHost/Builds/Android/gradle/wrapper/gradle-wrapper.properties index 80082ba5..702c227c 100644 --- a/extras/AudioPluginHost/Builds/Android/gradle/wrapper/gradle-wrapper.properties +++ b/extras/AudioPluginHost/Builds/Android/gradle/wrapper/gradle-wrapper.properties @@ -1 +1 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip \ No newline at end of file diff --git a/extras/AudioPluginHost/Builds/LinuxMakefile/Makefile b/extras/AudioPluginHost/Builds/LinuxMakefile/Makefile index fb0581a4..6439db8f 100644 --- a/extras/AudioPluginHost/Builds/LinuxMakefile/Makefile +++ b/extras/AudioPluginHost/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_WASAPI=1" "-DJUCE_DIRECTSOUND=1" "-DJUCE_ALSA=1" "-DJUCE_USE_FLAC=0" "-DJUCE_USE_OGGVORBIS=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_AU=1" "-DJUCE_PLUGINHOST_LADSPA=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_USE_CDREADER=0" "-DJUCE_USE_CDBURNER=0" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_WASAPI=1" "-DJUCE_DIRECTSOUND=1" "-DJUCE_ALSA=1" "-DJUCE_USE_FLAC=0" "-DJUCE_USE_OGGVORBIS=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_AU=1" "-DJUCE_PLUGINHOST_LADSPA=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_USE_CDREADER=0" "-DJUCE_USE_CDBURNER=0" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := AudioPluginHost JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_WASAPI=1" "-DJUCE_DIRECTSOUND=1" "-DJUCE_ALSA=1" "-DJUCE_USE_FLAC=0" "-DJUCE_USE_OGGVORBIS=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_AU=1" "-DJUCE_PLUGINHOST_LADSPA=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_USE_CDREADER=0" "-DJUCE_USE_CDBURNER=0" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_WASAPI=1" "-DJUCE_DIRECTSOUND=1" "-DJUCE_ALSA=1" "-DJUCE_USE_FLAC=0" "-DJUCE_USE_OGGVORBIS=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_AU=1" "-DJUCE_PLUGINHOST_LADSPA=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_USE_CDREADER=0" "-DJUCE_USE_CDBURNER=0" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := AudioPluginHost JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -Os $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj b/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj index 7108cf0d..0fb33e31 100644 --- a/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj +++ b/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj @@ -428,10 +428,9 @@ 49453CC5AD9F08D2738464AC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -443,7 +442,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -503,7 +502,7 @@ INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -538,7 +537,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -568,10 +566,9 @@ C8B793AC1BEFBE7A99BE8352 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -583,7 +580,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -642,7 +639,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -677,7 +674,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; diff --git a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj index ff0d416b..dd2de8a9 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj +++ b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -150,6 +150,9 @@ + + true + true @@ -165,6 +168,9 @@ true + + true + true @@ -237,6 +243,9 @@ true + + true + true @@ -978,6 +987,9 @@ true + + true + true @@ -1392,6 +1404,9 @@ true + + true + true @@ -2304,6 +2319,9 @@ true + + true + true @@ -2355,6 +2373,9 @@ true + + true + true @@ -2632,7 +2653,6 @@ - @@ -2971,6 +2991,7 @@ + @@ -3329,9 +3350,11 @@ + + @@ -3375,6 +3398,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters index 71f69c73..644f19ed 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters @@ -646,6 +646,9 @@ AudioPluginHost\Source + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -661,6 +664,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -733,6 +739,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1489,6 +1498,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1942,6 +1954,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2911,6 +2926,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2965,6 +2983,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3642,9 +3663,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4659,6 +4677,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5733,6 +5754,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5742,6 +5766,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5898,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj index 563ae87d..6e7a859c 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj +++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -150,6 +150,9 @@ + + true + true @@ -165,6 +168,9 @@ true + + true + true @@ -237,6 +243,9 @@ true + + true + true @@ -978,6 +987,9 @@ true + + true + true @@ -1392,6 +1404,9 @@ true + + true + true @@ -2304,6 +2319,9 @@ true + + true + true @@ -2355,6 +2373,9 @@ true + + true + true @@ -2632,7 +2653,6 @@ - @@ -2971,6 +2991,7 @@ + @@ -3329,9 +3350,11 @@ + + @@ -3375,6 +3398,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters index 5c056fd7..4cc5b50e 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters @@ -646,6 +646,9 @@ AudioPluginHost\Source + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -661,6 +664,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -733,6 +739,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1489,6 +1498,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1942,6 +1954,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2911,6 +2926,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2965,6 +2983,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3642,9 +3663,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4659,6 +4677,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5733,6 +5754,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5742,6 +5766,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5898,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj index 7022f9a1..75283ced 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj +++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -107,7 +107,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_WASAPI=1;JUCE_DIRECTSOUND=1;JUCE_ALSA=1;JUCE_USE_FLAC=0;JUCE_USE_OGGVORBIS=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_AU=1;JUCE_PLUGINHOST_LADSPA=1;JUCE_PLUGINHOST_LV2=1;JUCE_USE_CDREADER=0;JUCE_USE_CDBURNER=0;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\AudioPluginHost.exe @@ -150,6 +150,9 @@ + + true + true @@ -165,6 +168,9 @@ true + + true + true @@ -237,6 +243,9 @@ true + + true + true @@ -978,6 +987,9 @@ true + + true + true @@ -1392,6 +1404,9 @@ true + + true + true @@ -2304,6 +2319,9 @@ true + + true + true @@ -2355,6 +2373,9 @@ true + + true + true @@ -2632,7 +2653,6 @@ - @@ -2971,6 +2991,7 @@ + @@ -3329,9 +3350,11 @@ + + @@ -3375,6 +3398,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters index 46ac0640..1e370716 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters @@ -646,6 +646,9 @@ AudioPluginHost\Source + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -661,6 +664,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -733,6 +739,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1489,6 +1498,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1942,6 +1954,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2911,6 +2926,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2965,6 +2983,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3642,9 +3663,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4659,6 +4677,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5733,6 +5754,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5742,6 +5766,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5898,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/AudioPluginHost/Builds/iOS/AudioPluginHost.xcodeproj/project.pbxproj b/extras/AudioPluginHost/Builds/iOS/AudioPluginHost.xcodeproj/project.pbxproj index a7248509..4825c292 100644 --- a/extras/AudioPluginHost/Builds/iOS/AudioPluginHost.xcodeproj/project.pbxproj +++ b/extras/AudioPluginHost/Builds/iOS/AudioPluginHost.xcodeproj/project.pbxproj @@ -440,9 +440,8 @@ 49453CC5AD9F08D2738464AC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -456,7 +455,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -530,7 +529,6 @@ 8D1CA827F1EFD443BDCF198A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -568,7 +566,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "Plugin Host"; SDKROOT = iphoneos; @@ -581,9 +579,8 @@ C8B793AC1BEFBE7A99BE8352 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -597,7 +594,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -670,7 +667,6 @@ C9295196717FABE454A210B7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -708,7 +704,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; PRODUCT_NAME = "Plugin Host"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/extras/AudioPluginHost/Source/UI/PluginWindow.h b/extras/AudioPluginHost/Source/UI/PluginWindow.h index c84518ac..40160cd4 100644 --- a/extras/AudioPluginHost/Source/UI/PluginWindow.h +++ b/extras/AudioPluginHost/Source/UI/PluginWindow.h @@ -176,11 +176,15 @@ public: } #if JUCE_IOS || JUCE_ANDROID - auto screenBounds = Desktop::getInstance().getDisplays().getTotalBounds (true).toFloat(); - auto scaleFactor = jmin ((screenBounds.getWidth() - 50) / getWidth(), (screenBounds.getHeight() - 50) / getHeight()); + const auto screenBounds = Desktop::getInstance().getDisplays().getTotalBounds (true).toFloat(); + const auto scaleFactor = jmin ((screenBounds.getWidth() - 50.0f) / (float) getWidth(), + (screenBounds.getHeight() - 50.0f) / (float) getHeight()); if (scaleFactor < 1.0f) - setSize ((int) (getWidth() * scaleFactor), (int) (getHeight() * scaleFactor)); + { + setSize ((int) (scaleFactor * (float) getWidth()), + (int) (scaleFactor * (float) getHeight())); + } setTopLeftPosition (20, 20); #else @@ -280,32 +284,17 @@ private: //============================================================================== struct ProgramAudioProcessorEditor : public AudioProcessorEditor { - ProgramAudioProcessorEditor (AudioProcessor& p) : AudioProcessorEditor (p) + explicit ProgramAudioProcessorEditor (AudioProcessor& p) + : AudioProcessorEditor (p) { setOpaque (true); - addAndMakeVisible (panel); + addAndMakeVisible (listBox); + listBox.updateContent(); - Array programs; + const auto rowHeight = listBox.getRowHeight(); - auto numPrograms = p.getNumPrograms(); - int totalHeight = 0; - - for (int i = 0; i < numPrograms; ++i) - { - auto name = p.getProgramName (i).trim(); - - if (name.isEmpty()) - name = "Unnamed"; - - auto pc = new PropertyComp (name, p); - programs.add (pc); - totalHeight += pc->getPreferredHeight(); - } - - panel.addProperties (programs); - - setSize (400, jlimit (25, 400, totalHeight)); + setSize (400, jlimit (rowHeight, 400, p.getNumPrograms() * rowHeight)); } void paint (Graphics& g) override @@ -315,33 +304,58 @@ private: void resized() override { - panel.setBounds (getLocalBounds()); + listBox.setBounds (getLocalBounds()); } private: - struct PropertyComp : public PropertyComponent, - private AudioProcessorListener + class Model : public ListBoxModel { - PropertyComp (const String& name, AudioProcessor& p) : PropertyComponent (name), owner (p) + public: + Model (Component& o, AudioProcessor& p) + : owner (o), proc (p) {} + + int getNumRows() override { - owner.addListener (this); + return proc.getNumPrograms(); } - ~PropertyComp() override + void paintListBoxItem (int rowNumber, + Graphics& g, + int width, + int height, + bool rowIsSelected) override { - owner.removeListener (this); + const auto textColour = owner.findColour (ListBox::textColourId); + + if (rowIsSelected) + { + const auto defaultColour = owner.findColour (ListBox::backgroundColourId); + const auto c = rowIsSelected ? defaultColour.interpolatedWith (textColour, 0.5f) + : defaultColour; + + g.fillAll (c); + } + + g.setColour (textColour); + g.drawText (proc.getProgramName (rowNumber), + Rectangle { width, height }.reduced (2), + Justification::left, + true); } - void refresh() override {} - void audioProcessorChanged (AudioProcessor*, const ChangeDetails&) override {} - void audioProcessorParameterChanged (AudioProcessor*, int, float) override {} - - AudioProcessor& owner; + void selectedRowsChanged (int row) override + { + if (0 <= row) + proc.setCurrentProgram (row); + } - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PropertyComp) + private: + Component& owner; + AudioProcessor& proc; }; - PropertyPanel panel; + Model model { *this, *getAudioProcessor() }; + ListBox listBox { "Programs", &model }; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProgramAudioProcessorEditor) }; diff --git a/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile b/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile index 58dd5d45..cdb676f3 100644 --- a/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile +++ b/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_CONSOLEAPP := BinaryBuilder JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_CONSOLEAPP := BinaryBuilder JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -Os $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/BinaryBuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj b/extras/BinaryBuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj index 835c8731..032956a7 100644 --- a/extras/BinaryBuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj +++ b/extras/BinaryBuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj @@ -186,10 +186,9 @@ 00F18709927DE6070FBA7BD0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -201,7 +200,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_core=1", "JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1", "JUCE_STANDALONE_APPLICATION=1", @@ -224,7 +223,7 @@ "$(inherited)", ); INSTALL_PATH = "/usr/bin"; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.binarybuilder; PRODUCT_NAME = "BinaryBuilder"; @@ -255,7 +254,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -284,10 +282,9 @@ 8A190EF24B99F557190320DA /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -299,7 +296,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_core=1", "JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1", "JUCE_STANDALONE_APPLICATION=1", @@ -323,7 +320,7 @@ ); INSTALL_PATH = "/usr/bin"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.binarybuilder; PRODUCT_NAME = "BinaryBuilder"; @@ -354,7 +351,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; diff --git a/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj b/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj index 71be7f93..c8eed503 100644 --- a/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj +++ b/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -74,11 +74,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\BinaryBuilder.exe @@ -106,7 +106,7 @@ Full ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -116,11 +116,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\BinaryBuilder.exe @@ -538,6 +538,7 @@ + diff --git a/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj.filters b/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj.filters index 5284ca0c..b821c96b 100644 --- a/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj.filters +++ b/extras/BinaryBuilder/Builds/VisualStudio2022/BinaryBuilder_ConsoleApp.vcxproj.filters @@ -633,6 +633,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native diff --git a/extras/Build/CMake/JUCECheckAtomic.cmake b/extras/Build/CMake/JUCECheckAtomic.cmake index 46bfd6a4..2935ac11 100644 --- a/extras/Build/CMake/JUCECheckAtomic.cmake +++ b/extras/Build/CMake/JUCECheckAtomic.cmake @@ -63,7 +63,7 @@ function(_juce_create_atomic_target target_name) try_compile(compile_result "${test_bindir}" "${test_file_name}" OUTPUT_VARIABLE test_build_output_0 - CXX_STANDARD 14 + CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE) @@ -71,7 +71,7 @@ function(_juce_create_atomic_target target_name) try_compile(compile_result "${test_bindir}" "${test_file_name}" OUTPUT_VARIABLE test_build_output_1 LINK_LIBRARIES atomic - CXX_STANDARD 14 + CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE) @@ -81,7 +81,7 @@ function(_juce_create_atomic_target target_name) try_compile(compile_result "${test_bindir}" "${test_file_name}" OUTPUT_VARIABLE test_build_output_2 LINK_LIBRARIES atomic - CXX_STANDARD 14 + CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE) diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake index 555a72c4..25d53400 100644 --- a/extras/Build/CMake/JUCEModuleSupport.cmake +++ b/extras/Build/CMake/JUCEModuleSupport.cmake @@ -317,7 +317,7 @@ function(_juce_add_plugin_wrapper_target format path out_path) _juce_add_plugin_definitions("${target_name}" INTERFACE ${format}) _juce_add_standard_defs("${target_name}") - target_compile_features("${target_name}" INTERFACE cxx_std_14) + target_compile_features("${target_name}" INTERFACE cxx_std_17) add_library("juce::${target_name}" ALIAS "${target_name}") if(format STREQUAL "AUv3") @@ -327,6 +327,7 @@ function(_juce_add_plugin_wrapper_target format path out_path) _juce_link_frameworks("${target_name}" INTERFACE AudioUnit) endif() elseif(format STREQUAL "AU") + target_include_directories("${target_name}" INTERFACE "${out_path}/juce_audio_plugin_client/AU") _juce_link_frameworks("${target_name}" INTERFACE AudioUnit CoreAudioKit) endif() endfunction() @@ -440,6 +441,8 @@ function(juce_add_module module_path) _juce_module_sources("${module_path}" "${base_path}" globbed_sources headers) if(${module_name} STREQUAL "juce_audio_plugin_client") + list(REMOVE_ITEM headers "${module_path}/LV2/juce_LV2TurtleDumpProgram.cpp") + _juce_get_platform_plugin_kinds(plugin_kinds) foreach(kind IN LISTS plugin_kinds) diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 7f7c13b8..90f59fbf 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -87,12 +87,6 @@ set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD FALSE) if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) _juce_create_pkgconfig_target(JUCE_CURL_LINUX_DEPS libcurl) _juce_create_pkgconfig_target(JUCE_BROWSER_LINUX_DEPS webkit2gtk-4.0 gtk+-x11-3.0) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - find_program(JUCE_XCRUN xcrun) - - if(NOT JUCE_XCRUN) - message(WARNING "failed to find xcrun; older resource-based AU plug-ins may not work correctly") - endif() endif() # We set up default/fallback copy dirs here. If you need different copy dirs, use @@ -153,67 +147,6 @@ endfunction() # ================================================================================================== -function(_juce_add_au_resource_fork shared_code_target au_target) - if(NOT JUCE_XCRUN) - return() - endif() - - get_target_property(product_name ${shared_code_target} JUCE_PRODUCT_NAME) - get_target_property(module_sources juce::juce_audio_plugin_client_AU INTERFACE_SOURCES) - - list(FILTER module_sources INCLUDE REGEX "/juce_audio_plugin_client_AU.r$") - - if(NOT module_sources) - message(FATAL_ERROR "Failed to find AU resource file input") - endif() - - list(GET module_sources 0 au_rez_sources) - - get_target_property(juce_library_code ${shared_code_target} JUCE_GENERATED_SOURCES_DIRECTORY) - # We don't want our AU AppConfig.h to end up on peoples' include paths if we can help it - set(secret_au_resource_dir "${juce_library_code}/${au_target}/secret") - set(secret_au_plugindefines "${secret_au_resource_dir}/JucePluginDefines.h") - - set(au_rez_output "${secret_au_resource_dir}/${product_name}.rsrc") - - target_sources(${au_target} PRIVATE "${au_rez_output}") - set_source_files_properties("${au_rez_output}" PROPERTIES - GENERATED TRUE - MACOSX_PACKAGE_LOCATION Resources) - - set(defs_file $>) - - # Passing all our compile definitions using generator expressions is really painful - # because some of the definitions have pipes and quotes and dollars and goodness-knows - # what else that the shell would very much like to claim for itself, thank you very much. - # CMake definitely knows how to escape all these things, because it's perfectly happy to pass - # them to compiler invocations, but I have no idea how to get it to escape them - # in a custom command. - # In the end, it's simplest to generate a special single-purpose appconfig just for the - # resource compiler. - add_custom_command(OUTPUT "${secret_au_plugindefines}" - COMMAND juce::juceaide auplugindefines "${defs_file}" "${secret_au_plugindefines}" - DEPENDS "${defs_file}" - VERBATIM) - - add_custom_command(OUTPUT "${au_rez_output}" - COMMAND "${JUCE_XCRUN}" Rez - -d "ppc_$ppc" -d "i386_$i386" -d "ppc64_$ppc64" -d "x86_64_$x86_64" -d "arm64_$arm64" - -I "${secret_au_resource_dir}" - -I "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers" - -I "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/AudioUnit.framework/Headers" - -isysroot "${CMAKE_OSX_SYSROOT}" - "${au_rez_sources}" - -useDF - -o "${au_rez_output}" - DEPENDS "${secret_au_plugindefines}" - VERBATIM) - - set(au_resource_directory "$/Contents/Resources") -endfunction() - -# ================================================================================================== - # Ideally, we'd check the preprocessor defs on the target to see whether # JUCE_USE_CURL, JUCE_WEB_BROWSER, or JUCE_IN_APP_PURCHASES have been explicitly turned off, # and then link libraries as appropriate. @@ -423,7 +356,7 @@ function(juce_add_binary_data target) target_sources(${target} PRIVATE "${binary_file_names}") target_include_directories(${target} INTERFACE ${juce_binary_data_folder}) - target_compile_features(${target} PRIVATE cxx_std_14) + target_compile_features(${target} PRIVATE cxx_std_17) # This fixes an issue where Xcode is unable to find binary data during archive. if(CMAKE_GENERATOR STREQUAL "Xcode") @@ -871,6 +804,12 @@ function(juce_enable_copy_plugin_step shared_code_target) get_target_property(active_targets "${shared_code_target}" JUCE_ACTIVE_PLUGIN_TARGETS) foreach(target IN LISTS active_targets) + get_target_property(target_kind "${target}" JUCE_TARGET_KIND_STRING) + + if(target_kind STREQUAL "App") + continue() + endif() + get_target_property(source "${target}" JUCE_PLUGIN_ARTEFACT_FILE) if(source) @@ -895,6 +834,25 @@ endfunction() # ================================================================================================== +function(_juce_add_lv2_manifest_helper_target) + if(TARGET juce_lv2_helper OR (CMAKE_SYSTEM_NAME STREQUAL "iOS") OR (CMAKE_SYSTEM_NAME STREQUAL "Android")) + return() + endif() + + get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) + set(source "${module_path}/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp") + add_executable(juce_lv2_helper "${source}") + add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) + target_compile_features(juce_lv2_helper PRIVATE cxx_std_17) + set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) + target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS}) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(juce_lv2_helper PRIVATE Threads::Threads) +endfunction() + +# ================================================================================================== + function(_juce_set_plugin_target_properties shared_code_target kind) set(target_name ${shared_code_target}_${kind}) @@ -906,7 +864,15 @@ function(_juce_set_plugin_target_properties shared_code_target kind) get_target_property(products_folder ${target_name} LIBRARY_OUTPUT_DIRECTORY) set(product_name $) - if(kind STREQUAL "VST3") + if(kind STREQUAL "Standalone") + get_target_property(is_bundle "${target_name}" BUNDLE) + + if(is_bundle) + set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") + else() + set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") + endif() + elseif(kind STREQUAL "VST3") set_target_properties(${target_name} PROPERTIES BUNDLE_EXTENSION vst3 PREFIX "" @@ -1024,8 +990,10 @@ function(_juce_set_plugin_target_properties shared_code_target kind) set(output_path "${products_folder}/${product_name}.lv2") set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${output_path}") + _juce_add_lv2_manifest_helper_target() + add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND juce::juce_lv2_helper "$" + COMMAND juce_lv2_helper "$" VERBATIM) _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR) @@ -1271,10 +1239,6 @@ function(_juce_configure_plugin_targets target) _juce_configure_app_bundle(${target} ${target}_Standalone) endif() - if(TARGET ${target}_AU) - _juce_add_au_resource_fork(${target} ${target}_AU) - endif() - if(TARGET ${target}_AAX) target_link_libraries(${target}_AAX PRIVATE juce_aax_sdk) endif() diff --git a/extras/Build/juce_build_tools/juce_build_tools.h b/extras/Build/juce_build_tools/juce_build_tools.h index 6a776947..ef702c13 100644 --- a/extras/Build/juce_build_tools/juce_build_tools.h +++ b/extras/Build/juce_build_tools/juce_build_tools.h @@ -34,7 +34,7 @@ ID: juce_build_tools vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE Build Tools description: Classes for generating intermediate files for JUCE projects. website: http://www.juce.com/juce diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt index 34f1a7f5..422d8d09 100644 --- a/extras/Build/juceaide/CMakeLists.txt +++ b/extras/Build/juceaide/CMakeLists.txt @@ -51,12 +51,52 @@ if(JUCE_BUILD_HELPER_TOOLS) else() # If we're building using the NDK, the gradle wrapper will try to inject its own compiler using # environment variables, which is unfortunate because we really don't want to cross-compile - # juceaide. If you really want to set the compilers for juceaide, pass the appropriate - # CMAKE__COMPILER flags when configuring CMake. + # juceaide. + # Similarly, when cross-compiling from Linux->Windows (e.g. using + # Fedora's mingw64-cmake command), the environment might be configured + # for cross-compiling, and we'll need to attempt to put it back to the + # host settings in order to build an executable that can run on the host + # machine. if(CMAKE_CROSSCOMPILING) + unset(ENV{ADDR2LINE}) + unset(ENV{AR}) unset(ENV{ASM}) + unset(ENV{AS}) unset(ENV{CC}) + unset(ENV{CPP}) + unset(ENV{CXXFILT}) unset(ENV{CXX}) + unset(ENV{DLLTOOL}) + unset(ENV{DLLWRAP}) + unset(ENV{ELFEDIT}) + unset(ENV{GCC}) + unset(ENV{GCOV_DUMP}) + unset(ENV{GCOV_TOOL}) + unset(ENV{GCOV}) + unset(ENV{GPROF}) + unset(ENV{GXX}) + unset(ENV{LDFLAGS}) + unset(ENV{LD_BFD}) + unset(ENV{LD}) + unset(ENV{LTO_DUMP}) + unset(ENV{NM}) + unset(ENV{OBJCOPY}) + unset(ENV{OBJDUMP}) + unset(ENV{PKG_CONFIG_LIBDIR}) + unset(ENV{PKG_CONFIG}) + unset(ENV{RANLIB}) + unset(ENV{RC}) + unset(ENV{READELF}) + unset(ENV{SIZE}) + unset(ENV{STRINGS}) + unset(ENV{STRIP}) + unset(ENV{WIDL}) + unset(ENV{WINDMC}) + unset(ENV{WINDRES}) + + if(DEFINED ENV{PATH_ORIG}) + set(ENV{PATH} "$ENV{PATH_ORIG}") + endif() else() # When building with clang-cl in Clion on Windows for an x64 target, the ABI detection phase # of the inner build can fail unless we pass through these flags too diff --git a/extras/Build/juceaide/Main.cpp b/extras/Build/juceaide/Main.cpp index 0892dcad..d36380a9 100644 --- a/extras/Build/juceaide/Main.cpp +++ b/extras/Build/juceaide/Main.cpp @@ -530,7 +530,7 @@ int main (int argc, char** argv) juce::ArgumentList argumentList { arguments.front(), juce::StringArray (arguments.data() + 1, (int) arguments.size() - 1) }; - using Fn = std::add_lvalue_reference::type; + using Fn = int (*) (juce::ArgumentList&&); const std::unordered_map commands { diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt index e75d8c21..1635dd7f 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt +++ b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt @@ -1,8 +1,10 @@ -# Automatically generated makefile, created by the Projucer +# Automatically generated CMakeLists, created by the Projucer # Don't edit this file! Your changes will be overwritten when you re-save the Projucer project! cmake_minimum_required(VERSION 3.4.1) +project(juce_jni_project) + set(BINARY_NAME "juce_jni") set(OBOE_DIR "../../../../../modules/juce_audio_devices/native/oboe") @@ -23,9 +25,9 @@ include_directories( AFTER enable_language(ASM) if(JUCE_BUILD_CONFIGURATION MATCHES "DEBUG") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEBUG=0]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCE_DEBUG=0]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DDEBUG=1]] [[-D_DEBUG=1]]) elseif(JUCE_BUILD_CONFIGURATION MATCHES "RELEASE") - add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70002]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) + add_definitions([[-DJUCE_DISPLAY_SPLASH_SCREEN=0]] [[-DJUCE_USE_DARK_SPLASH_SCREEN=1]] [[-DJUCE_PROJUCER_VERSION=0x70005]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1]] [[-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1]] [[-DJUCE_MODULE_AVAILABLE_juce_core=1]] [[-DJUCE_MODULE_AVAILABLE_juce_cryptography=1]] [[-DJUCE_MODULE_AVAILABLE_juce_data_structures=1]] [[-DJUCE_MODULE_AVAILABLE_juce_events=1]] [[-DJUCE_MODULE_AVAILABLE_juce_graphics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1]] [[-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1]] [[-DJUCE_MODULE_AVAILABLE_juce_opengl=1]] [[-DJUCE_MODULE_AVAILABLE_juce_osc=1]] [[-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1]] [[-DJUCE_STANDALONE_APPLICATION=1]] [[-DJUCER_ANDROIDSTUDIO_7F0E4A25=1]] [[-DJUCE_APP_VERSION=1.0.0]] [[-DJUCE_APP_VERSION_HEX=0x10000]] [[-DNDEBUG=1]]) else() message( FATAL_ERROR "No matching build-configuration found." ) endif() @@ -40,6 +42,7 @@ add_library( ${BINARY_NAME} "../../../Source/ClientComponent.h" "../../../Source/SharedCanvas.h" "../../../Source/juce_icon.png" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -58,6 +61,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -114,6 +118,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -348,7 +353,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -758,6 +762,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -926,6 +931,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -1083,6 +1089,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -1538,6 +1545,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -1557,6 +1565,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -1641,6 +1650,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -1685,6 +1696,7 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -1790,6 +1802,7 @@ set_source_files_properties( "../../../Source/ClientComponent.h" "../../../Source/SharedCanvas.h" "../../../Source/juce_icon.png" + "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp" "../../../../../modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp" "../../../../../modules/juce_audio_basics/buffers/juce_AudioChannelSet.h" @@ -1808,6 +1821,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPConverters.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPDispatcher.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPFactory.h" + "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPIterator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToBytestreamTranslator.h" "../../../../../modules/juce_audio_basics/midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" @@ -1864,6 +1878,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_basics/sources/juce_MemoryAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_MixerAudioSource.h" + "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_PositionableAudioSource.h" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp" "../../../../../modules/juce_audio_basics/sources/juce_ResamplingAudioSource.h" @@ -2098,7 +2113,6 @@ set_source_files_properties( "../../../../../modules/juce_audio_formats/codecs/flac/ordinals.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_decoder.h" "../../../../../modules/juce_audio_formats/codecs/flac/stream_encoder.h" - "../../../../../modules/juce_audio_formats/codecs/flac/win_utf8_io.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_51.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/coupled/res_books_stereo.h" "../../../../../modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.7/lib/books/floor/floor_books.h" @@ -2508,6 +2522,7 @@ set_source_files_properties( "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h" "../../../../../modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h" + "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp" "../../../../../modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h" "../../../../../modules/juce_audio_processors/juce_audio_processors.cpp" "../../../../../modules/juce_audio_processors/juce_audio_processors.mm" @@ -2676,6 +2691,7 @@ set_source_files_properties( "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" + "../../../../../modules/juce_core/native/juce_native_ThreadPriorities.h" "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" @@ -2833,6 +2849,7 @@ set_source_files_properties( "../../../../../modules/juce_data_structures/app_properties/juce_ApplicationProperties.h" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp" "../../../../../modules/juce_data_structures/app_properties/juce_PropertiesFile.h" + "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoableAction.h" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.cpp" "../../../../../modules/juce_data_structures/undomanager/juce_UndoManager.h" @@ -3288,6 +3305,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAValueProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_UIAWindowProvider.h" "../../../../../modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h" + "../../../../../modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp" "../../../../../modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h" @@ -3307,6 +3325,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_MouseCursor.mm" "../../../../../modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm" + "../../../../../modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h" "../../../../../modules/juce_gui_basics/native/juce_mac_Windowing.mm" "../../../../../modules/juce_gui_basics/native/juce_MultiTouchMapper.h" "../../../../../modules/juce_gui_basics/native/juce_ScopedDPIAwarenessDisabler.h" @@ -3391,6 +3410,8 @@ set_source_files_properties( "../../../../../modules/juce_gui_basics/windows/juce_TooltipWindow.h" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp" "../../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.h" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp" + "../../../../../modules/juce_gui_basics/windows/juce_VBlankAttachement.h" "../../../../../modules/juce_gui_basics/juce_gui_basics.cpp" "../../../../../modules/juce_gui_basics/juce_gui_basics.mm" "../../../../../modules/juce_gui_basics/juce_gui_basics.h" @@ -3435,6 +3456,7 @@ set_source_files_properties( "../../../../../modules/juce_gui_extra/misc/juce_SplashScreen.h" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h" + "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp" "../../../../../modules/juce_gui_extra/misc/juce_WebBrowserComponent.h" "../../../../../modules/juce_gui_extra/native/juce_android_PushNotifications.cpp" "../../../../../modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp" @@ -3517,14 +3539,12 @@ set_source_files_properties( "../../../JuceLibraryCode/JuceHeader.h" PROPERTIES HEADER_FILE_ONLY TRUE) -target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" ) - if( JUCE_BUILD_CONFIGURATION MATCHES "DEBUG" ) - target_compile_options( ${BINARY_NAME} PRIVATE) + target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" ) endif() if( JUCE_BUILD_CONFIGURATION MATCHES "RELEASE" ) - target_compile_options( ${BINARY_NAME} PRIVATE) + target_compile_options( ${BINARY_NAME} PRIVATE "-fsigned-char" ) endif() find_library(log "log") diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/build.gradle b/extras/NetworkGraphicsDemo/Builds/Android/app/build.gradle index fd520d30..58c86355 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/app/build.gradle +++ b/extras/NetworkGraphicsDemo/Builds/Android/app/build.gradle @@ -1,7 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 33 + namespace "com.juce.networkgraphicsdemo" externalNativeBuild { cmake { path "CMakeLists.txt" @@ -20,10 +21,10 @@ android { defaultConfig { applicationId "com.juce.networkgraphicsdemo" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 33 externalNativeBuild { cmake { - arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-16", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=14", "-DCMAKE_CXX_EXTENSIONS=OFF" + arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-16", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE", "-DCMAKE_CXX_STANDARD=17", "-DCMAKE_CXX_EXTENSIONS=OFF" } } } @@ -51,21 +52,25 @@ android { } externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG", "-DCMAKE_CXX_FLAGS_DEBUG=-Ofast", "-DCMAKE_C_FLAGS_DEBUG=-Ofast" + cFlags "-Ofast" + cppFlags "-Ofast" + arguments "-DJUCE_BUILD_CONFIGURATION=DEBUG" } } dimension "default" - } + } release_ { externalNativeBuild { cmake { - arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE", "-DCMAKE_CXX_FLAGS_RELEASE=-O3", "-DCMAKE_C_FLAGS_RELEASE=-O3" + cFlags "-O3" + cppFlags "-O3" + arguments "-DJUCE_BUILD_CONFIGURATION=RELEASE" } } dimension "default" - } + } } variantFilter { variant -> diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml b/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml index daf044c3..e8e438e0 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,20 +1,18 @@ - + - - - - - + + + + - diff --git a/extras/NetworkGraphicsDemo/Builds/Android/build.gradle b/extras/NetworkGraphicsDemo/Builds/Android/build.gradle index ee98c096..8e2533a6 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/build.gradle +++ b/extras/NetworkGraphicsDemo/Builds/Android/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' + classpath 'com.android.tools.build:gradle:7.3.0' } } diff --git a/extras/NetworkGraphicsDemo/Builds/Android/gradle/wrapper/gradle-wrapper.properties b/extras/NetworkGraphicsDemo/Builds/Android/gradle/wrapper/gradle-wrapper.properties index 80082ba5..702c227c 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/gradle/wrapper/gradle-wrapper.properties +++ b/extras/NetworkGraphicsDemo/Builds/Android/gradle/wrapper/gradle-wrapper.properties @@ -1 +1 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip \ No newline at end of file diff --git a/extras/NetworkGraphicsDemo/Builds/LinuxMakefile/Makefile b/extras/NetworkGraphicsDemo/Builds/LinuxMakefile/Makefile index 44040973..820afe73 100644 --- a/extras/NetworkGraphicsDemo/Builds/LinuxMakefile/Makefile +++ b/extras/NetworkGraphicsDemo/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := JUCE\ Network\ Graphics\ Demo JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := JUCE\ Network\ Graphics\ Demo JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/NetworkGraphicsDemo/Builds/MacOSX/NetworkGraphicsDemo.xcodeproj/project.pbxproj b/extras/NetworkGraphicsDemo/Builds/MacOSX/NetworkGraphicsDemo.xcodeproj/project.pbxproj index 5d700e9f..4f363192 100644 --- a/extras/NetworkGraphicsDemo/Builds/MacOSX/NetworkGraphicsDemo.xcodeproj/project.pbxproj +++ b/extras/NetworkGraphicsDemo/Builds/MacOSX/NetworkGraphicsDemo.xcodeproj/project.pbxproj @@ -354,10 +354,9 @@ 2E06386CE7CCA5FF76819BFF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -369,7 +368,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -408,7 +407,7 @@ INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_LDFLAGS = "-weak_framework Metal -weak_framework MetalKit"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.NetworkGraphicsDemo; @@ -441,7 +440,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -490,7 +488,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -519,10 +516,9 @@ EE7498599191DDC73ECB55B0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -534,7 +530,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -572,7 +568,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_LDFLAGS = "-weak_framework Metal -weak_framework MetalKit"; PRODUCT_BUNDLE_IDENTIFIER = com.juce.NetworkGraphicsDemo; diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj index 4296299f..d4df0a26 100644 --- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj +++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -74,11 +74,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\JUCE Network Graphics Demo.exe @@ -106,7 +106,7 @@ Full ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -116,11 +116,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\JUCE Network Graphics Demo.exe @@ -142,6 +142,9 @@ + + true + true @@ -157,6 +160,9 @@ true + + true + true @@ -229,6 +235,9 @@ true + + true + true @@ -970,6 +979,9 @@ true + + true + true @@ -1384,6 +1396,9 @@ true + + true + true @@ -2188,6 +2203,9 @@ true + + true + true @@ -2239,6 +2257,9 @@ true + + true + true @@ -2540,7 +2561,6 @@ - @@ -2879,6 +2899,7 @@ + @@ -3190,9 +3211,11 @@ + + @@ -3236,6 +3259,7 @@ + diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters index 44a2998b..0dc2f237 100644 --- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters +++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters @@ -601,6 +601,9 @@ NetworkGraphicsDemo\Source + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -616,6 +619,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -688,6 +694,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1444,6 +1453,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1897,6 +1909,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2755,6 +2770,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2809,6 +2827,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3504,9 +3525,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4521,6 +4539,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5454,6 +5475,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5463,6 +5487,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5592,6 +5619,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/NetworkGraphicsDemo/Builds/iOS/NetworkGraphicsDemo.xcodeproj/project.pbxproj b/extras/NetworkGraphicsDemo/Builds/iOS/NetworkGraphicsDemo.xcodeproj/project.pbxproj index 4940ed4a..12bc5222 100644 --- a/extras/NetworkGraphicsDemo/Builds/iOS/NetworkGraphicsDemo.xcodeproj/project.pbxproj +++ b/extras/NetworkGraphicsDemo/Builds/iOS/NetworkGraphicsDemo.xcodeproj/project.pbxproj @@ -370,9 +370,8 @@ 2E06386CE7CCA5FF76819BFF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -386,7 +385,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", @@ -437,7 +436,6 @@ 3BF0365A560ACD4FD24D40CE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -475,7 +473,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "JUCE Network Graphics Demo"; SDKROOT = iphoneos; @@ -488,7 +486,6 @@ 9C6D2FD441D79104734762A5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -526,7 +523,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; PRODUCT_NAME = "JUCE Network Graphics Demo"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -538,9 +535,8 @@ EE7498599191DDC73ECB55B0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; @@ -554,7 +550,7 @@ "JUCE_CONTENT_SHARING=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", "JUCE_MODULE_AVAILABLE_juce_audio_formats=1", diff --git a/extras/NetworkGraphicsDemo/NetworkGraphicsDemo.jucer b/extras/NetworkGraphicsDemo/NetworkGraphicsDemo.jucer index a6441828..1fd911d4 100644 --- a/extras/NetworkGraphicsDemo/NetworkGraphicsDemo.jucer +++ b/extras/NetworkGraphicsDemo/NetworkGraphicsDemo.jucer @@ -19,10 +19,8 @@ - - + + @@ -111,8 +109,8 @@ androidCpp11="1" targetFolder="Builds/Android" bigIcon="Ww6bQw" gradleToolchainVersion="3.6"> - + diff --git a/extras/NetworkGraphicsDemo/Source/Demos.h b/extras/NetworkGraphicsDemo/Source/Demos.h index 3f683266..4a368ef6 100644 --- a/extras/NetworkGraphicsDemo/Source/Demos.h +++ b/extras/NetworkGraphicsDemo/Source/Demos.h @@ -490,7 +490,7 @@ struct MultiLogo : public BackgroundLogo }; //============================================================================== -void createAllDemos (OwnedArray& demos) +inline void createAllDemos (OwnedArray& demos) { demos.add (new FlockDemo()); demos.add (new FlockWithText()); diff --git a/extras/Projucer/Builds/LinuxMakefile/Makefile b/extras/Projucer/Builds/LinuxMakefile/Makefile index a0f93a7f..139692af 100644 --- a/extras/Projucer/Builds/LinuxMakefile/Makefile +++ b/extras/Projucer/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_build_tools=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_LOG_ASSERTIONS=1" "-DJUCE_USE_CURL=1" "-DJUCE_LOAD_CURL_SYMBOLS_LAZILY=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.2" "-DJUCE_APP_VERSION_HEX=0x70002" $(shell $(PKG_CONFIG) --cflags freetype2) -pthread -I../../JuceLibraryCode -I../../../Build -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_build_tools=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_LOG_ASSERTIONS=1" "-DJUCE_USE_CURL=1" "-DJUCE_LOAD_CURL_SYMBOLS_LAZILY=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.5" "-DJUCE_APP_VERSION_HEX=0x70005" $(shell $(PKG_CONFIG) --cflags freetype2) -pthread -I../../JuceLibraryCode -I../../../Build -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := Projucer JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs freetype2) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_build_tools=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_LOG_ASSERTIONS=1" "-DJUCE_USE_CURL=1" "-DJUCE_LOAD_CURL_SYMBOLS_LAZILY=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.2" "-DJUCE_APP_VERSION_HEX=0x70002" $(shell $(PKG_CONFIG) --cflags freetype2) -pthread -I../../JuceLibraryCode -I../../../Build -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_build_tools=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_LOG_ASSERTIONS=1" "-DJUCE_USE_CURL=1" "-DJUCE_LOAD_CURL_SYMBOLS_LAZILY=1" "-DJUCE_ALLOW_STATIC_NULL_VARIABLES=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_WEB_BROWSER=0" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=7.0.5" "-DJUCE_APP_VERSION_HEX=0x70005" $(shell $(PKG_CONFIG) --cflags freetype2) -pthread -I../../JuceLibraryCode -I../../../Build -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_APP := Projucer JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs freetype2) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/Projucer/Builds/MacOSX/Info-App.plist b/extras/Projucer/Builds/MacOSX/Info-App.plist index 255ae69c..82442e0f 100644 --- a/extras/Projucer/Builds/MacOSX/Info-App.plist +++ b/extras/Projucer/Builds/MacOSX/Info-App.plist @@ -22,9 +22,9 @@ CFBundleSignature ???? CFBundleShortVersionString - 7.0.2 + 7.0.5 CFBundleVersion - 7.0.2 + 7.0.5 NSHumanReadableCopyright Raw Material Software Limited NSHighResolutionCapable diff --git a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj index ff3b8511..68b0ed3a 100644 --- a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj +++ b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj @@ -1118,10 +1118,9 @@ 0BC15DC2E5FE5ECFFB398D49 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -1133,7 +1132,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_build_tools=1", "JUCE_MODULE_AVAILABLE_juce_core=1", "JUCE_MODULE_AVAILABLE_juce_cryptography=1", @@ -1151,8 +1150,8 @@ "JUCE_WEB_BROWSER=0", "JUCE_STANDALONE_APPLICATION=1", "JUCER_XCODE_MAC_F6D2F4CF=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -1172,7 +1171,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.12; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../Build $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -1188,10 +1187,9 @@ 0CC6C439D038EDA0D7F10DF0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -1203,7 +1201,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_build_tools=1", "JUCE_MODULE_AVAILABLE_juce_core=1", "JUCE_MODULE_AVAILABLE_juce_cryptography=1", @@ -1221,8 +1219,8 @@ "JUCE_WEB_BROWSER=0", "JUCE_STANDALONE_APPLICATION=1", "JUCER_XCODE_MAC_F6D2F4CF=1", - "JUCE_APP_VERSION=7.0.2", - "JUCE_APP_VERSION_HEX=0x70002", + "JUCE_APP_VERSION=7.0.5", + "JUCE_APP_VERSION_HEX=0x70005", "JucePlugin_Build_VST=0", "JucePlugin_Build_VST3=0", "JucePlugin_Build_AU=0", @@ -1242,7 +1240,7 @@ INFOPLIST_FILE = Info-App.plist; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.12; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../Build $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -1277,7 +1275,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -1325,7 +1322,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj index 83c0c597..eaab8066 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebug true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -107,7 +107,7 @@ Full ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -623,6 +623,9 @@ true + + true + true @@ -1427,6 +1430,9 @@ true + + true + true @@ -1478,6 +1484,9 @@ true + + true + true @@ -1771,6 +1780,7 @@ + @@ -2082,9 +2092,11 @@ + + @@ -2128,6 +2140,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 748c79a5..c01b7709 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -922,6 +922,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -1780,6 +1783,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -1834,6 +1840,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -2634,6 +2643,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3567,6 +3579,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -3576,6 +3591,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3723,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/Projucer/Builds/VisualStudio2017/resources.rc b/extras/Projucer/Builds/VisualStudio2017/resources.rc index 842cf681..9fdaf393 100644 --- a/extras/Projucer/Builds/VisualStudio2017/resources.rc +++ b/extras/Projucer/Builds/VisualStudio2017/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Raw Material Software Limited\0" VALUE "FileDescription", "Projucer\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj index ba0a4ff2..5563032f 100644 --- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebug true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -107,7 +107,7 @@ Full ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -623,6 +623,9 @@ true + + true + true @@ -1427,6 +1430,9 @@ true + + true + true @@ -1478,6 +1484,9 @@ true + + true + true @@ -1771,6 +1780,7 @@ + @@ -2082,9 +2092,11 @@ + + @@ -2128,6 +2140,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters index c3b4cd56..bf82efb3 100644 --- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters @@ -922,6 +922,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -1780,6 +1783,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -1834,6 +1840,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -2634,6 +2643,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3567,6 +3579,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -3576,6 +3591,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3723,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/Projucer/Builds/VisualStudio2019/resources.rc b/extras/Projucer/Builds/VisualStudio2019/resources.rc index 842cf681..9fdaf393 100644 --- a/extras/Projucer/Builds/VisualStudio2019/resources.rc +++ b/extras/Projucer/Builds/VisualStudio2019/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Raw Material Software Limited\0" VALUE "FileDescription", "Projucer\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj index 6a8f866d..a6b64ae1 100644 --- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebug true NotUsing @@ -75,11 +75,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -107,7 +107,7 @@ Full ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreaded true NotUsing @@ -118,11 +118,11 @@ true true /w44265 /w45038 /w44062 %(AdditionalOptions) - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\Build;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.2;JUCE_APP_VERSION_HEX=0x70002;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_build_tools=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_LOG_ASSERTIONS=1;JUCE_USE_CURL=1;JUCE_LOAD_CURL_SYMBOLS_LAZILY=1;JUCE_ALLOW_STATIC_NULL_VARIABLES=0;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_WEB_BROWSER=0;JUCE_STANDALONE_APPLICATION=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=7.0.5;JUCE_APP_VERSION_HEX=0x70005;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\Projucer.exe @@ -623,6 +623,9 @@ true + + true + true @@ -1427,6 +1430,9 @@ true + + true + true @@ -1478,6 +1484,9 @@ true + + true + true @@ -1771,6 +1780,7 @@ + @@ -2082,9 +2092,11 @@ + + @@ -2128,6 +2140,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters index dcac9aae..3e3eb445 100644 --- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters @@ -922,6 +922,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -1780,6 +1783,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -1834,6 +1840,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -2634,6 +2643,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3567,6 +3579,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -3576,6 +3591,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3723,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/Projucer/Builds/VisualStudio2022/resources.rc b/extras/Projucer/Builds/VisualStudio2022/resources.rc index 842cf681..9fdaf393 100644 --- a/extras/Projucer/Builds/VisualStudio2022/resources.rc +++ b/extras/Projucer/Builds/VisualStudio2022/resources.rc @@ -9,7 +9,7 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 7,0,2,0 +FILEVERSION 7,0,5,0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -18,9 +18,9 @@ BEGIN VALUE "CompanyName", "Raw Material Software Limited\0" VALUE "LegalCopyright", "Raw Material Software Limited\0" VALUE "FileDescription", "Projucer\0" - VALUE "FileVersion", "7.0.2\0" + VALUE "FileVersion", "7.0.5\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.5\0" END END diff --git a/extras/Projucer/CMakeLists.txt b/extras/Projucer/CMakeLists.txt index 6e76a007..012eda67 100644 --- a/extras/Projucer/CMakeLists.txt +++ b/extras/Projucer/CMakeLists.txt @@ -30,10 +30,6 @@ juce_add_gui_app(Projucer juce_generate_juce_header(Projucer) -# This is to work around a bug with how cmake computes language standard flags with -# target_compile_features -set_target_properties(Projucer PROPERTIES CXX_STANDARD 11) - target_sources(Projucer PRIVATE Source/Application/jucer_AutoUpdater.cpp Source/Application/jucer_CommandLine.cpp diff --git a/extras/Projucer/JuceLibraryCode/JuceHeader.h b/extras/Projucer/JuceLibraryCode/JuceHeader.h index 1653f927..a7678ade 100644 --- a/extras/Projucer/JuceLibraryCode/JuceHeader.h +++ b/extras/Projucer/JuceLibraryCode/JuceHeader.h @@ -44,7 +44,7 @@ namespace ProjectInfo { const char* const projectName = "Projucer"; const char* const companyName = "Raw Material Software Limited"; - const char* const versionString = "7.0.2"; - const int versionNumber = 0x70002; + const char* const versionString = "7.0.5"; + const int versionNumber = 0x70005; } #endif diff --git a/extras/Projucer/Projucer.jucer b/extras/Projucer/Projucer.jucer index d27c80ca..f836208c 100644 --- a/extras/Projucer/Projucer.jucer +++ b/extras/Projucer/Projucer.jucer @@ -1,7 +1,7 @@ @@ -12,9 +12,9 @@ applicationCategory="public.app-category.developer-tools"> + recommendedWarnings="LLVM"/> + linkTimeOptimisation="0" recommendedWarnings="LLVM"/> diff --git a/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp b/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp index 3b6fed5a..204d649b 100644 --- a/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp +++ b/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp @@ -44,7 +44,7 @@ void LatestVersionCheckerAndUpdater::checkForNewVersion (bool background) if (! isThreadRunning()) { backgroundCheck = background; - startThread (3); + startThread (Priority::low); } } @@ -373,7 +373,7 @@ public: : ThreadWithProgressWindow ("Downloading New Version", true, true), asset (a), targetFolder (t), completionCallback (std::move (cb)) { - launchThread (3); + launchThread (Priority::low); } private: diff --git a/extras/Projucer/Source/Application/jucer_CommonHeaders.h b/extras/Projucer/Source/Application/jucer_CommonHeaders.h index cfecff48..7873dd74 100644 --- a/extras/Projucer/Source/Application/jucer_CommonHeaders.h +++ b/extras/Projucer/Source/Application/jucer_CommonHeaders.h @@ -27,8 +27,7 @@ //============================================================================== -// The GCC extensions define linux somewhere in the headers, so undef it here... -#if JUCE_GCC +#ifdef linux #undef linux #endif diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp index e12f5fad..7a7e7160 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp @@ -1433,9 +1433,9 @@ PathPoint PathPoint::withChangedPointType (const Path::Iterator::PathElementType p.pos [numPoints - 1] = p.pos [oldNumPoints - 1]; p.pos [numPoints - 1].getRectangleDouble (x, y, w, h, parentArea, owner->getDocument()->getComponentLayout()); - const int index = owner->points.indexOf (this); + const int index = owner->indexOfPoint (this); - if (PathPoint* lastPoint = owner->points [index - 1]) + if (PathPoint* lastPoint = owner->getPoint (index - 1)) { lastPoint->pos [lastPoint->getNumPoints() - 1] .getRectangleDouble (lastX, lastY, w, h, parentArea, owner->getDocument()->getComponentLayout()); @@ -1486,7 +1486,7 @@ void PathPoint::getEditableProperties (Array& props, bool mu if (multipleSelected) return; - auto index = owner->points.indexOf (this); + auto index = owner->indexOfPoint (this); jassert (index >= 0); switch (type) @@ -1537,7 +1537,7 @@ void PathPoint::getEditableProperties (Array& props, bool mu void PathPoint::deleteFromPath() { - owner->deletePoint (owner->points.indexOf (this), true); + owner->deletePoint (owner->indexOfPoint (this), true); } //============================================================================== @@ -1554,7 +1554,7 @@ PathPointComponent::PathPointComponent (PaintElementPath* const path_, setSize (11, 11); setRepaintsOnMouseActivity (true); - selected = routine->getSelectedPoints().isSelected (path_->points [index]); + selected = routine->getSelectedPoints().isSelected (path_->getPoint (index)); routine->getSelectedPoints().addChangeListener (this); } @@ -1614,7 +1614,7 @@ void PathPointComponent::mouseDown (const MouseEvent& e) dragX = getX() + getWidth() / 2; dragY = getY() + getHeight() / 2; - mouseDownSelectStatus = routine->getSelectedPoints().addToSelectionOnMouseDown (path->points [index], e.mods); + mouseDownSelectStatus = routine->getSelectedPoints().addToSelectionOnMouseDown (path->getPoint (index), e.mods); owner->getDocument()->beginTransaction(); } @@ -1646,7 +1646,7 @@ void PathPointComponent::mouseDrag (const MouseEvent& e) void PathPointComponent::mouseUp (const MouseEvent& e) { - routine->getSelectedPoints().addToSelectionOnMouseUp (path->points [index], + routine->getSelectedPoints().addToSelectionOnMouseUp (path->getPoint (index), e.mods, dragging, mouseDownSelectStatus); } @@ -1655,7 +1655,7 @@ void PathPointComponent::changeListenerCallback (ChangeBroadcaster* source) { ElementSiblingComponent::changeListenerCallback (source); - const bool nowSelected = routine->getSelectedPoints().isSelected (path->points [index]); + const bool nowSelected = routine->getSelectedPoints().isSelected (path->getPoint (index)); if (nowSelected != selected) { diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.h index fc1eb504..d6a949f8 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.h @@ -70,21 +70,21 @@ public: //============================================================================== void setInitialBounds (int parentWidth, int parentHeight) override; Rectangle getCurrentBounds (const Rectangle& parentArea) const override; - void setCurrentBounds (const Rectangle& b, const Rectangle& parentArea, const bool undoable) override; + void setCurrentBounds (const Rectangle& b, const Rectangle& parentArea, bool undoable) override; //============================================================================== bool getPoint (int index, int pointNumber, double& x, double& y, const Rectangle& parentArea) const; - void movePoint (int index, int pointNumber, double newX, double newY, const Rectangle& parentArea, const bool undoable); + void movePoint (int index, int pointNumber, double newX, double newY, const Rectangle& parentArea, bool undoable); RelativePositionedRectangle getPoint (int index, int pointNumber) const; - void setPoint (int index, int pointNumber, const RelativePositionedRectangle& newPoint, const bool undoable); + void setPoint (int index, int pointNumber, const RelativePositionedRectangle& newPoint, bool undoable); int getNumPoints() const noexcept { return points.size(); } PathPoint* getPoint (int index) const noexcept { return points [index]; } - int indexOfPoint (PathPoint* const p) const noexcept { return points.indexOf (p); } + int indexOfPoint (const PathPoint* p) const noexcept { return points.indexOf (p); } - PathPoint* addPoint (int pointIndexToAddItAfter, const bool undoable); - void deletePoint (int pointIndex, const bool undoable); + PathPoint* addPoint (int pointIndexToAddItAfter, bool undoable); + void deletePoint (int pointIndex, bool undoable); void pointListChanged(); @@ -92,10 +92,10 @@ public: //============================================================================== bool isSubpathClosed (int pointIndex) const; - void setSubpathClosed (int pointIndex, const bool closed, const bool undoable); + void setSubpathClosed (int pointIndex, bool closed, bool undoable); bool isNonZeroWinding() const noexcept { return nonZeroWinding; } - void setNonZeroWinding (const bool nonZero, const bool undoable); + void setNonZeroWinding (bool nonZero, bool undoable); //============================================================================== void getEditableProperties (Array& props, bool multipleSelected) override; @@ -125,8 +125,6 @@ public: void changed() override; private: - friend class PathPoint; - friend class PathPointComponent; OwnedArray points; bool nonZeroWinding; mutable Path path; diff --git a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.h b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.h index cb2eb306..68eb64cc 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.h +++ b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.h @@ -120,6 +120,8 @@ public: void perform (UndoableAction* action, const String& actionName); + void moveComponentZOrder (int oldIndex, int newIndex); + private: JucerDocument* document; OwnedArray components; @@ -127,10 +129,6 @@ private: int nextCompUID; String getUnusedMemberName (String nameRoot, Component* comp) const; - - friend class FrontBackCompAction; - friend class DeleteCompAction; - void moveComponentZOrder (int oldIndex, int newIndex); }; void positionToCode (const RelativePositionedRectangle& position, diff --git a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp index 111c0f09..9c4b1eec 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp @@ -573,7 +573,7 @@ bool JucerDocument::reloadFromDocument() if (currentXML != nullptr && currentXML->isEquivalentTo (newXML.get(), true)) return true; - currentXML.reset (newXML.release()); + currentXML = std::move (newXML); stopTimer(); resources.loadFromCpp (getCppFile(), cppContent); diff --git a/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.h b/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.h index b8c6cc4c..67e0d7ca 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.h +++ b/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.h @@ -46,23 +46,23 @@ public: //============================================================================== int getNumElements() const noexcept { return elements.size(); } - PaintElement* getElement (const int index) const noexcept { return elements [index]; } + PaintElement* getElement (int index) const noexcept { return elements [index]; } int indexOfElement (PaintElement* e) const noexcept { return elements.indexOf (e); } bool containsElement (PaintElement* e) const noexcept { return elements.contains (e); } //============================================================================== void clear(); - PaintElement* addElementFromXml (const XmlElement& xml, const int index, const bool undoable); - PaintElement* addNewElement (PaintElement* elementToCopy, const int index, const bool undoable); - void removeElement (PaintElement* element, const bool undoable); + PaintElement* addElementFromXml (const XmlElement& xml, int index, bool undoable); + PaintElement* addNewElement (PaintElement* elementToCopy, int index, bool undoable); + void removeElement (PaintElement* element, bool undoable); - void elementToFront (PaintElement* element, const bool undoable); - void elementToBack (PaintElement* element, const bool undoable); + void elementToFront (PaintElement* element, bool undoable); + void elementToBack (PaintElement* element, bool undoable); - const Colour getBackgroundColour() const noexcept { return backgroundColour; } + Colour getBackgroundColour() const noexcept { return backgroundColour; } void setBackgroundColour (Colour newColour) noexcept; - void fillWithBackground (Graphics& g, const bool drawOpaqueBackground); + void fillWithBackground (Graphics& g, bool drawOpaqueBackground); void drawElements (Graphics& g, const Rectangle& relativeTo); void dropImageAt (const File& f, int x, int y); @@ -108,6 +108,8 @@ public: void applyCustomPaintSnippets (StringArray&); //============================================================================== + void moveElementZOrder (int oldIndex, int newIndex); + private: OwnedArray elements; SelectedItemSet selectedElements; @@ -115,8 +117,4 @@ private: JucerDocument* document; Colour backgroundColour; - - friend class DeleteElementAction; - friend class FrontOrBackElementAction; - void moveElementZOrder (int oldIndex, int newIndex); }; diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_Sidebar.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_Sidebar.h index 927ef5e3..fa894d34 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_Sidebar.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_Sidebar.h @@ -185,7 +185,7 @@ public: findPanel = (1 << 2) }; - JUCE_NODISCARD AdditionalComponents with (Type t) + [[nodiscard]] AdditionalComponents with (Type t) { auto copy = *this; copy.componentTypes |= t; diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index d0b8c2ac..6f350c4b 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -236,7 +236,7 @@ bool Project::setCppVersionFromOldExporterSettings() } } - if (highestLanguageStandard >= 14) + if (highestLanguageStandard >= 17) { cppStandardValue = highestLanguageStandard; return true; @@ -247,8 +247,14 @@ bool Project::setCppVersionFromOldExporterSettings() void Project::updateDeprecatedProjectSettings() { - if (cppStandardValue.get().toString() == "11") - cppStandardValue.resetToDefault(); + for (const auto& version : { "11", "14" }) + { + if (cppStandardValue.get().toString() == version) + { + cppStandardValue.resetToDefault(); + break; + } + } for (ExporterIterator exporter (*this); exporter.next();) exporter->updateDeprecatedSettings(); @@ -299,7 +305,7 @@ void Project::initialiseProjectValues() useAppConfigValue.referTo (projectRoot, Ids::useAppConfig, getUndoManager(), true); addUsingNamespaceToJuceHeader.referTo (projectRoot, Ids::addUsingNamespaceToJuceHeader, getUndoManager(), true); - cppStandardValue.referTo (projectRoot, Ids::cppLanguageStandard, getUndoManager(), "14"); + cppStandardValue.referTo (projectRoot, Ids::cppLanguageStandard, getUndoManager(), "17"); headerSearchPathsValue.referTo (projectRoot, Ids::headerPath, getUndoManager()); preprocessorDefsValue.referTo (projectRoot, Ids::defines, getUndoManager()); @@ -1717,7 +1723,8 @@ Value Project::Item::getShouldSkipPCHValue() { return state.getPr bool Project::Item::shouldSkipPCH() const { return isModuleCode() || state [Ids::skipPCH]; } Value Project::Item::getCompilerFlagSchemeValue() { return state.getPropertyAsValue (Ids::compilerFlagScheme, getUndoManager()); } -String Project::Item::getCompilerFlagSchemeString() const { return state [Ids::compilerFlagScheme]; } + +String Project::Item::getCompilerFlagSchemeString() const { return state[Ids::compilerFlagScheme]; } void Project::Item::setCompilerFlagScheme (const String& scheme) { diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index 03401681..ae976c1e 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -220,8 +220,8 @@ public: bool shouldDisplaySplashScreen() const { return displaySplashScreenValue.get(); } String getSplashScreenColourString() const { return splashScreenColourValue.get(); } - static StringArray getCppStandardStrings() { return { "C++14", "C++17", "C++20", "Use Latest" }; } - static Array getCppStandardVars() { return { "14", "17", "20", "latest" }; } + static StringArray getCppStandardStrings() { return { "C++17", "C++20", "Use Latest" }; } + static Array getCppStandardVars() { return { "17", "20", "latest" }; } static String getLatestNumberedCppStandardString() { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 9021db21..a030a959 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -71,6 +71,12 @@ public: createOtherExporterProperties (props); } + void updateDeprecatedSettings() override + { + updateExternalReadPermission(); + updateBluetoothPermission(); + } + static String getDisplayName() { return "Android"; } static String getValueTreeTypeName() { return "ANDROIDSTUDIO"; } static String getTargetFolderName() { return "Android"; } @@ -94,7 +100,9 @@ public: androidCustomActivityClass, androidCustomApplicationClass, androidManifestCustomXmlElements, androidGradleSettingsContent, androidVersionCode, androidMinimumSDK, androidTargetSDK, androidTheme, androidExtraAssetsFolder, androidOboeRepositoryPath, androidInternetNeeded, androidMicNeeded, androidCameraNeeded, - androidBluetoothNeeded, androidExternalReadPermission, androidExternalWritePermission, + androidBluetoothScanNeeded, androidBluetoothAdvertiseNeeded, androidBluetoothConnectNeeded, + androidReadMediaAudioPermission, androidReadMediaImagesPermission, + androidReadMediaVideoPermission, androidExternalWritePermission, androidInAppBillingPermission, androidVibratePermission, androidOtherPermissions, androidPushNotifications, androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion; @@ -116,15 +124,19 @@ public: androidGradleSettingsContent (settings, Ids::androidGradleSettingsContent, getUndoManager()), androidVersionCode (settings, Ids::androidVersionCode, getUndoManager(), "1"), androidMinimumSDK (settings, Ids::androidMinimumSDK, getUndoManager(), "16"), - androidTargetSDK (settings, Ids::androidTargetSDK, getUndoManager(), "30"), + androidTargetSDK (settings, Ids::androidTargetSDK, getUndoManager(), "33"), androidTheme (settings, Ids::androidTheme, getUndoManager()), androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, getUndoManager()), androidOboeRepositoryPath (settings, Ids::androidOboeRepositoryPath, getUndoManager()), androidInternetNeeded (settings, Ids::androidInternetNeeded, getUndoManager(), true), androidMicNeeded (settings, Ids::microphonePermissionNeeded, getUndoManager(), false), androidCameraNeeded (settings, Ids::cameraPermissionNeeded, getUndoManager(), false), - androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, getUndoManager(), true), - androidExternalReadPermission (settings, Ids::androidExternalReadNeeded, getUndoManager(), true), + androidBluetoothScanNeeded (settings, Ids::androidBluetoothScanNeeded, getUndoManager(), false), + androidBluetoothAdvertiseNeeded (settings, Ids::androidBluetoothAdvertiseNeeded, getUndoManager(), false), + androidBluetoothConnectNeeded (settings, Ids::androidBluetoothConnectNeeded, getUndoManager(), false), + androidReadMediaAudioPermission (settings, Ids::androidReadMediaAudioPermission, getUndoManager(), true), + androidReadMediaImagesPermission (settings, Ids::androidReadMediaImagesPermission, getUndoManager(), true), + androidReadMediaVideoPermission (settings, Ids::androidReadMediaVideoPermission, getUndoManager(), true), androidExternalWritePermission (settings, Ids::androidExternalWriteNeeded, getUndoManager(), true), androidInAppBillingPermission (settings, Ids::androidInAppBilling, getUndoManager(), false), androidVibratePermission (settings, Ids::androidVibratePermissionNeeded, getUndoManager(), false), @@ -137,9 +149,9 @@ public: androidKeyStorePass (settings, Ids::androidKeyStorePass, getUndoManager(), "android"), androidKeyAlias (settings, Ids::androidKeyAlias, getUndoManager(), "androiddebugkey"), androidKeyAliasPass (settings, Ids::androidKeyAliasPass, getUndoManager(), "android"), - gradleVersion (settings, Ids::gradleVersion, getUndoManager(), "7.0.2"), + gradleVersion (settings, Ids::gradleVersion, getUndoManager(), "7.5.1"), gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"), - androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "7.0.0"), + androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "7.3.0"), AndroidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath, TargetOS::getThisOS()).get().toString()) { name = getDisplayName(); @@ -342,18 +354,46 @@ protected: } private: + void updateExternalReadPermission() + { + const auto needsExternalRead = getSettingString (Ids::androidExternalReadNeeded); + settings.removeProperty (Ids::androidExternalReadNeeded, nullptr); + + if (needsExternalRead.isEmpty()) + return; + + androidReadMediaAudioPermission .setValue (needsExternalRead, nullptr); + androidReadMediaImagesPermission.setValue (needsExternalRead, nullptr); + androidReadMediaVideoPermission .setValue (needsExternalRead, nullptr); + } + + void updateBluetoothPermission() + { + const auto needsBluetooth = getSettingString (Ids::androidBluetoothNeeded); + settings.removeProperty (Ids::androidBluetoothNeeded, nullptr); + + if (needsBluetooth.isEmpty()) + return; + + androidBluetoothScanNeeded .setValue (needsBluetooth, nullptr); + androidBluetoothAdvertiseNeeded.setValue (needsBluetooth, nullptr); + androidBluetoothConnectNeeded .setValue (needsBluetooth, nullptr); + } + void writeCmakeFile (const File& file) const { build_tools::writeStreamToFile (file, [&] (MemoryOutputStream& mo) { mo.setNewLineString (getNewLineString()); - mo << "# Automatically generated makefile, created by the Projucer" << newLine + mo << "# Automatically generated CMakeLists, created by the Projucer" << newLine << "# Don't edit this file! Your changes will be overwritten when you re-save the Projucer project!" << newLine + << newLine + << "cmake_minimum_required(VERSION 3.4.1)" << newLine + << newLine + << "project(juce_jni_project)" << newLine << newLine; - mo << "cmake_minimum_required(VERSION 3.4.1)" << newLine << newLine; - if (! isLibrary()) mo << "set(BINARY_NAME \"juce_jni\")" << newLine << newLine; @@ -405,13 +445,6 @@ private: mo << ")" << newLine << newLine; } - auto cfgExtraLinkerFlags = getExtraLinkerFlagsString(); - if (cfgExtraLinkerFlags.isNotEmpty()) - { - mo << "set( JUCE_LDFLAGS \"" << cfgExtraLinkerFlags.replace ("\"", "\\\"") << "\")" << newLine; - mo << "set( CMAKE_SHARED_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} ${JUCE_LDFLAGS}\")" << newLine << newLine; - } - mo << "enable_language(ASM)" << newLine << newLine; const auto userLibraries = getUserLibraries(); @@ -455,6 +488,14 @@ private: if (cfgDefines.size() > 0) mo << " add_definitions(" << getEscapedPreprocessorDefs (cfgDefines).joinIntoString (" ") << ")" << newLine; + const auto cfgExtraLinkerFlags = cfg.getAllLinkerFlagsString(); + + if (cfgExtraLinkerFlags.isNotEmpty()) + { + mo << " set( JUCE_LDFLAGS \"" << cfgExtraLinkerFlags.replace ("\"", "\\\"") << "\" )" << newLine + << " set( CMAKE_SHARED_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS} ${JUCE_LDFLAGS}\" )" << newLine << newLine; + } + writeCmakePathLines (mo, " ", "include_directories( AFTER", cfgHeaderPaths); if (userLibraries.size() > 0) @@ -535,26 +576,27 @@ private: mo << newLine; } - auto flags = getProjectCompilerFlags(); - - if (flags.size() > 0) - mo << "target_compile_options( ${BINARY_NAME} PRIVATE " << flags.joinIntoString (" ") << " )" << newLine << newLine; - for (ConstConfigIterator config (*this); config.next();) { auto& cfg = dynamic_cast (*config); - mo << "if( JUCE_BUILD_CONFIGURATION MATCHES \"" << cfg.getProductFlavourCMakeIdentifier() << "\" )" << newLine; - mo << " target_compile_options( ${BINARY_NAME} PRIVATE"; + mo << "if( JUCE_BUILD_CONFIGURATION MATCHES \"" << cfg.getProductFlavourCMakeIdentifier() << "\" )" << newLine + << " target_compile_options( ${BINARY_NAME} PRIVATE"; - auto recommendedFlags = cfg.getRecommendedCompilerWarningFlags(); + const auto recommendedFlags = cfg.getRecommendedCompilerWarningFlags(); for (auto& recommendedFlagsType : { recommendedFlags.common, recommendedFlags.cpp }) for (auto& flag : recommendedFlagsType) mo << " " << flag; - mo << ")" << newLine; - mo << "endif()" << newLine << newLine; + const auto flags = getConfigCompilerFlags (cfg); + + if (! flags.isEmpty()) + mo << " " << flags.joinIntoString (" "); + + mo << " )" << newLine + << "endif()" << newLine + << newLine; } auto libraries = getAndroidLibraries(); @@ -638,6 +680,7 @@ private: mo << "android {" << newLine; mo << " compileSdkVersion " << static_cast (androidTargetSDK.get()) << newLine; + mo << " namespace " << project.getBundleIdentifierString().toLowerCase().quoted() << newLine; mo << " externalNativeBuild {" << newLine; mo << " cmake {" << newLine; mo << " path \"CMakeLists.txt\"" << newLine; @@ -677,32 +720,25 @@ private: if (cfg.getArchitectures().isNotEmpty()) { - mo << " ndk {" << newLine; - mo << " abiFilters " << toGradleList (StringArray::fromTokens (cfg.getArchitectures(), " ", "")) << newLine; - mo << " }" << newLine; + mo << " ndk {" << newLine + << " abiFilters " << toGradleList (StringArray::fromTokens (cfg.getArchitectures(), " ", "")) << newLine + << " }" << newLine; } - mo << " externalNativeBuild {" << newLine; - mo << " cmake {" << newLine; + mo << " externalNativeBuild {" << newLine + << " cmake {" << newLine; if (getProject().getProjectType().isStaticLibrary()) mo << " targets \"" << getNativeModuleBinaryName (cfg) << "\"" << newLine; - mo << " arguments " - << "\"-DJUCE_BUILD_CONFIGURATION=" << cfg.getProductFlavourCMakeIdentifier() << "\""; - - mo << ", \"-DCMAKE_CXX_FLAGS_" << (cfg.isDebug() ? "DEBUG" : "RELEASE") - << "=-O" << cfg.getGCCOptimisationFlag(); - - mo << "\"" - << ", \"-DCMAKE_C_FLAGS_" << (cfg.isDebug() ? "DEBUG" : "RELEASE") - << "=-O" << cfg.getGCCOptimisationFlag() - << "\"" << newLine; - - mo << " }" << newLine; - mo << " }" << newLine << newLine; - mo << " dimension \"default\"" << newLine; - mo << " }" << newLine; + mo << " cFlags \"-O" << cfg.getGCCOptimisationFlag() << "\"" << newLine + << " cppFlags \"-O" << cfg.getGCCOptimisationFlag() << "\"" << newLine + << " arguments \"-DJUCE_BUILD_CONFIGURATION=" << cfg.getProductFlavourCMakeIdentifier() << "\"" << newLine + << " }" << newLine + << " }" << newLine + << newLine + << " dimension \"default\"" << newLine + << " }" << newLine; } mo << " }" << newLine; @@ -1102,11 +1138,23 @@ private: props.add (new ChoicePropertyComponent (androidCameraNeeded, "Camera Required"), "If enabled, this will set the android.permission.CAMERA flag in the manifest."); - props.add (new ChoicePropertyComponent (androidBluetoothNeeded, "Bluetooth Permissions Required"), - "If enabled, this will set the android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN flag in the manifest. This is required for Bluetooth MIDI on Android."); + props.add (new ChoicePropertyComponent (androidBluetoothScanNeeded, "Bluetooth Scan Required"), + "If enabled, this will set the android.permission.BLUETOOTH_SCAN, android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN flags in the manifest. This is required for Bluetooth MIDI on Android."); - props.add (new ChoicePropertyComponent (androidExternalReadPermission, "Read From External Storage"), - "If enabled, this will set the android.permission.READ_EXTERNAL_STORAGE flag in the manifest."); + props.add (new ChoicePropertyComponent (androidBluetoothAdvertiseNeeded, "Bluetooth Advertise Required"), + "If enabled, this will set the android.permission.BLUETOOTH_ADVERTISE, android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN flags in the manifest."); + + props.add (new ChoicePropertyComponent (androidBluetoothConnectNeeded, "Bluetooth Connect Required"), + "If enabled, this will set the android.permission.BLUETOOTH_CONNECT, android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN flags in the manifest. This is required for Bluetooth MIDI on Android."); + + props.add (new ChoicePropertyComponent (androidReadMediaAudioPermission, "Read Audio From External Storage"), + "If enabled, this will set the android.permission.READ_MEDIA_AUDIO and android.permission.READ_EXTERNAL_STORAGE flags in the manifest."); + + props.add (new ChoicePropertyComponent (androidReadMediaImagesPermission, "Read Images From External Storage"), + "If enabled, this will set the android.permission.READ_MEDIA_IMAGES and android.permission.READ_EXTERNAL_STORAGE flags in the manifest."); + + props.add (new ChoicePropertyComponent (androidReadMediaVideoPermission, "Read Video From External Storage"), + "If enabled, this will set the android.permission.READ_MEDIA_VIDEO and android.permission.READ_EXTERNAL_STORAGE flags in the manifest."); props.add (new ChoicePropertyComponent (androidExternalWritePermission, "Write to External Storage"), "If enabled, this will set the android.permission.WRITE_EXTERNAL_STORAGE flag in the manifest."); @@ -1376,8 +1424,10 @@ private: } //============================================================================== - void addCompileUnits (const Project::Item& projectItem, MemoryOutputStream& mo, - Array& excludeFromBuild, Array>& extraCompilerFlags) const + void addCompileUnits (const Project::Item& projectItem, + MemoryOutputStream& mo, + Array& excludeFromBuild, + Array>& extraCompilerFlags) const { if (projectItem.isGroup()) { @@ -1402,7 +1452,7 @@ private: } else { - auto extraFlags = compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString(); + auto extraFlags = getCompilerFlagsForProjectItem (projectItem); if (extraFlags.isNotEmpty()) extraCompilerFlags.add ({ file, extraFlags }); @@ -1410,7 +1460,8 @@ private: } } - void addCompileUnits (MemoryOutputStream& mo, Array& excludeFromBuild, + void addCompileUnits (MemoryOutputStream& mo, + Array& excludeFromBuild, Array>& extraCompilerFlags) const { for (int i = 0; i < getAllGroups().size(); ++i) @@ -1457,10 +1508,10 @@ private: return cFlags; } - StringArray getProjectCompilerFlags() const + StringArray getConfigCompilerFlags (const BuildConfiguration& config) const { auto cFlags = getAndroidCompilerFlags(); - cFlags.addArray (getEscapedFlags (StringArray::fromTokens (getExtraCompilerFlagsString(), true))); + cFlags.addArray (getEscapedFlags (StringArray::fromTokens (config.getAllCompilerFlagsString(), true))); return cFlags; } @@ -1641,7 +1692,6 @@ private: setAttributeIfNotPresent (*manifest, "xmlns:android", "http://schemas.android.com/apk/res/android"); setAttributeIfNotPresent (*manifest, "android:versionCode", androidVersionCode.get()); setAttributeIfNotPresent (*manifest, "android:versionName", project.getVersionString()); - setAttributeIfNotPresent (*manifest, "package", project.getBundleIdentifierString().toLowerCase()); return manifest; } @@ -1680,6 +1730,22 @@ private: // This permission only has an effect on SDK version 28 and lower if (permission == "android.permission.WRITE_EXTERNAL_STORAGE") usesPermission->setAttribute ("android:maxSdkVersion", "28"); + + // https://developer.android.com/training/data-storage/shared/documents-files + // If the SDK version is <= 28, READ_EXTERNAL_STORAGE is required to access any + // media file, including files created by the current app. + // If the SDK version is <= 32, READ_EXTERNAL_STORAGE is required to access other + // apps' media files. + // This permission has no effect on later Android versions. + if (permission == "android.permission.READ_EXTERNAL_STORAGE") + usesPermission->setAttribute ("android:maxSdkVersion", "32"); + + // These permissions are obsoleted by new more fine-grained permissions in API level 31 + if (permission == "android.permission.BLUETOOTH" + || permission == "android.permission.BLUETOOTH_ADMIN") + { + usesPermission->setAttribute ("android:maxSdkVersion", "30"); + } } } @@ -1734,10 +1800,9 @@ private: auto* act = getOrCreateChildWithName (application, "activity"); setAttributeIfNotPresent (*act, "android:name", getActivityClassString()); - setAttributeIfNotPresent (*act, "android:label", "@string/app_name"); if (! act->hasAttribute ("android:configChanges")) - act->setAttribute ("android:configChanges", "keyboardHidden|orientation|screenSize"); + act->setAttribute ("android:configChanges", "keyboard|keyboardHidden|orientation|screenSize|navigation"); if (androidScreenOrientation.get() == "landscape") { @@ -1838,7 +1903,18 @@ private: if (androidCameraNeeded.get()) s.add ("android.permission.CAMERA"); - if (androidBluetoothNeeded.get()) + if (androidBluetoothScanNeeded.get()) + s.add ("android.permission.BLUETOOTH_SCAN"); + + if (androidBluetoothAdvertiseNeeded.get()) + s.add ("android.permission.BLUETOOTH_ADVERTISE"); + + if (androidBluetoothConnectNeeded.get()) + s.add ("android.permission.BLUETOOTH_CONNECT"); + + if ( androidBluetoothScanNeeded.get() + || androidBluetoothAdvertiseNeeded.get() + || androidBluetoothConnectNeeded.get()) { s.add ("android.permission.BLUETOOTH"); s.add ("android.permission.BLUETOOTH_ADMIN"); @@ -1846,8 +1922,21 @@ private: s.add ("android.permission.ACCESS_COARSE_LOCATION"); } - if (androidExternalReadPermission.get()) + if (androidReadMediaAudioPermission.get()) + s.add ("android.permission.READ_MEDIA_AUDIO"); + + if (androidReadMediaImagesPermission.get()) + s.add ("android.permission.READ_MEDIA_IMAGES"); + + if (androidReadMediaVideoPermission.get()) + s.add ("android.permission.READ_MEDIA_VIDEO"); + + if ( androidReadMediaAudioPermission.get() + || androidReadMediaImagesPermission.get() + || androidReadMediaVideoPermission.get()) + { s.add ("android.permission.READ_EXTERNAL_STORAGE"); + } if (androidExternalWritePermission.get()) s.add ("android.permission.WRITE_EXTERNAL_STORAGE"); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h index f8359fb2..8d1c04b3 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h @@ -404,7 +404,7 @@ private: if (config.isDebug()) flags.add ("-g"); - flags.addTokens (replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim(), + flags.addTokens (replacePreprocessorTokens (config, config.getAllCompilerFlagsString()).trim(), " \n", "\"'"); if (config.exporter.isLinux()) @@ -445,7 +445,7 @@ private: if (config.isLinkTimeOptimisationEnabled()) flags.add ("-flto"); - flags.addTokens (replacePreprocessorTokens (config, getExtraLinkerFlagsString()).trim(), " \n", "\"'"); + flags.addTokens (replacePreprocessorTokens (config, config.getAllLinkerFlagsString()).trim(), " \n", "\"'"); if (config.exporter.isLinux()) { @@ -761,7 +761,7 @@ private: if (projectItem.shouldBeCompiled()) { - auto extraCompilerFlags = compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString(); + auto extraCompilerFlags = getCompilerFlagsForProjectItem (projectItem); if (extraCompilerFlags.isNotEmpty()) { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index b5563705..c7b85ea2 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -73,11 +73,21 @@ public: String getWindowsTargetPlatformVersion() const { return targetPlatformVersion.get(); } //============================================================================== - void addToolsetProperty (PropertyListBuilder& props, const char** names, const var* values, int num) + void addToolsetProperty (PropertyListBuilder& props, std::initializer_list valueStrings) { - props.add (new ChoicePropertyComponent (platformToolsetValue, "Platform Toolset", - StringArray (names, num), { values, num }), - "Specifies the version of the platform toolset that will be used when building this project."); + StringArray names; + Array values; + + for (const auto& valueString : valueStrings) + { + names.add (valueString); + values.add (valueString); + } + + props.add (new ChoicePropertyComponent (platformToolsetValue, "Platform Toolset", names, values), + "Specifies the version of the platform toolset that will be used when building this project.\n" + "In order to use the ClangCL toolset, you must first install the \"C++ Clang Tools for Windows\" " + "package using the Visual Studio Installer."); } void create (const OwnedArray&) const override @@ -161,7 +171,7 @@ public: multiProcessorCompilationValue (config, Ids::multiProcessorCompilation, getUndoManager(), true), intermediatesPathValue (config, Ids::intermediatesPath, getUndoManager()), characterSetValue (config, Ids::characterSet, getUndoManager()), - architectureTypeValue (config, Ids::winArchitecture, getUndoManager(), get64BitArchName()), + architectureTypeValue (config, Ids::winArchitecture, getUndoManager(), getIntel64BitArchName()), fastMathValue (config, Ids::fastMath, getUndoManager()), debugInformationFormatValue (config, Ids::debugInformationFormat, getUndoManager(), isDebug() ? "ProgramDatabase" : "None"), pluginBinaryCopyStepValue (config, Ids::enablePluginBinaryCopyStep, getUndoManager(), false), @@ -191,8 +201,10 @@ public: String getUnityPluginBinaryLocationString() const { return unityPluginBinaryLocation.get(); } String getIntermediatesPathString() const { return intermediatesPathValue.get(); } String getCharacterSetString() const { return characterSetValue.get(); } - String get64BitArchName() const { return "x64"; } - String get32BitArchName() const { return "Win32"; } + String getIntel64BitArchName() const { return "x64"; } + String getIntel32BitArchName() const { return "Win32"; } + String getArm64BitArchName() const { return "ARM64"; } + String getArm32BitArchName() const { return "ARM"; } String getArchitectureString() const { return architectureTypeValue.get(); } String getDebugInformationFormatString() const { return debugInformationFormatValue.get(); } @@ -201,14 +213,13 @@ public: bool shouldLinkIncremental() const { return enableIncrementalLinkingValue.get(); } bool isUsingRuntimeLibDLL() const { return useRuntimeLibDLLValue.get(); } bool shouldUseMultiProcessorCompilation() const { return multiProcessorCompilationValue.get(); } - bool is64Bit() const { return getArchitectureString() == get64BitArchName(); } bool isFastMathEnabled() const { return fastMathValue.get(); } bool isPluginBinaryCopyStepEnabled() const { return pluginBinaryCopyStepValue.get(); } //============================================================================== String createMSVCConfigName() const { - return getName() + "|" + (is64Bit() ? "x64" : "Win32"); + return getName() + "|" + getArchitectureString(); } String getOutputFilename (const String& suffix, @@ -235,10 +246,9 @@ public: addVisualStudioPluginInstallPathProperties (props); props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture", - { get32BitArchName(), get64BitArchName() }, - { get32BitArchName(), get64BitArchName() }), - "Whether to use a 32-bit or 64-bit architecture."); - + { getIntel32BitArchName(), getIntel64BitArchName(), getArm32BitArchName(), getArm64BitArchName() }, + { getIntel32BitArchName(), getIntel64BitArchName(), getArm32BitArchName(), getArm64BitArchName() }), + "Which Windows architecture to use."); props.add (new ChoicePropertyComponentWithEnablement (debugInformationFormatValue, isDebug() ? isDebugValue : generateDebugSymbolsValue, @@ -374,13 +384,26 @@ public: void setPluginBinaryCopyLocationDefaults() { - vstBinaryLocation.setDefault ((is64Bit() ? "%ProgramW6432%" : "%programfiles(x86)%") + String ("\\Steinberg\\Vstplugins")); + const auto [programsFolderPath, commonsFolderPath] = [&]() -> std::tuple + { + static const std::map> options + { + { "Win32", { "%programfiles(x86)%", "%CommonProgramFiles(x86)%" } }, + { "x64", { "%ProgramW6432%", "%CommonProgramW6432%" } }, + { "ARM", { "%programfiles(arm)%", "%CommonProgramFiles(arm)%" } }, + { "ARM64", { "%ProgramW6432%", "%CommonProgramW6432%" } } + }; + + if (const auto iter = options.find (getArchitectureString()); iter != options.cend()) + return iter->second; - auto prefix = is64Bit() ? "%CommonProgramW6432%" - : "%CommonProgramFiles(x86)%"; + jassertfalse; + return { "%programfiles%", "%CommonProgramFiles%" }; + }(); - vst3BinaryLocation.setDefault (prefix + String ("\\VST3")); - aaxBinaryLocation.setDefault (prefix + String ("\\Avid\\Audio\\Plug-Ins")); + vstBinaryLocation.setDefault (programsFolderPath + String ("\\Steinberg\\Vstplugins")); + vst3BinaryLocation.setDefault (commonsFolderPath + String ("\\VST3")); + aaxBinaryLocation.setDefault (commonsFolderPath + String ("\\Avid\\Audio\\Plug-Ins")); lv2BinaryLocation.setDefault ("%APPDATA%\\LV2"); } @@ -424,8 +447,7 @@ public: auto* e = configsGroup->createNewChildElement ("ProjectConfiguration"); e->setAttribute ("Include", config.createMSVCConfigName()); e->createNewChildElement ("Configuration")->addTextElement (config.getName()); - e->createNewChildElement ("Platform")->addTextElement (config.is64Bit() ? config.get64BitArchName() - : config.get32BitArchName()); + e->createNewChildElement ("Platform")->addTextElement (config.getArchitectureString()); } } @@ -615,7 +637,8 @@ public: if (config.isFastMathEnabled()) cl->createNewChildElement ("FloatingPointModel")->addTextElement ("Fast"); - auto extraFlags = getOwner().replacePreprocessorTokens (config, getOwner().getExtraCompilerFlagsString()).trim(); + auto extraFlags = getOwner().replacePreprocessorTokens (config, config.getAllCompilerFlagsString()).trim(); + if (extraFlags.isNotEmpty()) cl->createNewChildElement ("AdditionalOptions")->addTextElement (extraFlags + " %(AdditionalOptions)"); @@ -651,7 +674,7 @@ public: link->createNewChildElement ("ProgramDatabaseFile")->addTextElement (pdbFilename); link->createNewChildElement ("SubSystem")->addTextElement (type == ConsoleApp || type == LV2TurtleProgram ? "Console" : "Windows"); - if (! config.is64Bit()) + if (config.getArchitectureString() == "Win32") link->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); if (isUsingEditAndContinue) @@ -674,7 +697,7 @@ public: if (additionalDependencies.isNotEmpty()) link->createNewChildElement ("AdditionalDependencies")->addTextElement (additionalDependencies); - auto extraLinkerOptions = getOwner().getExtraLinkerFlagsString(); + auto extraLinkerOptions = config.getAllLinkerFlagsString(); if (extraLinkerOptions.isNotEmpty()) link->createNewChildElement ("AdditionalOptions")->addTextElement (getOwner().replacePreprocessorTokens (config, extraLinkerOptions).trim() + " %(AdditionalOptions)"); @@ -716,7 +739,7 @@ public: build_tools::RelativePath::buildTargetFolder).toWindowsStyle()); } - if (getTargetFileType() == staticLibrary && ! config.is64Bit()) + if (getTargetFileType() == staticLibrary && config.getArchitectureString() == "Win32") { auto* lib = group->createNewChildElement ("Lib"); lib->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); @@ -889,7 +912,7 @@ public: if (projectItem.shouldBeCompiled()) { - auto extraCompilerFlags = owner.compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString(); + auto extraCompilerFlags = getOwner().getCompilerFlagsForProjectItem (projectItem); if (shouldAddBigobjFlag (path)) { @@ -1196,7 +1219,7 @@ public: auto outputFilename = config.getOutputFilename (".aaxplugin", true, type); auto bundleDir = getOwner().getOutDirFile (config, outputFilename); auto bundleContents = bundleDir + "\\Contents"; - auto archDir = bundleContents + String ("\\") + (config.is64Bit() ? "x64" : "Win32"); + auto archDir = bundleContents + String ("\\") + config.getArchitectureString(); auto executablePath = archDir + String ("\\") + outputFilename; auto pkgScript = String ("copy /Y ") + getOutputFilePath (config).quoted() + String (" ") + executablePath.quoted() + String ("\r\ncall ") @@ -1274,7 +1297,7 @@ public: auto bundleDir = getOwner().getOutDirFile (config, config.getOutputFilename (".aaxplugin", false, type)); auto bundleContents = bundleDir + "\\Contents"; - auto archDir = bundleContents + String ("\\") + (config.is64Bit() ? "x64" : "Win32"); + auto archDir = bundleContents + String ("\\") + config.getArchitectureString(); for (auto& folder : StringArray { bundleDir, bundleContents, archDir }) script += String ("if not exist \"") + folder + String ("\" mkdir \"") + folder + String ("\"\r\n"); @@ -1820,10 +1843,7 @@ public: void createExporterProperties (PropertyListBuilder& props) override { - static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp" }; - const var toolsets[] = { "v140", "v140_xp", "v141", "v141_xp" }; - addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); - + addToolsetProperty (props, { "v140", "v140_xp", "v141", "v141_xp" }); MSVCProjectExporterBase::createExporterProperties (props); } @@ -1865,10 +1885,7 @@ public: void createExporterProperties (PropertyListBuilder& props) override { - static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp", "v142" }; - const var toolsets[] = { "v140", "v140_xp", "v141", "v141_xp", "v142" }; - addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); - + addToolsetProperty (props, { "v140", "v140_xp", "v141", "v141_xp", "v142", "ClangCL" }); MSVCProjectExporterBase::createExporterProperties (props); } @@ -1910,10 +1927,7 @@ public: void createExporterProperties (PropertyListBuilder& props) override { - static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp", "v142", "v143" }; - const var toolsets[] = { "v140", "v140_xp", "v141", "v141_xp", "v142", "v143" }; - addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); - + addToolsetProperty (props, { "v140", "v140_xp", "v141", "v141_xp", "v142", "v143", "ClangCL" }); MSVCProjectExporterBase::createExporterProperties (props); } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h index 563f18be..f506f750 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -218,7 +218,7 @@ public: } else if (type == LV2PlugIn) { - s.add ("JUCE_LV2DIR := " + targetName + ".lv2"); + s.add ("JUCE_LV2DIR := " + escapeQuotesAndSpaces (targetName) + ".lv2"); targetName = "$(JUCE_LV2DIR)/" + targetName + ".so"; } else if (type == LV2TurtleProgram) @@ -228,6 +228,9 @@ public: s.add ("JUCE_TARGET_" + getTargetVarName() + String (" := ") + escapeQuotesAndSpaces (targetName)); + if (type == LV2PlugIn) + s.add ("JUCE_LV2_FULL_PATH := $(JUCE_OUTDIR)/$(JUCE_TARGET_LV2_PLUGIN)"); + if (config.isPluginBinaryCopyStepEnabled() && (type == VST3PlugIn || type == VSTPlugIn || type == UnityPlugIn || type == LV2PlugIn)) { @@ -251,7 +254,6 @@ public: else if (type == LV2PlugIn) { s.add ("JUCE_LV2DESTDIR := " + config.getLV2BinaryLocationString()); - s.add ("JUCE_LV2_FULL_PATH := $(JUCE_OUTDIR)/$(JUCE_TARGET_LV2_PLUGIN)"); s.add (copyCmd + "$(JUCE_LV2DIR) $(JUCE_LV2DESTDIR)"); } } @@ -275,32 +277,30 @@ public: return String (getName()).toUpperCase().replaceCharacter (L' ', L'_'); } - void writeObjects (OutputStream& out, const Array>& filesToCompile) const + void writeObjects (OutputStream& out, const std::vector>& filesToCompile) const { out << "OBJECTS_" + getTargetVarName() + String (" := \\") << newLine; for (auto& f : filesToCompile) - out << " $(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor ({ f.first, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder })) + out << " $(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor (f.first)) << " \\" << newLine; out << newLine; } - void addFiles (OutputStream& out, const Array>& filesToCompile) + void addFiles (OutputStream& out, const std::vector>& filesToCompile) { auto cppflagsVarName = "JUCE_CPPFLAGS_" + getTargetVarName(); auto cflagsVarName = "JUCE_CFLAGS_" + getTargetVarName(); - for (auto& f : filesToCompile) + for (auto& [path, flags] : filesToCompile) { - build_tools::RelativePath relativePath (f.first, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder); - - out << "$(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor (relativePath)) << ": " << escapeQuotesAndSpaces (relativePath.toUnixStyle()) << newLine - << "\t-$(V_AT)mkdir -p $(JUCE_OBJDIR)" << newLine - << "\t@echo \"Compiling " << relativePath.getFileName() << "\"" << newLine - << (relativePath.hasFileExtension ("c;s;S") ? "\t$(V_AT)$(CC) $(JUCE_CFLAGS) " : "\t$(V_AT)$(CXX) $(JUCE_CXXFLAGS) ") + out << "$(JUCE_OBJDIR)/" << escapeQuotesAndSpaces (owner.getObjectFileFor (path)) << ": " << escapeQuotesAndSpaces (path.toUnixStyle()) << newLine + << "\t-$(V_AT)mkdir -p $(JUCE_OBJDIR)" << newLine + << "\t@echo \"Compiling " << path.getFileName() << "\"" << newLine + << (path.hasFileExtension ("c;s;S") ? "\t$(V_AT)$(CC) $(JUCE_CFLAGS) " : "\t$(V_AT)$(CXX) $(JUCE_CXXFLAGS) ") << "$(" << cppflagsVarName << ") $(" << cflagsVarName << ")" - << (f.second.isNotEmpty() ? " $(" + owner.getCompilerFlagSchemeVariableName (f.second) + ")" : "") << " -o \"$@\" -c \"$<\"" << newLine + << (flags.isNotEmpty() ? " $(" + owner.getCompilerFlagSchemeVariableName (flags) + ")" : "") << " -o \"$@\" -c \"$<\"" << newLine << newLine; } } @@ -380,13 +380,11 @@ public: if (type == VST3PlugIn) { - out << "\t-$(V_AT)mkdir -p $(JUCE_VST3DESTDIR)" << newLine - << "\t-$(V_AT)cp -R $(JUCE_COPYCMD_VST3)" << newLine; + out << "\t-$(V_AT)[ ! \"$(JUCE_VST3DESTDIR)\" ] || (mkdir -p $(JUCE_VST3DESTDIR) && cp -R $(JUCE_COPYCMD_VST3))" << newLine; } else if (type == VSTPlugIn) { - out << "\t-$(V_AT)mkdir -p $(JUCE_VSTDESTDIR)" << newLine - << "\t-$(V_AT)cp -R $(JUCE_COPYCMD_VST)" << newLine; + out << "\t-$(V_AT)[ ! \"$(JUCE_VSTDESTDIR)\" ] || (mkdir -p $(JUCE_VSTDESTDIR) && cp -R $(JUCE_COPYCMD_VST))" << newLine; } else if (type == UnityPlugIn) { @@ -397,15 +395,12 @@ public: build_tools::RelativePath::projectFolder); out << "\t-$(V_AT)cp " + scriptPath.toUnixStyle() + " $(JUCE_OUTDIR)/$(JUCE_UNITYDIR)" << newLine - << "\t-$(V_AT)mkdir -p $(JUCE_UNITYDESTDIR)" << newLine - << "\t-$(V_AT)cp -R $(JUCE_COPYCMD_UNITY_PLUGIN)" << newLine; + << "\t-$(V_AT)[ ! \"$(JUCE_UNITYDESTDIR)\" ] || (mkdir -p $(JUCE_UNITYDESTDIR) && cp -R $(JUCE_COPYCMD_UNITY_PLUGIN))" << newLine; } else if (type == LV2PlugIn) { - out << "\t$(V_AT) $(JUCE_OUTDIR)/$(JUCE_TARGET_LV2_MANIFEST_HELPER) " - "$(abspath $(JUCE_LV2_FULL_PATH))" << newLine - << "\t-$(V_AT)mkdir -p $(JUCE_LV2DESTDIR)" << newLine - << "\t-$(V_AT)cp -R $(JUCE_COPYCMD_LV2_PLUGIN)" << newLine; + out << "\t$(V_AT) $(JUCE_OUTDIR)/$(JUCE_TARGET_LV2_MANIFEST_HELPER) $(JUCE_LV2_FULL_PATH)" << newLine + << "\t-$(V_AT)[ ! \"$(JUCE_LV2DESTDIR)\" ] || (mkdir -p $(JUCE_LV2DESTDIR) && cp -R $(JUCE_COPYCMD_LV2_PLUGIN))" << newLine; } out << newLine; @@ -651,7 +646,7 @@ private: for (auto& recommended : config.getRecommendedCompilerWarningFlags().common) result.add (recommended); - auto extra = replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim(); + auto extra = replacePreprocessorTokens (config, config.getAllCompilerFlagsString()).trim(); if (extra.isNotEmpty()) result.add (extra); @@ -722,7 +717,7 @@ private: if (config.isLinkTimeOptimisationEnabled()) result.add ("-flto"); - auto extraFlags = getExtraLinkerFlagsString().trim(); + const auto extraFlags = config.getAllLinkerFlagsString().trim(); if (extraFlags.isNotEmpty()) result.add (replacePreprocessorTokens (config, extraFlags)); @@ -915,12 +910,19 @@ private: static String getCompilerFlagSchemeVariableName (const String& schemeName) { return "JUCE_COMPILERFLAGSCHEME_" + schemeName; } - void findAllFilesToCompile (const Project::Item& projectItem, Array>& results) const + std::vector> findAllFilesToCompile (const Project::Item& projectItem) const { + std::vector> results; + if (projectItem.isGroup()) { for (int i = 0; i < projectItem.getNumChildren(); ++i) - findAllFilesToCompile (projectItem.getChild (i), results); + { + auto inner = findAllFilesToCompile (projectItem.getChild (i)); + results.insert (results.end(), + std::make_move_iterator (inner.cbegin()), + std::make_move_iterator (inner.cend())); + } } else { @@ -931,33 +933,35 @@ private: if (shouldFileBeCompiledByDefault (f)) { auto scheme = projectItem.getCompilerFlagSchemeString(); - auto flags = compilerFlagSchemesMap[scheme].get().toString(); + auto flags = getCompilerFlagsForProjectItem (projectItem); if (scheme.isNotEmpty() && flags.isNotEmpty()) - results.add ({ f, scheme }); + results.emplace_back (f, scheme); else - results.add ({ f, {} }); + results.emplace_back (f, String{}); } } } + + return results; } - void writeCompilerFlagSchemes (OutputStream& out, const Array>& filesToCompile) const + void writeCompilerFlagSchemes (OutputStream& out, const std::vector>& filesToCompile) const { - StringArray schemesToWrite; + std::set schemesToWrite; - for (auto& f : filesToCompile) - if (f.second.isNotEmpty()) - schemesToWrite.addIfNotAlreadyThere (f.second); + for (const auto& pair : filesToCompile) + if (pair.second.isNotEmpty()) + schemesToWrite.insert (pair.second); - if (! schemesToWrite.isEmpty()) - { - for (auto& s : schemesToWrite) - out << getCompilerFlagSchemeVariableName (s) << " := " - << compilerFlagSchemesMap[s].get().toString() << newLine; + if (schemesToWrite.empty()) + return; - out << newLine; - } + for (const auto& s : schemesToWrite) + if (const auto flags = getCompilerFlagsForFileCompilerFlagScheme (s); flags.isNotEmpty()) + out << getCompilerFlagSchemeVariableName (s) << " := " << flags << newLine; + + out << newLine; } void writeMakefile (OutputStream& out) const @@ -1004,27 +1008,44 @@ private: for (ConstConfigIterator config (*this); config.next();) writeConfig (out, dynamic_cast (*config)); - Array> filesToCompile; + std::vector> filesToCompile; for (int i = 0; i < getAllGroups().size(); ++i) - findAllFilesToCompile (getAllGroups().getReference (i), filesToCompile); + { + auto group = findAllFilesToCompile (getAllGroups().getReference (i)); + filesToCompile.insert (filesToCompile.end(), + std::make_move_iterator (group.cbegin()), + std::make_move_iterator (group.cend())); + } writeCompilerFlagSchemes (out, filesToCompile); - auto getFilesForTarget = [this] (const Array>& files, - MakefileTarget* target, - const Project& p) -> Array> + const auto getFilesForTarget = [this] (const std::vector>& files, + MakefileTarget* target, + const Project& p) { - Array> targetFiles; + std::vector> targetFiles; auto targetType = (p.isAudioPluginProject() ? target->type : MakefileTarget::SharedCodeTarget); - for (auto& f : files) - if (p.getTargetTypeFromFilePath (f.first, true) == targetType) - targetFiles.add (f); + for (auto& [path, flags] : files) + { + if (p.getTargetTypeFromFilePath (path, true) == targetType) + { + targetFiles.emplace_back (build_tools::RelativePath { path, + getTargetFolder(), + build_tools::RelativePath::buildTargetFolder }, + flags); + } + } if (targetType == MakefileTarget::LV2TurtleProgram) - targetFiles.add ({ project.resolveFilename (getLV2TurtleDumpProgramSource().toUnixStyle()), {} }); + { + targetFiles.emplace_back (getLV2TurtleDumpProgramSource().rebased (projectFolder, + getTargetFolder(), + build_tools::RelativePath::buildTargetFolder), + String{}); + } return targetFiles; }; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 6344807c..3d29ce30 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -689,7 +689,7 @@ public: "added separated by a semicolon. The App Groups Capability setting must be enabled for this setting to have any effect."); props.add (new ChoicePropertyComponent (keepCustomXcodeSchemesValue, "Keep Custom Xcode Schemes"), - "Enable this to keep any Xcode schemes you have created for debugging or running, e.g. to launch a plug-in in" + "Enable this to keep any Xcode schemes you have created for debugging or running, e.g. to launch a plug-in in " "various hosts. If disabled, all schemes are replaced by a default set."); props.add (new ChoicePropertyComponent (useHeaderMapValue, "USE_HEADERMAP"), @@ -807,10 +807,10 @@ protected: : BuildConfiguration (p, t, e), iOS (isIOS), macOSBaseSDK (config, Ids::macOSBaseSDK, getUndoManager()), - macOSDeploymentTarget (config, Ids::macOSDeploymentTarget, getUndoManager(), "10.11"), + macOSDeploymentTarget (config, Ids::macOSDeploymentTarget, getUndoManager(), "10.13"), macOSArchitecture (config, Ids::osxArchitecture, getUndoManager(), macOSArch_Default), iosBaseSDK (config, Ids::iosBaseSDK, getUndoManager()), - iosDeploymentTarget (config, Ids::iosDeploymentTarget, getUndoManager(), "9.3"), + iosDeploymentTarget (config, Ids::iosDeploymentTarget, getUndoManager(), "11.0"), customXcodeFlags (config, Ids::customXcodeFlags, getUndoManager()), plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, getUndoManager()), codeSignIdentity (config, Ids::codeSigningIdentity, getUndoManager()), @@ -859,7 +859,7 @@ protected: "The version of the macOS SDK to link against." + sdkInfoString + "10.11."); props.add (new TextPropertyComponent (macOSDeploymentTarget, "macOS Deployment Target", 8, false), - "The minimum version of macOS to target." + sdkInfoString + "10.7."); + "The minimum version of macOS to target." + sdkInfoString + "10.9."); props.add (new ChoicePropertyComponent (macOSArchitecture, "macOS Architecture", { "Native architecture of build machine", "Standard 32-bit", "Standard 32/64-bit", "Standard 64-bit" }, @@ -1048,7 +1048,7 @@ public: struct XcodeTarget : build_tools::ProjectType::Target { //============================================================================== - XcodeTarget (build_tools::ProjectType::Target::Type targetType, const XcodeProjectExporter& exporter) + XcodeTarget (Type targetType, const XcodeProjectExporter& exporter) : Target (targetType), owner (exporter) { @@ -1614,9 +1614,10 @@ public: for (const auto& xcodeFlags : { XcodeWarningFlags { recommendedWarnings.common, "OTHER_CFLAGS" }, XcodeWarningFlags { recommendedWarnings.cpp, "OTHER_CPLUSPLUSFLAGS" } }) { - auto flags = (xcodeFlags.flags.joinIntoString (" ") - + " " + owner.getExtraCompilerFlagsString()).trim(); - flags = owner.replacePreprocessorTokens (config, flags); + const auto flags = owner.replacePreprocessorTokens (config, + (xcodeFlags.flags.joinIntoString (" ") + + " " + + config.getAllCompilerFlagsString()).trim()); if (flags.isNotEmpty()) s.set (xcodeFlags.variable, flags.quoted()); @@ -1680,11 +1681,9 @@ public: s.set ("GCC_VERSION", gccVersion); s.set ("CLANG_LINK_OBJC_RUNTIME", "NO"); - auto codeSigningIdentity = owner.getCodeSigningIdentity (config); - s.set (owner.iOS ? "\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"" : "CODE_SIGN_IDENTITY", - codeSigningIdentity.quoted()); + owner.addCodeSigningIdentity (config, s); - if (codeSigningIdentity.isNotEmpty()) + if (owner.getCodeSigningIdentity (config).isNotEmpty()) { s.set ("PROVISIONING_PROFILE_SPECIFIER", "\"\""); @@ -1699,10 +1698,13 @@ public: s.set ("CODE_SIGN_ENTITLEMENTS", getEntitlementsFilename().quoted()); { - auto cppStandard = owner.project.getCppStandardString(); + const auto cppStandard = [&]() -> String + { + if (owner.project.getCppStandardString() == "latest") + return owner.project.getLatestNumberedCppStandardString(); - if (cppStandard == "latest") - cppStandard = owner.project.getLatestNumberedCppStandardString(); + return owner.project.getCppStandardString(); + }(); s.set ("CLANG_CXX_LANGUAGE_STANDARD", (String (owner.shouldUseGNUExtensions() ? "gnu++" : "c++") + cppStandard).quoted()); @@ -1851,7 +1853,7 @@ public: flags.add (getLinkerFlagForLib (l)); } - flags.add (owner.replacePreprocessorTokens (config, owner.getExtraLinkerFlagsString())); + flags.add (owner.replacePreprocessorTokens (config, config.getAllLinkerFlagsString())); flags = getCleanedStringArray (flags); } @@ -1968,11 +1970,15 @@ public: StringArray paths (owner.extraSearchPaths); paths.addArray (config.getHeaderSearchPaths()); - if (owner.project.getEnabledModules().isModuleEnabled ("juce_audio_plugin_client")) + constexpr auto audioPluginClient = "juce_audio_plugin_client"; + + if (owner.project.getEnabledModules().isModuleEnabled (audioPluginClient)) { - // Needed to compile .r files - paths.add (owner.getModuleFolderRelativeToProject ("juce_audio_plugin_client") - .rebased (owner.projectFolder, owner.getTargetFolder(), build_tools::RelativePath::buildTargetFolder) + paths.add (owner.getModuleFolderRelativeToProject (audioPluginClient) + .getChildFile ("AU") + .rebased (owner.projectFolder, + owner.getTargetFolder(), + build_tools::RelativePath::buildTargetFolder) .toUnixStyle()); } @@ -2299,7 +2305,16 @@ private: if (target->type == XcodeTarget::LV2PlugIn) { - auto script = "set -e\n\"$CONFIGURATION_BUILD_DIR/../" + // When building LV2 plugins on Arm macs, we need to load and run the plugin bundle + // during a post-build step in order to generate the plugin's supporting files. Arm + // macs will only load shared libraries if they are signed, but Xcode runs its + // signing step after any post-build scripts. As a workaround, we check whether the + // plugin is signed and generate an adhoc certificate if necessary, before running + // the manifest-generator. + auto script = "set -e\n" + "xcrun codesign --verify \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME\" " + "|| xcrun codesign -s - \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME\"\n" + "\"$CONFIGURATION_BUILD_DIR/../" + Project::getLV2FileWriterName() + "\" \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME\"\n"; @@ -2516,6 +2531,13 @@ private: return config.getCodeSignIdentityString(); } + void addCodeSigningIdentity (const XcodeBuildConfiguration& config, StringPairArray& result) const + { + if (const auto codeSigningIdentity = getCodeSigningIdentity (config); codeSigningIdentity.isNotEmpty()) + result.set (iOS ? "\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"" : "CODE_SIGN_IDENTITY", + codeSigningIdentity.quoted()); + } + StringPairArray getProjectSettings (const XcodeBuildConfiguration& config) const { StringPairArray s; @@ -2566,8 +2588,7 @@ private: s.set ("ONLY_ACTIVE_ARCH", "YES"); } - s.set (iOS ? "\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"" : "CODE_SIGN_IDENTITY", - getCodeSigningIdentity (config).quoted()); + addCodeSigningIdentity (config, s); if (iOS) { @@ -3196,7 +3217,7 @@ private: xcodeTarget = getTargetOfType (project.getTargetTypeFromFilePath (projectItem.getFile(), false)); return addFile (FileOptions().withRelativePath (path) - .withCompilerFlags (compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get()) + .withCompilerFlags (getCompilerFlagsForProjectItem (projectItem)) .withCompilationEnabled (projectItem.shouldBeCompiled()) .withAddToBinaryResourcesEnabled (projectItem.shouldBeAddedToBinaryResources()) .withAddToXcodeResourcesEnabled (projectItem.shouldBeAddedToXcodeResources()) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp index a1e08a5e..915e4d5b 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp @@ -245,7 +245,11 @@ void ProjectExporter::updateCompilerFlagValues() compilerFlagSchemesMap.clear(); for (auto& scheme : project.getCompilerFlagSchemes()) - compilerFlagSchemesMap.set (scheme, { settings, scheme, getUndoManager() }); + { + compilerFlagSchemesMap.emplace (std::piecewise_construct, + std::forward_as_tuple (scheme), + std::forward_as_tuple (settings, scheme, getUndoManager())); + } } //============================================================================== @@ -285,9 +289,11 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the " "form ${NAME_OF_DEFINITION}, which will be replaced with their values."); - for (HashMap::Iterator i (compilerFlagSchemesMap); i.next();) - props.add (new TextPropertyComponent (compilerFlagSchemesMap.getReference (i.getKey()), "Compiler Flags for " + i.getKey().quoted(), 8192, false), + for (const auto& [key, property] : compilerFlagSchemesMap) + { + props.add (new TextPropertyComponent (property, "Compiler Flags for " + key.quoted(), 8192, false), "The exporter-specific compiler flags that will be added to files using this scheme."); + } props.add (new TextPropertyComponent (extraLinkerFlagsValue, "Extra Linker Flags", 8192, true), "Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. " @@ -507,6 +513,19 @@ String ProjectExporter::replacePreprocessorTokens (const ProjectExporter::BuildC sourceString); } +String ProjectExporter::getCompilerFlagsForFileCompilerFlagScheme (StringRef schemeName) const +{ + if (const auto iter = compilerFlagSchemesMap.find (schemeName); iter != compilerFlagSchemesMap.cend()) + return iter->second.get().toString(); + + return {}; +} + +String ProjectExporter::getCompilerFlagsForProjectItem (const Project::Item& item) const +{ + return getCompilerFlagsForFileCompilerFlagScheme (item.getCompilerFlagSchemeString()); +} + void ProjectExporter::copyMainGroupFromProject() { jassert (itemGroups.size() == 0); @@ -761,31 +780,6 @@ ProjectExporter::BuildConfiguration::Ptr ProjectExporter::getConfiguration (int return createBuildConfig (getConfigurations().getChild (index)); } -bool ProjectExporter::hasConfigurationNamed (const String& nameToFind) const -{ - auto configs = getConfigurations(); - for (int i = configs.getNumChildren(); --i >= 0;) - if (configs.getChild(i) [Ids::name].toString() == nameToFind) - return true; - - return false; -} - -String ProjectExporter::getUniqueConfigName (String nm) const -{ - auto nameRoot = nm; - while (CharacterFunctions::isDigit (nameRoot.getLastCharacter())) - nameRoot = nameRoot.dropLastCharacters (1); - - nameRoot = nameRoot.trim(); - - int suffix = 2; - while (hasConfigurationNamed (name)) - nm = nameRoot + " " + String (suffix++); - - return nm; -} - void ProjectExporter::addNewConfigurationFromExisting (const BuildConfiguration& configToCopy) { auto configs = getConfigurations(); @@ -894,33 +888,22 @@ ProjectExporter::BuildConfiguration::BuildConfiguration (Project& p, const Value librarySearchPathValue (config, Ids::libraryPath, getUndoManager()), userNotesValue (config, Ids::userNotes, getUndoManager()), usePrecompiledHeaderFileValue (config, Ids::usePrecompiledHeaderFile, getUndoManager(), false), - precompiledHeaderFileValue (config, Ids::precompiledHeaderFile, getUndoManager()) + precompiledHeaderFileValue (config, Ids::precompiledHeaderFile, getUndoManager()), + configCompilerFlagsValue (config, Ids::extraCompilerFlags, getUndoManager()), + configLinkerFlagsValue (config, Ids::extraLinkerFlags, getUndoManager()) { auto& llvmFlags = recommendedCompilerWarningFlags[CompilerNames::llvm] = BuildConfiguration::CompilerWarningFlags::getRecommendedForGCCAndLLVM(); - llvmFlags.common.addArray ({ - "-Wshorten-64-to-32", "-Wconversion", "-Wint-conversion", - "-Wconditional-uninitialized", "-Wconstant-conversion", "-Wbool-conversion", - "-Wextra-semi", "-Wshift-sign-overflow", - "-Wshadow-all", "-Wnullable-to-nonnull-conversion", - "-Wmissing-prototypes" - }); - llvmFlags.cpp.addArray ({ - "-Wunused-private-field", "-Winconsistent-missing-destructor-override" - }); - llvmFlags.objc.addArray ({ - "-Wunguarded-availability", "-Wunguarded-availability-new" - }); + llvmFlags.common.addArray ({ "-Wshorten-64-to-32", "-Wconversion", "-Wint-conversion", + "-Wconditional-uninitialized", "-Wconstant-conversion", "-Wbool-conversion", + "-Wextra-semi", "-Wshift-sign-overflow", + "-Wshadow-all", "-Wnullable-to-nonnull-conversion", + "-Wmissing-prototypes" }); + llvmFlags.cpp.addArray ({ "-Wunused-private-field", "-Winconsistent-missing-destructor-override" }); + llvmFlags.objc.addArray ({ "-Wunguarded-availability", "-Wunguarded-availability-new" }); auto& gccFlags = recommendedCompilerWarningFlags[CompilerNames::gcc] = BuildConfiguration::CompilerWarningFlags::getRecommendedForGCCAndLLVM(); - gccFlags.common.addArray ({ - "-Wextra", "-Wsign-compare", "-Wno-implicit-fallthrough", "-Wno-maybe-uninitialized", - "-Wredundant-decls", "-Wno-strict-overflow", - "-Wshadow" - }); -} - -ProjectExporter::BuildConfiguration::~BuildConfiguration() -{ + gccFlags.common.addArray ({ "-Wextra", "-Wsign-compare", "-Wno-implicit-fallthrough", "-Wno-maybe-uninitialized", + "-Wredundant-decls", "-Wno-strict-overflow", "-Wshadow" }); } String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const @@ -1007,6 +990,12 @@ void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBui "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace, commas, or " "new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash."); + props.add (new TextPropertyComponent (configCompilerFlagsValue, "Configuration-specific Compiler Flags", 8192, true), + "Compiler flags that are only to be used in this configuration."); + + props.add (new TextPropertyComponent (configLinkerFlagsValue, "Configuration-specific Linker Flags", 8192, true), + "Linker flags that are only to be used in this configuration."); + props.add (new ChoicePropertyComponent (linkTimeOptimisationValue, "Link-Time Optimisation"), "Enable this to perform link-time code optimisation. This is recommended for release builds."); @@ -1038,28 +1027,6 @@ StringPairArray ProjectExporter::BuildConfiguration::getAllPreprocessorDefs() co parsePreprocessorDefs (getBuildConfigPreprocessorDefsString())); } -StringPairArray ProjectExporter::BuildConfiguration::getUniquePreprocessorDefs() const -{ - auto perConfigurationDefs = parsePreprocessorDefs (getBuildConfigPreprocessorDefsString()); - auto globalDefs = project.getPreprocessorDefs(); - - for (int i = 0; i < globalDefs.size(); ++i) - { - auto globalKey = globalDefs.getAllKeys()[i]; - - int idx = perConfigurationDefs.getAllKeys().indexOf (globalKey); - if (idx >= 0) - { - auto globalValue = globalDefs.getAllValues()[i]; - - if (globalValue == perConfigurationDefs.getAllValues()[idx]) - perConfigurationDefs.remove (idx); - } - } - - return perConfigurationDefs; -} - StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const { return getSearchPathsFromString (getHeaderSearchPathString() + ';' + project.getHeaderSearchPathsString()); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index a29ef6d4..a25d1fe8 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -37,7 +37,6 @@ class ProjectExporter : private Value::Listener { public: ProjectExporter (Project&, const ValueTree& settings); - virtual ~ProjectExporter() override = default; //============================================================================== struct ExporterTypeInfo @@ -140,9 +139,6 @@ public: Value getTargetLocationValue() { return targetLocationValue.getPropertyAsValue(); } String getTargetLocationString() const { return targetLocationValue.get(); } - String getExtraCompilerFlagsString() const { return extraCompilerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } - String getExtraLinkerFlagsString() const { return extraLinkerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } - StringArray getExternalLibrariesStringArray() const { return getSearchPathsFromString (externalLibrariesValue.get().toString()); } String getExternalLibrariesString() const { return getExternalLibrariesStringArray().joinIntoString (";"); } @@ -228,7 +224,6 @@ public: { public: BuildConfiguration (Project& project, const ValueTree& configNode, const ProjectExporter&); - ~BuildConfiguration(); using Ptr = ReferenceCountedObjectPtr; @@ -253,7 +248,6 @@ public: String getBuildConfigPreprocessorDefsString() const { return ppDefinesValue.get(); } StringPairArray getAllPreprocessorDefs() const; // includes inherited definitions - StringPairArray getUniquePreprocessorDefs() const; // returns pre-processor definitions that are not already in the project pre-processor defs String getHeaderSearchPathString() const { return headerSearchPathValue.get(); } StringArray getHeaderSearchPaths() const; @@ -267,6 +261,9 @@ public: bool shouldUsePrecompiledHeaderFile() const { return usePrecompiledHeaderFileValue.get(); } String getPrecompiledHeaderFileContent() const; + String getAllCompilerFlagsString() const { return (exporter.extraCompilerFlagsValue.get().toString() + " " + configCompilerFlagsValue.get().toString()).replaceCharacters ("\r\n", " ").trim(); } + String getAllLinkerFlagsString() const { return (exporter.extraLinkerFlagsValue .get().toString() + " " + configLinkerFlagsValue .get().toString()).replaceCharacters ("\r\n", " ").trim(); } + //============================================================================== Value getValue (const Identifier& nm) { return config.getPropertyAsValue (nm, getUndoManager()); } UndoManager* getUndoManager() const { return project.getUndoManagerFor (config); } @@ -311,7 +308,7 @@ public: protected: ValueTreePropertyWithDefault isDebugValue, configNameValue, targetNameValue, targetBinaryPathValue, recommendedWarningsValue, optimisationLevelValue, linkTimeOptimisationValue, ppDefinesValue, headerSearchPathValue, librarySearchPathValue, userNotesValue, - usePrecompiledHeaderFileValue, precompiledHeaderFileValue; + usePrecompiledHeaderFileValue, precompiledHeaderFileValue, configCompilerFlagsValue, configLinkerFlagsValue; private: std::map recommendedCompilerWarningFlags; @@ -321,8 +318,6 @@ public: void addNewConfigurationFromExisting (const BuildConfiguration& configToCopy); void addNewConfiguration (bool isDebugConfig); - bool hasConfigurationNamed (const String& name) const; - String getUniqueConfigName (String name) const; String getExternalLibraryFlags (const BuildConfiguration& config) const; @@ -403,6 +398,9 @@ public: return false; } + String getCompilerFlagsForFileCompilerFlagScheme (StringRef) const; + String getCompilerFlagsForProjectItem (const Project::Item&) const; + protected: //============================================================================== String name; @@ -418,7 +416,6 @@ protected: userNotesValue, gnuExtensionsValue, bigIconValue, smallIconValue, extraPPDefsValue; Value projectCompilerFlagSchemesValue; - HashMap compilerFlagSchemesMap; mutable Array itemGroups; Project::Item* modulesGroup = nullptr; @@ -455,6 +452,9 @@ protected: } private: + //============================================================================== + std::map compilerFlagSchemesMap; + //============================================================================== void valueChanged (Value&) override { updateCompilerFlagValues(); } void updateCompilerFlagValues(); diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h index 350d7c41..88800347 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h @@ -234,7 +234,13 @@ namespace Ids DECLARE_ID (androidGradleSettingsContent); DECLARE_ID (androidCustomStringXmlElements); DECLARE_ID (androidBluetoothNeeded); + DECLARE_ID (androidBluetoothScanNeeded); + DECLARE_ID (androidBluetoothAdvertiseNeeded); + DECLARE_ID (androidBluetoothConnectNeeded); DECLARE_ID (androidExternalReadNeeded); + DECLARE_ID (androidReadMediaAudioPermission); + DECLARE_ID (androidReadMediaImagesPermission); + DECLARE_ID (androidReadMediaVideoPermission); DECLARE_ID (androidExternalWriteNeeded); DECLARE_ID (androidInAppBilling); DECLARE_ID (androidVibratePermissionNeeded); diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_TranslationHelpers.h b/extras/Projucer/Source/Utility/Helpers/jucer_TranslationHelpers.h index 37e4e895..8795a092 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_TranslationHelpers.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_TranslationHelpers.h @@ -296,7 +296,6 @@ struct TranslationHelpers const StringArray& originalKeys (originalStrings.getAllKeys()); const StringArray& originalValues (originalStrings.getAllValues()); - int numRemoved = 0; for (int i = preStrings.size(); --i >= 0;) { @@ -304,7 +303,6 @@ struct TranslationHelpers { preStrings.remove (i); postStrings.remove (i); - ++numRemoved; } } diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp index 88aa018f..ea203361 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp @@ -265,6 +265,9 @@ ValueTree PIPGenerator::createExporterChild (const Identifier& exporterIdentifie } } + if (exporterIdentifier.toString() == AndroidProjectExporter::getValueTreeTypeName()) + exporter.setProperty (Ids::androidBluetoothNeeded, true, nullptr); + { ValueTree configs (Ids::CONFIGURATIONS); diff --git a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h index eb8d904c..4a3e744f 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h +++ b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h @@ -108,7 +108,6 @@ protected: private: class ItemSelectionTimer; - friend class ItemSelectionTimer; std::unique_ptr delayedSelectionTimer; void invokeShowDocument(); diff --git a/extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h b/extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h index 15cbc65e..f3f064e0 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h +++ b/extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h @@ -58,7 +58,6 @@ public: private: struct DotButton; - friend struct DotButton; struct PageInfo { diff --git a/extras/UnitTestRunner/Builds/LinuxMakefile/Makefile b/extras/UnitTestRunner/Builds/LinuxMakefile/Makefile index 2c7ebd71..5d735a95 100644 --- a/extras/UnitTestRunner/Builds/LinuxMakefile/Makefile +++ b/extras/UnitTestRunner/Builds/LinuxMakefile/Makefile @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_CONSOLEAPP := UnitTestRunner JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) @@ -60,12 +60,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := endif - JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) + JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70005" "-DJUCE_MODULE_AVAILABLE_juce_analytics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_cryptography=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_dsp=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_MODULE_AVAILABLE_juce_opengl=1" "-DJUCE_MODULE_AVAILABLE_juce_osc=1" "-DJUCE_MODULE_AVAILABLE_juce_product_unlocking=1" "-DJUCE_MODULE_AVAILABLE_juce_video=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_PLUGINHOST_VST3=1" "-DJUCE_PLUGINHOST_LV2=1" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCE_UNIT_TESTS=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd -I../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 -I../../../../modules/juce_audio_processors/format_types/LV2_SDK -I../../../../modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS) JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0" JUCE_TARGET_CONSOLEAPP := UnitTestRunner JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS) - JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS) + JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++17 $(CXXFLAGS) JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lGL $(LDFLAGS) CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR) diff --git a/extras/UnitTestRunner/Builds/MacOSX/UnitTestRunner.xcodeproj/project.pbxproj b/extras/UnitTestRunner/Builds/MacOSX/UnitTestRunner.xcodeproj/project.pbxproj index 3d05bd8e..ba35702c 100644 --- a/extras/UnitTestRunner/Builds/MacOSX/UnitTestRunner.xcodeproj/project.pbxproj +++ b/extras/UnitTestRunner/Builds/MacOSX/UnitTestRunner.xcodeproj/project.pbxproj @@ -363,7 +363,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -393,10 +392,9 @@ 962CC7E0A536C3F56DBE1F8F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; DEAD_CODE_STRIPPING = YES; @@ -408,7 +406,7 @@ "NDEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -462,7 +460,7 @@ ); INSTALL_PATH = "/usr/bin"; LLVM_LTO = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; @@ -497,7 +495,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; @@ -526,10 +523,9 @@ A81C9C5D3696F83D5E8CFE11 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; COPY_PHASE_STRIP = NO; @@ -541,7 +537,7 @@ "DEBUG=1", "JUCE_DISPLAY_SPLASH_SCREEN=0", "JUCE_USE_DARK_SPLASH_SCREEN=1", - "JUCE_PROJUCER_VERSION=0x70002", + "JUCE_PROJUCER_VERSION=0x70005", "JUCE_MODULE_AVAILABLE_juce_analytics=1", "JUCE_MODULE_AVAILABLE_juce_audio_basics=1", "JUCE_MODULE_AVAILABLE_juce_audio_devices=1", @@ -594,7 +590,7 @@ "$(inherited)", ); INSTALL_PATH = "/usr/bin"; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lilv $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sratom $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord/src $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/sord $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/serd $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK/lv2 $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/LV2_SDK $(SRCROOT)/../../../../modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../../../modules"; OTHER_CFLAGS = "-Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; OTHER_CPLUSPLUSFLAGS = "-Woverloaded-virtual -Wreorder -Wzero-as-null-pointer-constant -Wunused-private-field -Winconsistent-missing-destructor-override -Wall -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wswitch-enum -Wsign-conversion -Wsign-compare -Wunreachable-code -Wcast-align -Wno-ignored-qualifiers -Wshorten-64-to-32 -Wconversion -Wint-conversion -Wconditional-uninitialized -Wconstant-conversion -Wbool-conversion -Wextra-semi -Wshift-sign-overflow -Wshadow-all -Wnullable-to-nonnull-conversion -Wmissing-prototypes -Wunguarded-availability -Wunguarded-availability-new"; diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj index 8c216b9f..beb5b01d 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -76,11 +76,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -108,7 +108,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -120,11 +120,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2017_78A5024=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -158,6 +158,9 @@ true + + true + true @@ -173,6 +176,9 @@ true + + true + true @@ -245,6 +251,9 @@ true + + true + true @@ -986,6 +995,9 @@ true + + true + true @@ -1400,6 +1412,9 @@ true + + true + true @@ -2312,6 +2327,9 @@ true + + true + true @@ -2363,6 +2381,9 @@ true + + true + true @@ -2698,7 +2719,6 @@ - @@ -3037,6 +3057,7 @@ + @@ -3395,9 +3416,11 @@ + + @@ -3441,6 +3464,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters index aaaf298f..e0a95f88 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -670,6 +670,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -685,6 +688,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -757,6 +763,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1513,6 +1522,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1966,6 +1978,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2935,6 +2950,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2989,6 +3007,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3732,9 +3753,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4749,6 +4767,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5823,6 +5844,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5832,6 +5856,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5988,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj index 9928fd8d..3f268eba 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -76,11 +76,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -108,7 +108,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -120,11 +120,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2019_78A5026=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -158,6 +158,9 @@ true + + true + true @@ -173,6 +176,9 @@ true + + true + true @@ -245,6 +251,9 @@ true + + true + true @@ -986,6 +995,9 @@ true + + true + true @@ -1400,6 +1412,9 @@ true + + true + true @@ -2312,6 +2327,9 @@ true + + true + true @@ -2363,6 +2381,9 @@ true + + true + true @@ -2698,7 +2719,6 @@ - @@ -3037,6 +3057,7 @@ + @@ -3395,9 +3416,11 @@ + + @@ -3441,6 +3464,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters index a60b3465..2d93b6b1 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -670,6 +670,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -685,6 +688,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -757,6 +763,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1513,6 +1522,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1966,6 +1978,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2935,6 +2950,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2989,6 +3007,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3732,9 +3753,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4749,6 +4767,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5823,6 +5844,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5832,6 +5856,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5988,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj index 20584fb4..5cde0f75 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -76,11 +76,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -108,7 +108,7 @@ Full ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -120,11 +120,11 @@ true /w44265 /w45038 /w44062 %(AdditionalOptions) true - stdcpp14 + stdcpp17 ..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lilv;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sratom;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord\src;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\sord;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\serd;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK\lv2;..\..\..\..\modules\juce_audio_processors\format_types\LV2_SDK;..\..\..\..\modules\juce_audio_processors\format_types\VST3_SDK;..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_analytics=1;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_dsp=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_osc=1;JUCE_MODULE_AVAILABLE_juce_product_unlocking=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_PLUGINHOST_VST3=1;JUCE_PLUGINHOST_LV2=1;JUCE_STRICT_REFCOUNTEDPOINTER=1;JUCE_STANDALONE_APPLICATION=1;JUCE_UNIT_TESTS=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;%(PreprocessorDefinitions) $(OutDir)\UnitTestRunner.exe @@ -158,6 +158,9 @@ true + + true + true @@ -173,6 +176,9 @@ true + + true + true @@ -245,6 +251,9 @@ true + + true + true @@ -986,6 +995,9 @@ true + + true + true @@ -1400,6 +1412,9 @@ true + + true + true @@ -2312,6 +2327,9 @@ true + + true + true @@ -2363,6 +2381,9 @@ true + + true + true @@ -2698,7 +2719,6 @@ - @@ -3037,6 +3057,7 @@ + @@ -3395,9 +3416,11 @@ + + @@ -3441,6 +3464,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters index dfe10afe..d785e613 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -670,6 +670,9 @@ JUCE Modules\juce_analytics + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -685,6 +688,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -757,6 +763,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1513,6 +1522,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1966,6 +1978,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2935,6 +2950,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2989,6 +3007,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3732,9 +3753,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4749,6 +4767,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5823,6 +5844,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5832,6 +5856,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5988,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/extras/UnitTestRunner/UnitTestRunner.jucer b/extras/UnitTestRunner/UnitTestRunner.jucer index b340c140..9fc1ad3b 100644 --- a/extras/UnitTestRunner/UnitTestRunner.jucer +++ b/extras/UnitTestRunner/UnitTestRunner.jucer @@ -12,10 +12,10 @@ - - + + diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj index 42b8349d..b08545b4 100644 --- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj +++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj @@ -64,7 +64,7 @@ Disabled ProgramDatabase ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) MultiThreadedDebugDLL true NotUsing @@ -74,11 +74,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;DEBUG;_DEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) $(OutDir)\juce_dll.lib @@ -106,7 +106,7 @@ Full ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) MultiThreadedDLL true NotUsing @@ -116,11 +116,11 @@ Level4 true true - stdcpp14 + stdcpp17 ..\..\JuceLibraryCode;..\..\..\..\modules;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70002;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCE_DISPLAY_SPLASH_SCREEN=0;JUCE_USE_DARK_SPLASH_SCREEN=1;JUCE_PROJUCER_VERSION=0x70005;JUCE_MODULE_AVAILABLE_juce_audio_basics=1;JUCE_MODULE_AVAILABLE_juce_audio_devices=1;JUCE_MODULE_AVAILABLE_juce_audio_formats=1;JUCE_MODULE_AVAILABLE_juce_audio_processors=1;JUCE_MODULE_AVAILABLE_juce_audio_utils=1;JUCE_MODULE_AVAILABLE_juce_core=1;JUCE_MODULE_AVAILABLE_juce_cryptography=1;JUCE_MODULE_AVAILABLE_juce_data_structures=1;JUCE_MODULE_AVAILABLE_juce_events=1;JUCE_MODULE_AVAILABLE_juce_graphics=1;JUCE_MODULE_AVAILABLE_juce_gui_basics=1;JUCE_MODULE_AVAILABLE_juce_gui_extra=1;JUCE_MODULE_AVAILABLE_juce_opengl=1;JUCE_MODULE_AVAILABLE_juce_video=1;JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1;JUCE_STANDALONE_APPLICATION=1;JUCE_DLL_BUILD=1;JUCER_VS2022_78A503E=1;JUCE_APP_VERSION=1.0.0;JUCE_APP_VERSION_HEX=0x10000;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;JucePlugin_Build_LV2=0;_LIB;%(PreprocessorDefinitions) $(OutDir)\juce_dll.lib @@ -141,6 +141,9 @@ + + true + true @@ -156,6 +159,9 @@ true + + true + true @@ -228,6 +234,9 @@ true + + true + true @@ -969,6 +978,9 @@ true + + true + true @@ -1383,6 +1395,9 @@ true + + true + true @@ -2187,6 +2202,9 @@ true + + true + true @@ -2238,6 +2256,9 @@ true + + true + true @@ -2516,7 +2537,6 @@ - @@ -2855,6 +2875,7 @@ + @@ -3166,9 +3187,11 @@ + + @@ -3212,6 +3235,7 @@ + diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters index 473d86c6..33d4edb9 100644 --- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters +++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters @@ -598,6 +598,9 @@ + + JUCE Modules\juce_audio_basics\audio_play_head + JUCE Modules\juce_audio_basics\buffers @@ -613,6 +616,9 @@ JUCE Modules\juce_audio_basics\midi\ump + + JUCE Modules\juce_audio_basics\midi\ump + JUCE Modules\juce_audio_basics\midi\ump @@ -685,6 +691,9 @@ JUCE Modules\juce_audio_basics\sources + + JUCE Modules\juce_audio_basics\sources + JUCE Modules\juce_audio_basics\sources @@ -1441,6 +1450,9 @@ JUCE Modules\juce_audio_processors\utilities + + JUCE Modules\juce_audio_processors\utilities + JUCE Modules\juce_audio_processors @@ -1894,6 +1906,9 @@ JUCE Modules\juce_data_structures\app_properties + + JUCE Modules\juce_data_structures\undomanager + JUCE Modules\juce_data_structures\undomanager @@ -2752,6 +2767,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2806,6 +2824,9 @@ JUCE Modules\juce_gui_extra\misc + + JUCE Modules\juce_gui_extra\misc + JUCE Modules\juce_gui_extra\native @@ -3471,9 +3492,6 @@ JUCE Modules\juce_audio_formats\codecs\flac - - JUCE Modules\juce_audio_formats\codecs\flac - JUCE Modules\juce_audio_formats\codecs\oggvorbis\libvorbis-1.3.7\lib\books\coupled @@ -4488,6 +4506,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5421,6 +5442,9 @@ JUCE Modules\juce_gui_basics\native\accessibility + + JUCE Modules\juce_gui_basics\native\x11 + JUCE Modules\juce_gui_basics\native\x11 @@ -5430,6 +5454,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5559,6 +5586,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index a51590cc..68330694 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -44,5 +44,3 @@ juce_add_modules( juce_osc juce_product_unlocking juce_video) - -add_subdirectory(juce_audio_plugin_client) diff --git a/modules/juce_analytics/juce_analytics.h b/modules/juce_analytics/juce_analytics.h index 42eae71c..745371f5 100644 --- a/modules/juce_analytics/juce_analytics.h +++ b/modules/juce_analytics/juce_analytics.h @@ -35,12 +35,12 @@ ID: juce_analytics vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE analytics classes description: Classes to collect analytics and send to destinations website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_gui_basics diff --git a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp new file mode 100644 index 00000000..72888e2f --- /dev/null +++ b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp @@ -0,0 +1,31 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +bool AudioPlayHead::canControlTransport() { return false; } +void AudioPlayHead::transportPlay ([[maybe_unused]] bool shouldStartPlaying) {} +void AudioPlayHead::transportRecord ([[maybe_unused]] bool shouldStartRecording) {} +void AudioPlayHead::transportRewind() {} + +} // namespace juce diff --git a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h index 51907c32..3c47f85c 100644 --- a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h +++ b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h @@ -102,13 +102,13 @@ public: double getEffectiveRate() const { return pulldown ? (double) base / 1.001 : (double) base; } /** Returns a copy of this object with the specified base rate. */ - JUCE_NODISCARD FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); } + [[nodiscard]] FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); } /** Returns a copy of this object with drop frames enabled or disabled, as specified. */ - JUCE_NODISCARD FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); } + [[nodiscard]] FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); } /** Returns a copy of this object with pulldown enabled or disabled, as specified. */ - JUCE_NODISCARD FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); } + [[nodiscard]] FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); } /** Returns true if this instance is equal to other. */ bool operator== (const FrameRate& other) const @@ -578,16 +578,16 @@ public: virtual Optional getPosition() const = 0; /** Returns true if this object can control the transport. */ - virtual bool canControlTransport() { return false; } + virtual bool canControlTransport(); /** Starts or stops the audio. */ - virtual void transportPlay (bool shouldStartPlaying) { ignoreUnused (shouldStartPlaying); } + virtual void transportPlay (bool shouldStartPlaying); /** Starts or stops recording the audio. */ - virtual void transportRecord (bool shouldStartRecording) { ignoreUnused (shouldStartRecording); } + virtual void transportRecord (bool shouldStartRecording); /** Rewinds the audio. */ - virtual void transportRewind() {} + virtual void transportRewind(); }; } // namespace juce diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h index aca7d7ce..c5907447 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h @@ -436,6 +436,9 @@ public: /** Adds a number of samples to the pointer's position. */ Pointer& operator+= (int samplesToJump) noexcept { this->advanceDataBy (data, samplesToJump); return *this; } + /** Returns a new pointer with the specified offset from this pointer's position. */ + Pointer operator+ (int samplesToJump) const { return Pointer { *this } += samplesToJump; } + /** Writes a stream of samples into this pointer from another pointer. This will copy the specified number of samples, converting between formats appropriately. */ @@ -662,7 +665,7 @@ private: { using ElementType = std::remove_pointer_t; using ChannelType = std::conditional_t; - using DataType = std::conditional_t; + using DataType = std::conditional_t; using PointerType = Pointer, diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 9ea81f51..d583a593 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -324,7 +324,7 @@ public: Don't modify any of the pointers that are returned, and bear in mind that these will become invalid if the buffer is resized. */ - const Type** getArrayOfReadPointers() const noexcept { return const_cast (channels); } + const Type* const* getArrayOfReadPointers() const noexcept { return channels; } /** Returns an array of pointers to the channels in the buffer. @@ -339,7 +339,7 @@ public: @see setNotClear */ - Type** getArrayOfWritePointers() noexcept { isClear = false; return channels; } + Type* const* getArrayOfWritePointers() noexcept { isClear = false; return channels; } //============================================================================== /** Changes the buffer's size or number of channels. @@ -465,7 +465,7 @@ public: @param newNumSamples the number of samples to use - this must correspond to the size of the arrays passed in */ - void setDataToReferTo (Type** dataToReferTo, + void setDataToReferTo (Type* const* dataToReferTo, int newNumChannels, int newStartSample, int newNumSamples) @@ -506,7 +506,7 @@ public: @param newNumSamples the number of samples to use - this must correspond to the size of the arrays passed in */ - void setDataToReferTo (Type** dataToReferTo, + void setDataToReferTo (Type* const* dataToReferTo, int newNumChannels, int newNumSamples) { @@ -558,7 +558,11 @@ public: if (! isClear) { for (int i = 0; i < numChannels; ++i) + { + JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4661) FloatVectorOperations::clear (channels[i], size); + JUCE_END_IGNORE_WARNINGS_MSVC + } isClear = true; } @@ -799,6 +803,8 @@ public: auto* d = channels[destChannel] + destStartSample; auto* s = source.channels[sourceChannel] + sourceStartSample; + JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4661) + if (isClear) { isClear = false; @@ -815,6 +821,8 @@ public: else FloatVectorOperations::add (d, s, numSamples); } + + JUCE_END_IGNORE_WARNINGS_MSVC } } @@ -877,7 +885,11 @@ public: @param numSamples the number of samples to process @param startGain the gain to apply to the first sample (this is multiplied with the source samples before they are added to this buffer) - @param endGain the gain to apply to the final sample. The gain is linearly + @param endGain The gain that would apply to the sample after the final sample. + The gain that applies to the final sample is + (numSamples - 1) / numSamples * (endGain - startGain). This + ensures a continuous ramp when supplying the same value in + endGain and startGain in subsequent blocks. The gain is linearly interpolated between the first and last samples. */ void addFromWithRamp (int destChannel, @@ -1043,7 +1055,11 @@ public: @param numSamples the number of samples to process @param startGain the gain to apply to the first sample (this is multiplied with the source samples before they are copied to this buffer) - @param endGain the gain to apply to the final sample. The gain is linearly + @param endGain The gain that would apply to the sample after the final sample. + The gain that applies to the final sample is + (numSamples - 1) / numSamples * (endGain - startGain). This + ensures a continuous ramp when supplying the same value in + endGain and startGain in subsequent blocks. The gain is linearly interpolated between the first and last samples. @see addFrom @@ -1177,7 +1193,7 @@ private: jassert (size >= 0); auto channelListSize = (size_t) (numChannels + 1) * sizeof (Type*); - auto requiredSampleAlignment = std::alignment_of::value; + auto requiredSampleAlignment = std::alignment_of_v; size_t alignmentOverflow = channelListSize % requiredSampleAlignment; if (alignmentOverflow != 0) diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index 1e5af0e6..2a576dc9 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -938,15 +938,13 @@ namespace #if JUCE_USE_VDSP_FRAMEWORK vDSP_vabs ((float*) src, 1, dest, 1, (vDSP_Length) num); #else - FloatVectorHelpers::signMask32 signMask; + [[maybe_unused]] FloatVectorHelpers::signMask32 signMask; signMask.i = 0x7fffffffUL; JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), Mode::bit_and (s, mask), JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.f);) - - ignoreUnused (signMask); #endif } @@ -956,7 +954,7 @@ namespace #if JUCE_USE_VDSP_FRAMEWORK vDSP_vabsD ((double*) src, 1, dest, 1, (vDSP_Length) num); #else - FloatVectorHelpers::signMask64 signMask; + [[maybe_unused]] FloatVectorHelpers::signMask64 signMask; signMask.i = 0x7fffffffffffffffULL; JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), @@ -964,8 +962,6 @@ namespace JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.d);) - - ignoreUnused (signMask); #endif } @@ -1430,34 +1426,44 @@ void JUCE_CALLTYPE FloatVectorOperations::convertFixedToFloat (float* dest, cons intptr_t JUCE_CALLTYPE FloatVectorOperations::getFpStatusRegister() noexcept { intptr_t fpsr = 0; - #if JUCE_INTEL && JUCE_USE_SSE_INTRINSICS + #if JUCE_INTEL && JUCE_USE_SSE_INTRINSICS fpsr = static_cast (_mm_getcsr()); - #elif defined(__arm64__) || defined(__aarch64__) || JUCE_USE_ARM_NEON - #if defined(__arm64__) || defined(__aarch64__) + #elif (JUCE_64BIT && JUCE_ARM) || JUCE_USE_ARM_NEON + #if _MSC_VER + // _control87 returns static values for x86 bits that don't exist on arm + // to emulate x86 behaviour. We are only ever interested in de-normal bits + // so mask out only those. + fpsr = (intptr_t) (_control87 (0, 0) & _MCW_DN); + #else + #if JUCE_64BIT asm volatile("mrs %0, fpcr" : "=r"(fpsr)); #elif JUCE_USE_ARM_NEON asm volatile("vmrs %0, fpscr" : "=r"(fpsr)); #endif - #else - #if ! (defined(JUCE_INTEL) || defined(JUCE_ARM)) + #endif + #else + #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for getting the floating point status register for your platform - #endif #endif + #endif return fpsr; } -void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister (intptr_t fpsr) noexcept +void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister ([[maybe_unused]] intptr_t fpsr) noexcept { - #if JUCE_INTEL && JUCE_USE_SSE_INTRINSICS + #if JUCE_INTEL && JUCE_USE_SSE_INTRINSICS // the volatile keyword here is needed to workaround a bug in AppleClang 13.0 // which aggressively optimises away the variable otherwise volatile auto fpsr_w = static_cast (fpsr); _mm_setcsr (fpsr_w); - #elif defined(__arm64__) || defined(__aarch64__) || JUCE_USE_ARM_NEON - #if defined(__arm64__) || defined(__aarch64__) + #elif (JUCE_64BIT && JUCE_ARM) || JUCE_USE_ARM_NEON + #if _MSC_VER + _control87 ((unsigned int) fpsr, _MCW_DN); + #else + #if JUCE_64BIT asm volatile("msr fpcr, %0" : : "ri"(fpsr)); @@ -1466,17 +1472,17 @@ void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister (intptr_t fpsr) no : : "ri"(fpsr)); #endif - #else - #if ! (defined(JUCE_INTEL) || defined(JUCE_ARM)) + #endif + #else + #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for getting the floating point status register for your platform - #endif - ignoreUnused (fpsr); #endif + #endif } -void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnable) noexcept +void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode ([[maybe_unused]] bool shouldEnable) noexcept { - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined(__arm64__) || defined(__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS intptr_t mask = _MM_FLUSH_ZERO_MASK; #else /*JUCE_USE_ARM_NEON*/ @@ -1484,16 +1490,15 @@ void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnab #endif setFpStatusRegister ((getFpStatusRegister() & (~mask)) | (shouldEnable ? mask : 0)); #else - #if ! (defined(JUCE_INTEL) || defined(JUCE_ARM)) + #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for flush to zero mode on your platform #endif - ignoreUnused (shouldEnable); #endif } -void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool shouldDisable) noexcept +void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport ([[maybe_unused]] bool shouldDisable) noexcept { - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined(__arm64__) || defined(__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS intptr_t mask = 0x8040; #else /*JUCE_USE_ARM_NEON*/ @@ -1502,9 +1507,8 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool setFpStatusRegister ((getFpStatusRegister() & (~mask)) | (shouldDisable ? mask : 0)); #else - ignoreUnused (shouldDisable); - #if ! (defined(JUCE_INTEL) || defined(JUCE_ARM)) + #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for disable denormals mode on your platform #endif #endif @@ -1512,7 +1516,7 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool bool JUCE_CALLTYPE FloatVectorOperations::areDenormalsDisabled() noexcept { - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined(__arm64__) || defined(__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS intptr_t mask = 0x8040; #else /*JUCE_USE_ARM_NEON*/ @@ -1527,7 +1531,7 @@ bool JUCE_CALLTYPE FloatVectorOperations::areDenormalsDisabled() noexcept ScopedNoDenormals::ScopedNoDenormals() noexcept { - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined(__arm64__) || defined(__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS intptr_t mask = 0x8040; #else /*JUCE_USE_ARM_NEON*/ @@ -1541,7 +1545,7 @@ ScopedNoDenormals::ScopedNoDenormals() noexcept ScopedNoDenormals::~ScopedNoDenormals() noexcept { - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined(__arm64__) || defined(__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) FloatVectorOperations::setFpStatusRegister (fpsr); #endif } diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h index 3f0f0366..9c6ed499 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h @@ -142,65 +142,26 @@ struct FloatVectorOperationsBase namespace detail { -template -struct NameForwarder; - -template -struct NameForwarder : Head {}; - -template -struct NameForwarder : Head, NameForwarder +template +struct NameForwarder : public Bases... { - using Head::clear; - using NameForwarder::clear; - - using Head::fill; - using NameForwarder::fill; - - using Head::copy; - using NameForwarder::copy; - - using Head::copyWithMultiply; - using NameForwarder::copyWithMultiply; - - using Head::add; - using NameForwarder::add; - - using Head::subtract; - using NameForwarder::subtract; - - using Head::addWithMultiply; - using NameForwarder::addWithMultiply; - - using Head::subtractWithMultiply; - using NameForwarder::subtractWithMultiply; - - using Head::multiply; - using NameForwarder::multiply; - - using Head::negate; - using NameForwarder::negate; - - using Head::abs; - using NameForwarder::abs; - - using Head::min; - using NameForwarder::min; - - using Head::max; - using NameForwarder::max; - - using Head::clip; - using NameForwarder::clip; - - using Head::findMinAndMax; - using NameForwarder::findMinAndMax; - - using Head::findMinimum; - using NameForwarder::findMinimum; - - using Head::findMaximum; - using NameForwarder::findMaximum; + using Bases::clear..., + Bases::fill..., + Bases::copy..., + Bases::copyWithMultiply..., + Bases::add..., + Bases::subtract..., + Bases::addWithMultiply..., + Bases::subtractWithMultiply..., + Bases::multiply..., + Bases::negate..., + Bases::abs..., + Bases::min..., + Bases::max..., + Bases::clip..., + Bases::findMinAndMax..., + Bases::findMinimum..., + Bases::findMaximum...; }; } // namespace detail @@ -261,7 +222,7 @@ public: ~ScopedNoDenormals() noexcept; private: - #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined (__arm64__) || defined (__aarch64__)) + #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) intptr_t fpsr; #endif }; diff --git a/modules/juce_audio_basics/juce_audio_basics.cpp b/modules/juce_audio_basics/juce_audio_basics.cpp index 10f3a9bb..57097476 100644 --- a/modules/juce_audio_basics/juce_audio_basics.cpp +++ b/modules/juce_audio_basics/juce_audio_basics.cpp @@ -85,13 +85,16 @@ #include "sources/juce_ResamplingAudioSource.cpp" #include "sources/juce_ReverbAudioSource.cpp" #include "sources/juce_ToneGeneratorAudioSource.cpp" +#include "sources/juce_PositionableAudioSource.cpp" #include "synthesisers/juce_Synthesiser.cpp" +#include "audio_play_head/juce_AudioPlayHead.cpp" #include "midi/ump/juce_UMP.h" #include "midi/ump/juce_UMPUtils.cpp" #include "midi/ump/juce_UMPView.cpp" #include "midi/ump/juce_UMPSysEx7.cpp" #include "midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" +#include "midi/ump/juce_UMPIterator.cpp" #if JUCE_UNIT_TESTS #include "utilities/juce_ADSR_test.cpp" diff --git a/modules/juce_audio_basics/juce_audio_basics.h b/modules/juce_audio_basics/juce_audio_basics.h index 46d5883a..85c0c437 100644 --- a/modules/juce_audio_basics/juce_audio_basics.h +++ b/modules/juce_audio_basics/juce_audio_basics.h @@ -32,12 +32,12 @@ ID: juce_audio_basics vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE audio and MIDI data classes description: Classes for audio buffer manipulation, midi message handling, synthesis, etc. website: http://www.juce.com/juce license: ISC - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_core OSXFrameworks: Accelerate @@ -83,7 +83,9 @@ //============================================================================== #include "buffers/juce_AudioDataConverters.h" +JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4661) #include "buffers/juce_FloatVectorOperations.h" +JUCE_END_IGNORE_WARNINGS_MSVC #include "buffers/juce_AudioSampleBuffer.h" #include "buffers/juce_AudioChannelSet.h" #include "buffers/juce_AudioProcessLoadMeasurer.h" diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp new file mode 100644 index 00000000..0ba7ce07 --- /dev/null +++ b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp @@ -0,0 +1,37 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ +namespace universal_midi_packets +{ + +Iterator::Iterator (const uint32_t* ptr, [[maybe_unused]] size_t bytes) noexcept + : view (ptr) + #if JUCE_DEBUG + , bytesRemaining (bytes) + #endif +{ +} + +} // namespace universal_midi_packets +} // namespace juce diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h index b4dcea9a..eba62029 100644 --- a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h +++ b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h @@ -43,14 +43,7 @@ public: Iterator() noexcept = default; /** Creates an iterator pointing at `ptr`. */ - explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept - : view (ptr) - #if JUCE_DEBUG - , bytesRemaining (bytes) - #endif - { - ignoreUnused (bytes); - } + explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept; using difference_type = std::iterator_traits::difference_type; using value_type = View; @@ -124,7 +117,7 @@ private: #endif }; -} -} +} // namespace universal_midi_packets +} // namespace juce #endif diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPView.h b/modules/juce_audio_basics/midi/ump/juce_UMPView.h index 0186bef6..e9f70d6d 100644 --- a/modules/juce_audio_basics/midi/ump/juce_UMPView.h +++ b/modules/juce_audio_basics/midi/ump/juce_UMPView.h @@ -33,7 +33,7 @@ namespace universal_midi_packets The packet must be well-formed for member functions to work correctly. Specifically, the constructor argument must be the beginning of a region of - uint32_t that contains at least `getNumWordsForMessageType(*ddata)` items, + uint32_t that contains at least `getNumWordsForMessageType(*data)` items, where `data` is the constructor argument. NOTE: Instances of this class do not own the memory that they point to! diff --git a/modules/juce_audio_basics/midi/ump/juce_UMP_test.cpp b/modules/juce_audio_basics/midi/ump/juce_UMP_test.cpp index 0706b13b..fd52554b 100644 --- a/modules/juce_audio_basics/midi/ump/juce_UMP_test.cpp +++ b/modules/juce_audio_basics/midi/ump/juce_UMP_test.cpp @@ -992,7 +992,7 @@ private: #if JUCE_WINDOWS && ! JUCE_MINGW #define JUCE_CHECKED_ITERATOR(msg, size) \ - stdext::checked_array_iterator::type> ((msg), (size_t) (size)) + stdext::checked_array_iterator> ((msg), (size_t) (size)) #else #define JUCE_CHECKED_ITERATOR(msg, size) (msg) #endif diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPacket.h b/modules/juce_audio_basics/midi/ump/juce_UMPacket.h index c0e855d3..ef811510 100644 --- a/modules/juce_audio_basics/midi/ump/juce_UMPacket.h +++ b/modules/juce_audio_basics/midi/ump/juce_UMPacket.h @@ -38,35 +38,35 @@ class Packet public: Packet() = default; - template ::type = 0> + template = 0> Packet (uint32_t a) : contents { { a } } { jassert (Utils::getNumWordsForMessageType (a) == 1); } - template ::type = 0> + template = 0> Packet (uint32_t a, uint32_t b) : contents { { a, b } } { jassert (Utils::getNumWordsForMessageType (a) == 2); } - template ::type = 0> + template = 0> Packet (uint32_t a, uint32_t b, uint32_t c) : contents { { a, b, c } } { jassert (Utils::getNumWordsForMessageType (a) == 3); } - template ::type = 0> + template = 0> Packet (uint32_t a, uint32_t b, uint32_t c, uint32_t d) : contents { { a, b, c, d } } { jassert (Utils::getNumWordsForMessageType (a) == 4); } - template ::type = 0> + template = 0> explicit Packet (const std::array& fullPacket) : contents (fullPacket) { diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index 576b8b38..87f3df39 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -853,6 +853,14 @@ void MPEInstrument::releaseAllNotes() notes.clear(); } +//============================================================================== +void MPEInstrument::Listener::noteAdded ([[maybe_unused]] MPENote newNote) {} +void MPEInstrument::Listener::notePressureChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::notePitchbendChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteTimbreChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteKeyStateChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteReleased ([[maybe_unused]] MPENote finishedNote) {} +void MPEInstrument::Listener::zoneLayoutChanged() {} //============================================================================== //============================================================================== diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.h b/modules/juce_audio_basics/mpe/juce_MPEInstrument.h index 29195741..e7993c1d 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.h +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.h @@ -265,12 +265,12 @@ public: /** Implement this callback to be informed whenever a new expressive MIDI note is triggered. */ - virtual void noteAdded (MPENote newNote) { ignoreUnused (newNote); } + virtual void noteAdded (MPENote newNote); /** Implement this callback to be informed whenever a currently playing MPE note's pressure value changes. */ - virtual void notePressureChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void notePressureChanged (MPENote changedNote); /** Implement this callback to be informed whenever a currently playing MPE note's pitchbend value changes. @@ -279,12 +279,12 @@ public: master channel pitchbend event, or if both occur simultaneously. Call MPENote::getFrequencyInHertz to get the effective note frequency. */ - virtual void notePitchbendChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void notePitchbendChanged (MPENote changedNote); /** Implement this callback to be informed whenever a currently playing MPE note's timbre value changes. */ - virtual void noteTimbreChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void noteTimbreChanged (MPENote changedNote); /** Implement this callback to be informed whether a currently playing MPE note's key state (whether the key is down and/or the note is @@ -293,19 +293,19 @@ public: Note: If the key state changes to MPENote::off, noteReleased is called instead. */ - virtual void noteKeyStateChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void noteKeyStateChanged (MPENote changedNote); /** Implement this callback to be informed whenever an MPE note is released (either by a note-off message, or by a sustain/sostenuto pedal release for a note that already received a note-off), and should therefore stop playing. */ - virtual void noteReleased (MPENote finishedNote) { ignoreUnused (finishedNote); } + virtual void noteReleased (MPENote finishedNote); /** Implement this callback to be informed whenever the MPE zone layout or legacy mode settings of this instrument have been changed. */ - virtual void zoneLayoutChanged() {} + virtual void zoneLayoutChanged(); }; //============================================================================== diff --git a/modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp b/modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp index fde51b29..f89d3ae6 100644 --- a/modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp @@ -184,15 +184,19 @@ MPESynthesiserVoice* MPESynthesiser::findVoiceToSteal (MPENote noteToStealVoiceF MPESynthesiserVoice* low = nullptr; // Lowest sounding note, might be sustained, but NOT in release phase MPESynthesiserVoice* top = nullptr; // Highest sounding note, might be sustained, but NOT in release phase + // All major OSes use double-locking so this will be lock- and wait-free as long as stealLock is not + // contended. This is always the case if you do not call findVoiceToSteal on multiple threads at + // the same time. + const ScopedLock sl (stealLock); + // this is a list of voices we can steal, sorted by how long they've been running - Array usableVoices; - usableVoices.ensureStorageAllocated (voices.size()); + usableVoicesToStealArray.clear(); for (auto* voice : voices) { jassert (voice->isActive()); // We wouldn't be here otherwise - usableVoices.add (voice); + usableVoicesToStealArray.add (voice); // NB: Using a functor rather than a lambda here due to scare-stories about // compilers generating code containing heap allocations.. @@ -201,7 +205,7 @@ MPESynthesiserVoice* MPESynthesiser::findVoiceToSteal (MPENote noteToStealVoiceF bool operator() (const MPESynthesiserVoice* a, const MPESynthesiserVoice* b) const noexcept { return a->noteOnTime < b->noteOnTime; } }; - std::sort (usableVoices.begin(), usableVoices.end(), Sorter()); + std::sort (usableVoicesToStealArray.begin(), usableVoicesToStealArray.end(), Sorter()); if (! voice->isPlayingButReleased()) // Don't protect released notes { @@ -222,24 +226,24 @@ MPESynthesiserVoice* MPESynthesiser::findVoiceToSteal (MPENote noteToStealVoiceF // If we want to re-use the voice to trigger a new note, // then The oldest note that's playing the same note number is ideal. if (noteToStealVoiceFor.isValid()) - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice->getCurrentlyPlayingNote().initialNote == noteToStealVoiceFor.initialNote) return voice; // Oldest voice that has been released (no finger on it and not held by sustain pedal) - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top && voice->isPlayingButReleased()) return voice; // Oldest voice that doesn't have a finger on it: - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top && voice->getCurrentlyPlayingNote().keyState != MPENote::keyDown && voice->getCurrentlyPlayingNote().keyState != MPENote::keyDownAndSustained) return voice; // Oldest voice that isn't protected - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top) return voice; @@ -256,9 +260,16 @@ MPESynthesiserVoice* MPESynthesiser::findVoiceToSteal (MPENote noteToStealVoiceF //============================================================================== void MPESynthesiser::addVoice (MPESynthesiserVoice* const newVoice) { - const ScopedLock sl (voicesLock); - newVoice->setCurrentSampleRate (getSampleRate()); - voices.add (newVoice); + { + const ScopedLock sl (voicesLock); + newVoice->setCurrentSampleRate (getSampleRate()); + voices.add (newVoice); + } + + { + const ScopedLock sl (stealLock); + usableVoicesToStealArray.ensureStorageAllocated (voices.size() + 1); + } } void MPESynthesiser::clearVoices() diff --git a/modules/juce_audio_basics/mpe/juce_MPESynthesiser.h b/modules/juce_audio_basics/mpe/juce_MPESynthesiser.h index 9a443c5f..bc4c1b40 100644 --- a/modules/juce_audio_basics/mpe/juce_MPESynthesiser.h +++ b/modules/juce_audio_basics/mpe/juce_MPESynthesiser.h @@ -304,6 +304,8 @@ private: //============================================================================== std::atomic shouldStealVoices { false }; uint32 lastNoteOnCounter = 0; + mutable CriticalSection stealLock; + mutable Array usableVoicesToStealArray; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiser) }; diff --git a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp new file mode 100644 index 00000000..d7fbe375 --- /dev/null +++ b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp @@ -0,0 +1,28 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +void PositionableAudioSource::setLooping ([[maybe_unused]] bool shouldLoop) {} + +} // namespace juce diff --git a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h index 1898bbbc..6fb6691e 100644 --- a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h +++ b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h @@ -70,7 +70,7 @@ public: virtual bool isLooping() const = 0; /** Tells the source whether you'd like it to play in a loop. */ - virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); } + virtual void setLooping (bool shouldLoop); }; } // namespace juce diff --git a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp index c407911f..f9aaff23 100644 --- a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp +++ b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp @@ -98,9 +98,20 @@ void Synthesiser::clearVoices() SynthesiserVoice* Synthesiser::addVoice (SynthesiserVoice* const newVoice) { - const ScopedLock sl (lock); - newVoice->setCurrentPlaybackSampleRate (sampleRate); - return voices.add (newVoice); + SynthesiserVoice* voice; + + { + const ScopedLock sl (lock); + newVoice->setCurrentPlaybackSampleRate (sampleRate); + voice = voices.add (newVoice); + } + + { + const ScopedLock sl (stealLock); + usableVoicesToStealArray.ensureStorageAllocated (voices.size() + 1); + } + + return voice; } void Synthesiser::removeVoice (const int index) @@ -471,15 +482,14 @@ void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown) } } -void Synthesiser::handleSoftPedal (int midiChannel, bool /*isDown*/) +void Synthesiser::handleSoftPedal ([[maybe_unused]] int midiChannel, bool /*isDown*/) { - ignoreUnused (midiChannel); jassert (midiChannel > 0 && midiChannel <= 16); } -void Synthesiser::handleProgramChange (int midiChannel, int programNumber) +void Synthesiser::handleProgramChange ([[maybe_unused]] int midiChannel, + [[maybe_unused]] int programNumber) { - ignoreUnused (midiChannel, programNumber); jassert (midiChannel > 0 && midiChannel <= 16); } @@ -514,9 +524,13 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay, SynthesiserVoice* low = nullptr; // Lowest sounding note, might be sustained, but NOT in release phase SynthesiserVoice* top = nullptr; // Highest sounding note, might be sustained, but NOT in release phase + // All major OSes use double-locking so this will be lock- and wait-free as long as the lock is not + // contended. This is always the case if you do not call findVoiceToSteal on multiple threads at + // the same time. + const ScopedLock sl (stealLock); + // this is a list of voices we can steal, sorted by how long they've been running - Array usableVoices; - usableVoices.ensureStorageAllocated (voices.size()); + usableVoicesToStealArray.clear(); for (auto* voice : voices) { @@ -524,7 +538,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay, { jassert (voice->isVoiceActive()); // We wouldn't be here otherwise - usableVoices.add (voice); + usableVoicesToStealArray.add (voice); // NB: Using a functor rather than a lambda here due to scare-stories about // compilers generating code containing heap allocations.. @@ -533,7 +547,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay, bool operator() (const SynthesiserVoice* a, const SynthesiserVoice* b) const noexcept { return a->wasStartedBefore (*b); } }; - std::sort (usableVoices.begin(), usableVoices.end(), Sorter()); + std::sort (usableVoicesToStealArray.begin(), usableVoicesToStealArray.end(), Sorter()); if (! voice->isPlayingButReleased()) // Don't protect released notes { @@ -553,22 +567,22 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay, top = nullptr; // The oldest note that's playing with the target pitch is ideal.. - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice->getCurrentlyPlayingNote() == midiNoteNumber) return voice; // Oldest voice that has been released (no finger on it and not held by sustain pedal) - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top && voice->isPlayingButReleased()) return voice; // Oldest voice that doesn't have a finger on it: - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top && ! voice->isKeyDown()) return voice; // Oldest voice that isn't protected - for (auto* voice : usableVoices) + for (auto* voice : usableVoicesToStealArray) if (voice != low && voice != top) return voice; diff --git a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h index b9db266c..5010667c 100644 --- a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h +++ b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h @@ -627,6 +627,8 @@ private: bool subBlockSubdivisionIsStrict = false; bool shouldStealNotes = true; BigInteger sustainPedalsDown; + mutable CriticalSection stealLock; + mutable Array usableVoicesToStealArray; template void processNextBlock (AudioBuffer&, const MidiBuffer&, int startSample, int numSamples); diff --git a/modules/juce_audio_basics/utilities/juce_GenericInterpolator.h b/modules/juce_audio_basics/utilities/juce_GenericInterpolator.h index 084927d2..5427f02a 100644 --- a/modules/juce_audio_basics/utilities/juce_GenericInterpolator.h +++ b/modules/juce_audio_basics/utilities/juce_GenericInterpolator.h @@ -39,6 +39,16 @@ namespace juce template class JUCE_API GenericInterpolator { + static auto processReplacingCallback() + { + return [] (auto, auto newValue) { return newValue; }; + } + + static auto processAddingCallback (float gain) + { + return [gain] (auto oldValue, auto newValue) { return oldValue + gain * newValue; }; + } + public: GenericInterpolator() noexcept { reset(); } @@ -81,7 +91,11 @@ public: float* outputSamples, int numOutputSamplesToProduce) noexcept { - return interpolate (speedRatio, inputSamples, outputSamples, numOutputSamplesToProduce); + return interpolateImpl (speedRatio, + inputSamples, + outputSamples, + numOutputSamplesToProduce, + processReplacingCallback()); } /** Resamples a stream of samples. @@ -106,8 +120,13 @@ public: int numInputSamplesAvailable, int wrapAround) noexcept { - return interpolate (speedRatio, inputSamples, outputSamples, - numOutputSamplesToProduce, numInputSamplesAvailable, wrapAround); + return interpolateImpl (speedRatio, + inputSamples, + outputSamples, + numOutputSamplesToProduce, + numInputSamplesAvailable, + wrapAround, + processReplacingCallback()); } /** Resamples a stream of samples, adding the results to the output data @@ -131,7 +150,11 @@ public: int numOutputSamplesToProduce, float gain) noexcept { - return interpolateAdding (speedRatio, inputSamples, outputSamples, numOutputSamplesToProduce, gain); + return interpolateImpl (speedRatio, + inputSamples, + outputSamples, + numOutputSamplesToProduce, + processAddingCallback (gain)); } /** Resamples a stream of samples, adding the results to the output data @@ -162,8 +185,13 @@ public: int wrapAround, float gain) noexcept { - return interpolateAdding (speedRatio, inputSamples, outputSamples, - numOutputSamplesToProduce, numInputSamplesAvailable, wrapAround, gain); + return interpolateImpl (speedRatio, + inputSamples, + outputSamples, + numOutputSamplesToProduce, + numInputSamplesAvailable, + wrapAround, + processAddingCallback (gain)); } private: @@ -255,113 +283,48 @@ private: } //============================================================================== - int interpolate (double speedRatio, - const float* input, - float* output, - int numOutputSamplesToProduce) noexcept - { - auto pos = subSamplePos; - int numUsed = 0; - - while (numOutputSamplesToProduce > 0) - { - while (pos >= 1.0) - { - pushInterpolationSample (input[numUsed++]); - pos -= 1.0; - } - - *output++ = InterpolatorTraits::valueAtOffset (lastInputSamples, (float) pos, indexBuffer); - pos += speedRatio; - --numOutputSamplesToProduce; - } - - subSamplePos = pos; - return numUsed; - } - - int interpolate (double speedRatio, - const float* input, float* output, - int numOutputSamplesToProduce, - int numInputSamplesAvailable, - int wrap) noexcept + template + int interpolateImpl (double speedRatio, + const float* input, + float* output, + int numOutputSamplesToProduce, + int numInputSamplesAvailable, + int wrap, + Process process) { auto originalIn = input; - auto pos = subSamplePos; bool exceeded = false; - if (speedRatio < 1.0) + const auto pushSample = [&] { - for (int i = numOutputSamplesToProduce; --i >= 0;) + if (exceeded) { - if (pos >= 1.0) - { - if (exceeded) - { - pushInterpolationSample (0.0f); - } - else - { - pushInterpolationSample (*input++); - - if (--numInputSamplesAvailable <= 0) - { - if (wrap > 0) - { - input -= wrap; - numInputSamplesAvailable += wrap; - } - else - { - exceeded = true; - } - } - } - - pos -= 1.0; - } - - *output++ = InterpolatorTraits::valueAtOffset (lastInputSamples, (float) pos, indexBuffer); - pos += speedRatio; + pushInterpolationSample (0.0); } - } - else - { - for (int i = numOutputSamplesToProduce; --i >= 0;) + else { - while (pos < speedRatio) + pushInterpolationSample (*input++); + + if (--numInputSamplesAvailable <= 0) { - if (exceeded) + if (wrap > 0) { - pushInterpolationSample (0); + input -= wrap; + numInputSamplesAvailable += wrap; } else { - pushInterpolationSample (*input++); - - if (--numInputSamplesAvailable <= 0) - { - if (wrap > 0) - { - input -= wrap; - numInputSamplesAvailable += wrap; - } - else - { - exceeded = true; - } - } + exceeded = true; } - - pos += 1.0; } - - pos -= speedRatio; - *output++ = InterpolatorTraits::valueAtOffset (lastInputSamples, jmax (0.0f, 1.0f - (float) pos), indexBuffer); } - } + }; - subSamplePos = pos; + interpolateImpl (speedRatio, + output, + numOutputSamplesToProduce, + process, + pushSample); if (wrap == 0) return (int) (input - originalIn); @@ -369,121 +332,47 @@ private: return ((int) (input - originalIn) + wrap) % wrap; } - int interpolateAdding (double speedRatio, - const float* input, - float* output, - int numOutputSamplesToProduce, - int numInputSamplesAvailable, - int wrap, - float gain) noexcept + template + int interpolateImpl (double speedRatio, + const float* input, + float* output, + int numOutputSamplesToProduce, + Process process) { - auto originalIn = input; - auto pos = subSamplePos; - bool exceeded = false; - - if (speedRatio < 1.0) - { - for (int i = numOutputSamplesToProduce; --i >= 0;) - { - if (pos >= 1.0) - { - if (exceeded) - { - pushInterpolationSample (0.0); - } - else - { - pushInterpolationSample (*input++); - - if (--numInputSamplesAvailable <= 0) - { - if (wrap > 0) - { - input -= wrap; - numInputSamplesAvailable += wrap; - } - else - { - numInputSamplesAvailable = true; - } - } - } - - pos -= 1.0; - } - - *output++ += gain * InterpolatorTraits::valueAtOffset (lastInputSamples, (float) pos, indexBuffer); - pos += speedRatio; - } - } - else - { - for (int i = numOutputSamplesToProduce; --i >= 0;) - { - while (pos < speedRatio) - { - if (exceeded) - { - pushInterpolationSample (0.0); - } - else - { - pushInterpolationSample (*input++); - - if (--numInputSamplesAvailable <= 0) - { - if (wrap > 0) - { - input -= wrap; - numInputSamplesAvailable += wrap; - } - else - { - exceeded = true; - } - } - } - - pos += 1.0; - } - - pos -= speedRatio; - *output++ += gain * InterpolatorTraits::valueAtOffset (lastInputSamples, jmax (0.0f, 1.0f - (float) pos), indexBuffer); - } - } - - subSamplePos = pos; + int numUsed = 0; - if (wrap == 0) - return (int) (input - originalIn); + interpolateImpl (speedRatio, + output, + numOutputSamplesToProduce, + process, + [this, input, &numUsed] { pushInterpolationSample (input[numUsed++]); }); - return ((int) (input - originalIn) + wrap) % wrap; + return numUsed; } - int interpolateAdding (double speedRatio, - const float* input, - float* output, - int numOutputSamplesToProduce, - float gain) noexcept + template + void interpolateImpl (double speedRatio, + float* output, + int numOutputSamplesToProduce, + Process process, + PushSample pushSample) { auto pos = subSamplePos; - int numUsed = 0; - while (numOutputSamplesToProduce > 0) + for (auto i = 0; i < numOutputSamplesToProduce; ++i) { while (pos >= 1.0) { - pushInterpolationSample (input[numUsed++]); + pushSample(); pos -= 1.0; } - *output++ += gain * InterpolatorTraits::valueAtOffset (lastInputSamples, (float) pos, indexBuffer); + *output = process (*output, InterpolatorTraits::valueAtOffset (lastInputSamples, (float) pos, indexBuffer)); + ++output; pos += speedRatio; - --numOutputSamplesToProduce; } subSamplePos = pos; - return numUsed; } //============================================================================== diff --git a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h index 21888b85..e210705e 100644 --- a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h +++ b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h @@ -229,7 +229,7 @@ public: //============================================================================== /** Constructor. */ SmoothedValue() noexcept - : SmoothedValue ((FloatType) (std::is_same::value ? 0 : 1)) + : SmoothedValue ((FloatType) (std::is_same_v ? 0 : 1)) { } @@ -237,7 +237,7 @@ public: SmoothedValue (FloatType initialValue) noexcept { // Multiplicative smoothed values cannot ever reach 0! - jassert (! (std::is_same::value && initialValue == 0)); + jassert (! (std::is_same_v && initialValue == 0)); // Visual Studio can't handle base class initialisation with CRTP this->currentValue = initialValue; @@ -280,7 +280,7 @@ public: } // Multiplicative smoothed values cannot ever reach 0! - jassert (! (std::is_same::value && newValue == 0)); + jassert (! (std::is_same_v && newValue == 0)); this->target = newValue; this->countdown = stepsToTarget; @@ -352,49 +352,45 @@ public: private: //============================================================================== - template - using LinearVoid = typename std::enable_if ::value, void>::type; - - template - using MultiplicativeVoid = typename std::enable_if ::value, void>::type; - - //============================================================================== - template - LinearVoid setStepSize() noexcept - { - step = (this->target - this->currentValue) / (FloatType) this->countdown; - } - template - MultiplicativeVoid setStepSize() + void setStepSize() noexcept { - step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / (FloatType) this->countdown); + if constexpr (std::is_same_v) + { + step = (this->target - this->currentValue) / (FloatType) this->countdown; + } + else if constexpr (std::is_same_v) + { + step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / (FloatType) this->countdown); + } } //============================================================================== template - LinearVoid setNextValue() noexcept + void setNextValue() noexcept { - this->currentValue += step; - } - - template - MultiplicativeVoid setNextValue() noexcept - { - this->currentValue *= step; + if constexpr (std::is_same_v) + { + this->currentValue += step; + } + else if constexpr (std::is_same_v) + { + this->currentValue *= step; + } } //============================================================================== template - LinearVoid skipCurrentValue (int numSamples) noexcept + void skipCurrentValue (int numSamples) noexcept { - this->currentValue += step * (FloatType) numSamples; - } - - template - MultiplicativeVoid skipCurrentValue (int numSamples) - { - this->currentValue *= (FloatType) std::pow (step, numSamples); + if constexpr (std::is_same_v) + { + this->currentValue += step * (FloatType) numSamples; + } + else if constexpr (std::is_same_v) + { + this->currentValue *= (FloatType) std::pow (step, numSamples); + } } //============================================================================== diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index fa8a59c2..e2645ef0 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -69,9 +69,9 @@ public: CallbackHandler (AudioDeviceManager& adm) noexcept : owner (adm) {} private: - void audioDeviceIOCallbackWithContext (const float** ins, + void audioDeviceIOCallbackWithContext (const float* const* ins, int numIns, - float** outs, + float* const* outs, int numOuts, int numSamples, const AudioIODeviceCallbackContext& context) override @@ -502,15 +502,90 @@ String AudioDeviceManager::initialiseWithDefaultDevices (int numInputChannelsNee void AudioDeviceManager::insertDefaultDeviceNames (AudioDeviceSetup& setup) const { + enum class Direction { out, in }; + if (auto* type = getCurrentDeviceTypeObject()) { - for (const auto isInput : { false, true }) + // We avoid selecting a device pair that doesn't share a matching sample rate, if possible. + // If not, other parts of the AudioDeviceManager and AudioIODevice classes should generate + // an appropriate error message when opening or starting these devices. + const auto getDevicesToTestForMatchingSampleRate = [&setup, type, this] (Direction dir) { - const auto numChannelsNeeded = isInput ? numInputChansNeeded : numOutputChansNeeded; + const auto isInput = dir == Direction::in; const auto info = getSetupInfo (setup, isInput); - if (numChannelsNeeded > 0 && info.name.isEmpty()) - info.name = type->getDeviceNames (isInput) [type->getDefaultDeviceIndex (isInput)]; + if (! info.name.isEmpty()) + return StringArray { info.name }; + + const auto numChannelsNeeded = isInput ? numInputChansNeeded : numOutputChansNeeded; + auto deviceNames = numChannelsNeeded > 0 ? type->getDeviceNames (isInput) : StringArray {}; + deviceNames.move (type->getDefaultDeviceIndex (isInput), 0); + + return deviceNames; + }; + + std::map, Array> sampleRatesCache; + + const auto getSupportedSampleRates = [&sampleRatesCache, type] (Direction dir, const String& deviceName) + { + const auto key = std::make_pair (dir, deviceName); + + auto& entry = [&]() -> auto& + { + auto it = sampleRatesCache.find (key); + + if (it != sampleRatesCache.end()) + return it->second; + + auto& elem = sampleRatesCache[key]; + auto tempDevice = rawToUniquePtr (type->createDevice ((dir == Direction::in) ? "" : deviceName, + (dir == Direction::in) ? deviceName : "")); + if (tempDevice != nullptr) + elem = tempDevice->getAvailableSampleRates(); + + return elem; + }(); + + return entry; + }; + + const auto validate = [&getSupportedSampleRates] (const String& outputDeviceName, const String& inputDeviceName) + { + jassert (! outputDeviceName.isEmpty() && ! inputDeviceName.isEmpty()); + + const auto outputSampleRates = getSupportedSampleRates (Direction::out, outputDeviceName); + const auto inputSampleRates = getSupportedSampleRates (Direction::in, inputDeviceName); + + return std::any_of (inputSampleRates.begin(), + inputSampleRates.end(), + [&] (auto inputSampleRate) { return outputSampleRates.contains (inputSampleRate); }); + }; + + auto outputsToTest = getDevicesToTestForMatchingSampleRate (Direction::out); + auto inputsToTest = getDevicesToTestForMatchingSampleRate (Direction::in); + + // We set default device names, so in case no in-out pair passes the validation, we still + // produce the same result as before + if (setup.outputDeviceName.isEmpty() && ! outputsToTest.isEmpty()) + setup.outputDeviceName = outputsToTest[0]; + + if (setup.inputDeviceName.isEmpty() && ! inputsToTest.isEmpty()) + setup.inputDeviceName = inputsToTest[0]; + + // We check all possible in-out pairs until the first validation pass. If no pair passes we + // leave the setup unchanged. + for (const auto& out : outputsToTest) + { + for (const auto& in : inputsToTest) + { + if (validate (out, in)) + { + setup.outputDeviceName = out; + setup.inputDeviceName = in; + + return; + } + } } } } @@ -720,6 +795,12 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup currentDeviceType = currentAudioDevice->getTypeName(); currentAudioDevice->start (callbackHandler.get()); + + error = currentAudioDevice->getLastError(); + } + + if (error.isEmpty()) + { updateCurrentSetup(); for (int i = 0; i < availableDeviceTypes.size(); ++i) @@ -901,9 +982,9 @@ void AudioDeviceManager::removeAudioCallback (AudioIODeviceCallback* callbackToR } } -void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelData, +void AudioDeviceManager::audioDeviceIOCallbackInt (const float* const* inputChannelData, int numInputChannels, - float** outputChannelData, + float* const* outputChannelData, int numOutputChannels, int numSamples, const AudioIODeviceCallbackContext& context) @@ -925,7 +1006,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat numSamples, context); - auto** tempChans = tempBuffer.getArrayOfWritePointers(); + auto* const* tempChans = tempBuffer.getArrayOfWritePointers(); for (int i = callbacks.size(); --i > 0;) { @@ -967,7 +1048,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat testSound.reset(); } - outputLevelGetter->updateLevel (const_cast (outputChannelData), numOutputChannels, numSamples); + outputLevelGetter->updateLevel (outputChannelData, numOutputChannels, numSamples); } void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device) @@ -1810,10 +1891,19 @@ private: std::function stopped; std::function error; - void audioDeviceIOCallback (const float**, int, float**, int, int) override { NullCheckedInvocation::invoke (callback); } - void audioDeviceAboutToStart (AudioIODevice*) override { NullCheckedInvocation::invoke (aboutToStart); } - void audioDeviceStopped() override { NullCheckedInvocation::invoke (stopped); } - void audioDeviceError (const String&) override { NullCheckedInvocation::invoke (error); } + void audioDeviceIOCallbackWithContext (const float* const*, + int, + float* const*, + int, + int, + const AudioIODeviceCallbackContext&) override + { + NullCheckedInvocation::invoke (callback); + } + + void audioDeviceAboutToStart (AudioIODevice*) override { NullCheckedInvocation::invoke (aboutToStart); } + void audioDeviceStopped() override { NullCheckedInvocation::invoke (stopped); } + void audioDeviceError (const String&) override { NullCheckedInvocation::invoke (error); } }; void initialiseManager (AudioDeviceManager& manager) diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h index f288b6e1..c655254e 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h @@ -526,9 +526,9 @@ private: class CallbackHandler; std::unique_ptr callbackHandler; - void audioDeviceIOCallbackInt (const float** inputChannelData, + void audioDeviceIOCallbackInt (const float* const* inputChannelData, int totalNumInputChannels, - float** outputChannelData, + float* const* outputChannelData, int totalNumOutputChannels, int numSamples, const AudioIODeviceCallbackContext& context); diff --git a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp index 45a83d2b..63817286 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp @@ -23,6 +23,14 @@ namespace juce { +void AudioIODeviceCallback::audioDeviceIOCallbackWithContext ([[maybe_unused]] const float* const* inputChannelData, + [[maybe_unused]] int numInputChannels, + [[maybe_unused]] float* const* outputChannelData, + [[maybe_unused]] int numOutputChannels, + [[maybe_unused]] int numSamples, + [[maybe_unused]] const AudioIODeviceCallbackContext& context) {} + +//============================================================================== AudioIODevice::AudioIODevice (const String& deviceName, const String& deviceTypeName) : name (deviceName), typeName (deviceTypeName) { diff --git a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h index 8864ffd7..1405f7e2 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h +++ b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h @@ -39,7 +39,7 @@ struct AudioIODeviceCallbackContext One of these is passed to an AudioIODevice object to stream the audio data in and out. - The AudioIODevice will repeatedly call this class's audioDeviceIOCallback() + The AudioIODevice will repeatedly call this class's audioDeviceIOCallbackWithContext() method on its own high-priority audio thread, when it needs to send or receive the next block of data. @@ -90,31 +90,15 @@ public: processing into several smaller callbacks to ensure higher audio performance. So make sure your code can cope with reasonable changes in the buffer size from one callback to the next. + @param context Additional information that may be passed to the + AudioIODeviceCallback. */ - virtual void audioDeviceIOCallback (const float** inputChannelData, - int numInputChannels, - float** outputChannelData, - int numOutputChannels, - int numSamples) - { - ignoreUnused (inputChannelData, numInputChannels, outputChannelData, numOutputChannels, numSamples); - } - - /** The same as audioDeviceIOCallback(), but with an additional context argument. - - The default implementation of this function will call audioDeviceIOCallback(), - but you can override this function if you need to make use of the context information. - */ - virtual void audioDeviceIOCallbackWithContext (const float** inputChannelData, + virtual void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, - float** outputChannelData, + float* const* outputChannelData, int numOutputChannels, int numSamples, - const AudioIODeviceCallbackContext& context) - { - audioDeviceIOCallback (inputChannelData, numInputChannels, outputChannelData, numOutputChannels, numSamples); - ignoreUnused (context); - } + const AudioIODeviceCallbackContext& context); /** Called to indicate that the device is about to start calling back. @@ -142,7 +126,6 @@ public: virtual void audioDeviceError (const String& errorMessage); }; - //============================================================================== /** Base class for an audio device with synchronised input and output channels. diff --git a/modules/juce_audio_devices/juce_audio_devices.cpp b/modules/juce_audio_devices/juce_audio_devices.cpp index f4b4de06..5449282b 100644 --- a/modules/juce_audio_devices/juce_audio_devices.cpp +++ b/modules/juce_audio_devices/juce_audio_devices.cpp @@ -188,7 +188,13 @@ //============================================================================== #elif JUCE_ANDROID - #include "native/juce_android_Audio.cpp" +namespace juce +{ + using RealtimeThreadFactory = pthread_t (*) (void* (*) (void*), void*); + RealtimeThreadFactory getAndroidRealtimeThreadFactory(); +} // namespace juce + +#include "native/juce_android_Audio.cpp" #include #include "native/juce_android_Midi.cpp" @@ -218,6 +224,12 @@ #include "native/juce_android_Oboe.cpp" #endif + #else +// No audio library, so no way to create realtime threads. + namespace juce + { + RealtimeThreadFactory getAndroidRealtimeThreadFactory() { return nullptr; } + } #endif #endif diff --git a/modules/juce_audio_devices/juce_audio_devices.h b/modules/juce_audio_devices/juce_audio_devices.h index 6695c0ac..b2685820 100644 --- a/modules/juce_audio_devices/juce_audio_devices.h +++ b/modules/juce_audio_devices/juce_audio_devices.h @@ -32,12 +32,12 @@ ID: juce_audio_devices vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE audio and MIDI I/O device classes description: Classes to play and record from audio and MIDI I/O devices website: http://www.juce.com/juce license: ISC - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_audio_basics, juce_events OSXFrameworks: CoreAudio CoreMIDI AudioToolbox diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp index 51f0e5af..b2baf8c1 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp @@ -23,6 +23,12 @@ namespace juce { +void MidiInputCallback::handlePartialSysexMessage ([[maybe_unused]] MidiInput* source, + [[maybe_unused]] const uint8* messageData, + [[maybe_unused]] int numBytesSoFar, + [[maybe_unused]] double timestamp) {} + +//============================================================================== MidiOutput::MidiOutput (const String& deviceName, const String& deviceIdentifier) : Thread ("midi out"), deviceInfo (deviceName, deviceIdentifier) { @@ -87,7 +93,7 @@ void MidiOutput::clearAllPendingMessages() void MidiOutput::startBackgroundThread() { - startThread (9); + startThread (Priority::high); } void MidiOutput::stopBackgroundThread() diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h index 814cb7d8..5dab3f92 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h @@ -225,10 +225,7 @@ public: virtual void handlePartialSysexMessage (MidiInput* source, const uint8* messageData, int numBytesSoFar, - double timestamp) - { - ignoreUnused (source, messageData, numBytesSoFar, timestamp); - } + double timestamp); }; //============================================================================== diff --git a/modules/juce_audio_devices/native/juce_android_Audio.cpp b/modules/juce_audio_devices/native/juce_android_Audio.cpp index 75607c69..b654dae6 100644 --- a/modules/juce_audio_devices/native/juce_android_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_android_Audio.cpp @@ -253,7 +253,7 @@ public: if (inputDevice != nullptr) env->CallVoidMethod (inputDevice, AudioRecord.startRecording); - startThread (8); + startThread (Priority::high); } else { diff --git a/modules/juce_audio_devices/native/juce_android_Midi.cpp b/modules/juce_audio_devices/native/juce_android_Midi.cpp index 371ac4c8..08825325 100644 --- a/modules/juce_audio_devices/native/juce_android_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_android_Midi.cpp @@ -327,7 +327,7 @@ static const uint8 javaMidiByteCode[] = STATICMETHOD (getAndroidMidiDeviceManager, "getAndroidMidiDeviceManager", "(Landroid/content/Context;)Lcom/rmsl/juce/JuceMidiSupport$MidiDeviceManager;") \ STATICMETHOD (getAndroidBluetoothManager, "getAndroidBluetoothManager", "(Landroid/content/Context;)Lcom/rmsl/juce/JuceMidiSupport$BluetoothManager;") -DECLARE_JNI_CLASS_WITH_BYTECODE (JuceMidiSupport, "com/rmsl/juce/JuceMidiSupport", 23, javaMidiByteCode, sizeof (javaMidiByteCode)) +DECLARE_JNI_CLASS_WITH_BYTECODE (JuceMidiSupport, "com/rmsl/juce/JuceMidiSupport", 23, javaMidiByteCode) #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ diff --git a/modules/juce_audio_devices/native/juce_android_Oboe.cpp b/modules/juce_audio_devices/native/juce_android_Oboe.cpp index 105a182a..42a9efc9 100644 --- a/modules/juce_audio_devices/native/juce_android_Oboe.cpp +++ b/modules/juce_audio_devices/native/juce_android_Oboe.cpp @@ -423,8 +423,8 @@ private: } } - void process (const float** inputChannelData, int numInputChannels, - float** outputChannelData, int numOutputChannels, int32_t numFrames) + void process (const float* const* inputChannelData, int numInputChannels, + float* const* outputChannelData, int numOutputChannels, int32_t numFrames) { if (auto* cb = callback.exchange (nullptr)) { @@ -596,8 +596,7 @@ private: { if (stream != nullptr) { - oboe::Result result = stream->close(); - ignoreUnused (result); + [[maybe_unused]] oboe::Result result = stream->close(); JUCE_OBOE_LOG ("Requested Oboe stream close with result: " + getOboeString (result)); } } @@ -693,14 +692,15 @@ private: } // Not strictly required as these should not change, but recommended by Google anyway - void checkStreamSetup (OboeStream* stream, int deviceId, int numChannels, int expectedSampleRate, - int expectedBufferSize, oboe::AudioFormat format) + void checkStreamSetup (OboeStream* stream, + [[maybe_unused]] int deviceId, + [[maybe_unused]] int numChannels, + [[maybe_unused]] int expectedSampleRate, + [[maybe_unused]] int expectedBufferSize, + oboe::AudioFormat format) { - if (auto* nativeStream = stream != nullptr ? stream->getNativeStream() : nullptr) + if ([[maybe_unused]] auto* nativeStream = stream != nullptr ? stream->getNativeStream() : nullptr) { - ignoreUnused (deviceId, numChannels, sampleRate, expectedBufferSize); - ignoreUnused (streamFormat, bitDepth); - jassert (numChannels == 0 || numChannels == nativeStream->getChannelCount()); jassert (expectedSampleRate == 0 || expectedSampleRate == nativeStream->getSampleRate()); jassert (format == nativeStream->getFormat()); @@ -860,10 +860,8 @@ private: return oboe::DataCallbackResult::Continue; } - void printStreamDebugInfo (oboe::AudioStream* stream) + void printStreamDebugInfo ([[maybe_unused]] oboe::AudioStream* stream) { - ignoreUnused (stream); - JUCE_OBOE_LOG ("\nUses AAudio = " + (stream != nullptr ? String ((int) stream->usesAAudio()) : String ("?")) + "\nDirection = " + (stream != nullptr ? getOboeString (stream->getDirection()) : String ("?")) + "\nSharingMode = " + (stream != nullptr ? getOboeString (stream->getSharingMode()) : String ("?")) @@ -928,10 +926,8 @@ private: return time.tv_sec * oboe::kNanosPerSecond + time.tv_nsec; } - void onErrorBeforeClose (oboe::AudioStream* stream, oboe::Result error) override + void onErrorBeforeClose (oboe::AudioStream* stream, [[maybe_unused]] oboe::Result error) override { - ignoreUnused (error); - // only output stream should be the master stream receiving callbacks jassert (stream->getDirection() == oboe::Direction::Output); @@ -1167,10 +1163,8 @@ public: JUCE_OBOE_LOG ("-----InputDevices:"); - for (auto& device : inputDevices) + for ([[maybe_unused]] auto& device : inputDevices) { - ignoreUnused (device); - JUCE_OBOE_LOG ("name = " << device.name); JUCE_OBOE_LOG ("id = " << String (device.id)); JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size())); @@ -1179,10 +1173,8 @@ public: JUCE_OBOE_LOG ("-----OutputDevices:"); - for (auto& device : outputDevices) + for ([[maybe_unused]] auto& device : outputDevices) { - ignoreUnused (device); - JUCE_OBOE_LOG ("name = " << device.name); JUCE_OBOE_LOG ("id = " << String (device.id)); JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size())); @@ -1259,7 +1251,12 @@ public: case 22: return "USB headset"; case 23: return "hearing aid"; case 24: return "built-in speaker safe"; - case 25: return {}; + case 25: return "remote submix"; + case 26: return "BLE headset"; + case 27: return "BLE speaker"; + case 28: return "echo reference"; + case 29: return "HDMI eARC"; + case 30: return "BLE broadcast"; default: jassertfalse; return {}; // type not supported yet, needs to be added! } } @@ -1392,17 +1389,15 @@ public: return oboe::DataCallbackResult::Continue; } - void onErrorBeforeClose (oboe::AudioStream*, oboe::Result error) override + void onErrorBeforeClose (oboe::AudioStream*, [[maybe_unused]] oboe::Result error) override { JUCE_OBOE_LOG ("OboeRealtimeThread: Oboe stream onErrorBeforeClose(): " + getOboeString (error)); - ignoreUnused (error); jassertfalse; // Should never get here! } - void onErrorAfterClose (oboe::AudioStream*, oboe::Result error) override + void onErrorAfterClose (oboe::AudioStream*, [[maybe_unused]] oboe::Result error) override { JUCE_OBOE_LOG ("OboeRealtimeThread: Oboe stream onErrorAfterClose(): " + getOboeString (error)); - ignoreUnused (error); jassertfalse; // Should never get here! } @@ -1420,20 +1415,22 @@ private: }; //============================================================================== -pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr); -pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr) +RealtimeThreadFactory getAndroidRealtimeThreadFactory() { - auto thread = std::make_unique(); + return [] (void* (*entry) (void*), void* userPtr) -> pthread_t + { + auto thread = std::make_unique(); - if (! thread->isOk()) - return {}; + if (! thread->isOk()) + return {}; - auto threadID = thread->startThread (entry, userPtr); + auto threadID = thread->startThread (entry, userPtr); - // the thread will de-allocate itself - thread.release(); + // the thread will de-allocate itself + thread.release(); - return threadID; + return threadID; + }; } } // namespace juce diff --git a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp index 674f827e..f0e6d939 100644 --- a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp +++ b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp @@ -601,7 +601,7 @@ public: } } - void process (const float** inputChannelData, float** outputChannelData) + void process (const float* const* inputChannelData, float* const* outputChannelData) { if (auto* cb = callback.exchange (nullptr)) { @@ -750,8 +750,8 @@ public: T* recorderBuffer = (inputChannels > 0 ? recorder->getNextBuffer() : nullptr); T* playerBuffer = (outputChannels > 0 ? player->getNextBuffer() : nullptr); - const float** inputChannelData = nullptr; - float** outputChannelData = nullptr; + const float* const* inputChannelData = nullptr; + float* const* outputChannelData = nullptr; if (recorderBuffer != nullptr) { @@ -1273,20 +1273,22 @@ private: }; //============================================================================== -pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr); -pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr) +RealtimeThreadFactory getAndroidRealtimeThreadFactory() { - auto thread = std::make_unique(); + return [] (void* (*entry) (void*), void* userPtr) -> pthread_t + { + auto thread = std::make_unique(); - if (! thread->isOk()) - return {}; + if (! thread->isOk()) + return {}; - auto threadID = thread->startThread (entry, userPtr); + auto threadID = thread->startThread (entry, userPtr); - // the thread will de-allocate itself - thread.release(); + // the thread will de-allocate itself + thread.release(); - return threadID; + return threadID; + }; } } // namespace juce diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 12c8b338..9789e2a3 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -579,16 +579,15 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater impl.fillHostCallbackInfo (callbackInfo); Boolean hostIsPlaying = NO; - OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, - &hostIsPlaying, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr); + [[maybe_unused]] OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, + &hostIsPlaying, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr); - ignoreUnused (err); jassert (err == noErr); if (hostIsPlaying != shouldSartPlaying) @@ -604,15 +603,14 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater impl.fillHostCallbackInfo (callbackInfo); Boolean hostIsRecording = NO; - OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, - nullptr, - &hostIsRecording, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, + nullptr, + &hostIsRecording, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr); jassert (err == noErr); if (hostIsRecording != shouldStartRecording) @@ -703,12 +701,13 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") Image getIcon (int size) { + #if TARGET_OS_MACCATALYST if (@available (macCatalyst 14.0, *)) + #endif { if (interAppAudioConnected) { - UIImage* hostUIImage = AudioOutputUnitGetHostIcon (audioUnit, size); - if (hostUIImage != nullptr) + if (UIImage* hostUIImage = AudioOutputUnitGetHostIcon (audioUnit, size)) return juce_createImageFromUIImage (hostUIImage); } } @@ -808,11 +807,9 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater void handleAudioUnitPropertyChange (AudioUnit, AudioUnitPropertyID propertyID, - AudioUnitScope scope, - AudioUnitElement element) + [[maybe_unused]] AudioUnitScope scope, + [[maybe_unused]] AudioUnitElement element) { - ignoreUnused (scope); - ignoreUnused (element); JUCE_IOS_AUDIO_LOG ("handleAudioUnitPropertyChange: propertyID: " << String (propertyID) << " scope: " << String (scope) << " element: " << String (element)); @@ -834,9 +831,8 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater { UInt32 connected; UInt32 dataSize = sizeof (connected); - OSStatus err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_IsInterAppConnected, - kAudioUnitScope_Global, 0, &connected, &dataSize); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_IsInterAppConnected, + kAudioUnitScope_Global, 0, &connected, &dataSize); jassert (err == noErr); JUCE_IOS_AUDIO_LOG ("handleInterAppAudioConnectionChange: " << (connected ? "connected" @@ -892,8 +888,8 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater if ((int) numFrames > channelData.getFloatBufferSize()) channelData.setFloatBufferSize ((int) numFrames); - float** const inputData = channelData.audioData.getArrayOfWritePointers(); - float** const outputData = inputData + channelData.inputs->numActiveChannels; + float* const* const inputData = channelData.audioData.getArrayOfWritePointers(); + float* const* const outputData = inputData + channelData.inputs->numActiveChannels; if (useInput) { @@ -1078,21 +1074,19 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater { zerostruct (callbackInfo); UInt32 dataSize = sizeof (HostCallbackInfo); - OSStatus err = AudioUnitGetProperty (audioUnit, - kAudioUnitProperty_HostCallbacks, - kAudioUnitScope_Global, - 0, - &callbackInfo, - &dataSize); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitGetProperty (audioUnit, + kAudioUnitProperty_HostCallbacks, + kAudioUnitScope_Global, + 0, + &callbackInfo, + &dataSize); jassert (err == noErr); } void handleAudioTransportEvent (AudioUnitRemoteControlEvent event) { - OSStatus err = AudioUnitSetProperty (audioUnit, kAudioOutputUnitProperty_RemoteControlToHost, - kAudioUnitScope_Global, 0, &event, sizeof (event)); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitSetProperty (audioUnit, kAudioOutputUnitProperty_RemoteControlToHost, + kAudioUnitScope_Global, 0, &event, sizeof (event)); jassert (err == noErr); } diff --git a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp index dafb34cf..1be927ae 100644 --- a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp +++ b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp @@ -618,7 +618,7 @@ public: if (outputDevice != nullptr && JUCE_ALSA_FAILED (snd_pcm_prepare (outputDevice->handle))) return; - startThread (9); + startThread (Priority::high); int count = 1000; diff --git a/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp b/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp index 8b7e7757..4cce7016 100644 --- a/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp +++ b/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp @@ -462,7 +462,7 @@ private: if (callback != nullptr) { if ((numActiveInChans + numActiveOutChans) > 0) - callback->audioDeviceIOCallbackWithContext (const_cast (inChans.getData()), + callback->audioDeviceIOCallbackWithContext (inChans.getData(), numActiveInChans, outChans, numActiveOutChans, @@ -544,21 +544,19 @@ private: } } - static void infoShutdownCallback (jack_status_t code, const char* reason, void* arg) + static void infoShutdownCallback (jack_status_t code, [[maybe_unused]] const char* reason, void* arg) { jassertquiet (code == 0); JUCE_JACK_LOG ("Shutting down with message:"); JUCE_JACK_LOG (reason); - ignoreUnused (reason); shutdownCallback (arg); } - static void errorCallback (const char* msg) + static void errorCallback ([[maybe_unused]] const char* msg) { JUCE_JACK_LOG ("JackAudioIODevice::errorCallback " + String (msg)); - ignoreUnused (msg); } bool deviceIsOpen = false; diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index b9dfa3e9..90d54e38 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -41,99 +41,232 @@ constexpr auto juceAudioObjectPropertyElementMain = #endif //============================================================================== -struct AsyncRestarter +class ManagedAudioBufferList : public AudioBufferList { - virtual ~AsyncRestarter() = default; - virtual void restartAsync() = 0; -}; +public: + struct Deleter + { + void operator() (ManagedAudioBufferList* p) const + { + if (p != nullptr) + p->~ManagedAudioBufferList(); -struct SystemVol -{ - SystemVol (AudioObjectPropertySelector selector) noexcept - : outputDeviceID (kAudioObjectUnknown) + delete[] reinterpret_cast (p); + } + }; + + using Ref = std::unique_ptr; + + //============================================================================== + static Ref create (std::size_t numBuffers) { - addr.mScope = kAudioObjectPropertyScopeGlobal; - addr.mElement = juceAudioObjectPropertyElementMain; - addr.mSelector = kAudioHardwarePropertyDefaultOutputDevice; + static_assert (alignof (ManagedAudioBufferList) <= alignof (std::max_align_t)); - if (AudioObjectHasProperty (kAudioObjectSystemObject, &addr)) - { - UInt32 deviceIDSize = sizeof (outputDeviceID); - OSStatus status = AudioObjectGetPropertyData (kAudioObjectSystemObject, &addr, 0, nullptr, &deviceIDSize, &outputDeviceID); + if (std::unique_ptr storage { new std::byte[storageSizeForNumBuffers (numBuffers)] }) + return Ref { new (storage.release()) ManagedAudioBufferList (numBuffers) }; - if (status == noErr) - { - addr.mElement = juceAudioObjectPropertyElementMain; - addr.mSelector = selector; - addr.mScope = kAudioDevicePropertyScopeOutput; + return nullptr; + } - if (! AudioObjectHasProperty (outputDeviceID, &addr)) - outputDeviceID = kAudioObjectUnknown; - } - } + //============================================================================== + static std::size_t storageSizeForNumBuffers (std::size_t numBuffers) noexcept + { + return audioBufferListHeaderSize + (numBuffers * sizeof (::AudioBuffer)); } - float getGain() const noexcept + static std::size_t numBuffersForStorageSize (std::size_t bytes) noexcept { - Float32 gain = 0; + bytes -= audioBufferListHeaderSize; - if (outputDeviceID != kAudioObjectUnknown) - { - UInt32 size = sizeof (gain); - AudioObjectGetPropertyData (outputDeviceID, &addr, 0, nullptr, &size, &gain); - } + // storage size ends between to buffers in AudioBufferList + jassert ((bytes % sizeof (::AudioBuffer)) == 0); - return (float) gain; + return bytes / sizeof (::AudioBuffer); } - bool setGain (float gain) const noexcept +private: + // Do not call the base constructor here as this will zero-initialize the first buffer, + // for which no storage may be available though (when numBuffers == 0). + explicit ManagedAudioBufferList (std::size_t numBuffers) { - if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) + mNumberBuffers = static_cast (numBuffers); + } + + static constexpr auto audioBufferListHeaderSize = sizeof (AudioBufferList) - sizeof (::AudioBuffer); + + JUCE_DECLARE_NON_COPYABLE (ManagedAudioBufferList) + JUCE_DECLARE_NON_MOVEABLE (ManagedAudioBufferList) +}; + +//============================================================================== +struct IgnoreUnused +{ + template + void operator() (Ts&&...) const {} +}; + +template +static auto getDataPtrAndSize (T& t) +{ + static_assert (std::is_pod_v); + return std::make_tuple (&t, (UInt32) sizeof (T)); +} + +static auto getDataPtrAndSize (ManagedAudioBufferList::Ref& t) +{ + const auto size = t.get() != nullptr + ? ManagedAudioBufferList::storageSizeForNumBuffers (t->mNumberBuffers) + : 0; + return std::make_tuple (t.get(), (UInt32) size); +} + +//============================================================================== +[[nodiscard]] static bool audioObjectHasProperty (AudioObjectID objectID, const AudioObjectPropertyAddress address) +{ + return objectID != kAudioObjectUnknown && AudioObjectHasProperty (objectID, &address); +} + +template +[[nodiscard]] static auto audioObjectGetProperty (AudioObjectID objectID, + const AudioObjectPropertyAddress address, + OnError&& onError = {}) +{ + using Result = std::conditional_t, ManagedAudioBufferList::Ref, std::optional>; + + if (! audioObjectHasProperty (objectID, address)) + return Result{}; + + auto result = [&] + { + if constexpr (std::is_same_v) { - Float32 newVolume = gain; - UInt32 size = sizeof (newVolume); + UInt32 size{}; + + if (auto status = AudioObjectGetPropertyDataSize (objectID, &address, 0, nullptr, &size); status != noErr) + { + onError (status); + return Result{}; + } - return AudioObjectSetPropertyData (outputDeviceID, &addr, 0, nullptr, size, &newVolume) == noErr; + return ManagedAudioBufferList::create (ManagedAudioBufferList::numBuffersForStorageSize (size)); } + else + { + return T{}; + } + }(); + + auto [ptr, size] = getDataPtrAndSize (result); + + if (size == 0) + return Result{}; + + if (auto status = AudioObjectGetPropertyData (objectID, &address, 0, nullptr, &size, ptr); status != noErr) + { + onError (status); + return Result{}; + } + + return Result { std::move (result) }; +} +template +static bool audioObjectSetProperty (AudioObjectID objectID, + const AudioObjectPropertyAddress address, + const T value, + OnError&& onError = {}) +{ + if (! audioObjectHasProperty (objectID, address)) + return false; + + Boolean isSettable = NO; + if (auto status = AudioObjectIsPropertySettable (objectID, &address, &isSettable); status != noErr) + { + onError (status); return false; } - bool isMuted() const noexcept + if (! isSettable) + return false; + + if (auto status = AudioObjectSetPropertyData (objectID, &address, 0, nullptr, static_cast (sizeof (T)), &value); status != noErr) { - UInt32 muted = 0; + onError (status); + return false; + } - if (outputDeviceID != kAudioObjectUnknown) - { - UInt32 size = sizeof (muted); - AudioObjectGetPropertyData (outputDeviceID, &addr, 0, nullptr, &size, &muted); - } + return true; +} + +template +[[nodiscard]] static std::vector audioObjectGetProperties (AudioObjectID objectID, + const AudioObjectPropertyAddress address, + OnError&& onError = {}) +{ + if (! audioObjectHasProperty (objectID, address)) + return {}; + + UInt32 size{}; - return muted != 0; + if (auto status = AudioObjectGetPropertyDataSize (objectID, &address, 0, nullptr, &size); status != noErr) + { + onError (status); + return {}; } - bool setMuted (bool mute) const noexcept + // If this is hit, the number of results is not integral, and the following + // AudioObjectGetPropertyData will probably write past the end of the result buffer. + jassert ((size % sizeof (T)) == 0); + std::vector result (size / sizeof (T)); + + if (auto status = AudioObjectGetPropertyData (objectID, &address, 0, nullptr, &size, result.data()); status != noErr) { - if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) - { - UInt32 newMute = mute ? 1 : 0; - UInt32 size = sizeof (newMute); + onError (status); + return {}; + } - return AudioObjectSetPropertyData (outputDeviceID, &addr, 0, nullptr, size, &newMute) == noErr; - } + return result; +} - return false; +//============================================================================== +struct AsyncRestarter +{ + virtual ~AsyncRestarter() = default; + virtual void restartAsync() = 0; +}; + +struct SystemVol +{ + explicit SystemVol (AudioObjectPropertySelector selector) noexcept + : outputDeviceID (audioObjectGetProperty (kAudioObjectSystemObject, { kAudioHardwarePropertyDefaultOutputDevice, + kAudioObjectPropertyScopeGlobal, + juceAudioObjectPropertyElementMain }).value_or (kAudioObjectUnknown)), + addr { selector, kAudioDevicePropertyScopeOutput, juceAudioObjectPropertyElementMain } + {} + + float getGain() const noexcept + { + return audioObjectGetProperty (outputDeviceID, addr).value_or (0.0f); } -private: - AudioDeviceID outputDeviceID; - AudioObjectPropertyAddress addr; + bool setGain (float gain) const noexcept + { + return audioObjectSetProperty (outputDeviceID, addr, static_cast (gain)); + } + + bool isMuted() const noexcept + { + return audioObjectGetProperty (outputDeviceID, addr).value_or (0) != 0; + } - bool canSetVolume() const noexcept + bool setMuted (bool mute) const noexcept { - Boolean isSettable = NO; - return AudioObjectIsPropertySettable (outputDeviceID, &addr, &isSettable) == noErr && isSettable; + return audioObjectSetProperty (outputDeviceID, addr, static_cast (mute ? 1 : 0)); } + +private: + AudioDeviceID outputDeviceID; + AudioObjectPropertyAddress addr; }; JUCE_END_IGNORE_WARNINGS_GCC_LIKE @@ -162,19 +295,25 @@ class CoreAudioIODevice; class CoreAudioInternal : private Timer, private AsyncUpdater { +private: + // members with deduced return types need to be defined before they + // are used, so define it here. decltype doesn't help as you can't + // capture anything in lambdas inside a decltype context. + auto err2log() const { return [this] (OSStatus err) { OK (err); }; } + public: - CoreAudioInternal (CoreAudioIODevice& d, AudioDeviceID id, bool input, bool output) + CoreAudioInternal (CoreAudioIODevice& d, AudioDeviceID id, bool hasInput, bool hasOutput) : owner (d), deviceID (id), - isInputDevice (input), - isOutputDevice (output) + inStream (hasInput ? new Stream (true, *this, {}) : nullptr), + outStream (hasOutput ? new Stream (false, *this, {}) : nullptr) { jassert (deviceID != 0); updateDetailsFromDevice(); JUCE_COREAUDIOLOG ("Creating CoreAudioInternal\n" - << (isInputDevice ? (" inputDeviceId " + String (deviceID) + "\n") : "") - << (isOutputDevice ? (" outputDeviceId " + String (deviceID) + "\n") : "") + << (inStream != nullptr ? (" inputDeviceId " + String (deviceID) + "\n") : "") + << (outStream != nullptr ? (" outputDeviceId " + String (deviceID) + "\n") : "") << getDeviceDetails().joinIntoString ("\n ")); AudioObjectPropertyAddress pa; @@ -200,17 +339,20 @@ public: stop (false); } + auto getStreams() const { return std::array { { inStream.get(), outStream.get() } }; } + void allocateTempBuffers() { auto tempBufSize = bufferSize + 4; - audioBuffer.calloc ((numInputChans + numOutputChans) * tempBufSize); - tempInputBuffers.calloc (numInputChans + 2); - tempOutputBuffers.calloc (numOutputChans + 2); + auto streams = getStreams(); + const auto total = std::accumulate (streams.begin(), streams.end(), 0, + [] (int n, const auto& s) { return n + (s != nullptr ? s->channels : 0); }); + audioBuffer.calloc (total * tempBufSize); - int count = 0; - for (int i = 0; i < numInputChans; ++i) tempInputBuffers[i] = audioBuffer + count++ * tempBufSize; - for (int i = 0; i < numOutputChans; ++i) tempOutputBuffers[i] = audioBuffer + count++ * tempBufSize; + auto channels = 0; + for (auto* stream : streams) + channels += stream != nullptr ? stream->allocateTempBuffers (tempBufSize, channels, audioBuffer) : 0; } struct CallbackDetailsForChannel @@ -220,91 +362,24 @@ public: int dataStrideSamples; }; - // returns the number of actual available channels - StringArray getChannelInfo (bool input, Array& newChannelInfo) const - { - StringArray newNames; - int chanNum = 0; - UInt32 size; - - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyStreamConfiguration; - pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; - pa.mElement = juceAudioObjectPropertyElementMain; - - if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, nullptr, &size))) - { - HeapBlock bufList; - bufList.calloc (size, 1); - - if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, bufList))) - { - const int numStreams = (int) bufList->mNumberBuffers; - - for (int i = 0; i < numStreams; ++i) - { - auto& b = bufList->mBuffers[i]; - - for (unsigned int j = 0; j < b.mNumberChannels; ++j) - { - String name; - NSString* nameNSString = nil; - size = sizeof (nameNSString); - - pa.mSelector = kAudioObjectPropertyElementName; - pa.mElement = (AudioObjectPropertyElement) chanNum + 1; - - if (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &nameNSString) == noErr) - { - name = nsStringToJuce (nameNSString); - [nameNSString release]; - } - - if ((input ? activeInputChans : activeOutputChans) [chanNum]) - { - CallbackDetailsForChannel info = { i, (int) j, (int) b.mNumberChannels }; - newChannelInfo.add (info); - } - - if (name.isEmpty()) - name << (input ? "Input " : "Output ") << (chanNum + 1); - - newNames.add (name); - ++chanNum; - } - } - } - } - - return newNames; - } - Array getSampleRatesFromDevice() const { Array newSampleRates; - AudioObjectPropertyAddress pa; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioDevicePropertyAvailableNominalSampleRates; - UInt32 size = 0; - - if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, nullptr, &size))) + if (auto ranges = audioObjectGetProperties (deviceID, + { kAudioDevicePropertyAvailableNominalSampleRates, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }, + err2log()); ! ranges.empty()) { - HeapBlock ranges; - ranges.calloc (size, 1); - - if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, ranges))) + for (const auto rate : SampleRateHelpers::getAllSampleRates()) { - for (const auto rate : SampleRateHelpers::getAllSampleRates()) + for (auto range = ranges.rbegin(); range != ranges.rend(); ++range) { - for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) + if (range->mMinimum - 2 <= rate && rate <= range->mMaximum + 2) { - if (ranges[j].mMinimum - 2 <= rate && rate <= ranges[j].mMaximum + 2) - { - newSampleRates.add (rate); - break; - } + newSampleRates.add (rate); + break; } } } @@ -325,36 +400,27 @@ public: { Array newBufferSizes; - AudioObjectPropertyAddress pa; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioDevicePropertyBufferFrameSizeRange; - UInt32 size = 0; - - if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, nullptr, &size))) + if (auto ranges = audioObjectGetProperties (deviceID, { kAudioDevicePropertyBufferFrameSizeRange, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }, + err2log()); ! ranges.empty()) { - HeapBlock ranges; - ranges.calloc (size, 1); + newBufferSizes.add ((int) (ranges[0].mMinimum + 15) & ~15); - if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, ranges))) + for (int i = 32; i <= 2048; i += 32) { - newBufferSizes.add ((int) (ranges[0].mMinimum + 15) & ~15); - - for (int i = 32; i <= 2048; i += 32) + for (auto range = ranges.rbegin(); range != ranges.rend(); ++range) { - for (int j = size / (int) sizeof (AudioValueRange); --j >= 0;) + if (i >= range->mMinimum && i <= range->mMaximum) { - if (i >= ranges[j].mMinimum && i <= ranges[j].mMaximum) - { - newBufferSizes.addIfNotAlreadyThere (i); - break; - } + newBufferSizes.addIfNotAlreadyThere (i); + break; } } - - if (bufferSize > 0) - newBufferSizes.addIfNotAlreadyThere (bufferSize); } + + if (bufferSize > 0) + newBufferSizes.addIfNotAlreadyThere (bufferSize); } if (newBufferSizes.isEmpty() && bufferSize > 0) @@ -363,68 +429,22 @@ public: return newBufferSizes; } - int getLatencyFromDevice (AudioObjectPropertyScope scope) const - { - UInt32 latency = 0; - UInt32 size = sizeof (latency); - AudioObjectPropertyAddress pa; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioDevicePropertyLatency; - pa.mScope = scope; - AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &latency); - - UInt32 safetyOffset = 0; - size = sizeof (safetyOffset); - pa.mSelector = kAudioDevicePropertySafetyOffset; - AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &safetyOffset); - - return (int) (latency + safetyOffset); - } - - int getBitDepthFromDevice (AudioObjectPropertyScope scope) const - { - AudioObjectPropertyAddress pa; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioStreamPropertyPhysicalFormat; - pa.mScope = scope; - - AudioStreamBasicDescription asbd; - UInt32 size = sizeof (asbd); - - if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &asbd))) - return (int) asbd.mBitsPerChannel; - - return 0; - } - int getFrameSizeFromDevice() const { - AudioObjectPropertyAddress pa; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioDevicePropertyBufferFrameSize; - - UInt32 framesPerBuf = (UInt32) bufferSize; - UInt32 size = sizeof (framesPerBuf); - AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &framesPerBuf); - return (int) framesPerBuf; + return static_cast (audioObjectGetProperty (deviceID, { kAudioDevicePropertyBufferFrameSize, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }).value_or (0)); } bool isDeviceAlive() const { - AudioObjectPropertyAddress pa; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; - pa.mSelector = kAudioDevicePropertyDeviceIsAlive; - - UInt32 isAlive = 0; - UInt32 size = sizeof (isAlive); return deviceID != 0 - && OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &isAlive)) - && isAlive != 0; + && audioObjectGetProperty (deviceID, { kAudioDevicePropertyDeviceIsAlive, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }, err2log()).value_or (0) != 0; } - bool updateDetailsFromDevice() + bool updateDetailsFromDevice (const BigInteger& activeIns, const BigInteger& activeOuts) { stopTimer(); @@ -440,16 +460,10 @@ public: auto newBufferSizes = getBufferSizesFromDevice(); auto newSampleRates = getSampleRatesFromDevice(); - auto newInputLatency = getLatencyFromDevice (kAudioDevicePropertyScopeInput); - auto newOutputLatency = getLatencyFromDevice (kAudioDevicePropertyScopeOutput); - - Array newInChans, newOutChans; - auto newInNames = isInputDevice ? getChannelInfo (true, newInChans) : StringArray(); - auto newOutNames = isOutputDevice ? getChannelInfo (false, newOutChans) : StringArray(); + auto newInput = rawToUniquePtr (inStream != nullptr ? new Stream (true, *this, activeIns) : nullptr); + auto newOutput = rawToUniquePtr (outStream != nullptr ? new Stream (false, *this, activeOuts) : nullptr); - auto inputBitDepth = isInputDevice ? getBitDepthFromDevice (kAudioDevicePropertyScopeInput) : 0; - auto outputBitDepth = isOutputDevice ? getBitDepthFromDevice (kAudioDevicePropertyScopeOutput) : 0; - auto newBitDepth = jmax (inputBitDepth, outputBitDepth); + auto newBitDepth = jmax (getBitDepth (newInput), getBitDepth (newOutput)); { const ScopedLock sl (callbackLock); @@ -459,21 +473,13 @@ public: if (newSampleRate > 0) sampleRate = newSampleRate; - inputLatency = newInputLatency; - outputLatency = newOutputLatency; bufferSize = newBufferSize; sampleRates.swapWith (newSampleRates); bufferSizes.swapWith (newBufferSizes); - inChanNames.swapWith (newInNames); - outChanNames.swapWith (newOutNames); - - inputChannelInfo.swapWith (newInChans); - outputChannelInfo.swapWith (newOutChans); - - numInputChans = inputChannelInfo.size(); - numOutputChans = outputChannelInfo.size(); + std::swap (inStream, newInput); + std::swap (outStream, newOutput); allocateTempBuffers(); } @@ -481,6 +487,11 @@ public: return true; } + bool updateDetailsFromDevice() + { + return updateDetailsFromDevice (getActiveChannels (inStream), getActiveChannels (outStream)); + } + StringArray getDeviceDetails() { StringArray result; @@ -500,27 +511,33 @@ public: result.add (availableBufferSizes); result.add ("Buffer size: " + String (bufferSize)); result.add ("Bit depth: " + String (bitDepth)); - result.add ("Input latency: " + String (inputLatency)); - result.add ("Output latency: " + String (outputLatency)); - result.add ("Input channel names: " + inChanNames.joinIntoString (" ")); - result.add ("Output channel names: " + outChanNames.joinIntoString (" ")); + result.add ("Input latency: " + String (getLatency (inStream))); + result.add ("Output latency: " + String (getLatency (outStream))); + result.add ("Input channel names: " + getChannelNames (inStream)); + result.add ("Output channel names: " + getChannelNames (outStream)); return result; } + static auto getScope (bool input) + { + return input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + } + //============================================================================== StringArray getSources (bool input) { StringArray s; - HeapBlock types; - auto num = getAllDataSourcesForDevice (deviceID, types); + auto types = audioObjectGetProperties (deviceID, { kAudioDevicePropertyDataSources, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }); - for (int i = 0; i < num; ++i) + for (auto type : types) { AudioValueTranslation avt; char buffer[256]; - avt.mInputData = &(types[i]); + avt.mInputData = &type; avt.mInputDataSize = sizeof (UInt32); avt.mOutputData = buffer; avt.mOutputDataSize = 256; @@ -529,7 +546,7 @@ public: AudioObjectPropertyAddress pa; pa.mSelector = kAudioDevicePropertyDataSourceNameForID; - pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + pa.mScope = getScope (input); pa.mElement = juceAudioObjectPropertyElementMain; if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &transSize, &avt))) @@ -541,66 +558,48 @@ public: int getCurrentSourceIndex (bool input) const { - OSType currentSourceID = 0; - UInt32 size = sizeof (currentSourceID); - int result = -1; - - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyDataSource; - pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; - pa.mElement = juceAudioObjectPropertyElementMain; - if (deviceID != 0) { - if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, ¤tSourceID))) + if (auto currentSourceID = audioObjectGetProperty (deviceID, { kAudioDevicePropertyDataSource, + getScope (input), + juceAudioObjectPropertyElementMain }, err2log())) { - HeapBlock types; - auto num = getAllDataSourcesForDevice (deviceID, types); + auto types = audioObjectGetProperties (deviceID, { kAudioDevicePropertyDataSources, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }); - for (int i = 0; i < num; ++i) - { - if (types[num] == currentSourceID) - { - result = i; - break; - } - } + if (auto it = std::find (types.begin(), types.end(), *currentSourceID); it != types.end()) + return static_cast (std::distance (types.begin(), it)); } } - return result; + return -1; } void setCurrentSourceIndex (int index, bool input) { if (deviceID != 0) { - HeapBlock types; - auto num = getAllDataSourcesForDevice (deviceID, types); + auto types = audioObjectGetProperties (deviceID, { kAudioDevicePropertyDataSources, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }); - if (isPositiveAndBelow (index, num)) + if (isPositiveAndBelow (index, static_cast (types.size()))) { - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyDataSource; - pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; - pa.mElement = juceAudioObjectPropertyElementMain; - - OSType typeId = types[index]; - - OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (typeId), &typeId)); + audioObjectSetProperty (deviceID, { kAudioDevicePropertyDataSource, + getScope (input), + juceAudioObjectPropertyElementMain }, + types[static_cast (index)], err2log()); } } } double getNominalSampleRate() const { - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyNominalSampleRate; - pa.mScope = kAudioObjectPropertyScopeGlobal; - pa.mElement = juceAudioObjectPropertyElementMain; - Float64 sr = 0; - UInt32 size = (UInt32) sizeof (sr); - return OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &sr)) ? (double) sr : 0.0; + return static_cast (audioObjectGetProperty (deviceID, { kAudioDevicePropertyNominalSampleRate, + kAudioObjectPropertyScopeGlobal, + juceAudioObjectPropertyElementMain }, + err2log()).value_or (0.0)); } bool setNominalSampleRate (double newSampleRate) const @@ -608,78 +607,52 @@ public: if (std::abs (getNominalSampleRate() - newSampleRate) < 1.0) return true; - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyNominalSampleRate; - pa.mScope = kAudioObjectPropertyScopeGlobal; - pa.mElement = juceAudioObjectPropertyElementMain; - Float64 sr = newSampleRate; - return OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (sr), &sr)); + return audioObjectSetProperty (deviceID, { kAudioDevicePropertyNominalSampleRate, + kAudioObjectPropertyScopeGlobal, + juceAudioObjectPropertyElementMain }, + static_cast (newSampleRate), err2log()); } //============================================================================== - String reopen (const BigInteger& inputChannels, - const BigInteger& outputChannels, - double newSampleRate, int bufferSizeSamples) + String reopen (const BigInteger& ins, const BigInteger& outs, double newSampleRate, int bufferSizeSamples) { - String error; callbacksAllowed = false; + const ScopeGuard scope { [&] { callbacksAllowed = true; } }; + stopTimer(); stop (false); - updateDetailsFromDevice(); - - activeInputChans = inputChannels; - activeInputChans.setRange (inChanNames.size(), - activeInputChans.getHighestBit() + 1 - inChanNames.size(), - false); - - activeOutputChans = outputChannels; - activeOutputChans.setRange (outChanNames.size(), - activeOutputChans.getHighestBit() + 1 - outChanNames.size(), - false); - - numInputChans = activeInputChans.countNumberOfSetBits(); - numOutputChans = activeOutputChans.countNumberOfSetBits(); - if (! setNominalSampleRate (newSampleRate)) { - updateDetailsFromDevice(); - error = "Couldn't change sample rate"; + updateDetailsFromDevice (ins, outs); + return "Couldn't change sample rate"; } - else + + if (! audioObjectSetProperty (deviceID, { kAudioDevicePropertyBufferFrameSize, + kAudioObjectPropertyScopeGlobal, + juceAudioObjectPropertyElementMain }, + static_cast (bufferSizeSamples), err2log())) { - // change buffer size - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyBufferFrameSize; - pa.mScope = kAudioObjectPropertyScopeGlobal; - pa.mElement = juceAudioObjectPropertyElementMain; - UInt32 framesPerBuf = (UInt32) bufferSizeSamples; + updateDetailsFromDevice (ins, outs); + return "Couldn't change buffer size"; + } - if (! OK (AudioObjectSetPropertyData (deviceID, &pa, 0, nullptr, sizeof (framesPerBuf), &framesPerBuf))) - { - updateDetailsFromDevice(); - error = "Couldn't change buffer size"; - } - else - { - // Annoyingly, after changing the rate and buffer size, some devices fail to - // correctly report their new settings until some random time in the future, so - // after calling updateDetailsFromDevice, we need to manually bodge these values - // to make sure we're using the correct numbers.. - updateDetailsFromDevice(); - sampleRate = newSampleRate; - bufferSize = bufferSizeSamples; + // Annoyingly, after changing the rate and buffer size, some devices fail to + // correctly report their new settings until some random time in the future, so + // after calling updateDetailsFromDevice, we need to manually bodge these values + // to make sure we're using the correct numbers.. + updateDetailsFromDevice (ins, outs); + sampleRate = newSampleRate; + bufferSize = bufferSizeSamples; - if (sampleRates.size() == 0) - error = "Device has no available sample-rates"; - else if (bufferSizes.size() == 0) - error = "Device has no available buffer-sizes"; - } - } + if (sampleRates.size() == 0) + return "Device has no available sample-rates"; - callbacksAllowed = true; - return error; + if (bufferSizes.size() == 0) + return "Device has no available buffer-sizes"; + + return {}; } bool start (AudioIODeviceCallback* callbackToNotify) @@ -692,28 +665,42 @@ public: callback->audioDeviceAboutToStart (&owner); } - if (! started) + for (auto* stream : getStreams()) + if (stream != nullptr) + stream->previousSampleTime = invalidSampleTime; + + owner.hadDiscontinuity = false; + + if (scopedProcID.get() == nullptr && deviceID != 0) { - if (deviceID != 0) + scopedProcID = [&self = *this, + &lock = callbackLock, + nextProcID = ScopedAudioDeviceIOProcID { *this, deviceID, audioIOProc }, + deviceID = deviceID]() mutable -> ScopedAudioDeviceIOProcID { - if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, this, &audioProcID))) + // It *looks* like AudioDeviceStart may start the audio callback running, and then + // immediately lock an internal mutex. + // The same mutex is locked before calling the audioIOProc. + // If we get very unlucky, then we can end up with thread A taking the callbackLock + // and calling AudioDeviceStart, followed by thread B taking the CoreAudio lock + // and calling into audioIOProc, which waits on the callbackLock. When thread A + // continues it attempts to take the CoreAudio lock, and the program deadlocks. + + if (auto* procID = nextProcID.get()) { - if (OK (AudioDeviceStart (deviceID, audioProcID))) - { - started = true; - } - else - { - OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); - audioProcID = {}; - } + const ScopedUnlock su (lock); + + if (self.OK (AudioDeviceStart (deviceID, procID))) + return std::move (nextProcID); } - } + + return {}; + }(); } - playing = started && callback != nullptr; + playing = scopedProcID.get() != nullptr && callback != nullptr; - return started; + return scopedProcID.get() != nullptr; } AudioIODeviceCallback* stop (bool leaveInterruptRunning) @@ -722,7 +709,7 @@ public: auto result = std::exchange (callback, nullptr); - if (started && (deviceID != 0) && ! leaveInterruptRunning) + if (scopedProcID.get() != nullptr && (deviceID != 0) && ! leaveInterruptRunning) { audioDeviceStopPending = true; @@ -736,9 +723,7 @@ public: Thread::sleep (50); } - OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); - audioProcID = {}; - started = false; + scopedProcID = {}; playing = false; } @@ -748,7 +733,8 @@ public: double getSampleRate() const { return sampleRate; } int getBufferSize() const { return bufferSize; } - void audioCallback (const AudioTimeStamp* timeStamp, + void audioCallback (const AudioTimeStamp* inputTimestamp, + const AudioTimeStamp* outputTimestamp, const AudioBufferList* inInputData, AudioBufferList* outOutputData) { @@ -756,18 +742,21 @@ public: if (audioDeviceStopPending) { - if (OK (AudioDeviceStop (deviceID, audioProcID))) + if (OK (AudioDeviceStop (deviceID, scopedProcID.get()))) audioDeviceStopPending = false; return; } + const auto numInputChans = getChannels (inStream); + const auto numOutputChans = getChannels (outStream); + if (callback != nullptr) { for (int i = numInputChans; --i >= 0;) { - auto& info = inputChannelInfo.getReference(i); - auto dest = tempInputBuffers[i]; + auto& info = inStream->channelInfo.getReference (i); + auto dest = inStream->tempBuffers[i]; auto src = ((const float*) inInputData->mBuffers[info.streamNum].mData) + info.dataOffsetSamples; auto stride = info.dataStrideSamples; @@ -781,19 +770,23 @@ public: } } + for (auto* stream : getStreams()) + if (stream != nullptr) + owner.hadDiscontinuity |= stream->checkTimestampsForDiscontinuity (stream == inStream.get() ? inputTimestamp + : outputTimestamp); + + const auto* timeStamp = numOutputChans > 0 ? outputTimestamp : inputTimestamp; const auto nanos = timeStamp != nullptr ? timeConversions.hostTimeToNanos (timeStamp->mHostTime) : 0; - callback->audioDeviceIOCallbackWithContext (const_cast (tempInputBuffers.get()), - numInputChans, - tempOutputBuffers, - numOutputChans, + callback->audioDeviceIOCallbackWithContext (getTempBuffers (inStream), numInputChans, + getTempBuffers (outStream), numOutputChans, bufferSize, { timeStamp != nullptr ? &nanos : nullptr }); for (int i = numOutputChans; --i >= 0;) { - auto& info = outputChannelInfo.getReference (i); - auto src = tempOutputBuffers[i]; + auto& info = outStream->channelInfo.getReference (i); + auto src = outStream->tempBuffers[i]; auto dest = ((float*) outOutputData->mBuffers[info.streamNum].mData) + info.dataOffsetSamples; auto stride = info.dataStrideSamples; @@ -813,6 +806,10 @@ public: zeromem (outOutputData->mBuffers[i].mData, outOutputData->mBuffers[i].mDataByteSize); } + + for (auto* stream : getStreams()) + if (stream != nullptr) + stream->previousSampleTime += static_cast (bufferSize); } // called by callbacks (possibly off the main thread) @@ -832,34 +829,256 @@ public: bool isPlaying() const { return playing.load(); } //============================================================================== + struct Stream + { + Stream (bool isInput, CoreAudioInternal& parent, const BigInteger& activeRequested) + : input (isInput), + latency (getLatencyFromDevice (isInput, parent)), + bitDepth (getBitDepthFromDevice (isInput, parent)), + chanNames (getChannelNames (isInput, parent)), + activeChans ([&activeRequested, clearFrom = chanNames.size()] + { + auto result = activeRequested; + result.setRange (clearFrom, result.getHighestBit() + 1 - clearFrom, false); + return result; + }()), + channelInfo (getChannelInfos (isInput, parent, activeChans)), + channels (static_cast (channelInfo.size())) + {} + + int allocateTempBuffers (int tempBufSize, int channelCount, HeapBlock& buffer) + { + tempBuffers.calloc (channels + 2); + + for (int i = 0; i < channels; ++i) + tempBuffers[i] = buffer + channelCount++ * tempBufSize; + + return channels; + } + + template + static auto visitChannels (bool isInput, CoreAudioInternal& parent, Visitor&& visitor) + { + struct Args { int stream, channelIdx, chanNum, streamChannels; }; + using VisitorResultType = typename std::invoke_result_t::value_type; + Array result; + int chanNum = 0; + + if (auto bufList = audioObjectGetProperty (parent.deviceID, { kAudioDevicePropertyStreamConfiguration, + getScope (isInput), + juceAudioObjectPropertyElementMain }, parent.err2log())) + { + const int numStreams = static_cast (bufList->mNumberBuffers); + + for (int i = 0; i < numStreams; ++i) + { + auto& b = bufList->mBuffers[i]; + + for (unsigned int j = 0; j < b.mNumberChannels; ++j) + { + // Passing an anonymous struct ensures that callback can't confuse the argument order + if (auto opt = visitor (Args { i, static_cast (j), chanNum++, static_cast (b.mNumberChannels) })) + result.add (std::move (*opt)); + } + } + } + + return result; + } + + static Array getChannelInfos (bool isInput, CoreAudioInternal& parent, const BigInteger& active) + { + return visitChannels (isInput, parent, + [&] (const auto& args) -> std::optional + { + if (! active[args.chanNum]) + return {}; + + return CallbackDetailsForChannel { args.stream, args.channelIdx, args.streamChannels }; + }); + } + + static StringArray getChannelNames (bool isInput, CoreAudioInternal& parent) + { + auto names = visitChannels (isInput, parent, + [&] (const auto& args) -> std::optional + { + String name; + const auto element = static_cast (args.chanNum + 1); + + if (auto nameNSString = audioObjectGetProperty (parent.deviceID, { kAudioObjectPropertyElementName, + getScope (isInput), + element }).value_or (nullptr)) + { + name = nsStringToJuce (nameNSString); + [nameNSString release]; + } + + if (name.isEmpty()) + name << (isInput ? "Input " : "Output ") << (args.chanNum + 1); + + return name; + }); + + return { names }; + } + + static int getBitDepthFromDevice (bool isInput, CoreAudioInternal& parent) + { + return static_cast (audioObjectGetProperty (parent.deviceID, { kAudioStreamPropertyPhysicalFormat, + getScope (isInput), + juceAudioObjectPropertyElementMain }, parent.err2log()) + .value_or (AudioStreamBasicDescription{}).mBitsPerChannel); + } + + static int getLatencyFromDevice (bool isInput, CoreAudioInternal& parent) + { + const auto scope = getScope (isInput); + + const auto deviceLatency = audioObjectGetProperty (parent.deviceID, { kAudioDevicePropertyLatency, + scope, + juceAudioObjectPropertyElementMain }).value_or (0); + + const auto safetyOffset = audioObjectGetProperty (parent.deviceID, { kAudioDevicePropertySafetyOffset, + scope, + juceAudioObjectPropertyElementMain }).value_or (0); + + const auto framesInBuffer = audioObjectGetProperty (parent.deviceID, { kAudioDevicePropertyBufferFrameSize, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }).value_or (0); + + UInt32 streamLatency = 0; + + if (auto streams = audioObjectGetProperties (parent.deviceID, { kAudioDevicePropertyStreams, + scope, + juceAudioObjectPropertyElementMain }); ! streams.empty()) + streamLatency = audioObjectGetProperty (streams.front(), { kAudioStreamPropertyLatency, + scope, + juceAudioObjectPropertyElementMain }).value_or (0); + + return static_cast (deviceLatency + safetyOffset + framesInBuffer + streamLatency); + } + + bool checkTimestampsForDiscontinuity (const AudioTimeStamp* timestamp) noexcept + { + if (channels > 0) + { + jassert (timestamp == nullptr || (((timestamp->mFlags & kAudioTimeStampSampleTimeValid) != 0) + && ((timestamp->mFlags & kAudioTimeStampHostTimeValid) != 0))); + + if (previousSampleTime == invalidSampleTime) + previousSampleTime = timestamp != nullptr ? timestamp->mSampleTime : 0.0; + + if (timestamp != nullptr && std::fabs (previousSampleTime - timestamp->mSampleTime) >= 1.0) + { + previousSampleTime = timestamp->mSampleTime; + return true; + } + } + + return false; + } + + //============================================================================== + const bool input; + const int latency; + const int bitDepth; + const StringArray chanNames; + const BigInteger activeChans; + const Array channelInfo; + const int channels = 0; + Float64 previousSampleTime; + + HeapBlock tempBuffers; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Stream) + }; + + template + static auto getWithDefault (const std::unique_ptr& ptr, Callback&& callback) + { + return ptr != nullptr ? callback (*ptr) : decltype (callback (*ptr)) {}; + } + + template + static auto getWithDefault (const std::unique_ptr& ptr, Value (Stream::* member)) + { + return getWithDefault (ptr, [&] (Stream& s) { return s.*member; }); + } + + static int getLatency (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::latency); } + static int getBitDepth (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::bitDepth); } + static int getChannels (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::channels); } + static int getNumChannelNames (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::chanNames).size(); } + static String getChannelNames (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::chanNames).joinIntoString (" "); } + static BigInteger getActiveChannels (const std::unique_ptr& ptr) { return getWithDefault (ptr, &Stream::activeChans); } + static float** getTempBuffers (const std::unique_ptr& ptr) { return getWithDefault (ptr, [] (auto& s) { return s.tempBuffers.get(); }); } + + //============================================================================== + static constexpr Float64 invalidSampleTime = std::numeric_limits::max(); + CoreAudioIODevice& owner; - int inputLatency = 0; - int outputLatency = 0; int bitDepth = 32; int xruns = 0; - BigInteger activeInputChans, activeOutputChans; - StringArray inChanNames, outChanNames; Array sampleRates; Array bufferSizes; - AudioDeviceIOProcID audioProcID = {}; + AudioDeviceID deviceID; + std::unique_ptr inStream, outStream; private: + class ScopedAudioDeviceIOProcID + { + public: + ScopedAudioDeviceIOProcID() = default; + + ScopedAudioDeviceIOProcID (CoreAudioInternal& coreAudio, AudioDeviceID d, AudioDeviceIOProc audioIOProc) + : deviceID (d) + { + if (! coreAudio.OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, &coreAudio, &proc))) + proc = {}; + } + + ~ScopedAudioDeviceIOProcID() noexcept + { + if (proc != AudioDeviceIOProcID{}) + AudioDeviceDestroyIOProcID (deviceID, proc); + } + + ScopedAudioDeviceIOProcID (ScopedAudioDeviceIOProcID&& other) noexcept + { + swap (other); + } + + ScopedAudioDeviceIOProcID& operator= (ScopedAudioDeviceIOProcID&& other) noexcept + { + ScopedAudioDeviceIOProcID { std::move (other) }.swap (*this); + return *this; + } + + AudioDeviceIOProcID get() const { return proc; } + + private: + void swap (ScopedAudioDeviceIOProcID& other) noexcept + { + std::swap (other.deviceID, deviceID); + std::swap (other.proc, proc); + } + + AudioDeviceID deviceID = {}; + AudioDeviceIOProcID proc = {}; + }; + + //============================================================================== + ScopedAudioDeviceIOProcID scopedProcID; CoreAudioTimeConversions timeConversions; AudioIODeviceCallback* callback = nullptr; CriticalSection callbackLock; - AudioDeviceID deviceID; - bool started = false, audioDeviceStopPending = false; + bool audioDeviceStopPending = false; std::atomic playing { false }; double sampleRate = 0; int bufferSize = 0; HeapBlock audioBuffer; - int numInputChans = 0; - int numOutputChans = 0; Atomic callbacksAllowed { 1 }; - const bool isInputDevice, isOutputDevice; - - Array inputChannelInfo, outputChannelInfo; - HeapBlock tempInputBuffers, tempOutputBuffers; //============================================================================== void timerCallback() override @@ -883,14 +1102,14 @@ private: } static OSStatus audioIOProc (AudioDeviceID /*inDevice*/, - const AudioTimeStamp* inNow, + [[maybe_unused]] const AudioTimeStamp* inNow, const AudioBufferList* inInputData, - const AudioTimeStamp* /*inInputTime*/, + const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, - const AudioTimeStamp* /*inOutputTime*/, + const AudioTimeStamp* inOutputTime, void* device) { - static_cast (device)->audioCallback (inNow, inInputData, outOutputData); + static_cast (device)->audioCallback (inInputTime, inOutputTime, inInputData, outOutputData); return noErr; } @@ -932,26 +1151,6 @@ private: } //============================================================================== - static int getAllDataSourcesForDevice (AudioDeviceID deviceID, HeapBlock& types) - { - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyDataSources; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; - UInt32 size = 0; - - if (deviceID != 0 - && AudioObjectGetPropertyDataSize (deviceID, &pa, 0, nullptr, &size) == noErr) - { - types.calloc (size, 1); - - if (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, types) == noErr) - return size / (int) sizeof (OSType); - } - - return 0; - } - bool OK (const OSStatus errorCode) const { if (errorCode == noErr) @@ -1017,8 +1216,8 @@ public: AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal.get()); } - StringArray getOutputChannelNames() override { return internal->outChanNames; } - StringArray getInputChannelNames() override { return internal->inChanNames; } + StringArray getOutputChannelNames() override { return internal->outStream != nullptr ? internal->outStream->chanNames : StringArray(); } + StringArray getInputChannelNames() override { return internal->inStream != nullptr ? internal->inStream ->chanNames : StringArray(); } bool isOpen() override { return isOpen_; } @@ -1030,12 +1229,14 @@ public: int getCurrentBufferSizeSamples() override { return internal->getBufferSize(); } int getXRunCount() const noexcept override { return internal->xruns; } + int getIndexOfDevice (bool asInput) const { return asInput ? inputIndex : outputIndex; } + int getDefaultBufferSize() override { int best = 0; for (int i = 0; best < 512 && i < internal->bufferSizes.size(); ++i) - best = internal->bufferSizes.getUnchecked(i); + best = internal->bufferSizes.getUnchecked (i); if (best == 0) best = 512; @@ -1073,21 +1274,10 @@ public: internal->stop (false); } - BigInteger getActiveOutputChannels() const override { return internal->activeOutputChans; } - BigInteger getActiveInputChannels() const override { return internal->activeInputChans; } - - int getOutputLatencyInSamples() override - { - // this seems like a good guess at getting the latency right - comparing - // this with a round-trip measurement, it gets it to within a few millisecs - // for the built-in mac soundcard - return internal->outputLatency; - } - - int getInputLatencyInSamples() override - { - return internal->inputLatency; - } + BigInteger getActiveOutputChannels() const override { return CoreAudioInternal::getActiveChannels (internal->outStream); } + BigInteger getActiveInputChannels() const override { return CoreAudioInternal::getActiveChannels (internal->inStream); } + int getOutputLatencyInSamples() override { return CoreAudioInternal::getLatency (internal->outStream); } + int getInputLatencyInSamples() override { return CoreAudioInternal::getLatency (internal->inStream); } void start (AudioIODeviceCallback* callback) override { @@ -1164,6 +1354,7 @@ public: WeakReference deviceType; int inputIndex, outputIndex; + bool hadDiscontinuity; private: std::unique_ptr internal; @@ -1207,82 +1398,48 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreAudioIODevice) }; + //============================================================================== class AudioIODeviceCombiner : public AudioIODevice, private AsyncRestarter, - private Thread, private Timer { public: - AudioIODeviceCombiner (const String& deviceName, CoreAudioIODeviceType* deviceType) + AudioIODeviceCombiner (const String& deviceName, CoreAudioIODeviceType* deviceType, + std::unique_ptr&& inputDevice, + std::unique_ptr&& outputDevice) : AudioIODevice (deviceName, "CoreAudio"), - Thread (deviceName), - owner (deviceType) + owner (deviceType), + currentSampleRate (inputDevice->getCurrentSampleRate()), + currentBufferSize (inputDevice->getCurrentBufferSizeSamples()), + inputWrapper (*this, std::move (inputDevice), true), + outputWrapper (*this, std::move (outputDevice), false) { + if (getAvailableSampleRates().isEmpty()) + lastError = TRANS("The input and output devices don't share a common sample rate!"); } ~AudioIODeviceCombiner() override { close(); - devices.clear(); - } - - void addDevice (std::unique_ptr device, bool useInputs, bool useOutputs) - { - jassert (device != nullptr); - jassert (! isOpen()); - jassert (! device->isOpen()); - auto* devicePtr = device.get(); - - devices.add (std::make_unique (*this, std::move (device), useInputs, useOutputs)); - - if (currentSampleRate == 0) - currentSampleRate = devicePtr->getCurrentSampleRate(); - - if (currentBufferSize == 0) - currentBufferSize = devicePtr->getCurrentBufferSizeSamples(); - } - - Array getDevices() const - { - Array devs; - - for (auto* d : devices) - devs.add (d->device.get()); - - return devs; } - StringArray getOutputChannelNames() override - { - StringArray names; - - for (auto* d : devices) - names.addArray (d->getOutputChannelNames()); - - names.appendNumbersToDuplicates (false, true); - return names; - } + auto getDeviceWrappers() { return std::array< DeviceWrapper*, 2> { { &inputWrapper, &outputWrapper } }; } + auto getDeviceWrappers() const { return std::array { { &inputWrapper, &outputWrapper } }; } - StringArray getInputChannelNames() override - { - StringArray names; - - for (auto* d : devices) - names.addArray (d->getInputChannelNames()); - - names.appendNumbersToDuplicates (false, true); - return names; - } + StringArray getOutputChannelNames() override { return outputWrapper.getChannelNames(); } + StringArray getInputChannelNames() override { return inputWrapper .getChannelNames(); } + BigInteger getActiveOutputChannels() const override { return outputWrapper.getActiveChannels(); } + BigInteger getActiveInputChannels() const override { return inputWrapper .getActiveChannels(); } Array getAvailableSampleRates() override { Array commonRates; bool first = true; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { - auto rates = d->device->getAvailableSampleRates(); + auto rates = d->getAvailableSampleRates(); if (first) { @@ -1303,9 +1460,9 @@ public: Array commonSizes; bool first = true; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { - auto sizes = d->device->getAvailableBufferSizes(); + auto sizes = d->getAvailableBufferSizes(); if (first) { @@ -1330,8 +1487,8 @@ public: { int depth = 32; - for (auto* d : devices) - depth = jmin (depth, d->device->getCurrentBitDepth()); + for (auto& d : getDeviceWrappers()) + depth = jmin (depth, d->getCurrentBitDepth()); return depth; } @@ -1340,8 +1497,8 @@ public: { int size = 0; - for (auto* d : devices) - size = jmax (size, d->device->getDefaultBufferSize()); + for (auto& d : getDeviceWrappers()) + size = jmax (size, d->getDefaultBufferSize()); return size; } @@ -1366,29 +1523,18 @@ public: auto rates = getAvailableSampleRates(); for (int i = 0; i < rates.size() && sampleRate < 44100.0; ++i) - sampleRate = rates.getUnchecked(i); + sampleRate = rates.getUnchecked (i); } currentSampleRate = sampleRate; currentBufferSize = bufferSize; + targetLatency = bufferSize; - const int fifoSize = bufferSize * 3 + 1; - int totalInputChanIndex = 0, totalOutputChanIndex = 0; - int chanIndex = 0; - - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { - BigInteger ins (inputChannels >> totalInputChanIndex); - BigInteger outs (outputChannels >> totalOutputChanIndex); - - int numIns = d->getInputChannelNames().size(); - int numOuts = d->getOutputChannelNames().size(); - - totalInputChanIndex += numIns; - totalOutputChanIndex += numOuts; - - String err = d->open (ins, outs, sampleRate, bufferSize, - chanIndex, fifoSize); + auto err = d->open ( d->isInput() ? inputChannels : BigInteger(), + ! d->isInput() ? outputChannels : BigInteger(), + sampleRate, bufferSize); if (err.isNotEmpty()) { @@ -1397,15 +1543,13 @@ public: return err; } - chanIndex += d->numInputChans + d->numOutputChans; + targetLatency += d->getLatencyInSamples(); } - fifos.setSize (chanIndex, fifoSize); - fifoReadPointers = fifos.getArrayOfReadPointers(); - fifoWritePointers = fifos.getArrayOfWritePointers(); - fifos.clear(); - startThread (9); - threadInitialised.wait(); + const auto numOuts = outputWrapper.getChannelNames().size(); + + fifo.setSize (numOuts, targetLatency + (bufferSize * 2)); + scratchBuffer.setSize (numOuts, bufferSize); return {}; } @@ -1413,11 +1557,10 @@ public: void close() override { stop(); - stopThread (10000); - fifos.clear(); + fifo.clear(); active = false; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) d->close(); } @@ -1430,7 +1573,7 @@ public: auto newSampleRate = sampleRateRequested; auto newBufferSize = bufferSizeRequested; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { auto deviceSampleRate = d->getCurrentSampleRate(); @@ -1439,8 +1582,8 @@ public: if (! getAvailableSampleRates().contains (deviceSampleRate)) return; - for (auto* d2 : devices) - if (d2 != d) + for (auto& d2 : getDeviceWrappers()) + if (&d2 != &d) d2->setCurrentSampleRate (deviceSampleRate); newSampleRate = deviceSampleRate; @@ -1448,7 +1591,7 @@ public: } } - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { auto deviceBufferSize = d->getCurrentBufferSizeSamples(); @@ -1462,8 +1605,7 @@ public: } } - open (inputChannelsRequested, outputChannelsRequested, - newSampleRate, newBufferSize); + open (inputChannelsRequested, outputChannelsRequested, newSampleRate, newBufferSize); start (cb); } @@ -1485,62 +1627,14 @@ public: startTimer (100); } - BigInteger getActiveOutputChannels() const override - { - BigInteger chans; - int start = 0; - - for (auto* d : devices) - { - auto numChans = d->getOutputChannelNames().size(); - - if (numChans > 0) - { - chans |= (d->device->getActiveOutputChannels() << start); - start += numChans; - } - } - - return chans; - } - - BigInteger getActiveInputChannels() const override - { - BigInteger chans; - int start = 0; - - for (auto* d : devices) - { - auto numChans = d->getInputChannelNames().size(); - - if (numChans > 0) - { - chans |= (d->device->getActiveInputChannels() << start); - start += numChans; - } - } - - return chans; - } - int getOutputLatencyInSamples() override { - int lat = 0; - - for (auto* d : devices) - lat = jmax (lat, d->device->getOutputLatencyInSamples()); - - return lat + currentBufferSize * 2; + return targetLatency - getInputLatencyInSamples(); } int getInputLatencyInSamples() override { - int lat = 0; - - for (auto* d : devices) - lat = jmax (lat, d->device->getInputLatencyInSamples()); - - return lat + currentBufferSize * 2; + return inputWrapper.getLatencyInSamples(); } void start (AudioIODeviceCallback* newCallback) override @@ -1554,13 +1648,20 @@ public: if (shouldStart) { stop(); - fifos.clear(); + fifo.clear(); + reset(); + + { + ScopedErrorForwarder forwarder (*this, newCallback); - for (auto* d : devices) - d->start(); + for (auto& d : getDeviceWrappers()) + d->start (d); - if (newCallback != nullptr) - newCallback->audioDeviceAboutToStart (this); + if (! forwarder.encounteredError() && newCallback != nullptr) + newCallback->audioDeviceAboutToStart (this); + else if (lastError.isEmpty()) + lastError = TRANS("Failed to initialise all requested devices."); + } const ScopedLock sl (callbackLock); previousCallback = callback = newCallback; @@ -1574,7 +1675,14 @@ public: return lastError; } + int getXRunCount() const noexcept override + { + return xruns.load(); + } + private: + static constexpr auto invalidSampleTime = std::numeric_limits::max(); + WeakReference owner; CriticalSection callbackLock; AudioIODeviceCallback* callback = nullptr; @@ -1583,78 +1691,16 @@ private: int currentBufferSize = 0; bool active = false; String lastError; - AudioBuffer fifos; - const float** fifoReadPointers = nullptr; - float** fifoWritePointers = nullptr; - WaitableEvent threadInitialised; + AudioSampleBuffer fifo, scratchBuffer; CriticalSection closeLock; + int targetLatency = 0; + std::atomic xruns { -1 }; + std::atomic lastValidReadPosition { invalidSampleTime }; BigInteger inputChannelsRequested, outputChannelsRequested; double sampleRateRequested = 44100; int bufferSizeRequested = 512; - void run() override - { - auto numSamples = currentBufferSize; - - AudioBuffer buffer (fifos.getNumChannels(), numSamples); - buffer.clear(); - - Array inputChans; - Array outputChans; - - for (auto* d : devices) - { - for (int j = 0; j < d->numInputChans; ++j) inputChans.add (buffer.getReadPointer (d->inputIndex + j)); - for (int j = 0; j < d->numOutputChans; ++j) outputChans.add (buffer.getWritePointer (d->outputIndex + j)); - } - - auto numInputChans = inputChans.size(); - auto numOutputChans = outputChans.size(); - - inputChans.add (nullptr); - outputChans.add (nullptr); - - auto blockSizeMs = jmax (1, (int) (1000 * numSamples / currentSampleRate)); - - jassert (numInputChans + numOutputChans == buffer.getNumChannels()); - - threadInitialised.signal(); - - while (! threadShouldExit()) - { - readInput (buffer, numSamples, blockSizeMs); - - bool didCallback = true; - - { - const ScopedLock sl (callbackLock); - - if (callback != nullptr) - callback->audioDeviceIOCallbackWithContext ((const float**) inputChans.getRawDataPointer(), - numInputChans, - outputChans.getRawDataPointer(), - numOutputChans, - numSamples, - {}); // Can't predict when the next output callback will happen - else - didCallback = false; - } - - if (didCallback) - { - pushOutputData (buffer, numSamples, blockSizeMs); - } - else - { - for (int i = 0; i < numOutputChans; ++i) - FloatVectorOperations::clear (outputChans[i], numSamples); - - reset(); - } - } - } - void timerCallback() override { stopTimer(); @@ -1671,8 +1717,8 @@ private: std::swap (callback, lastCallback); } - for (auto* d : devices) - d->device->stopInternal(); + for (auto& d : getDeviceWrappers()) + d->stopInternal(); if (lastCallback != nullptr) { @@ -1685,90 +1731,152 @@ private: void reset() { - for (auto* d : devices) + xruns.store (0); + fifo.clear(); + scratchBuffer.clear(); + + for (auto& d : getDeviceWrappers()) d->reset(); } - void underrun() + // AbstractFifo cannot be used here for two reasons: + // 1) We use absolute timestamps as the fifo's read/write positions. This not only makes the code + // more readable (especially when checking for underruns/overflows) but also simplifies the + // initial setup when actual latency is not known yet until both callbacks have fired. + // 2) AbstractFifo doesn't have the necessary mechanics to recover from underrun/overflow conditions + // in a lock-free and data-race free way. It's great if you don't care (i.e. overwrite and/or + // read stale data) or can abort the operation entirely, but this is not the case here. We + // need bespoke underrun/overflow handling here which fits this use-case. + template + void accessFifo (const uint64_t startPos, const int numChannels, const int numItems, Callback&& operateOnRange) { + const auto fifoSize = fifo.getNumSamples(); + auto fifoPos = static_cast (startPos % static_cast (fifoSize)); + + for (int pos = 0; pos < numItems;) + { + const auto max = std::min (numItems - pos, fifoSize - fifoPos); + + struct Args { int fifoPos, inputPos, nItems, channel; }; + + for (auto ch = 0; ch < numChannels; ++ch) + operateOnRange (Args { fifoPos, pos, max, ch }); + + fifoPos = (fifoPos + max) % fifoSize; + pos += max; + } } - void readInput (AudioBuffer& buffer, const int numSamples, const int blockSizeMs) + void inputAudioCallback (const float* const* channels, int numChannels, int n, const AudioIODeviceCallbackContext& context) noexcept { - for (auto* d : devices) - d->done = (d->numInputChans == 0 || d->isWaitingForInput); + auto& writePos = inputWrapper.sampleTime; - float totalWaitTimeMs = blockSizeMs * 5.0f; - constexpr int numReadAttempts = 6; - auto sumPower2s = [] (int maxPower) { return (1 << (maxPower + 1)) - 1; }; - float waitTime = totalWaitTimeMs / (float) sumPower2s (numReadAttempts - 2); - - for (int numReadAttemptsRemaining = numReadAttempts;;) { - bool anySamplesRemaining = false; + ScopedLock lock (callbackLock); - for (auto* d : devices) + if (callback != nullptr) { - if (! d->done) - { - if (d->isInputReady (numSamples)) - { - d->readInput (buffer, numSamples); - d->done = true; - } - else - { - anySamplesRemaining = true; - } - } + const auto numActiveOutputChannels = outputWrapper.getActiveChannels().countNumberOfSetBits(); + jassert (numActiveOutputChannels <= scratchBuffer.getNumChannels()); + + callback->audioDeviceIOCallbackWithContext (channels, + numChannels, + scratchBuffer.getArrayOfWritePointers(), + numActiveOutputChannels, + n, + context); + } + else + { + scratchBuffer.clear(); } + } - if (! anySamplesRemaining) - return; + auto currentWritePos = writePos.load(); + const auto nextWritePos = currentWritePos + static_cast (n); - if (--numReadAttemptsRemaining == 0) - break; + writePos.compare_exchange_strong (currentWritePos, nextWritePos); + + if (currentWritePos == invalidSampleTime) + return; + + const auto readPos = outputWrapper.sampleTime.load(); - wait (jmax (1, roundToInt (waitTime))); - waitTime *= 2.0f; + // check for fifo overflow + if (readPos != invalidSampleTime) + { + // write will overlap previous read + if (readPos > currentWritePos || (currentWritePos + static_cast (n) - readPos) > static_cast (fifo.getNumSamples())) + { + xrun(); + return; + } } - for (auto* d : devices) - if (! d->done) - for (int i = 0; i < d->numInputChans; ++i) - buffer.clear (d->inputIndex + i, 0, numSamples); + accessFifo (currentWritePos, scratchBuffer.getNumChannels(), n, [&] (const auto& args) + { + FloatVectorOperations::copy (fifo.getWritePointer (args.channel, args.fifoPos), + scratchBuffer.getReadPointer (args.channel, args.inputPos), + args.nItems); + }); + + { + auto invalid = invalidSampleTime; + lastValidReadPosition.compare_exchange_strong (invalid, nextWritePos); + } } - void pushOutputData (AudioBuffer& buffer, const int numSamples, const int blockSizeMs) + void outputAudioCallback (float* const* channels, int numChannels, int n) noexcept { - for (auto* d : devices) - d->done = (d->numOutputChans == 0); + auto& readPos = outputWrapper.sampleTime; + auto currentReadPos = readPos.load(); - for (int tries = 5;;) - { - bool anyRemaining = false; + if (currentReadPos == invalidSampleTime) + return; - for (auto* d : devices) + const auto writePos = inputWrapper.sampleTime.load(); + + // check for fifo underrun + if (writePos != invalidSampleTime) + { + if ((currentReadPos + static_cast (n)) > writePos) { - if (! d->done) - { - if (d->isOutputReady (numSamples)) - { - d->pushOutputData (buffer, numSamples); - d->done = true; - } - else - { - anyRemaining = true; - } - } + xrun(); + return; } + } - if ((! anyRemaining) || --tries == 0) - return; + // If there was an xrun, we want to output zeros until we're sure that there's some valid + // input for us to read. + const auto longN = static_cast (n); + const auto nextReadPos = currentReadPos + longN; + const auto validReadPos = lastValidReadPosition.load(); + const auto sanitisedValidReadPos = validReadPos != invalidSampleTime ? validReadPos : nextReadPos; + const auto numZerosToWrite = sanitisedValidReadPos <= currentReadPos + ? 0 + : jmin (longN, sanitisedValidReadPos - currentReadPos); - wait (blockSizeMs); - } + for (auto i = 0; i < numChannels; ++i) + std::fill (channels[i], channels[i] + numZerosToWrite, 0.0f); + + accessFifo (currentReadPos + numZerosToWrite, numChannels, static_cast (longN - numZerosToWrite), [&] (const auto& args) + { + FloatVectorOperations::copy (channels[args.channel] + args.inputPos + numZerosToWrite, + fifo.getReadPointer (args.channel, args.fifoPos), + args.nItems); + }); + + // use compare exchange here as we need to avoid the case + // where we overwrite readPos being equal to invalidSampleTime + readPos.compare_exchange_strong (currentReadPos, nextReadPos); + } + + void xrun() noexcept + { + for (auto& d : getDeviceWrappers()) + d->sampleTime.store (invalidSampleTime); + + ++xruns; } void handleAudioDeviceAboutToStart (AudioIODevice* device) @@ -1802,7 +1910,7 @@ private: currentSampleRate = newSampleRate; bool anySampleRateChanges = false; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { if (d->getCurrentSampleRate() != currentSampleRate) { @@ -1822,215 +1930,156 @@ private: void handleAudioDeviceError (const String& errorMessage) { shutdown (errorMessage.isNotEmpty() ? errorMessage : String ("unknown")); } //============================================================================== - struct DeviceWrapper : private AudioIODeviceCallback + struct DeviceWrapper : public AudioIODeviceCallback { - DeviceWrapper (AudioIODeviceCombiner& cd, std::unique_ptr d, bool useIns, bool useOuts) - : owner (cd), device (std::move (d)), - useInputs (useIns), useOutputs (useOuts) + DeviceWrapper (AudioIODeviceCombiner& cd, std::unique_ptr d, bool shouldBeInput) + : owner (cd), + device (std::move (d)), + input (shouldBeInput) { device->setAsyncRestarter (&owner); } ~DeviceWrapper() override - { - close(); - } - - String open (const BigInteger& inputChannels, const BigInteger& outputChannels, - double sampleRate, int bufferSize, int channelIndex, int fifoSize) - { - inputFifo.setTotalSize (fifoSize); - outputFifo.setTotalSize (fifoSize); - inputFifo.reset(); - outputFifo.reset(); - - auto err = device->open (useInputs ? inputChannels : BigInteger(), - useOutputs ? outputChannels : BigInteger(), - sampleRate, bufferSize); - - numInputChans = useInputs ? device->getActiveInputChannels().countNumberOfSetBits() : 0; - numOutputChans = useOutputs ? device->getActiveOutputChannels().countNumberOfSetBits() : 0; - - isWaitingForInput = numInputChans > 0; - - inputIndex = channelIndex; - outputIndex = channelIndex + numInputChans; - - return err; - } - - void close() { device->close(); } - void start() + void reset() { - reset(); - device->start (this); + sampleTime.store (invalidSampleTime); } - void reset() + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, + int numInputChannels, + float* const* outputChannelData, + int numOutputChannels, + int numSamples, + const AudioIODeviceCallbackContext& context) override { - inputFifo.reset(); - outputFifo.reset(); - } + if (std::exchange (device->hadDiscontinuity, false)) + owner.xrun(); - StringArray getOutputChannelNames() const { return useOutputs ? device->getOutputChannelNames() : StringArray(); } - StringArray getInputChannelNames() const { return useInputs ? device->getInputChannelNames() : StringArray(); } + updateSampleTimeFromContext (context); - bool isInputReady (int numSamples) const noexcept - { - return numInputChans == 0 || inputFifo.getNumReady() >= numSamples; + if (input) + owner.inputAudioCallback (inputChannelData, numInputChannels, numSamples, context); + else + owner.outputAudioCallback (outputChannelData, numOutputChannels, numSamples); } - void readInput (AudioBuffer& destBuffer, int numSamples) + void audioDeviceAboutToStart (AudioIODevice* d) override { owner.handleAudioDeviceAboutToStart (d); } + void audioDeviceStopped() override { owner.handleAudioDeviceStopped(); } + void audioDeviceError (const String& errorMessage) override { owner.handleAudioDeviceError (errorMessage); } + + bool setCurrentSampleRate (double newSampleRate) { return device->setCurrentSampleRate (newSampleRate); } + StringArray getChannelNames() const { return input ? device->getInputChannelNames() : device->getOutputChannelNames(); } + BigInteger getActiveChannels() const { return input ? device->getActiveInputChannels() : device->getActiveOutputChannels(); } + int getLatencyInSamples() const { return input ? device->getInputLatencyInSamples() : device->getOutputLatencyInSamples(); } + int getIndexOfDevice (bool asInput) const { return device->getIndexOfDevice (asInput); } + double getCurrentSampleRate() const { return device->getCurrentSampleRate(); } + int getCurrentBufferSizeSamples() const { return device->getCurrentBufferSizeSamples(); } + Array getAvailableSampleRates() const { return device->getAvailableSampleRates(); } + Array getAvailableBufferSizes() const { return device->getAvailableBufferSizes(); } + int getCurrentBitDepth() const { return device->getCurrentBitDepth(); } + int getDefaultBufferSize() const { return device->getDefaultBufferSize(); } + void start (AudioIODeviceCallback* callbackToNotify) const { return device->start (callbackToNotify); } + AudioIODeviceCallback* stopInternal() const { return device->stopInternal(); } + void close() const { return device->close(); } + + String open (const BigInteger& inputChannels, const BigInteger& outputChannels, double sampleRate, int bufferSizeSamples) const { - if (numInputChans == 0) - return; - - int start1, size1, start2, size2; - inputFifo.prepareToRead (numSamples, start1, size1, start2, size2); - - for (int i = 0; i < numInputChans; ++i) - { - auto index = inputIndex + i; - auto dest = destBuffer.getWritePointer (index); - auto src = owner.fifoReadPointers[index]; - - if (size1 > 0) FloatVectorOperations::copy (dest, src + start1, size1); - if (size2 > 0) FloatVectorOperations::copy (dest + size1, src + start2, size2); - } - - inputFifo.finishedRead (size1 + size2); + return device->open (inputChannels, outputChannels, sampleRate, bufferSizeSamples); } - bool isOutputReady (int numSamples) const noexcept + std::uint64_t nsToSampleTime (std::uint64_t ns) const noexcept { - return numOutputChans == 0 || outputFifo.getFreeSpace() >= numSamples; + return static_cast (std::round (static_cast (ns) * device->getCurrentSampleRate() * 1e-9)); } - void pushOutputData (AudioBuffer& srcBuffer, int numSamples) + void updateSampleTimeFromContext (const AudioIODeviceCallbackContext& context) noexcept { - if (numOutputChans == 0) - return; - - int start1, size1, start2, size2; - outputFifo.prepareToWrite (numSamples, start1, size1, start2, size2); + auto callbackSampleTime = context.hostTimeNs != nullptr ? nsToSampleTime (*context.hostTimeNs) : 0; - for (int i = 0; i < numOutputChans; ++i) - { - auto index = outputIndex + i; - auto dest = owner.fifoWritePointers[index]; - auto src = srcBuffer.getReadPointer (index); + if (input) + callbackSampleTime += static_cast (owner.targetLatency); - if (size1 > 0) FloatVectorOperations::copy (dest + start1, src, size1); - if (size2 > 0) FloatVectorOperations::copy (dest + start2, src + size1, size2); - } + auto copy = invalidSampleTime; - outputFifo.finishedWrite (size1 + size2); + if (sampleTime.compare_exchange_strong (copy, callbackSampleTime) && (! input)) + owner.lastValidReadPosition = invalidSampleTime; } - void audioDeviceIOCallbackWithContext (const float** inputChannelData, - int numInputChannels, - float** outputChannelData, - int numOutputChannels, - int numSamples, - const AudioIODeviceCallbackContext&) override - { - if (numInputChannels > 0) - { - isWaitingForInput = false; - - int start1, size1, start2, size2; - inputFifo.prepareToWrite (numSamples, start1, size1, start2, size2); - - if (size1 + size2 < numSamples) - { - inputFifo.reset(); - inputFifo.prepareToWrite (numSamples, start1, size1, start2, size2); - } - - for (int i = 0; i < numInputChannels; ++i) - { - auto dest = owner.fifoWritePointers[inputIndex + i]; - auto src = inputChannelData[i]; + bool isInput() const { return input; } - if (size1 > 0) FloatVectorOperations::copy (dest + start1, src, size1); - if (size2 > 0) FloatVectorOperations::copy (dest + start2, src + size1, size2); - } + std::atomic sampleTime { invalidSampleTime }; - auto totalSize = size1 + size2; - inputFifo.finishedWrite (totalSize); + private: - if (numSamples > totalSize) - { - auto samplesRemaining = numSamples - totalSize; + //============================================================================== + AudioIODeviceCombiner& owner; + std::unique_ptr device; + const bool input; - for (int i = 0; i < numInputChans; ++i) - FloatVectorOperations::clear (owner.fifoWritePointers[inputIndex + i] + totalSize, samplesRemaining); + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DeviceWrapper) + }; - owner.underrun(); - } - } + /* If the current AudioIODeviceCombiner::callback is nullptr, it sets itself as the callback + and forwards error related callbacks to the provided callback + */ + class ScopedErrorForwarder : public AudioIODeviceCallback + { + public: + ScopedErrorForwarder (AudioIODeviceCombiner& ownerIn, AudioIODeviceCallback* cb) + : owner (ownerIn), + target (cb) + { + const ScopedLock sl (owner.callbackLock); - if (numOutputChannels > 0) - { - int start1, size1, start2, size2; - outputFifo.prepareToRead (numSamples, start1, size1, start2, size2); + if (owner.callback == nullptr) + owner.callback = this; + } - if (size1 + size2 < numSamples) - { - Thread::sleep (1); - outputFifo.prepareToRead (numSamples, start1, size1, start2, size2); - } + ~ScopedErrorForwarder() override + { + const ScopedLock sl (owner.callbackLock); - for (int i = 0; i < numOutputChannels; ++i) - { - auto dest = outputChannelData[i]; - auto src = owner.fifoReadPointers[outputIndex + i]; + if (owner.callback == this) + owner.callback = nullptr; + } - if (size1 > 0) FloatVectorOperations::copy (dest, src + start1, size1); - if (size2 > 0) FloatVectorOperations::copy (dest + size1, src + start2, size2); - } + // We only want to be notified about error conditions when the owner's callback is nullptr. + // This class shouldn't be relied on for forwarding this call. + void audioDeviceAboutToStart (AudioIODevice*) override {} - auto totalSize = size1 + size2; - outputFifo.finishedRead (totalSize); + void audioDeviceStopped() override + { + if (target != nullptr) + target->audioDeviceStopped(); - if (numSamples > totalSize) - { - auto samplesRemaining = numSamples - totalSize; + error = true; + } - for (int i = 0; i < numOutputChannels; ++i) - FloatVectorOperations::clear (outputChannelData[i] + totalSize, samplesRemaining); + void audioDeviceError (const String& errorMessage) override + { + owner.lastError = errorMessage; - owner.underrun(); - } - } + if (target != nullptr) + target->audioDeviceError (errorMessage); - owner.notify(); + error = true; } - double getCurrentSampleRate() { return device->getCurrentSampleRate(); } - bool setCurrentSampleRate (double newSampleRate) { return device->setCurrentSampleRate (newSampleRate); } - int getCurrentBufferSizeSamples() { return device->getCurrentBufferSizeSamples(); } - - void audioDeviceAboutToStart (AudioIODevice* d) override { owner.handleAudioDeviceAboutToStart (d); } - void audioDeviceStopped() override { owner.handleAudioDeviceStopped(); } - void audioDeviceError (const String& errorMessage) override { owner.handleAudioDeviceError (errorMessage); } + bool encounteredError() const { return error; } + private: AudioIODeviceCombiner& owner; - std::unique_ptr device; - int inputIndex = 0, numInputChans = 0, outputIndex = 0, numOutputChans = 0; - bool useInputs = false, useOutputs = false; - std::atomic isWaitingForInput { false }; - AbstractFifo inputFifo { 32 }, outputFifo { 32 }; - bool done = false; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DeviceWrapper) + AudioIODeviceCallback* target; + bool error = false; }; - OwnedArray devices; + DeviceWrapper inputWrapper, outputWrapper; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioIODeviceCombiner) }; @@ -2073,45 +2122,30 @@ public: inputIds.clear(); outputIds.clear(); - UInt32 size; - - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioHardwarePropertyDevices; - pa.mScope = kAudioObjectPropertyScopeWildcard; - pa.mElement = juceAudioObjectPropertyElementMain; + auto audioDevices = audioObjectGetProperties (kAudioObjectSystemObject, { kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain }); - if (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, nullptr, &size) == noErr) + for (const auto audioDevice : audioDevices) { - HeapBlock devs; - devs.calloc (size, 1); - - if (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, nullptr, &size, devs) == noErr) + if (const auto optionalName = audioObjectGetProperty (audioDevice, { kAudioDevicePropertyDeviceNameCFString, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain })) { - auto num = (int) size / (int) sizeof (AudioDeviceID); - - for (int i = 0; i < num; ++i) + if (const CFUniquePtr name { *optionalName }) { - char name[1024]; - size = sizeof (name); - pa.mSelector = kAudioDevicePropertyDeviceName; + const auto nameString = String::fromCFString (name.get()); + + if (const auto numIns = getNumChannels (audioDevice, true); numIns > 0) + { + inputDeviceNames.add (nameString); + inputIds.add (audioDevice); + } - if (AudioObjectGetPropertyData (devs[i], &pa, 0, nullptr, &size, name) == noErr) + if (const auto numOuts = getNumChannels (audioDevice, false); numOuts > 0) { - auto nameString = String::fromUTF8 (name, (int) strlen (name)); - auto numIns = getNumChannels (devs[i], true); - auto numOuts = getNumChannels (devs[i], false); - - if (numIns > 0) - { - inputDeviceNames.add (nameString); - inputIds.add (devs[i]); - } - - if (numOuts > 0) - { - outputDeviceNames.add (nameString); - outputIds.add (devs[i]); - } + outputDeviceNames.add (nameString); + outputIds.add (audioDevice); } } } @@ -2133,32 +2167,23 @@ public: { jassert (hasScanned); // need to call scanForDevices() before doing this - AudioDeviceID deviceID; - UInt32 size = sizeof (deviceID); - // if they're asking for any input channels at all, use the default input, so we // get the built-in mic rather than the built-in output with no inputs.. AudioObjectPropertyAddress pa; - pa.mSelector = forInput ? kAudioHardwarePropertyDefaultInputDevice - : kAudioHardwarePropertyDefaultOutputDevice; + auto selector = forInput ? kAudioHardwarePropertyDefaultInputDevice + : kAudioHardwarePropertyDefaultOutputDevice; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = juceAudioObjectPropertyElementMain; - if (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, nullptr, &size, &deviceID) == noErr) + if (auto deviceID = audioObjectGetProperty (kAudioObjectSystemObject, { selector, + kAudioObjectPropertyScopeWildcard, + juceAudioObjectPropertyElementMain })) { - if (forInput) - { - for (int i = inputIds.size(); --i >= 0;) - if (inputIds[i] == deviceID) - return i; - } - else - { - for (int i = outputIds.size(); --i >= 0;) - if (outputIds[i] == deviceID) - return i; - } + auto& ids = forInput ? inputIds : outputIds; + + if (auto it = std::find (ids.begin(), ids.end(), deviceID); it != ids.end()) + return static_cast (std::distance (ids.begin(), it)); } return 0; @@ -2169,19 +2194,12 @@ public: jassert (hasScanned); // need to call scanForDevices() before doing this if (auto* d = dynamic_cast (device)) - return asInput ? d->inputIndex - : d->outputIndex; + return d->getIndexOfDevice (asInput); if (auto* d = dynamic_cast (device)) - { - for (auto* dev : d->getDevices()) - { - auto index = getIndexOfDevice (dev, asInput); - - if (index >= 0) + for (auto* dev : d->getDeviceWrappers()) + if (const auto index = dev->getIndexOfDevice (asInput); index >= 0) return index; - } - } return -1; } @@ -2217,9 +2235,7 @@ public: if (in == nullptr) return out.release(); if (out == nullptr) return in.release(); - auto combo = std::make_unique (combinedName, this); - combo->addDevice (std::move (in), true, false); - combo->addDevice (std::move (out), false, true); + auto combo = std::make_unique (combinedName, this, std::move (in), std::move (out)); return combo.release(); } @@ -2244,25 +2260,15 @@ private: static int getNumChannels (AudioDeviceID deviceID, bool input) { int total = 0; - UInt32 size; - - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioDevicePropertyStreamConfiguration; - pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; - pa.mElement = juceAudioObjectPropertyElementMain; - if (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, nullptr, &size) == noErr) + if (auto bufList = audioObjectGetProperty (deviceID, { kAudioDevicePropertyStreamConfiguration, + CoreAudioInternal::getScope (input), + juceAudioObjectPropertyElementMain })) { - HeapBlock bufList; - bufList.calloc (size, 1); + auto numStreams = (int) bufList->mNumberBuffers; - if (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, bufList) == noErr) - { - auto numStreams = (int) bufList->mNumberBuffers; - - for (int i = 0; i < numStreams; ++i) - total += bufList->mBuffers[i].mNumberChannels; - } + for (int i = 0; i < numStreams; ++i) + total += bufList->mBuffers[i].mNumberChannels; } return total; diff --git a/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm b/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm index 4f6d8b81..fd61986e 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm +++ b/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm @@ -29,7 +29,7 @@ namespace juce namespace CoreMidiHelpers { - static bool checkError (OSStatus err, int lineNum) + static bool checkError (OSStatus err, [[maybe_unused]] int lineNum) { if (err == noErr) return true; @@ -38,7 +38,6 @@ namespace CoreMidiHelpers Logger::writeToLog ("CoreMIDI error: " + String (lineNum) + " - " + String::toHexString ((int) err)); #endif - ignoreUnused (lineNum); return false; } @@ -661,11 +660,11 @@ namespace CoreMidiHelpers : u32InputHandler (std::make_unique (input, callback)) {} - void dispatch (const MIDIEventList& list, double time) const + void dispatch (const MIDIEventList* list, double time) const { - auto* packet = &list.packet[0]; + auto* packet = list->packet; - for (uint32_t i = 0; i < list.numPackets; ++i) + for (uint32_t i = 0; i < list->numPackets; ++i) { static_assert (sizeof (uint32_t) == sizeof (UInt32) && alignof (uint32_t) == alignof (UInt32), @@ -695,11 +694,11 @@ namespace CoreMidiHelpers : bytestreamInputHandler (std::make_unique (input, callback)) {} - void dispatch (const MIDIPacketList& list, double time) const + void dispatch (const MIDIPacketList* list, double time) const { - auto* packet = &list.packet[0]; + auto* packet = list->packet; - for (unsigned int i = 0; i < list.numPackets; ++i) + for (unsigned int i = 0; i < list->numPackets; ++i) { auto len = readUnalignedlength)> (&(packet->length)); bytestreamInputHandler->pushMidiData (packet->data, len, time); @@ -725,12 +724,12 @@ namespace CoreMidiHelpers : newReceiver (input, callback), oldReceiver (input, callback) {} - void dispatch (const MIDIEventList& list, double time) const + void dispatch (const MIDIEventList* list, double time) const { newReceiver.dispatch (list, time); } - void dispatch (const MIDIPacketList& list, double time) const + void dispatch (const MIDIPacketList* list, double time) const { oldReceiver.dispatch (list, time); } @@ -768,7 +767,7 @@ namespace CoreMidiHelpers } template - void handlePackets (const EventList& list) + void handlePackets (const EventList* list) { const auto time = Time::getMillisecondCounterHiRes() * 0.001; @@ -885,7 +884,7 @@ namespace CoreMidiHelpers static void newMidiInputProc (const MIDIEventList* list, void* readProcRefCon, void*) { - static_cast (readProcRefCon)->handlePackets (*list); + static_cast (readProcRefCon)->handlePackets (list); } }; #endif @@ -928,7 +927,7 @@ namespace CoreMidiHelpers private: static void oldMidiInputProc (const MIDIPacketList* list, void* readProcRefCon, void*) { - static_cast (readProcRefCon)->handlePackets (*list); + static_cast (readProcRefCon)->handlePackets (list); } }; #endif diff --git a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp index 529c8b6f..eb46baf7 100644 --- a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp +++ b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp @@ -330,7 +330,7 @@ public: openDevice(); } - ~ASIOAudioIODevice() + ~ASIOAudioIODevice() override { for (int i = 0; i < maxNumASIODevices; ++i) if (currentASIODev[i] == this) @@ -1157,7 +1157,7 @@ private: // Get error message if init() failed, or if it's a buggy Denon driver, // which returns true from init() even when it fails. - if ((! initOk) || getName().containsIgnoreCase ("denon dj")) + if ((! initOk) || getName().containsIgnoreCase ("denon dj asio")) driverError = getLastDriverError(); if ((! initOk) && driverError.isEmpty()) @@ -1326,7 +1326,7 @@ private: inputFormat[i].convertToFloat (infos[i].buffers[bufferIndex], inBuffers[i], samps); } - currentCallback->audioDeviceIOCallbackWithContext (const_cast (inBuffers.getData()), + currentCallback->audioDeviceIOCallbackWithContext (inBuffers.getData(), numActiveInputChans, outBuffers, numActiveOutputChans, diff --git a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp index b0e5dcd1..017bee61 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -251,8 +251,8 @@ public: if (pOutputBuffer != nullptr) { JUCE_DS_LOG ("closing output: " + name); - HRESULT hr = pOutputBuffer->Stop(); - JUCE_DS_LOG_ERROR (hr); ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = pOutputBuffer->Stop(); + JUCE_DS_LOG_ERROR (hr); pOutputBuffer->Release(); pOutputBuffer = nullptr; @@ -555,8 +555,8 @@ public: if (pInputBuffer != nullptr) { JUCE_DS_LOG ("closing input: " + name); - HRESULT hr = pInputBuffer->Stop(); - JUCE_DS_LOG_ERROR (hr); ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = pInputBuffer->Stop(); + JUCE_DS_LOG_ERROR (hr); pInputBuffer->Release(); pInputBuffer = nullptr; @@ -1196,7 +1196,7 @@ String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels, for (int i = 0; i < inChans.size(); ++i) inChans.getUnchecked(i)->synchronisePosition(); - startThread (9); + startThread (Priority::highest); sleep (10); notify(); diff --git a/modules/juce_audio_devices/native/juce_win32_Midi.cpp b/modules/juce_audio_devices/native/juce_win32_Midi.cpp index 803f5b34..c2b13f70 100644 --- a/modules/juce_audio_devices/native/juce_win32_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_win32_Midi.cpp @@ -29,6 +29,39 @@ namespace juce { +template +class CheckedReference +{ +public: + template + friend auto createCheckedReference (Ptr*); + + void clear() + { + std::lock_guard lock { mutex }; + ptr = nullptr; + } + + template + void access (Callback&& callback) + { + std::lock_guard lock { mutex }; + callback (ptr); + } + +private: + explicit CheckedReference (T* ptrIn) : ptr (ptrIn) {} + + T* ptr; + std::mutex mutex; +}; + +template +auto createCheckedReference (Ptr* ptrIn) +{ + return std::shared_ptr> { new CheckedReference (ptrIn) }; +} + class MidiInput::Pimpl { public: @@ -1417,59 +1450,56 @@ private: }; //============================================================================== - template - struct OpenMidiPortThread : public Thread + template + static void openMidiPortThread (String threadName, + String midiDeviceID, + ComSmartPtr& comFactory, + ComSmartPtr& comPort) { - OpenMidiPortThread (String threadName, String midiDeviceID, - ComSmartPtr& comFactory, - ComSmartPtr& comPort) - : Thread (threadName), - deviceID (midiDeviceID), - factory (comFactory), - port (comPort) - { - } - - ~OpenMidiPortThread() + std::thread { [&] { - stopThread (2000); - } + Thread::setCurrentThreadName (threadName); - void run() override - { - WinRTWrapper::ScopedHString hDeviceId (deviceID); + const WinRTWrapper::ScopedHString hDeviceId { midiDeviceID }; ComSmartPtr> asyncOp; - auto hr = factory->FromIdAsync (hDeviceId.get(), asyncOp.resetAndGetPointerAddress()); + const auto hr = comFactory->FromIdAsync (hDeviceId.get(), asyncOp.resetAndGetPointerAddress()); if (FAILED (hr)) return; - hr = asyncOp->put_Completed (Callback> ( - [this] (IAsyncOperation* asyncOpPtr, AsyncStatus) - { - if (asyncOpPtr == nullptr) - return E_ABORT; + std::promise> promise; + auto future = promise.get_future(); - auto hr = asyncOpPtr->GetResults (port.resetAndGetPointerAddress()); + auto callback = [p = std::move (promise)] (IAsyncOperation* asyncOpPtr, AsyncStatus) mutable + { + if (asyncOpPtr == nullptr) + { + p.set_value (nullptr); + return E_ABORT; + } - if (FAILED (hr)) - return hr; + ComSmartPtr result; + const auto hr = asyncOpPtr->GetResults (result.resetAndGetPointerAddress()); - portOpened.signal(); - return S_OK; - } - ).Get()); + if (FAILED (hr)) + { + p.set_value (nullptr); + return hr; + } - // We need to use a timeout here, rather than waiting indefinitely, as the - // WinRT API can occasionally hang! - portOpened.wait (2000); - } + p.set_value (std::move (result)); + return S_OK; + }; - const String deviceID; - ComSmartPtr& factory; - ComSmartPtr& port; - WaitableEvent portOpened { true }; - }; + const auto ir = asyncOp->put_Completed (Callback> (std::move (callback)).Get()); + + if (FAILED (ir)) + return; + + if (future.wait_for (std::chrono::milliseconds (2000)) == std::future_status::ready) + comPort = future.get(); + } }.join(); + } //============================================================================== template @@ -1565,12 +1595,7 @@ private: inputDevice (input), callback (cb) { - OpenMidiPortThread portThread ("Open WinRT MIDI input port", - deviceInfo.deviceID, - service.midiInFactory, - midiPort); - portThread.startThread(); - portThread.waitForThreadToExit (-1); + openMidiPortThread ("Open WinRT MIDI input port", deviceInfo.deviceID, service.midiInFactory, midiPort); if (midiPort == nullptr) { @@ -1582,7 +1607,18 @@ private: auto hr = midiPort->add_MessageReceived ( Callback> ( - [this] (IMidiInPort*, IMidiMessageReceivedEventArgs* args) { return midiInMessageReceived (args); } + [self = checkedReference] (IMidiInPort*, IMidiMessageReceivedEventArgs* args) + { + HRESULT hr = S_OK; + + self->access ([&hr, args] (auto* ptr) + { + if (ptr != nullptr) + hr = ptr->midiInMessageReceived (args); + }); + + return hr; + } ).Get(), &midiInMessageToken); @@ -1595,6 +1631,7 @@ private: ~WinRTInputWrapper() { + checkedReference->clear(); disconnect(); } @@ -1706,6 +1743,8 @@ private: double startTime = 0; bool isStarted = false; + std::shared_ptr> checkedReference = createCheckedReference (this); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WinRTInputWrapper); }; @@ -1716,12 +1755,7 @@ private: WinRTOutputWrapper (WinRTMidiService& service, const String& deviceIdentifier) : WinRTIOWrapper (*service.bleDeviceWatcher, *service.outputDeviceWatcher, deviceIdentifier) { - OpenMidiPortThread portThread ("Open WinRT MIDI output port", - deviceInfo.deviceID, - service.midiOutFactory, - midiPort); - portThread.startThread(); - portThread.waitForThreadToExit (-1); + openMidiPortThread ("Open WinRT MIDI output port", deviceInfo.deviceID, service.midiOutFactory, midiPort); if (midiPort == nullptr) throw std::runtime_error ("Timed out waiting for midi output port creation"); diff --git a/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp b/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp index b1a0aae1..b516cdbb 100644 --- a/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp +++ b/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp @@ -33,9 +33,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token") namespace WasapiClasses { -static void logFailure (HRESULT hr) +static void logFailure ([[maybe_unused]] HRESULT hr) { - ignoreUnused (hr); jassert (hr != (HRESULT) 0x800401f0); // If you hit this, it means you're trying to call from // a thread which hasn't been initialised with CoInitialize(). @@ -430,21 +429,23 @@ public: if (tempClient == nullptr) return; - WAVEFORMATEXTENSIBLE format; + auto format = getClientMixFormat (tempClient); - if (! getClientMixFormat (tempClient, format)) + if (! format) return; - actualNumChannels = numChannels = format.Format.nChannels; - defaultSampleRate = format.Format.nSamplesPerSec; + defaultNumChannels = maxNumChannels = format->Format.nChannels; + defaultSampleRate = format->Format.nSamplesPerSec; rates.addUsingDefaultSort (defaultSampleRate); - mixFormatChannelMask = format.dwChannelMask; + defaultFormatChannelMask = format->dwChannelMask; if (isExclusiveMode (deviceMode)) - findSupportedFormat (tempClient, defaultSampleRate, mixFormatChannelMask, format); + if (auto optFormat = findSupportedFormat (tempClient, defaultNumChannels, defaultSampleRate)) + format = optFormat; - querySupportedBufferSizes (format, tempClient); - querySupportedSampleRates (format, tempClient); + querySupportedBufferSizes (*format, tempClient); + querySupportedSampleRates (*format, tempClient); + maxNumChannels = queryMaxNumChannels (tempClient); } virtual ~WASAPIDeviceBase() @@ -459,7 +460,7 @@ public: { sampleRate = newSampleRate; channels = newChannels; - channels.setRange (actualNumChannels, channels.getHighestBit() + 1 - actualNumChannels, false); + channels.setRange (maxNumChannels, channels.getHighestBit() + 1 - maxNumChannels, false); numChannels = channels.getHighestBit() + 1; if (numChannels == 0) @@ -533,10 +534,10 @@ public: WASAPIDeviceMode deviceMode; double sampleRate = 0, defaultSampleRate = 0; - int numChannels = 0, actualNumChannels = 0; + int numChannels = 0, actualNumChannels = 0, maxNumChannels = 0, defaultNumChannels = 0; int minBufferSize = 0, defaultBufferSize = 0, latencySamples = 0; int lowLatencyBufferSizeMultiple = 0, lowLatencyMaxBufferSize = 0; - DWORD mixFormatChannelMask = 0; + DWORD defaultFormatChannelMask = 0; Array rates; HANDLE clientEvent = {}; BigInteger channels; @@ -627,17 +628,19 @@ private: return newClient; } - static bool getClientMixFormat (ComSmartPtr& client, WAVEFORMATEXTENSIBLE& format) + static std::optional getClientMixFormat (ComSmartPtr& client) { WAVEFORMATEX* mixFormat = nullptr; if (! check (client->GetMixFormat (&mixFormat))) - return false; + return {}; + + WAVEFORMATEXTENSIBLE format; copyWavFormat (format, mixFormat); CoTaskMemFree (mixFormat); - return true; + return format; } //============================================================================== @@ -710,12 +713,25 @@ private: int bytesPerSampleContainer; }; - bool tryFormat (const AudioSampleFormat sampleFormat, IAudioClient* clientToUse, double newSampleRate, - DWORD newMixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const + static constexpr AudioSampleFormat formatsToTry[] = + { + { true, 32, 4 }, + { false, 32, 4 }, + { false, 24, 4 }, + { false, 24, 3 }, + { false, 20, 4 }, + { false, 20, 3 }, + { false, 16, 2 } + }; + + static std::optional tryFormat (const AudioSampleFormat sampleFormat, IAudioClient* clientToUse, + WASAPIDeviceMode mode, int newNumChannels, double newSampleRate, + DWORD newMixFormatChannelMask) { + WAVEFORMATEXTENSIBLE format; zerostruct (format); - if (numChannels <= 2 && sampleFormat.bitsPerSampleToTry <= 16) + if (newNumChannels <= 2 && sampleFormat.bitsPerSampleToTry <= 16) { format.Format.wFormatTag = WAVE_FORMAT_PCM; } @@ -726,7 +742,7 @@ private: } format.Format.nSamplesPerSec = (DWORD) newSampleRate; - format.Format.nChannels = (WORD) numChannels; + format.Format.nChannels = (WORD) newNumChannels; format.Format.wBitsPerSample = (WORD) (8 * sampleFormat.bytesPerSampleContainer); format.Samples.wValidBitsPerSample = (WORD) (sampleFormat.bitsPerSampleToTry); format.Format.nBlockAlign = (WORD) (format.Format.nChannels * format.Format.wBitsPerSample / 8); @@ -736,14 +752,14 @@ private: WAVEFORMATEX* nearestFormat = nullptr; - HRESULT hr = clientToUse->IsFormatSupported (isExclusiveMode (deviceMode) ? AUDCLNT_SHAREMODE_EXCLUSIVE - : AUDCLNT_SHAREMODE_SHARED, + HRESULT hr = clientToUse->IsFormatSupported (isExclusiveMode (mode) ? AUDCLNT_SHAREMODE_EXCLUSIVE + : AUDCLNT_SHAREMODE_SHARED, (WAVEFORMATEX*) &format, - isExclusiveMode (deviceMode) ? nullptr + isExclusiveMode (mode) ? nullptr : &nearestFormat); logFailure (hr); - auto supportsSRC = supportsSampleRateConversion (deviceMode); + auto supportsSRC = supportsSampleRateConversion (mode); if (hr == S_FALSE && nearestFormat != nullptr @@ -762,28 +778,49 @@ private: } CoTaskMemFree (nearestFormat); - return hr == S_OK; + + if (hr != S_OK) + return {}; + + return format; } - bool findSupportedFormat (IAudioClient* clientToUse, double newSampleRate, - DWORD newMixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const + std::optional findSupportedFormat (IAudioClient* clientToUse, int newNumChannels, double newSampleRate) const { - static const AudioSampleFormat formats[] = + for (auto ch = newNumChannels; ch <= maxNumChannels; ++ch) { - { true, 32, 4 }, - { false, 32, 4 }, - { false, 24, 4 }, - { false, 24, 3 }, - { false, 20, 4 }, - { false, 20, 3 }, - { false, 16, 2 } - }; + auto maskWithLowestNBitsSet = static_cast ((1 << ch) - 1); + auto mixFormatChannelMask = (ch == defaultNumChannels ? defaultFormatChannelMask : maskWithLowestNBitsSet); - for (int i = 0; i < numElementsInArray (formats); ++i) - if (tryFormat (formats[i], clientToUse, newSampleRate, newMixFormatChannelMask, format)) - return true; + for (auto const& sampleFormat: formatsToTry) + if (auto format = tryFormat (sampleFormat, clientToUse, deviceMode, ch, newSampleRate, mixFormatChannelMask)) + return format; + } - return false; + return {}; + } + + int queryMaxNumChannels (IAudioClient* clientToUse) const + { + static constexpr auto maxNumChannelsToQuery = static_cast (AudioChannelSet::maxChannelsOfNamedLayout); + const auto fallbackNumChannels = defaultNumChannels; + + if (fallbackNumChannels >= maxNumChannelsToQuery) + return fallbackNumChannels; + + auto result = fallbackNumChannels; + + for (auto ch = maxNumChannelsToQuery; ch > result; --ch) + { + auto channelMask = static_cast ((1 << ch) - 1); + + for (auto rate : rates) + for (auto const& sampleFormat: formatsToTry) + if (auto format = tryFormat (sampleFormat, clientToUse, deviceMode, ch, rate, channelMask)) + result = jmax (static_cast (format->Format.nChannels), result); + } + + return result; } DWORD getStreamFlags() @@ -851,19 +888,18 @@ private: bool tryInitialisingWithBufferSize (int bufferSizeSamples) { - WAVEFORMATEXTENSIBLE format; - if (findSupportedFormat (client, sampleRate, mixFormatChannelMask, format)) + if (auto format = findSupportedFormat (client, numChannels, sampleRate)) { - auto isInitialised = isLowLatencyMode (deviceMode) ? initialiseLowLatencyClient (bufferSizeSamples, format) - : initialiseStandardClient (bufferSizeSamples, format); + auto isInitialised = isLowLatencyMode (deviceMode) ? initialiseLowLatencyClient (bufferSizeSamples, *format) + : initialiseStandardClient (bufferSizeSamples, *format); if (isInitialised) { - actualNumChannels = format.Format.nChannels; - const bool isFloat = format.Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && format.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; - bytesPerSample = format.Format.wBitsPerSample / 8; - bytesPerFrame = format.Format.nBlockAlign; + actualNumChannels = format->Format.nChannels; + const bool isFloat = format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && format->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + bytesPerSample = format->Format.wBitsPerSample / 8; + bytesPerFrame = format->Format.nBlockAlign; updateFormat (isFloat); @@ -1269,7 +1305,7 @@ public: StringArray outChannels; if (outputDevice != nullptr) - for (int i = 1; i <= outputDevice->actualNumChannels; ++i) + for (int i = 1; i <= outputDevice->maxNumChannels; ++i) outChannels.add ("Output channel " + String (i)); return outChannels; @@ -1280,7 +1316,7 @@ public: StringArray inChannels; if (inputDevice != nullptr) - for (int i = 1; i <= inputDevice->actualNumChannels; ++i) + for (int i = 1; i <= inputDevice->maxNumChannels; ++i) inChannels.add ("Input channel " + String (i)); return inChannels; @@ -1350,7 +1386,7 @@ public: shouldShutdown = false; deviceSampleRateChanged = false; - startThread (8); + startThread (Priority::high); Thread::sleep (5); if (inputDevice != nullptr && inputDevice->client != nullptr) @@ -1515,7 +1551,7 @@ public: const ScopedTryLock sl (startStopLock); if (sl.isLocked() && isStarted) - callback->audioDeviceIOCallbackWithContext (const_cast (inputBuffers), + callback->audioDeviceIOCallbackWithContext (inputBuffers, numInputBuffers, outputBuffers, numOutputBuffers, @@ -1529,7 +1565,7 @@ public: { // Note that this function is handed the input device so it can check for the event and make sure // the input reservoir is filled up correctly even when bufferSize > device actualBufferSize - outputDevice->copyBuffers (const_cast (outputBuffers), numOutputBuffers, bufferSize, inputDevice.get(), *this); + outputDevice->copyBuffers (outputBuffers, numOutputBuffers, bufferSize, inputDevice.get(), *this); if (outputDevice->sampleRateHasChanged) { diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp index 8270d20a..99eb16c1 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -56,11 +56,12 @@ void AudioSourcePlayer::setGain (const float newGain) noexcept gain = newGain; } -void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, - int totalNumInputChannels, - float** outputChannelData, - int totalNumOutputChannels, - int numSamples) +void AudioSourcePlayer::audioDeviceIOCallbackWithContext (const float* const* inputChannelData, + int totalNumInputChannels, + float* const* outputChannelData, + int totalNumOutputChannels, + int numSamples, + [[maybe_unused]] const AudioIODeviceCallbackContext& context) { // these should have been prepared by audioDeviceAboutToStart()... jassert (sampleRate > 0 && bufferSize > 0); diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.h b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.h index 65c19aac..8a975ee1 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.h +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.h @@ -79,12 +79,13 @@ public: float getGain() const noexcept { return gain; } //============================================================================== - /** Implementation of the AudioIODeviceCallback method. */ - void audioDeviceIOCallback (const float** inputChannelData, - int totalNumInputChannels, - float** outputChannelData, - int totalNumOutputChannels, - int numSamples) override; + /** Implementation of the AudioIODeviceCallbackWithContext method. */ + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, + int totalNumInputChannels, + float* const* outputChannelData, + int totalNumOutputChannels, + int numSamples, + const AudioIODeviceCallbackContext& context) override; /** Implementation of the AudioIODeviceCallback method. */ void audioDeviceAboutToStart (AudioIODevice* device) override; diff --git a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp index a5b63297..6974d048 100644 --- a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp @@ -573,7 +573,7 @@ public: } //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, @@ -721,8 +721,7 @@ private: { using namespace AiffFileHelpers; - const bool couldSeekOk = output->setPosition (headerPosition); - ignoreUnused (couldSeekOk); + [[maybe_unused]] const bool couldSeekOk = output->setPosition (headerPosition); // if this fails, you've given it an output stream that can't seek! It needs // to be able to seek back to write the header @@ -829,7 +828,7 @@ public: { } - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, diff --git a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp index e7ef336d..079df3f3 100644 --- a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp @@ -502,7 +502,7 @@ public: } //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, diff --git a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp index 8e389f52..e743ae66 100644 --- a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp @@ -92,8 +92,8 @@ namespace FlacNamespace { #if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE) - #undef VERSION - #define VERSION "1.3.1" + #undef PACKAGE_VERSION + #define PACKAGE_VERSION "1.3.4" #define FLAC__NO_DLL 1 @@ -131,11 +131,17 @@ namespace FlacNamespace #define FLAC__HAS_X86INTRIN 1 #endif - #undef __STDC_LIMIT_MACROS - #define __STDC_LIMIT_MACROS 1 #define flac_max jmax #define flac_min jmin - #undef DEBUG // (some flac code dumps debug trace if the app defines this macro) + + #pragma push_macro ("DEBUG") + #pragma push_macro ("NDEBUG") + #undef DEBUG // (some flac code dumps debug trace if the app defines this macro) + + #ifndef NDEBUG + #define NDEBUG // (some flac code prints cpu info if this isn't defined) + #endif + #include "flac/all.h" #include "flac/libFLAC/bitmath.c" #include "flac/libFLAC/bitreader.c" @@ -152,7 +158,11 @@ namespace FlacNamespace #include "flac/libFLAC/stream_encoder.c" #include "flac/libFLAC/stream_encoder_framing.c" #include "flac/libFLAC/window_flac.c" - #undef VERSION + + #pragma pop_macro ("DEBUG") + #pragma pop_macro ("NDEBUG") + + #undef PACKAGE_VERSION JUCE_END_IGNORE_WARNINGS_GCC_LIKE JUCE_END_IGNORE_WARNINGS_MSVC @@ -220,7 +230,7 @@ public: reservoir.setSize ((int) numChannels, 2 * (int) info.max_blocksize, false, false, true); } - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { if (! ok) @@ -486,8 +496,7 @@ public: packUint32 ((FLAC__uint32) info.total_samples, buffer + 14, 4); memcpy (buffer + 18, info.md5sum, 16); - const bool seekOk = output->setPosition (streamStartPos + 4); - ignoreUnused (seekOk); + [[maybe_unused]] const bool seekOk = output->setPosition (streamStartPos + 4); // if this fails, you've given it an output stream that can't seek! It needs // to be able to seek back to write the header diff --git a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp index 1120b0ff..00f31082 100644 --- a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp @@ -112,8 +112,8 @@ private: if (cp.start (processArgs)) { - auto childOutput = cp.readAllProcessOutput(); - DBG (childOutput); ignoreUnused (childOutput); + [[maybe_unused]] auto childOutput = cp.readAllProcessOutput(); + DBG (childOutput); cp.waitForProcessToFinish (10000); return tempMP3.getFile().getSize() > 0; diff --git a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp index 7a287f9c..d24df3df 100644 --- a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp @@ -2975,7 +2975,7 @@ public: } } - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { if (destSamples == nullptr) @@ -3033,7 +3033,7 @@ public: } const int numToCopy = jmin (decodedEnd - decodedStart, numSamples); - float* const* const dst = reinterpret_cast (destSamples); + float* const* const dst = reinterpret_cast (destSamples); memcpy (dst[0] + startOffsetInDestBuffer, decoded0 + decodedStart, (size_t) numToCopy * sizeof (float)); if (numDestChannels > 1 && dst[1] != nullptr) diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp index b47c4a4d..cf105e9b 100644 --- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp @@ -158,7 +158,7 @@ public: } //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { const auto getBufferedRange = [this] { return bufferedRange; }; diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index 20f0f492..c562882c 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -1476,7 +1476,7 @@ public: } //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, @@ -1852,7 +1852,7 @@ public: { } - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, diff --git a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp index 9764a696..cb7af04c 100644 --- a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp @@ -163,7 +163,7 @@ public: wmSyncReader->Close(); } - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { if (sampleRate <= 0) @@ -262,7 +262,7 @@ private: void checkCoInitialiseCalled() { - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); } void scanFileForDetails() diff --git a/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp b/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp index e02ab8f7..a8c974d2 100644 --- a/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp +++ b/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp @@ -115,17 +115,17 @@ void ARAAudioSourceReader::willDestroyAudioSource (ARAAudioSource* audioSource) invalidate(); } -bool ARAAudioSourceReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool ARAAudioSourceReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { const auto destSize = (bitsPerSample / 8) * (size_t) numSamples; const auto bufferOffset = (int) (bitsPerSample / 8) * startOffsetInDestBuffer; - if (isValid() && hostReader != nullptr) + if (isValid()) { const ScopedTryReadLock readLock (lock); - if (readLock.isLocked()) + if (readLock.isLocked() && hostReader != nullptr) { for (size_t i = 0; i < tmpPtrs.size(); ++i) { @@ -237,7 +237,7 @@ void ARAPlaybackRegionReader::invalidate() playbackRenderer.reset(); } -bool ARAPlaybackRegionReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool ARAPlaybackRegionReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { bool success = false; diff --git a/modules/juce_audio_formats/format/juce_ARAAudioReaders.h b/modules/juce_audio_formats/format/juce_ARAAudioReaders.h index c55a0636..6f231969 100644 --- a/modules/juce_audio_formats/format/juce_ARAAudioReaders.h +++ b/modules/juce_audio_formats/format/juce_ARAAudioReaders.h @@ -83,7 +83,7 @@ public: ~ARAAudioSourceReader() override; - bool readSamples (int** destSamples, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, @@ -166,7 +166,7 @@ public: */ void invalidate(); - bool readSamples (int** destSamples, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp index 21e6e82b..92998539 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp @@ -86,7 +86,7 @@ bool AudioFormatReader::read (int* const* destChannels, if (numSamplesToRead <= 0) return true; - if (! readSamples (const_cast (destChannels), + if (! readSamples (destChannels, jmin ((int) numChannels, numDestChannels), startOffsetInDestBuffer, startSampleInSource, numSamplesToRead)) return false; diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.h b/modules/juce_audio_formats/format/juce_AudioFormatReader.h index eff78691..25af44c2 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.h +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.h @@ -267,7 +267,7 @@ public: to begin reading. This value is guaranteed to be >= 0. @param numSamples the number of samples to read */ - virtual bool readSamples (int** destChannels, + virtual bool readSamples (int* const* destChannels, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, @@ -306,7 +306,7 @@ protected: /** Used by AudioFormatReader subclasses to clear any parts of the data blocks that lie beyond the end of their available length. */ - static void clearSamplesBeyondAvailableLength (int** destChannels, int numDestChannels, + static void clearSamplesBeyondAvailableLength (int* const* destChannels, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int& numSamples, int64 fileLengthInSamples) { diff --git a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp index 8c16177e..530c4bbc 100644 --- a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.cpp @@ -50,7 +50,7 @@ AudioSubsectionReader::~AudioSubsectionReader() } //============================================================================== -bool AudioSubsectionReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool AudioSubsectionReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, diff --git a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.h b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.h index 52d4ba6e..5b9cdddb 100644 --- a/modules/juce_audio_formats/format/juce_AudioSubsectionReader.h +++ b/modules/juce_audio_formats/format/juce_AudioSubsectionReader.h @@ -66,7 +66,7 @@ public: //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override; void readMaxLevels (int64 startSample, int64 numSamples, diff --git a/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.cpp b/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.cpp index d59b279a..95da52c9 100644 --- a/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.cpp +++ b/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.cpp @@ -53,7 +53,7 @@ void BufferingAudioReader::setReadTimeout (int timeoutMilliseconds) noexcept timeoutMs = timeoutMilliseconds; } -bool BufferingAudioReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool BufferingAudioReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { auto startTime = Time::getMillisecondCounter(); @@ -218,7 +218,7 @@ struct TestAudioFormatReader : public AudioFormatReader numChannels = (unsigned int) buffer.getNumChannels(); } - bool readSamples (int** destChannels, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destChannels, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override { clearSamplesBeyondAvailableLength (destChannels, numDestChannels, startOffsetInDestBuffer, @@ -254,7 +254,7 @@ public: void runTest() override { TimeSliceThread timeSlice ("TestBackgroundThread"); - timeSlice.startThread (5); + timeSlice.startThread (Thread::Priority::normal); beginTest ("Timeout"); { @@ -270,7 +270,7 @@ public: numChannels = 2; } - bool readSamples (int**, int, int, int64, int) override + bool readSamples (int* const*, int, int, int64, int) override { Thread::sleep (100); return true; diff --git a/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.h b/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.h index 8414c18a..b16e2bdc 100644 --- a/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.h +++ b/modules/juce_audio_formats/format/juce_BufferingAudioFormatReader.h @@ -63,7 +63,7 @@ public: void setReadTimeout (int timeoutMilliseconds) noexcept; //============================================================================== - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override; private: diff --git a/modules/juce_audio_formats/juce_audio_formats.h b/modules/juce_audio_formats/juce_audio_formats.h index 8eb69c2c..aa26e9fa 100644 --- a/modules/juce_audio_formats/juce_audio_formats.h +++ b/modules/juce_audio_formats/juce_audio_formats.h @@ -35,12 +35,12 @@ ID: juce_audio_formats vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE audio file format codecs description: Classes for reading and writing various audio file formats. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_audio_basics OSXFrameworks: CoreAudio CoreMIDI QuartzCore AudioToolbox diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index 9abcb113..f0c72288 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -43,7 +43,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnon-virtual-dtor", "-Wzero-as-null-pointer-constant", "-Winconsistent-missing-destructor-override", "-Wfour-char-constants", - "-Wtautological-overlap-compare") + "-Wtautological-overlap-compare", + "-Wdeprecated-declarations") #include @@ -70,11 +71,19 @@ static_assert (AAX_SDK_CURRENT_REVISION >= AAX_SDK_2p3p0_REVISION, "JUCE require #include #include -#ifdef AAX_SDK_2p3p1_REVISION - #if AAX_SDK_CURRENT_REVISION >= AAX_SDK_2p3p1_REVISION - #include - #include - #endif +#if defined (AAX_SDK_2p3p1_REVISION) && AAX_SDK_2p3p1_REVISION <= AAX_SDK_CURRENT_REVISION + #include + #include +#endif + +#if defined (AAX_SDK_2p4p0_REVISION) && AAX_SDK_2p4p0_REVISION <= AAX_SDK_CURRENT_REVISION + #define JUCE_AAX_HAS_TRANSPORT_NOTIFICATION 1 +#else + #define JUCE_AAX_HAS_TRANSPORT_NOTIFICATION 0 +#endif + +#if JUCE_AAX_HAS_TRANSPORT_NOTIFICATION + #include #endif JUCE_END_IGNORE_WARNINGS_MSVC @@ -738,8 +747,6 @@ namespace AAXClasses static AAX_CEffectParameters* AAX_CALLBACK Create() { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; - if (PluginHostType::jucePlugInIsRunningInAudioSuiteFn == nullptr) { PluginHostType::jucePlugInIsRunningInAudioSuiteFn = [] (AudioProcessor& processor) @@ -879,7 +886,7 @@ namespace AAXClasses case JUCEAlgorithmIDs::preparedFlag: { - const_cast(this)->preparePlugin(); + const_cast (this)->preparePlugin(); auto numObjects = dataSize / sizeof (uint32_t); auto* objects = static_cast (data); @@ -1048,14 +1055,16 @@ namespace AAXClasses return transport.GetCurrentTempo (&bpm) == AAX_SUCCESS ? makeOptional (bpm) : nullopt; }()); - info.setTimeSignature ([&] + const auto signature = [&] { int32_t num = 4, den = 4; return transport.GetCurrentMeter (&num, &den) == AAX_SUCCESS - ? makeOptional (TimeSignature { (int) num, (int) den }) - : nullopt; - }()); + ? makeOptional (TimeSignature { (int) num, (int) den }) + : nullopt; + }(); + + info.setTimeSignature (signature); info.setIsPlaying ([&] { @@ -1064,27 +1073,31 @@ namespace AAXClasses return transport.IsTransportPlaying (&isPlaying) == AAX_SUCCESS && isPlaying; }()); - info.setTimeInSamples ([&] + info.setIsRecording (recordingState.get().orFallback (false)); + + const auto optionalTimeInSamples = [&info, &transport] { int64_t timeInSamples = 0; - return ((! info.getIsPlaying() && transport.GetTimelineSelectionStartPosition (&timeInSamples) == AAX_SUCCESS) - || transport.GetCurrentNativeSampleLocation (&timeInSamples) == AAX_SUCCESS) - ? makeOptional (timeInSamples) - : nullopt; - }()); + || transport.GetCurrentNativeSampleLocation (&timeInSamples) == AAX_SUCCESS) + ? makeOptional (timeInSamples) + : nullopt; + }(); - info.setTimeInSeconds ((float) info.getTimeInSamples().orFallback (0) / sampleRate); + info.setTimeInSamples (optionalTimeInSamples); + info.setTimeInSeconds ((float) optionalTimeInSamples.orFallback (0) / sampleRate); - info.setPpqPosition ([&] + const auto tickPosition = [&] { int64_t ticks = 0; - return ((info.getIsPlaying() && transport.GetCustomTickPosition (&ticks, info.getTimeInSamples().orFallback (0))) == AAX_SUCCESS) - || transport.GetCurrentTickPosition (&ticks) == AAX_SUCCESS - ? makeOptional (ticks / 960000.0) - : nullopt; - }()); + return ((info.getIsPlaying() && transport.GetCustomTickPosition (&ticks, optionalTimeInSamples.orFallback (0))) == AAX_SUCCESS) + || transport.GetCurrentTickPosition (&ticks) == AAX_SUCCESS + ? makeOptional (ticks) + : nullopt; + }(); + + info.setPpqPosition (tickPosition.hasValue() ? makeOptional (static_cast (*tickPosition) / 960'000.0) : nullopt); bool isLooping = false; int64_t loopStartTick = 0, loopEndTick = 0; @@ -1139,7 +1152,29 @@ namespace AAXClasses } const auto effectiveRate = info.getFrameRate().hasValue() ? info.getFrameRate()->getEffectiveRate() : 0.0; - info.setEditOriginTime (effectiveRate != 0.0 ? makeOptional (offset / effectiveRate) : nullopt); + info.setEditOriginTime (makeOptional (effectiveRate != 0.0 ? offset / effectiveRate : offset)); + + { + int32_t bars{}, beats{}; + int64_t displayTicks{}; + + if (optionalTimeInSamples.hasValue() + && transport.GetBarBeatPosition (&bars, &beats, &displayTicks, *optionalTimeInSamples) == AAX_SUCCESS) + { + info.setBarCount (bars); + + if (signature.hasValue()) + { + const auto ticksSinceBar = static_cast (((beats - 1) * 4 * 960'000) / signature->denominator) + displayTicks; + + if (tickPosition.hasValue() && ticksSinceBar <= tickPosition) + { + const auto barStartInTicks = static_cast (*tickPosition - ticksSinceBar); + info.setPpqPositionOfLastBarStart (barStartInTicks / 960'000.0); + } + } + } + } return info; } @@ -1162,18 +1197,9 @@ namespace AAXClasses if (details.parameterInfoChanged) { - auto numParameters = juceParameters.getNumParameters(); - - for (int i = 0; i < numParameters; ++i) - { - if (auto* p = mParameterManager.GetParameterByID (getAAXParamIDFromJuceIndex (i))) - { - auto newName = juceParameters.getParamForIndex (i)->getName (31); - - if (p->Name() != newName.toRawUTF8()) - p->SetName (AAX_CString (newName.toRawUTF8())); - } - } + for (const auto* param : juceParameters) + if (auto* aaxParam = mParameterManager.GetParameterByID (getAAXParamIDFromJuceIndex (param->getParameterIndex()))) + syncParameterAttributes (aaxParam, param); } if (details.latencyChanged) @@ -1233,6 +1259,16 @@ namespace AAXClasses updateSidechainState(); break; } + + #if JUCE_AAX_HAS_TRANSPORT_NOTIFICATION + case AAX_eNotificationEvent_TransportStateChanged: + if (data != nullptr) + { + const auto& info = *static_cast (data); + recordingState.set (info.mIsRecording); + } + break; + #endif } return AAX_CEffectParameters::NotificationReceived (type, data, size); @@ -1245,7 +1281,7 @@ namespace AAXClasses if (idx < mainNumIns) return inputs[inputLayoutMap[idx]]; - return (sidechain != -1 ? inputs[sidechain] : sideChainBuffer.getData()); + return (sidechain != -1 ? inputs[sidechain] : sideChainBuffer.data()); } void process (const float* const* inputs, float* const* outputs, const int sideChainBufferIdx, @@ -1507,11 +1543,10 @@ namespace AAXClasses friend void AAX_CALLBACK AAXClasses::algorithmProcessCallback (JUCEAlgorithmContext* const instancesBegin[], const void* const instancesEnd); void process (float* const* channels, const int numChans, const int bufferSize, - const bool bypass, AAX_IMIDINode* midiNodeIn, AAX_IMIDINode* midiNodesOut) + const bool bypass, [[maybe_unused]] AAX_IMIDINode* midiNodeIn, [[maybe_unused]] AAX_IMIDINode* midiNodesOut) { AudioBuffer buffer (channels, numChans, bufferSize); midiBuffer.clear(); - ignoreUnused (midiNodeIn, midiNodesOut); #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect { @@ -1533,19 +1568,15 @@ namespace AAXClasses if (lastBufferSize != bufferSize) { lastBufferSize = bufferSize; - pluginInstance->setRateAndBufferSizeDetails (sampleRate, bufferSize); + pluginInstance->setRateAndBufferSizeDetails (sampleRate, lastBufferSize); + // we only call prepareToPlay here if the new buffer size is larger than + // the one used last time prepareToPlay was called. + // currently, this should never actually happen, because as of Pro Tools 12, + // the maximum possible value is 1024, and we call prepareToPlay with that + // value during initialisation. if (bufferSize > maxBufferSize) - { - // we only call prepareToPlay here if the new buffer size is larger than - // the one used last time prepareToPlay was called. - // currently, this should never actually happen, because as of Pro Tools 12, - // the maximum possible value is 1024, and we call prepareToPlay with that - // value during initialisation. - pluginInstance->prepareToPlay (sampleRate, bufferSize); - maxBufferSize = bufferSize; - sideChainBuffer.calloc (static_cast (maxBufferSize)); - } + prepareProcessorWithSampleRateAndBufferSize (sampleRate, bufferSize); } if (bypass && pluginInstance->getBypassParameter() == nullptr) @@ -1810,14 +1841,10 @@ namespace AAXClasses audioProcessor.releaseResources(); } - audioProcessor.setRateAndBufferSizeDetails (sampleRate, lastBufferSize); - audioProcessor.prepareToPlay (sampleRate, lastBufferSize); - maxBufferSize = lastBufferSize; + prepareProcessorWithSampleRateAndBufferSize (sampleRate, lastBufferSize); midiBuffer.ensureSize (2048); midiBuffer.clear(); - - sideChainBuffer.calloc (static_cast (maxBufferSize)); } check (Controller()->SetSignalLatency (audioProcessor.getLatencySamples())); @@ -1879,6 +1906,16 @@ namespace AAXClasses } } + void prepareProcessorWithSampleRateAndBufferSize (double sr, int bs) + { + maxBufferSize = jmax (maxBufferSize, bs); + + auto& audioProcessor = getPluginInstance(); + audioProcessor.setRateAndBufferSizeDetails (sr, maxBufferSize); + audioProcessor.prepareToPlay (sr, maxBufferSize); + sideChainBuffer.resize (static_cast (maxBufferSize)); + } + //============================================================================== void updateSidechainState() { @@ -1886,7 +1923,7 @@ namespace AAXClasses return; auto& audioProcessor = getPluginInstance(); - bool sidechainActual = audioProcessor.getChannelCountOfBus (true, 1) > 0; + const auto sidechainActual = audioProcessor.getChannelCountOfBus (true, 1) > 0; if (hasSidechain && canDisableSidechain && sidechainDesired != sidechainActual) { @@ -1902,7 +1939,7 @@ namespace AAXClasses bus->setCurrentLayout (lastSideChainState ? AudioChannelSet::mono() : AudioChannelSet::disabled()); - audioProcessor.prepareToPlay (audioProcessor.getSampleRate(), audioProcessor.getBlockSize()); + prepareProcessorWithSampleRateAndBufferSize (audioProcessor.getSampleRate(), maxBufferSize); isPrepared = true; } @@ -2064,22 +2101,97 @@ namespace AAXClasses return defaultLayout; } + void syncParameterAttributes (AAX_IParameter* aaxParam, const AudioProcessorParameter* juceParam) + { + if (juceParam == nullptr) + return; + + { + auto newName = juceParam->getName (31); + + if (aaxParam->Name() != newName.toRawUTF8()) + aaxParam->SetName (AAX_CString (newName.toRawUTF8())); + } + + { + auto newType = juceParam->isDiscrete() ? AAX_eParameterType_Discrete : AAX_eParameterType_Continuous; + + if (aaxParam->GetType() != newType) + aaxParam->SetType (newType); + } + + { + auto newNumSteps = static_cast (juceParam->getNumSteps()); + + if (aaxParam->GetNumberOfSteps() != newNumSteps) + aaxParam->SetNumberOfSteps (newNumSteps); + } + + { + auto defaultValue = juceParam->getDefaultValue(); + + if (! approximatelyEqual (static_cast (aaxParam->GetNormalizedDefaultValue()), defaultValue)) + aaxParam->SetNormalizedDefaultValue (defaultValue); + } + } + //============================================================================== ScopedJuceInitialiser_GUI libraryInitialiser; std::unique_ptr pluginInstance; + static constexpr auto maxSamplesPerBlock = 1 << AAX_eAudioBufferLength_Max; + bool isPrepared = false; MidiBuffer midiBuffer; Array channelList; int32_t juceChunkIndex = 0, numSetDirtyCalls = 0; AAX_CSampleRate sampleRate = 0; - int lastBufferSize = 1024, maxBufferSize = 1024; + int lastBufferSize = maxSamplesPerBlock, maxBufferSize = maxSamplesPerBlock; bool hasSidechain = false, canDisableSidechain = false, lastSideChainState = false; + /* Pro Tools 2021 sends TransportStateChanged on the main thread, but we read + the recording state on the audio thread. + I'm not sure whether Pro Tools ensures that these calls are mutually + exclusive, so to ensure there are no data races, we store the recording + state in an atomic int and convert it to/from an Optional as necessary. + */ + class RecordingState + { + public: + /* This uses Optional rather than std::optional for consistency with get() */ + void set (const Optional newState) + { + state.store (newState.hasValue() ? (flagValid | (*newState ? flagActive : 0)) + : 0, + std::memory_order_relaxed); + } + + /* PositionInfo::setIsRecording takes an Optional, so we use that type rather + than std::optional to avoid having to convert. + */ + Optional get() const + { + const auto loaded = state.load (std::memory_order_relaxed); + return ((loaded & flagValid) != 0) ? makeOptional ((loaded & flagActive) != 0) + : nullopt; + } + + private: + enum RecordingFlags + { + flagValid = 1 << 0, + flagActive = 1 << 1 + }; + + std::atomic state { 0 }; + }; + + RecordingState recordingState; + std::atomic processingSidechainChange, sidechainDesired; - HeapBlock sideChainBuffer; + std::vector sideChainBuffer; Array inputLayoutMap, outputLayoutMap; Array aaxParamIDs; @@ -2303,6 +2415,10 @@ namespace AAXClasses properties->AddProperty (AAX_eProperty_SupportsSaveRestore, false); #endif + #if JUCE_AAX_HAS_TRANSPORT_NOTIFICATION + properties->AddProperty (AAX_eProperty_ObservesTransportState, true); + #endif + if (fullLayout.getChannelSet (true, 1) == AudioChannelSet::mono()) { check (desc.AddSideChainIn (JUCEAlgorithmIDs::sideChainBuffers)); @@ -2365,10 +2481,9 @@ namespace AAXClasses return (AAX_STEM_FORMAT_INDEX (stemFormat) <= 12); } - static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, const AAX_IFeatureInfo* featureInfo) + static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, [[maybe_unused]] const AAX_IFeatureInfo* featureInfo) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; - std::unique_ptr plugin (createPluginFilterOfType (AudioProcessor::wrapperType_AAX)); + auto plugin = createPluginFilterOfType (AudioProcessor::wrapperType_AAX); auto numInputBuses = plugin->getBusCount (true); auto numOutputBuses = plugin->getBusCount (false); @@ -2398,7 +2513,6 @@ namespace AAXClasses #if JucePlugin_IsMidiEffect // MIDI effect plug-ins do not support any audio channels jassert (numInputBuses == 0 && numOutputBuses == 0); - ignoreUnused (featureInfo); if (auto* desc = descriptor.NewComponentDescriptor()) { diff --git a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp b/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp index d1b055e6..44f39beb 100644 --- a/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/ARA/juce_ARA_Wrapper.cpp @@ -37,6 +37,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4100) #include #include #include +#include JUCE_END_IGNORE_WARNINGS_MSVC JUCE_END_IGNORE_WARNINGS_GCC_LIKE diff --git a/modules/juce_audio_plugin_client/AUResources.r b/modules/juce_audio_plugin_client/AUResources.r deleted file mode 100644 index 30fb387e..00000000 --- a/modules/juce_audio_plugin_client/AUResources.r +++ /dev/null @@ -1,150 +0,0 @@ -/* - File: AUResources.r - Abstract: AUResources.r - Version: 1.1 - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple - Inc. ("Apple") in consideration of your agreement to the following - terms, and your use, installation, modification or redistribution of - this Apple software constitutes acceptance of these terms. If you do - not agree with these terms, please do not use, install, modify or - redistribute this Apple software. - - In consideration of your agreement to abide by the following terms, and - subject to these terms, Apple grants you a personal, non-exclusive - license, under Apple's copyrights in this original Apple software (the - "Apple Software"), to use, reproduce, modify and redistribute the Apple - Software, with or without modifications, in source and/or binary forms; - provided that if you redistribute the Apple Software in its entirety and - without modifications, you must retain this notice and the following - text and disclaimers in all such redistributions of the Apple Software. - Neither the name, trademarks, service marks or logos of Apple Inc. may - be used to endorse or promote products derived from the Apple Software - without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or - implied, are granted by Apple herein, including but not limited to any - patent rights that may be infringed by your derivative works or by other - works in which the Apple Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE - MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION - THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND - OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, - MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED - AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), - STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - Copyright (C) 2014 Apple Inc. All Rights Reserved. - -*/ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// AUResources.r -// -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -/* sample macro definitions -- all of these symbols must be defined -#define RES_ID kHALOutputResID -#define COMP_TYPE kAudioUnitComponentType -#define COMP_SUBTYPE kAudioUnitOutputSubType -#define COMP_MANUF kAudioUnitAudioHardwareOutputSubSubType -#define VERSION 0x00010000 -#define NAME "AudioHALOutput" -#define DESCRIPTION "Audio hardware output AudioUnit" -#define ENTRY_POINT "AUHALEntry" -*/ -#define UseExtendedThingResource 1 - -#include - -// this is a define used to indicate that a component has no static data that would mean -// that no more than one instance could be open at a time - never been true for AUs -#ifndef cmpThreadSafeOnMac -#define cmpThreadSafeOnMac 0x10000000 -#endif - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -resource 'STR ' (RES_ID, purgeable) { - NAME -}; - -resource 'STR ' (RES_ID + 1, purgeable) { - DESCRIPTION -}; - -resource 'dlle' (RES_ID) { - ENTRY_POINT -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -resource 'thng' (RES_ID, NAME) { - COMP_TYPE, - COMP_SUBTYPE, - COMP_MANUF, - 0, 0, 0, 0, // no 68K - 'STR ', RES_ID, - 'STR ', RES_ID + 1, - 0, 0, /* icon */ - VERSION, - componentHasMultiplePlatforms | componentDoAutoVersion, - 0, - { - #if defined(ppc_YES) - cmpThreadSafeOnMac, - 'dlle', RES_ID, platformPowerPCNativeEntryPoint - #define NeedLeadingComma 1 - #endif - #if defined(ppc64_YES) - #if defined(NeedLeadingComma) - , - #endif - cmpThreadSafeOnMac, - 'dlle', RES_ID, platformPowerPC64NativeEntryPoint - #define NeedLeadingComma 1 - #endif - #if defined(i386_YES) - #if defined(NeedLeadingComma) - , - #endif - cmpThreadSafeOnMac, - 'dlle', RES_ID, platformIA32NativeEntryPoint - #define NeedLeadingComma 1 - #endif - #if defined(x86_64_YES) - #if defined(NeedLeadingComma) - , - #endif - cmpThreadSafeOnMac, - 'dlle', RES_ID, 8 - #define NeedLeadingComma 1 - #endif - // JUCE CHANGE STARTS HERE - #if defined(arm64_YES) - #if defined(NeedLeadingComma) - , - #endif - cmpThreadSafeOnMac, - 'dlle', RES_ID, 9 - #define NeedLeadingComma 1 - #endif - // JUCE CHANGE ENDS HERE - } -}; - -#undef RES_ID -#undef COMP_TYPE -#undef COMP_SUBTYPE -#undef COMP_MANUF -#undef VERSION -#undef NAME -#undef DESCRIPTION -#undef ENTRY_POINT -#undef NeedLeadingComma diff --git a/modules/juce_audio_plugin_client/CMakeLists.txt b/modules/juce_audio_plugin_client/CMakeLists.txt deleted file mode 100644 index 116346c6..00000000 --- a/modules/juce_audio_plugin_client/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# ============================================================================== -# -# This file is part of the JUCE library. -# Copyright (c) 2022 - Raw Material Software Limited -# -# JUCE is an open source library subject to commercial or open-source -# licensing. -# -# By using JUCE, you agree to the terms of both the JUCE 7 End-User License -# Agreement and JUCE Privacy Policy. -# -# End User License Agreement: www.juce.com/juce-7-licence -# Privacy Policy: www.juce.com/juce-privacy-policy -# -# Or: You may also use this code under the terms of the GPL v3 (see -# www.gnu.org/licenses). -# -# JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER -# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE -# DISCLAIMED. -# -# ============================================================================== - -add_executable(juce_lv2_helper LV2/juce_LV2TurtleDumpProgram.cpp) -add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) -target_compile_features(juce_lv2_helper PRIVATE cxx_std_14) -set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) -target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS}) -install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") diff --git a/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp b/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp index 0e4723d2..c4ca28b3 100644 --- a/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp +++ b/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp @@ -23,18 +23,93 @@ ============================================================================== */ +#include +#include +#include +#include + #ifdef _WIN32 + #undef UNICODE + #undef _UNICODE + + #define UNICODE 1 + #define _UNICODE 1 + #include - HMODULE dlopen (const char* filename, int) { return LoadLibrary (filename); } + #include + HMODULE dlopen (const TCHAR* filename, int) { return LoadLibrary (filename); } FARPROC dlsym (HMODULE handle, const char* name) { return GetProcAddress (handle, name); } + void printError() + { + constexpr DWORD numElements = 256; + TCHAR messageBuffer[numElements]{}; + + FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + nullptr, + GetLastError(), + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + messageBuffer, + numElements - 1, + nullptr); + + _tprintf (_T ("%s"), messageBuffer); + } + enum { RTLD_LAZY = 0 }; + + class ArgList + { + public: + ArgList (int, const char**) {} + ArgList (const ArgList&) = delete; + ArgList (ArgList&&) = delete; + ArgList& operator= (const ArgList&) = delete; + ArgList& operator= (ArgList&&) = delete; + ~ArgList() { LocalFree (argv); } + + LPWSTR get (int i) const { return argv[i]; } + + int size() const { return argc; } + + private: + int argc = 0; + LPWSTR* argv = CommandLineToArgvW (GetCommandLineW(), &argc); + }; + + std::vector toUTF8 (const TCHAR* str) + { + const auto numBytes = WideCharToMultiByte (CP_UTF8, 0, str, -1, nullptr, 0, nullptr, nullptr); + std::vector result (numBytes); + WideCharToMultiByte (CP_UTF8, 0, str, -1, result.data(), static_cast (result.size()), nullptr, nullptr); + return result; + } + #else #include + void printError() { printf ("%s\n", dlerror()); } + class ArgList + { + public: + ArgList (int argcIn, const char** argvIn) : argc (argcIn), argv (argvIn) {} + ArgList (const ArgList&) = delete; + ArgList (ArgList&&) = delete; + ArgList& operator= (const ArgList&) = delete; + ArgList& operator= (ArgList&&) = delete; + ~ArgList() = default; + + const char* get (int i) const { return argv[i]; } + + int size() const { return argc; } + + private: + int argc = 0; + const char** argv = nullptr; + }; + + std::vector toUTF8 (const char* str) { return std::vector (str, str + std::strlen (str) + 1); } #endif -#include - -// Replicating some of the LV2 header here so that we don't have to set up any +// Replicating part of the LV2 header here so that we don't have to set up any // custom include paths for this file. // Normally this would be a bad idea, but the LV2 API has to keep these definitions // in order to remain backwards-compatible. @@ -56,10 +131,12 @@ extern "C" int main (int argc, const char** argv) { - if (argc != 2) + const ArgList argList { argc, argv }; + + if (argList.size() != 2) return 1; - const auto* libraryPath = argv[1]; + const auto* libraryPath = argList.get (1); struct RecallFeature { @@ -67,12 +144,29 @@ int main (int argc, const char** argv) }; if (auto* handle = dlopen (libraryPath, RTLD_LAZY)) + { if (auto* getDescriptor = reinterpret_cast (dlsym (handle, "lv2_descriptor"))) + { if (auto* descriptor = getDescriptor (0)) + { if (auto* extensionData = descriptor->extension_data) + { if (auto* recallFeature = reinterpret_cast (extensionData ("https://lv2-extensions.juce.com/turtle_recall"))) + { if (auto* doRecall = recallFeature->doRecall) - return doRecall (libraryPath); + { + const auto converted = toUTF8 (libraryPath); + return doRecall (converted.data()); + } + } + } + } + } + } + else + { + printError(); + } return 1; } diff --git a/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp b/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp index 6fba7a1e..2c1619b6 100644 --- a/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp +++ b/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp @@ -124,7 +124,14 @@ public: */ static String getIri (const AudioProcessorParameter& param) { - return URL::addEscapeChars (LegacyAudioParameter::getParamID (¶m, false), true); + const auto urlSanitised = URL::addEscapeChars (LegacyAudioParameter::getParamID (¶m, false), true); + const auto ttlSanitised = lv2_shared::sanitiseStringAsTtlName (urlSanitised); + + // If this is hit, the parameter ID could not be represented directly in the plugin ttl. + // We'll replace offending characters with '_'. + jassert (urlSanitised == ttlSanitised); + + return ttlSanitised; } void setValueFromHost (LV2_URID urid, float value) noexcept @@ -217,6 +224,11 @@ private: result.push_back (urid); } + // If this is hit, some parameters have duplicate IDs. + // This may be because the IDs resolve to the same string when removing characters that + // are invalid in a TTL name. + jassert (std::set (result.begin(), result.end()).size() == result.size()); + return result; }(); const std::map uridToIndexMap = [&] @@ -484,7 +496,7 @@ public: template static void iterateAudioBuffer (AudioBuffer& ab, UnaryFunction fn) { - float** sampleData = ab.getArrayOfWritePointers(); + float* const* sampleData = ab.getArrayOfWritePointers(); for (int c = ab.getNumChannels(); --c >= 0;) for (int s = ab.getNumSamples(); --s >= 0;) @@ -505,8 +517,12 @@ public: void run (uint32_t numSteps) { + // If this is hit, the host is trying to process more samples than it told us to prepare + jassert (static_cast (numSteps) <= processor->getBlockSize()); + midi.clear(); playHead.invalidate(); + audio.setSize (audio.getNumChannels(), static_cast (numSteps), true, false, true); ports.forEachInputEvent ([&] (const LV2_Atom_Event* event) { @@ -536,7 +552,7 @@ public: processor->setNonRealtime (ports.isFreeWheeling()); for (auto i = 0, end = processor->getTotalNumInputChannels(); i < end; ++i) - audio.copyFrom (i, 0, ports.getBufferForAudioInput (i), (int) numSteps); + audio.copyFrom (i, 0, ports.getBufferForAudioInput (i), audio.getNumSamples()); jassert (countNaNs (audio) == 0); @@ -705,7 +721,7 @@ public: static std::unique_ptr createProcessorInstance() { - std::unique_ptr result { createPluginFilterOfType (AudioProcessor::wrapperType_LV2) }; + auto result = createPluginFilterOfType (AudioProcessor::wrapperType_LV2); #if defined (JucePlugin_PreferredChannelConfigurations) constexpr short channelConfigurations[][2] { JucePlugin_PreferredChannelConfigurations }; @@ -797,22 +813,25 @@ struct RecallFeature { const ScopedJuceInitialiser_GUI scope; const auto processor = LV2PluginInstance::createProcessorInstance(); - const File absolutePath { CharPointer_UTF8 { libraryPath } }; - processor->enableAllBuses(); + const String pathString { CharPointer_UTF8 { libraryPath } }; + + const auto absolutePath = File::isAbsolutePath (pathString) ? File (pathString) + : File::getCurrentWorkingDirectory().getChildFile (pathString); + + const auto writers = { writeManifestTtl, writeDspTtl, writeUiTtl }; - for (auto* fn : { writeManifestTtl, writeDspTtl, writeUiTtl }) + const auto wroteSuccessfully = [&processor, &absolutePath] (auto* fn) { const auto result = fn (*processor, absolutePath); - if (result.wasOk()) - continue; + if (! result.wasOk()) + std::cerr << result.getErrorMessage() << '\n'; - std::cerr << result.getErrorMessage() << '\n'; - return 1; - } + return result.wasOk(); + }; - return 0; + return std::all_of (writers.begin(), writers.end(), wroteSuccessfully) ? 0 : 1; }; private: @@ -821,15 +840,28 @@ private: return JucePlugin_LV2URI + String (uriSeparator) + "preset" + String (index + 1); } - static std::ofstream openStream (const File& libraryPath, StringRef name) + static FileOutputStream openStream (const File& libraryPath, StringRef name) { - return std::ofstream { libraryPath.getSiblingFile (name + ".ttl").getFullPathName().toRawUTF8() }; + return FileOutputStream { libraryPath.getSiblingFile (name + ".ttl") }; + } + + static Result prepareStream (FileOutputStream& stream) + { + if (const auto result = stream.getStatus(); ! result) + return result; + + stream.setPosition (0); + stream.truncate(); + return Result::ok(); } static Result writeManifestTtl (AudioProcessor& proc, const File& libraryPath) { auto os = openStream (libraryPath, "manifest"); + if (const auto result = prepareStream (os); ! result) + return result; + os << "@prefix lv2: .\n" "@prefix rdfs: .\n" "@prefix pset: .\n" @@ -848,7 +880,7 @@ private: #define JUCE_LV2_UI_KIND "CocoaUI" #elif JUCE_WINDOWS #define JUCE_LV2_UI_KIND "WindowsUI" - #elif JUCE_LINUX + #elif JUCE_LINUX || JUCE_BSD #define JUCE_LV2_UI_KIND "X11UI" #else #error "LV2 UI is unsupported on this platform" @@ -961,6 +993,9 @@ private: { auto os = openStream (libraryPath, "dsp"); + if (const auto result = prepareStream (os); ! result) + return result; + os << "@prefix atom: .\n" "@prefix bufs: .\n" "@prefix doap: .\n" @@ -1298,6 +1333,9 @@ private: auto os = openStream (libraryPath, "ui"); + if (const auto result = prepareStream (os); ! result) + return result; + const auto editorInstance = rawToUniquePtr (proc.createEditor()); const auto resizeFeatureString = editorInstance->isResizable() ? "ui:resize" : "ui:noUserResize"; @@ -1341,8 +1379,6 @@ private: //============================================================================== LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor (uint32_t index) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_LV2; - if (index != 0) return nullptr; diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp index 009707ec..1f13a1d8 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp @@ -50,8 +50,6 @@ class StandaloneFilterApp : public JUCEApplication public: StandaloneFilterApp() { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_Standalone; - PropertiesFile::Options options; options.applicationName = getApplicationName(); diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 05842cc5..6a96c9be 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -124,7 +124,7 @@ public: //============================================================================== virtual void createPlugin() { - processor.reset (createPluginFilterOfType (AudioProcessor::wrapperType_Standalone)); + processor = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone); processor->disableNonMainBuses(); processor->setRateAndBufferSizeDetails (44100, 512); @@ -386,13 +386,12 @@ public: return false; } - Image getIAAHostIcon (int size) + Image getIAAHostIcon ([[maybe_unused]] int size) { #if JUCE_IOS && JucePlugin_Enable_IAA if (auto device = dynamic_cast (deviceManager.getCurrentAudioDevice())) return device->getIcon (size); #else - ignoreUnused (size); #endif return {}; @@ -425,7 +424,7 @@ private: On some platforms (such as iOS 10), the expected buffer size reported in audioDeviceAboutToStart may be smaller than the blocks passed to - audioDeviceIOCallback. This can lead to out-of-bounds reads if the render + audioDeviceIOCallbackWithContext. This can lead to out-of-bounds reads if the render callback depends on additional buffers which were initialised using the smaller size. @@ -448,9 +447,9 @@ private: inner.audioDeviceAboutToStart (device); } - void audioDeviceIOCallbackWithContext (const float** inputChannelData, + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, - float** outputChannelData, + float* const* outputChannelData, int numOutputChannels, int numSamples, const AudioIODeviceCallbackContext& context) override @@ -600,9 +599,9 @@ private: }; //============================================================================== - void audioDeviceIOCallbackWithContext (const float** inputChannelData, + void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels, - float** outputChannelData, + float* const* outputChannelData, int numOutputChannels, int numSamples, const AudioIODeviceCallbackContext& context) override diff --git a/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp b/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp index 47dfef29..e2cc0f69 100644 --- a/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp @@ -158,10 +158,8 @@ private: return std::make_unique (Image (this)); } - void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, Image::BitmapData::ReadWriteMode mode) override + void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, [[maybe_unused]] Image::BitmapData::ReadWriteMode mode) override { - ignoreUnused (mode); - const auto offset = (size_t) x * (size_t) pixelStride + (size_t) y * (size_t) lineStride; bitmap.data = imageData + offset; bitmap.size = (size_t) (lineStride * height) - offset; @@ -294,7 +292,7 @@ class AudioProcessorUnityWrapper public: AudioProcessorUnityWrapper (bool isTemporary) { - pluginInstance.reset (createPluginFilterOfType (AudioProcessor::wrapperType_Unity)); + pluginInstance = createPluginFilterOfType (AudioProcessor::wrapperType_Unity); if (! isTemporary && pluginInstance->hasEditor()) { @@ -510,9 +508,28 @@ static void onWrapperDeletion (AudioProcessorUnityWrapper* wrapperToRemove) } //============================================================================== -namespace UnityCallbacks +static UnityAudioEffectDefinition getEffectDefinition() { - static int UNITY_INTERFACE_API createCallback (UnityAudioEffectState* state) + const auto wrapper = std::make_unique (true); + const String originalName { JucePlugin_Name }; + const auto name = (! originalName.startsWithIgnoreCase ("audioplugin") ? "audioplugin_" : "") + originalName; + + UnityAudioEffectDefinition result{}; + name.copyToUTF8 (result.name, (size_t) numElementsInArray (result.name)); + + result.structSize = sizeof (UnityAudioEffectDefinition); + result.parameterStructSize = sizeof (UnityAudioParameterDefinition); + + result.apiVersion = UNITY_AUDIO_PLUGIN_API_VERSION; + result.pluginVersion = JucePlugin_VersionCode; + + // effects must set this to 0, generators > 0 + result.channels = (wrapper->getNumInputChannels() != 0 ? 0 + : static_cast (wrapper->getNumOutputChannels())); + + wrapper->declareParameters (result); + + result.create = [] (UnityAudioEffectState* state) { auto* pluginInstance = new AudioProcessorUnityWrapper (false); pluginInstance->create (state); @@ -522,9 +539,9 @@ namespace UnityCallbacks onWrapperCreation (pluginInstance); return 0; - } + }; - static int UNITY_INTERFACE_API releaseCallback (UnityAudioEffectState* state) + result.release = [] (UnityAudioEffectState* state) { auto* pluginInstance = state->getEffectData(); pluginInstance->release(); @@ -536,32 +553,57 @@ namespace UnityCallbacks shutdownJuce_GUI(); return 0; - } + }; - static int UNITY_INTERFACE_API resetCallback (UnityAudioEffectState* state) + result.reset = [] (UnityAudioEffectState* state) { auto* pluginInstance = state->getEffectData(); pluginInstance->reset(); return 0; - } + }; - static int UNITY_INTERFACE_API setPositionCallback (UnityAudioEffectState* state, unsigned int pos) + result.setPosition = [] (UnityAudioEffectState* state, unsigned int pos) { ignoreUnused (state, pos); + return 0; + }; + + result.process = [] (UnityAudioEffectState* state, + float* inBuffer, + float* outBuffer, + unsigned int bufferSize, + int numInChannels, + int numOutChannels) + { + auto* pluginInstance = state->getEffectData(); + + if (pluginInstance != nullptr) + { + auto isPlaying = ((state->flags & stateIsPlaying) != 0); + auto isMuted = ((state->flags & stateIsMuted) != 0); + auto isPaused = ((state->flags & stateIsPaused) != 0); + + const auto bypassed = ! isPlaying || (isMuted || isPaused); + pluginInstance->process (inBuffer, outBuffer, static_cast (bufferSize), numInChannels, numOutChannels, bypassed); + } + else + { + FloatVectorOperations::clear (outBuffer, static_cast (bufferSize) * numOutChannels); + } return 0; - } + }; - static int UNITY_INTERFACE_API setFloatParameterCallback (UnityAudioEffectState* state, int index, float value) + result.setFloatParameter = [] (UnityAudioEffectState* state, int index, float value) { auto* pluginInstance = state->getEffectData(); pluginInstance->setParameter (index, value); return 0; - } + }; - static int UNITY_INTERFACE_API getFloatParameterCallback (UnityAudioEffectState* state, int index, float* value, char* valueStr) + result.getFloatParameter = [] (UnityAudioEffectState* state, int index, float* value, char* valueStr) { auto* pluginInstance = state->getEffectData(); *value = pluginInstance->getParameter (index); @@ -569,21 +611,21 @@ namespace UnityCallbacks pluginInstance->getParameterString (index).copyToUTF8 (valueStr, 15); return 0; - } + }; - static int UNITY_INTERFACE_API getFloatBufferCallback (UnityAudioEffectState* state, const char* name, float* buffer, int numSamples) + result.getFloatBuffer = [] (UnityAudioEffectState* state, const char* kind, float* buffer, int numSamples) { ignoreUnused (numSamples); - auto nameStr = String (name); + const StringRef kindStr { kind }; - if (nameStr == "Editor") + if (kindStr == StringRef ("Editor")) { auto* pluginInstance = state->getEffectData(); buffer[0] = pluginInstance->hasEditor() ? 1.0f : 0.0f; } - else if (nameStr == "ID") + else if (kindStr == StringRef ("ID")) { auto* pluginInstance = state->getEffectData(); @@ -598,7 +640,7 @@ namespace UnityCallbacks return 0; } - else if (nameStr == "Size") + else if (kindStr == StringRef ("Size")) { auto* pluginInstance = state->getEffectData(); @@ -613,87 +655,27 @@ namespace UnityCallbacks } return 0; - } - - static int UNITY_INTERFACE_API processCallback (UnityAudioEffectState* state, float* inBuffer, float* outBuffer, - unsigned int bufferSize, int numInChannels, int numOutChannels) - { - auto* pluginInstance = state->getEffectData(); - - if (pluginInstance != nullptr) - { - auto isPlaying = ((state->flags & stateIsPlaying) != 0); - auto isMuted = ((state->flags & stateIsMuted) != 0); - auto isPaused = ((state->flags & stateIsPaused) != 0); - - const auto bypassed = ! isPlaying || (isMuted || isPaused); - pluginInstance->process (inBuffer, outBuffer, static_cast (bufferSize), numInChannels, numOutChannels, bypassed); - } - else - { - FloatVectorOperations::clear (outBuffer, static_cast (bufferSize) * numOutChannels); - } - - return 0; - } -} - -//============================================================================== -static void declareEffect (UnityAudioEffectDefinition& definition) -{ - memset (&definition, 0, sizeof (definition)); - - std::unique_ptr wrapper = std::make_unique (true); - - String name (JucePlugin_Name); - if (! name.startsWithIgnoreCase ("audioplugin")) - name = "audioplugin_" + name; - - name.copyToUTF8 (definition.name, (size_t) numElementsInArray (definition.name)); - - definition.structSize = sizeof (UnityAudioEffectDefinition); - definition.parameterStructSize = sizeof (UnityAudioParameterDefinition); - - definition.apiVersion = UNITY_AUDIO_PLUGIN_API_VERSION; - definition.pluginVersion = JucePlugin_VersionCode; + }; - // effects must set this to 0, generators > 0 - definition.channels = (wrapper->getNumInputChannels() != 0 ? 0 - : static_cast (wrapper->getNumOutputChannels())); - - wrapper->declareParameters (definition); - - definition.create = UnityCallbacks::createCallback; - definition.release = UnityCallbacks::releaseCallback; - definition.reset = UnityCallbacks::resetCallback; - definition.setPosition = UnityCallbacks::setPositionCallback; - definition.process = UnityCallbacks::processCallback; - definition.setFloatParameter = UnityCallbacks::setFloatParameterCallback; - definition.getFloatParameter = UnityCallbacks::getFloatParameterCallback; - definition.getFloatBuffer = UnityCallbacks::getFloatBufferCallback; + return result; } } // namespace juce +// From reading the example code, it seems that the triple indirection indicates +// an out-value of an array of pointers. That is, after calling this function, definitionsPtr +// should point to a pre-existing/static array of pointer-to-effect-definition. UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API UnityGetAudioEffectDefinitions (UnityAudioEffectDefinition*** definitionsPtr) { if (juce::getWrapperMap().size() == 0) juce::initialiseJuce_GUI(); - static bool hasInitialised = false; - - if (! hasInitialised) - { - juce::PluginHostType::jucePlugInClientCurrentWrapperType = juce::AudioProcessor::wrapperType_Unity; - juce::juce_createUnityPeerFn = juce::createUnityPeer; - - hasInitialised = true; - } - - auto* definition = new UnityAudioEffectDefinition(); - juce::declareEffect (*definition); + static std::once_flag flag; + std::call_once (flag, [] { juce::juce_createUnityPeerFn = juce::createUnityPeer; }); - *definitionsPtr = &definition; + static auto definition = juce::getEffectDefinition(); + static UnityAudioEffectDefinition* definitions[] { &definition }; + *definitionsPtr = definitions; return 1; } diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index 1127dd25..55226c66 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -68,6 +68,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996 4100) JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wconversion", "-Wshadow", "-Wdeprecated-register", + "-Wdeprecated-declarations", "-Wunused-parameter", "-Wdeprecated-writable-strings", "-Wnon-virtual-dtor", @@ -961,14 +962,12 @@ public: , public Timer #endif { - EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, float initialScale) + EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, [[maybe_unused]] float initialScale) : wrapper (w) { editor.setOpaque (true); #if ! JUCE_MAC editor.setScaleFactor (initialScale); - #else - ignoreUnused (initialScale); #endif addAndMakeVisible (editor); @@ -1018,7 +1017,7 @@ public: // before that happens. X11Symbols::getInstance()->xFlush (display); #elif JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE - checkHostWindowScaleFactor(); + checkHostWindowScaleFactor (true); startTimer (500); #endif #elif JUCE_MAC @@ -1222,12 +1221,12 @@ public: } #if JUCE_WIN_PER_MONITOR_DPI_AWARE - void checkHostWindowScaleFactor() + void checkHostWindowScaleFactor (bool force = false) { auto hostWindowScale = (float) getScaleFactorForWindow ((HostWindowType) hostWindow); - if (hostWindowScale > 0.0f && ! approximatelyEqual (hostWindowScale, wrapper.editorScaleFactor)) - wrapper.handleSetContentScaleFactor (hostWindowScale); + if (force || (hostWindowScale > 0.0f && ! approximatelyEqual (hostWindowScale, wrapper.editorScaleFactor))) + wrapper.handleSetContentScaleFactor (hostWindowScale, force); } void timerCallback() override @@ -1713,13 +1712,12 @@ private: return 0; } - pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args) + pointer_sized_int handlePreAudioProcessingEvents ([[maybe_unused]] VstOpCodeArguments args) { #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents); return 1; #else - ignoreUnused (args); return 0; #endif } @@ -1972,13 +1970,13 @@ private: if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect()) return false; - auto inputLayout = processor->getChannelLayoutOfBus (true, 0); - auto outputLayout = processor->getChannelLayoutOfBus (false, 0); + auto inputLayout = processor->getChannelLayoutOfBus (true, 0); + auto outputLayout = processor->getChannelLayoutOfBus (false, 0); - auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8); + const auto speakerBaseSize = offsetof (Vst2::VstSpeakerArrangement, speakers); - cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); - cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); + cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerProperties)), 1); + cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerProperties)), 1); *pluginInput = cachedInArrangement. getData(); *pluginOutput = cachedOutArrangement.getData(); @@ -2012,7 +2010,7 @@ private: return 0; } - pointer_sized_int handleSetContentScaleFactor (float scale) + pointer_sized_int handleSetContentScaleFactor ([[maybe_unused]] float scale, [[maybe_unused]] bool force = false) { checkWhetherMessageThreadIsCorrect(); #if JUCE_LINUX || JUCE_BSD @@ -2022,16 +2020,13 @@ private: #endif #if ! JUCE_MAC - if (! approximatelyEqual (scale, editorScaleFactor)) + if (force || ! approximatelyEqual (scale, editorScaleFactor)) { editorScaleFactor = scale; if (editorComp != nullptr) editorComp->setContentScaleFactor (editorScaleFactor); } - - #else - ignoreUnused (scale); #endif return 1; @@ -2198,8 +2193,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes") JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - initialiseMacVST(); return pluginEntryPoint (audioMaster); } @@ -2207,8 +2200,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes") JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - initialiseMacVST(); return pluginEntryPoint (audioMaster); } @@ -2220,16 +2211,12 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes") JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - return pluginEntryPoint (audioMaster); } JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main"); JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - return VSTPluginMain (audioMaster); } @@ -2243,16 +2230,12 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes") extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - return pluginEntryPoint (audioMaster); } #if ! defined (JUCE_64BIT) && JUCE_MSVC // (can't compile this on win64, but it's not needed anyway with VST2.4) extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster) { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; - return (int) pluginEntryPoint (audioMaster); } #endif diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm index 8e3fab41..2c13881a 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm @@ -80,7 +80,7 @@ void initialiseMacVST() } JUCE_API void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, bool isNSView); -void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, bool isNSView) +void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -161,7 +161,6 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, } #endif - ignoreUnused (isNSView); NSView* parentView = [(NSView*) parentWindowOrView retain]; #if JucePlugin_EditorRequiresKeyboardFocus @@ -183,7 +182,7 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, } JUCE_API void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSView); -void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSView) +void detachComponentFromWindowRefVST (Component* comp, void* window, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -232,14 +231,13 @@ void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSVi } #endif - ignoreUnused (isNSView); comp->removeFromDesktop(); [(id) window release]; } } JUCE_API void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, bool isNSView); -void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, bool isNSView) +void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -260,8 +258,6 @@ void setNativeHostWindowSizeVST (void* window, Component* component, int newWidt } #endif - ignoreUnused (isNSView); - if (NSView* hostView = (NSView*) window) { const int dx = newWidth - component->getWidth(); @@ -277,10 +273,10 @@ void setNativeHostWindowSizeVST (void* window, Component* component, int newWidt } JUCE_API void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView); -void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView) +void checkWindowVisibilityVST ([[maybe_unused]] void* window, + [[maybe_unused]] Component* comp, + [[maybe_unused]] bool isNSView) { - ignoreUnused (window, comp, isNSView); - #if ! JUCE_64BIT if (! isNSView) comp->setVisible ([((NSWindow*) window) isVisible]); @@ -288,7 +284,7 @@ void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView) } JUCE_API bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView); -bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView) +bool forwardCurrentKeyEventToHostVST ([[maybe_unused]] Component* comp, [[maybe_unused]] bool isNSView) { #if ! JUCE_64BIT if (! isNSView) @@ -300,7 +296,6 @@ bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView) } #endif - ignoreUnused (comp, isNSView); return false; } diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index b80ae5a5..da79dcc6 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -431,9 +431,11 @@ public: { info.id = Vst::kRootUnitId; info.parentUnitId = Vst::kNoParentUnitId; - info.programListId = Vst::kNoProgramListId; + info.programListId = getProgramListCount() > 0 + ? static_cast (programParamID) + : Vst::kNoProgramListId; - toString128 (info.name, TRANS("Root Unit")); + toString128 (info.name, TRANS ("Root Unit")); return kResultTrue; } @@ -467,7 +469,7 @@ public: info.id = static_cast (programParamID); info.programCount = static_cast (audioProcessor->getNumPrograms()); - toString128 (info.name, TRANS("Factory Presets")); + toString128 (info.name, TRANS ("Factory Presets")); return kResultTrue; } @@ -500,8 +502,8 @@ public: tresult PLUGIN_API getUnitByBus (Vst::MediaType, Vst::BusDirection, Steinberg::int32, Steinberg::int32, Vst::UnitID& unitId) override { - zerostruct (unitId); - return kNotImplemented; + unitId = Vst::kRootUnitId; + return kResultOk; } //============================================================================== @@ -1073,14 +1075,15 @@ public: } //============================================================================== - tresult PLUGIN_API getMidiControllerAssignment (Steinberg::int32 /*busIndex*/, Steinberg::int16 channel, - Vst::CtrlNumber midiControllerNumber, Vst::ParamID& resultID) override + tresult PLUGIN_API getMidiControllerAssignment ([[maybe_unused]] Steinberg::int32 busIndex, + [[maybe_unused]] Steinberg::int16 channel, + [[maybe_unused]] Vst::CtrlNumber midiControllerNumber, + [[maybe_unused]] Vst::ParamID& resultID) override { #if JUCE_VST3_EMULATE_MIDI_CC_WITH_PARAMETERS resultID = midiControllerToParameter[channel][midiControllerNumber]; return kResultTrue; // Returning false makes some hosts stop asking for further MIDI Controller Assignments #else - ignoreUnused (channel, midiControllerNumber, resultID); return kResultFalse; #endif } @@ -1127,18 +1130,18 @@ public: if (audioProcessor != nullptr) return audioProcessor->getUnitInfo (unitIndex, info); + jassertfalse; if (unitIndex == 0) { info.id = Vst::kRootUnitId; info.parentUnitId = Vst::kNoParentUnitId; info.programListId = Vst::kNoProgramListId; - toString128 (info.name, TRANS("Root Unit")); + toString128 (info.name, TRANS ("Root Unit")); return kResultTrue; } - jassertfalse; zerostruct (info); return kResultFalse; } @@ -1734,9 +1737,6 @@ private: #if JUCE_MAC if (getHostType().type == PluginHostType::SteinbergCubase10) cubase10Workaround.reset (new Cubase10WindowResizeWorkaround (*this)); - #else - if (! approximatelyEqual (editorScaleFactor, ec.lastScaleFactorReceived)) - setContentScaleFactor (ec.lastScaleFactorReceived); #endif } @@ -1784,12 +1784,24 @@ private: createContentWrapperComponentIfNeeded(); #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD + // If the plugin was last opened at a particular scale, try to reapply that scale here. + // Note that we do this during attach(), rather than in JuceVST3Editor(). During the + // constructor, we don't have a host plugFrame, so + // ContentWrapperComponent::resizeHostWindow() won't do anything, and the content + // wrapper component will be left at the wrong size. + applyScaleFactor (StoredScaleFactor{}.withInternal (owner->lastScaleFactorReceived)); + + // Check the host scale factor *before* calling addToDesktop, so that the initial + // window size during addToDesktop is correct for the current platform scale factor. + #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE + component->checkHostWindowScaleFactor(); + #endif + component->setOpaque (true); component->addToDesktop (0, (void*) systemWindow); component->setVisible (true); #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE - component->checkHostWindowScaleFactor(); component->startTimer (500); #endif @@ -1980,39 +1992,31 @@ private: return kResultFalse; } - tresult PLUGIN_API setContentScaleFactor (Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override + tresult PLUGIN_API setContentScaleFactor ([[maybe_unused]] const Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override { #if ! JUCE_MAC - if (! approximatelyEqual ((float) factor, editorScaleFactor)) + const auto scaleToApply = [&] { #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE // Cubase 10 only sends integer scale factors, so correct this for fractional scales - if (getHostType().type == PluginHostType::SteinbergCubase10) - { - auto hostWindowScale = (Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getScaleFactorForWindow ((HWND) systemWindow); + if (getHostType().type != PluginHostType::SteinbergCubase10) + return factor; - if (hostWindowScale > 0.0 && ! approximatelyEqual (factor, hostWindowScale)) - factor = hostWindowScale; - } - #endif + const auto hostWindowScale = (Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getScaleFactorForWindow (static_cast (systemWindow)); - editorScaleFactor = (float) factor; + if (hostWindowScale <= 0.0 || approximatelyEqual (factor, hostWindowScale)) + return factor; - if (owner != nullptr) - owner->lastScaleFactorReceived = editorScaleFactor; + return hostWindowScale; + #else + return factor; + #endif + }(); - if (component != nullptr) - { - #if JUCE_LINUX || JUCE_BSD - const MessageManagerLock mmLock; - #endif - component->setEditorScaleFactor (editorScaleFactor); - } - } + applyScaleFactor (scaleFactor.withHost (scaleToApply)); return kResultTrue; #else - ignoreUnused (factor); return kResultFalse; #endif } @@ -2093,7 +2097,7 @@ private: pluginEditor->setHostContext (editorHostContext.get()); #if ! JUCE_MAC - pluginEditor->setScaleFactor (owner.editorScaleFactor); + pluginEditor->setScaleFactor (owner.scaleFactor.get()); #endif addAndMakeVisible (pluginEditor.get()); @@ -2224,10 +2228,10 @@ private: #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE void checkHostWindowScaleFactor() { - auto hostWindowScale = (float) getScaleFactorForWindow ((HWND) owner.systemWindow); + const auto estimatedScale = (float) getScaleFactorForWindow (static_cast (owner.systemWindow)); - if (hostWindowScale > 0.0 && ! approximatelyEqual (hostWindowScale, owner.editorScaleFactor)) - owner.setContentScaleFactor (hostWindowScale); + if (estimatedScale > 0.0) + owner.applyScaleFactor (owner.scaleFactor.withInternal (estimatedScale)); } void timerCallback() override @@ -2311,7 +2315,38 @@ private: std::unique_ptr cubase10Workaround; #else - float editorScaleFactor = 1.0f; + class StoredScaleFactor + { + public: + StoredScaleFactor withHost (float x) const { return withMember (*this, &StoredScaleFactor::host, x); } + StoredScaleFactor withInternal (float x) const { return withMember (*this, &StoredScaleFactor::internal, x); } + float get() const { return host.value_or (internal); } + + private: + std::optional host; + float internal = 1.0f; + }; + + void applyScaleFactor (const StoredScaleFactor newFactor) + { + const auto previous = std::exchange (scaleFactor, newFactor).get(); + + if (previous == scaleFactor.get()) + return; + + if (owner != nullptr) + owner->lastScaleFactorReceived = scaleFactor.get(); + + if (component != nullptr) + { + #if JUCE_LINUX || JUCE_BSD + const MessageManagerLock mmLock; + #endif + component->setEditorScaleFactor (scaleFactor.get()); + } + } + + StoredScaleFactor scaleFactor; #if JUCE_WINDOWS WindowsHooks hooks; @@ -2385,16 +2420,15 @@ class JuceVST3Component : public Vst::IComponent, { public: JuceVST3Component (Vst::IHostApplication* h) - : pluginInstance (createPluginFilterOfType (AudioProcessor::wrapperType_VST3)), + : pluginInstance (createPluginFilterOfType (AudioProcessor::wrapperType_VST3).release()), host (h) { inParameterChangedCallback = false; #ifdef JucePlugin_PreferredChannelConfigurations short configs[][2] = { JucePlugin_PreferredChannelConfigurations }; - const int numConfigs = numElementsInArray (configs); + [[maybe_unused]] const int numConfigs = numElementsInArray (configs); - ignoreUnused (numConfigs); jassert (numConfigs > 0 && (configs[0][0] > 0 || configs[0][1] > 0)); pluginInstance->setPlayConfigDetails (configs[0][0], configs[0][1], 44100.0, 1024); @@ -2517,27 +2551,32 @@ public: //============================================================================== tresult PLUGIN_API setActive (TBool state) override { - active = (state != 0); + const auto willBeActive = (state != 0); - if (! state) - { - getPluginInstance().releaseResources(); - } - else - { - auto sampleRate = getPluginInstance().getSampleRate(); - auto bufferSize = getPluginInstance().getBlockSize(); + active = false; + // Some hosts may call setBusArrangements in response to calls made during prepareToPlay + // or releaseResources. Specifically, Wavelab 11.1 calls setBusArrangements in the same + // call stack when the AudioProcessor calls setLatencySamples inside prepareToPlay. + // In order for setBusArrangements to return successfully, the plugin must not be activated + // until after prepareToPlay has completely finished. + const ScopeGuard scope { [&] { active = willBeActive; } }; - sampleRate = processSetup.sampleRate > 0.0 - ? processSetup.sampleRate - : sampleRate; + if (willBeActive) + { + const auto sampleRate = processSetup.sampleRate > 0.0 + ? processSetup.sampleRate + : getPluginInstance().getSampleRate(); - bufferSize = processSetup.maxSamplesPerBlock > 0 - ? (int) processSetup.maxSamplesPerBlock - : bufferSize; + const auto bufferSize = processSetup.maxSamplesPerBlock > 0 + ? (int) processSetup.maxSamplesPerBlock + : getPluginInstance().getBlockSize(); preparePlugin (sampleRate, bufferSize, CallPrepareToPlay::yes); } + else + { + getPluginInstance().releaseResources(); + } return kResultOk; } @@ -3246,25 +3285,54 @@ public: if (numIns > numInputBuses || numOuts > numOutputBuses) return false; - auto requested = pluginInstance->getBusesLayout(); + // see the following documentation to understand the correct way to react to this callback + // https://steinbergmedia.github.io/vst3_doc/vstinterfaces/classSteinberg_1_1Vst_1_1IAudioProcessor.html#ad3bc7bac3fd3b194122669be2a1ecc42 - for (int i = 0; i < numIns; ++i) - requested.getChannelSet (true, i) = getChannelSetForSpeakerArrangement (inputs[i]); + const auto requestedLayout = [&] + { + auto result = pluginInstance->getBusesLayout(); - for (int i = 0; i < numOuts; ++i) - requested.getChannelSet (false, i) = getChannelSetForSpeakerArrangement (outputs[i]); + for (int i = 0; i < numIns; ++i) + result.getChannelSet (true, i) = getChannelSetForSpeakerArrangement (inputs[i]); + + for (int i = 0; i < numOuts; ++i) + result.getChannelSet (false, i) = getChannelSetForSpeakerArrangement (outputs[i]); + + return result; + }(); #ifdef JucePlugin_PreferredChannelConfigurations short configs[][2] = { JucePlugin_PreferredChannelConfigurations }; - if (! AudioProcessor::containsLayout (requested, configs)) + if (! AudioProcessor::containsLayout (requestedLayout, configs)) return kResultFalse; #endif - if (! pluginInstance->setBusesLayoutWithoutEnabling (requested)) - return kResultFalse; + if (pluginInstance->checkBusesLayoutSupported (requestedLayout)) + { + if (! pluginInstance->setBusesLayoutWithoutEnabling (requestedLayout)) + return kResultFalse; - bufferMapper.updateFromProcessor (*pluginInstance); - return kResultTrue; + bufferMapper.updateFromProcessor (*pluginInstance); + return kResultTrue; + } + + // apply layout changes in reverse order as Steinberg says we should prioritize main buses + const auto nextBest = [this, numInputBuses, numOutputBuses, &requestedLayout] + { + auto layout = pluginInstance->getBusesLayout(); + + for (auto busIdx = jmax (numInputBuses, numOutputBuses) - 1; busIdx >= 0; --busIdx) + for (const auto isInput : { true, false }) + if (auto* bus = pluginInstance->getBus (isInput, busIdx)) + bus->isLayoutSupported (requestedLayout.getChannelSet (isInput, busIdx), &layout); + + return layout; + }(); + + if (pluginInstance->setBusesLayoutWithoutEnabling (nextBest)) + bufferMapper.updateFromProcessor (*pluginInstance); + + return kResultFalse; } tresult PLUGIN_API getBusArrangement (Vst::BusDirection dir, Steinberg::int32 index, Vst::SpeakerArrangement& arr) override @@ -3337,31 +3405,45 @@ public: { jassert (pluginInstance != nullptr); - auto numParamsChanged = paramChanges.getParameterCount(); + struct ParamChangeInfo + { + Steinberg::int32 offsetSamples = 0; + double value = 0.0; + }; + + const auto getPointFromQueue = [] (Steinberg::Vst::IParamValueQueue* queue, Steinberg::int32 index) + { + ParamChangeInfo result; + return queue->getPoint (index, result.offsetSamples, result.value) == kResultTrue + ? makeOptional (result) + : nullopt; + }; + + const auto numParamsChanged = paramChanges.getParameterCount(); for (Steinberg::int32 i = 0; i < numParamsChanged; ++i) { if (auto* paramQueue = paramChanges.getParameterData (i)) { - auto numPoints = paramQueue->getPointCount(); - - Steinberg::int32 offsetSamples = 0; - double value = 0.0; + const auto vstParamID = paramQueue->getParameterId(); + const auto numPoints = paramQueue->getPointCount(); - if (paramQueue->getPoint (numPoints - 1, offsetSamples, value) == kResultTrue) + #if JUCE_VST3_EMULATE_MIDI_CC_WITH_PARAMETERS + if (juceVST3EditController != nullptr && juceVST3EditController->isMidiControllerParamID (vstParamID)) { - auto vstParamID = paramQueue->getParameterId(); - - #if JUCE_VST3_EMULATE_MIDI_CC_WITH_PARAMETERS - if (juceVST3EditController != nullptr && juceVST3EditController->isMidiControllerParamID (vstParamID)) - addParameterChangeToMidiBuffer (offsetSamples, vstParamID, value); - else - #endif + for (Steinberg::int32 point = 0; point < numPoints; ++point) { - if (auto* param = comPluginInstance->getParamForVSTParamID (vstParamID)) - setValueAndNotifyIfChanged (*param, (float) value); + if (const auto change = getPointFromQueue (paramQueue, point)) + addParameterChangeToMidiBuffer (change->offsetSamples, vstParamID, change->value); } } + else + #endif + if (const auto change = getPointFromQueue (paramQueue, numPoints - 1)) + { + if (auto* param = comPluginInstance->getParamForVSTParamID (vstParamID)) + setValueAndNotifyIfChanged (*param, (float) change->value); + } } } } @@ -4086,8 +4168,6 @@ using namespace juce; // The VST3 plugin entry point. extern "C" SMTG_EXPORT_SYMBOL IPluginFactory* PLUGIN_API GetPluginFactory() { - PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST3; - #if (JUCE_MSVC || (JUCE_WINDOWS && JUCE_CLANG)) && JUCE_32BIT // Cunning trick to force this function to be exported. Life's too short to // faff around creating .def files for this kind of thing. diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h index 39fd87e8..ae55ffd3 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h @@ -35,12 +35,12 @@ ID: juce_audio_plugin_client vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE audio plugin wrapper classes description: Classes for building VST, VST3, AU, AUv3 and AAX plugins. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_audio_processors diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU.r b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU.r deleted file mode 100644 index 06eb4cd5..00000000 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU.r +++ /dev/null @@ -1,50 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2022 - Raw Material Software Limited - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 7 End-User License - Agreement and JUCE Privacy Policy. - - End User License Agreement: www.juce.com/juce-7-licence - Privacy Policy: www.juce.com/juce-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#define UseExtendedThingResource 1 -#include - -//============================================================================== -/* The JucePluginDefines file should be a file in your project, containing info to describe the - plugin's name, type, etc. The Projucer will generate this file automatically for you. - - You may need to adjust the include path of your project to make sure it can be - found by this include statement. (Don't hack this file to change the include path) -*/ -#include "JucePluginDefines.h" - - -//============================================================================== -// component resources for Audio Unit -#define RES_ID 1000 -#define COMP_TYPE JucePlugin_AUMainType -#define COMP_SUBTYPE JucePlugin_AUSubType -#define COMP_MANUF JucePlugin_AUManufacturerCode -#define VERSION JucePlugin_VersionCode -#define NAME JucePlugin_Manufacturer ": " JucePlugin_Name -#define DESCRIPTION JucePlugin_Desc -#define ENTRY_POINT JucePlugin_AUExportPrefixQuoted "Entry" - -#include "AUResources.r" diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm index d36d18b2..ed10cded 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm @@ -60,21 +60,42 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wparentheses", #define verify_noerr(errorCode) __Verify_noErr(errorCode) #endif -#include "AU/CoreAudioUtilityClasses/AUBase.cpp" -#include "AU/CoreAudioUtilityClasses/AUBuffer.cpp" -#include "AU/CoreAudioUtilityClasses/AUDispatch.cpp" -#include "AU/CoreAudioUtilityClasses/AUInputElement.cpp" -#include "AU/CoreAudioUtilityClasses/AUMIDIBase.cpp" -#include "AU/CoreAudioUtilityClasses/AUOutputBase.cpp" -#include "AU/CoreAudioUtilityClasses/AUOutputElement.cpp" -#include "AU/CoreAudioUtilityClasses/AUScopeElement.cpp" -#include "AU/CoreAudioUtilityClasses/CAAUParameter.cpp" -#include "AU/CoreAudioUtilityClasses/CAAudioChannelLayout.cpp" -#include "AU/CoreAudioUtilityClasses/CAMutex.cpp" -#include "AU/CoreAudioUtilityClasses/CAStreamBasicDescription.cpp" -#include "AU/CoreAudioUtilityClasses/CAVectorUnit.cpp" -#include "AU/CoreAudioUtilityClasses/ComponentBase.cpp" -#include "AU/CoreAudioUtilityClasses/MusicDeviceBase.cpp" +#if ! defined (MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 +// These constants are only defined in the macOS 11+ SDKs + +enum MIDICVStatus : unsigned int +{ + kMIDICVStatusNoteOff = 0x8, + kMIDICVStatusNoteOn = 0x9, + kMIDICVStatusPolyPressure = 0xA, + kMIDICVStatusControlChange = 0xB, + kMIDICVStatusProgramChange = 0xC, + kMIDICVStatusChannelPressure = 0xD, + kMIDICVStatusPitchBend = 0xE, + kMIDICVStatusRegisteredPNC = 0x0, + kMIDICVStatusAssignablePNC = 0x1, + kMIDICVStatusRegisteredControl = 0x2, + kMIDICVStatusAssignableControl = 0x3, + kMIDICVStatusRelRegisteredControl = 0x4, + kMIDICVStatusRelAssignableControl = 0x5, + kMIDICVStatusPerNotePitchBend = 0x6, + kMIDICVStatusPerNoteMgmt = 0xF +}; + +#endif + +#include "AU/AudioUnitSDK/AUBase.cpp" +#include "AU/AudioUnitSDK/AUBuffer.cpp" +#include "AU/AudioUnitSDK/AUBufferAllocator.cpp" +#include "AU/AudioUnitSDK/AUEffectBase.cpp" +#include "AU/AudioUnitSDK/AUInputElement.cpp" +#include "AU/AudioUnitSDK/AUMIDIBase.cpp" +#include "AU/AudioUnitSDK/AUMIDIEffectBase.cpp" +#include "AU/AudioUnitSDK/AUOutputElement.cpp" +#include "AU/AudioUnitSDK/AUPlugInDispatch.cpp" +#include "AU/AudioUnitSDK/AUScopeElement.cpp" +#include "AU/AudioUnitSDK/ComponentBase.cpp" +#include "AU/AudioUnitSDK/MusicDeviceBase.cpp" #undef verify #undef verify_noerr diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp b/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp index 0eaf4685..e4c5c25b 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp @@ -44,6 +44,8 @@ JUCE_CREATE_APPLICATION_DEFINE(juce::StandaloneFilterApp) #endif -JUCE_MAIN_FUNCTION_DEFINITION +#if ! JUCE_USE_CUSTOM_PLUGIN_STANDALONE_ENTRYPOINT + JUCE_MAIN_FUNCTION_DEFINITION +#endif #endif diff --git a/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h b/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h index a5b7a1f5..50dfd51f 100644 --- a/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h +++ b/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h @@ -28,17 +28,18 @@ namespace juce { -inline AudioProcessor* JUCE_API JUCE_CALLTYPE createPluginFilterOfType (AudioProcessor::WrapperType type) +inline std::unique_ptr createPluginFilterOfType (AudioProcessor::WrapperType type) { + PluginHostType::jucePlugInClientCurrentWrapperType = type; AudioProcessor::setTypeOfNextNewPlugin (type); - AudioProcessor* const pluginInstance = ::createPluginFilter(); + auto pluginInstance = rawToUniquePtr (::createPluginFilter()); AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Undefined); // your createPluginFilter() method must return an object! jassert (pluginInstance != nullptr && pluginInstance->wrapperType == type); #if JucePlugin_Enable_ARA - jassert (dynamic_cast (pluginInstance) != nullptr); + jassert (dynamic_cast (pluginInstance.get()) != nullptr); #endif return pluginInstance; diff --git a/modules/juce_audio_plugin_client/utility/juce_LinuxMessageThread.h b/modules/juce_audio_plugin_client/utility/juce_LinuxMessageThread.h index 646d0728..267a86fe 100644 --- a/modules/juce_audio_plugin_client/utility/juce_LinuxMessageThread.h +++ b/modules/juce_audio_plugin_client/utility/juce_LinuxMessageThread.h @@ -25,8 +25,6 @@ #if JUCE_LINUX || JUCE_BSD -#include - namespace juce { @@ -34,15 +32,15 @@ namespace juce bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); /** @internal */ -class MessageThread +class MessageThread : public Thread { public: - MessageThread() + MessageThread() : Thread ("JUCE Plugin Message Thread") { start(); } - ~MessageThread() + ~MessageThread() override { MessageManager::getInstance()->stopDispatchLoop(); stop(); @@ -50,51 +48,37 @@ public: void start() { - if (isRunning()) - stop(); - - shouldExit = false; - - thread = std::thread { [this] - { - Thread::setCurrentThreadPriority (7); - Thread::setCurrentThreadName ("JUCE Plugin Message Thread"); - - MessageManager::getInstance()->setCurrentThreadAsMessageThread(); - XWindowSystem::getInstance(); + startThread (Priority::high); - threadInitialised.signal(); - - for (;;) - { - if (! dispatchNextMessageOnSystemQueue (true)) - Thread::sleep (1); - - if (shouldExit) - break; - } - } }; - - threadInitialised.wait(); + // Wait for setCurrentThreadAsMessageThread() and getInstance to be executed + // before leaving this method + threadInitialised.wait (10000); } void stop() { - if (! isRunning()) - return; - - shouldExit = true; - thread.join(); + signalThreadShouldExit(); + stopThread (-1); } - bool isRunning() const noexcept { return thread.joinable(); } + bool isRunning() const noexcept { return isThreadRunning(); } -private: - WaitableEvent threadInitialised; - std::thread thread; + void run() override + { + MessageManager::getInstance()->setCurrentThreadAsMessageThread(); + XWindowSystem::getInstance(); - std::atomic shouldExit { false }; + threadInitialised.signal(); + while (! threadShouldExit()) + { + if (! dispatchNextMessageOnSystemQueue (true)) + Thread::sleep (1); + } + } + +private: + WaitableEvent threadInitialised; JUCE_DECLARE_NON_MOVEABLE (MessageThread) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageThread) }; diff --git a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp index 0c2e7a17..f6b4b268 100644 --- a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp +++ b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp @@ -56,7 +56,7 @@ namespace juce const auto juce_strcat = [] (auto&& head, auto&&... tail) { strcat_s (head, numElementsInArray (head), tail...); }; const auto juce_sscanf = [] (auto&&... args) { sscanf_s (args...); }; #else - const auto juce_sprintf = [] (auto&&... args) { sprintf (args...); }; + const auto juce_sprintf = [] (auto&& head, auto&&... tail) { snprintf (head, (size_t) numElementsInArray (head), tail...); }; const auto juce_strcpy = [] (auto&&... args) { strcpy (args...); }; const auto juce_strcat = [] (auto&&... args) { strcat (args...); }; const auto juce_sscanf = [] (auto&&... args) { sscanf (args...); }; @@ -134,7 +134,10 @@ namespace juce #if JucePlugin_Build_VST bool JUCE_API handleManufacturerSpecificVST2Opcode (int32 index, pointer_sized_int value, void* ptr, float); - bool JUCE_API handleManufacturerSpecificVST2Opcode (int32 index, pointer_sized_int value, void* ptr, float) + bool JUCE_API handleManufacturerSpecificVST2Opcode ([[maybe_unused]] int32 index, + [[maybe_unused]] pointer_sized_int value, + [[maybe_unused]] void* ptr, + float) { #if VST3_REPLACEMENT_AVAILABLE if ((index == (int32) ByteOrder::bigEndianInt ("stCA") || index == (int32) ByteOrder::bigEndianInt ("stCa")) @@ -145,8 +148,6 @@ namespace juce ::memcpy (ptr, fuid, 16); return true; } - #else - ignoreUnused (index, value, ptr); #endif return false; } diff --git a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp index 9ba57bea..3e5c029b 100644 --- a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp +++ b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp @@ -64,10 +64,8 @@ void AudioPluginFormatManager::addDefaultFormats() #if JUCE_DEBUG // you should only call this method once! - for (auto* format : formats) + for (auto* format [[maybe_unused]] : formats) { - ignoreUnused (format); - #if HAS_VST jassert (dynamic_cast (format) == nullptr); #endif diff --git a/modules/juce_audio_processors/format_types/LV2_SDK/juce_lv2_config.h b/modules/juce_audio_processors/format_types/LV2_SDK/juce_lv2_config.h index 8f2260d0..07ce919a 100644 --- a/modules/juce_audio_processors/format_types/LV2_SDK/juce_lv2_config.h +++ b/modules/juce_audio_processors/format_types/LV2_SDK/juce_lv2_config.h @@ -67,7 +67,7 @@ #define LILV_DEFAULT_LV2_PATH \ "%APPDATA%\\LV2" LILV_PATH_SEP \ "%COMMONPROGRAMFILES%\\LV2" - #elif JUCE_LINUX || JUCE_ANDROID + #elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID #define LILV_DEFAULT_LV2_PATH \ "~/.lv2" LILV_PATH_SEP \ "/usr/lib/lv2" LILV_PATH_SEP \ diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index e5d40290..ef7b30ad 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -179,14 +179,15 @@ namespace AudioUnitFormatHelpers return false; } - static bool getComponentDescFromFile (const String& fileOrIdentifier, AudioComponentDescription& desc, - String& name, String& version, String& manufacturer) + static bool getComponentDescFromFile ([[maybe_unused]] const String& fileOrIdentifier, + [[maybe_unused]] AudioComponentDescription& desc, + [[maybe_unused]] String& name, + [[maybe_unused]] String& version, + [[maybe_unused]] String& manufacturer) { zerostruct (desc); #if JUCE_IOS - ignoreUnused (fileOrIdentifier, name, version, manufacturer); - return false; #else const File file (fileOrIdentifier); @@ -434,7 +435,7 @@ namespace AudioUnitFormatHelpers } } -static bool hasARAExtension (AudioUnit audioUnit) +static bool hasARAExtension ([[maybe_unused]] AudioUnit audioUnit) { #if JUCE_PLUGINHOST_ARA UInt32 propertySize = sizeof (ARA::ARAAudioUnitFactory); @@ -449,8 +450,6 @@ static bool hasARAExtension (AudioUnit audioUnit) if ((status == noErr) && (propertySize == sizeof (ARA::ARAAudioUnitFactory)) && ! isWriteable) return true; - #else - ignoreUnused (audioUnit); #endif return false; @@ -465,7 +464,7 @@ using AudioUnitUniquePtr = std::unique_ptr, Aud using AudioUnitSharedPtr = std::shared_ptr>; using AudioUnitWeakPtr = std::weak_ptr>; -static std::shared_ptr getARAFactory (AudioUnitSharedPtr audioUnit) +static std::shared_ptr getARAFactory ([[maybe_unused]] AudioUnitSharedPtr audioUnit) { #if JUCE_PLUGINHOST_ARA jassert (audioUnit != nullptr); @@ -491,8 +490,6 @@ static std::shared_ptr getARAFactory (AudioUnitSharedPtr [owningAuPtr = std::move (audioUnit)]() {}); } } - #else - ignoreUnused (audioUnit); #endif return {}; @@ -1137,24 +1134,20 @@ public: return false; // did anything actually change - if (layoutHasChanged) - { - bool success = (AudioUnitInitialize (audioUnit) == noErr); - - // Some plug-ins require the LayoutTag to be set after initialization - if (success) - success = syncBusLayouts (layouts, true, layoutHasChanged); + if (! layoutHasChanged) + return true; - AudioUnitUninitialize (audioUnit); + // Some plug-ins require the LayoutTag to be set after initialization + const auto success = (AudioUnitInitialize (audioUnit) == noErr) + && syncBusLayouts (layouts, true, layoutHasChanged); - if (! success) - // make sure that the layout is back to it's original state - syncBusLayouts (getBusesLayout(), false, layoutHasChanged); + AudioUnitUninitialize (audioUnit); - return success; - } + if (! success) + // make sure that the layout is back to its original state + syncBusLayouts (getBusesLayout(), false, layoutHasChanged); - return true; + return success; } //============================================================================== @@ -2297,43 +2290,43 @@ private: if (p != nullptr) *p = value; } - OSStatus getBeatAndTempo (Float64* outCurrentBeat, Float64* outCurrentTempo) const + /* If the AudioPlayHead is available, and has valid PositionInfo, this will return the result + of calling the specified getter on that PositionInfo. Otherwise, this will return a + default-constructed instance of the same type. + + For getters that return an Optional, this function will return a nullopt if the playhead or + position info is invalid. + + For getters that return a bool, this function will return false if the playhead or position + info is invalid. + */ + template + Result getFromPlayHead (Result (AudioPlayHead::PositionInfo::* member)() const) const { if (auto* ph = getPlayHead()) - { if (const auto pos = ph->getPosition()) - { - setIfNotNull (outCurrentBeat, pos->getPpqPosition().orFallback (0.0)); - setIfNotNull (outCurrentTempo, pos->getBpm().orFallback (0.0)); - return noErr; - } - } + return ((*pos).*member)(); + + return {}; + } - setIfNotNull (outCurrentBeat, 0); - setIfNotNull (outCurrentTempo, 120.0); + OSStatus getBeatAndTempo (Float64* outCurrentBeat, Float64* outCurrentTempo) const + { + setIfNotNull (outCurrentBeat, getFromPlayHead (&AudioPlayHead::PositionInfo::getPpqPosition).orFallback (0)); + setIfNotNull (outCurrentTempo, getFromPlayHead (&AudioPlayHead::PositionInfo::getBpm).orFallback (120.0)); return noErr; } OSStatus getMusicalTimeLocation (UInt32* outDeltaSampleOffsetToNextBeat, Float32* outTimeSig_Numerator, UInt32* outTimeSig_Denominator, Float64* outCurrentMeasureDownBeat) const { - if (auto* ph = getPlayHead()) - { - if (const auto pos = ph->getPosition()) - { - const auto signature = pos->getTimeSignature().orFallback (AudioPlayHead::TimeSignature{}); - setIfNotNull (outDeltaSampleOffsetToNextBeat, (UInt32) 0); //xxx - setIfNotNull (outTimeSig_Numerator, (UInt32) signature.numerator); - setIfNotNull (outTimeSig_Denominator, (UInt32) signature.denominator); - setIfNotNull (outCurrentMeasureDownBeat, pos->getPpqPositionOfLastBarStart().orFallback (0.0)); //xxx wrong - return noErr; - } - } + setIfNotNull (outDeltaSampleOffsetToNextBeat, (UInt32) 0); //xxx + setIfNotNull (outCurrentMeasureDownBeat, getFromPlayHead (&AudioPlayHead::PositionInfo::getPpqPositionOfLastBarStart).orFallback (0.0)); + + const auto signature = getFromPlayHead (&AudioPlayHead::PositionInfo::getTimeSignature).orFallback (AudioPlayHead::TimeSignature{}); + setIfNotNull (outTimeSig_Numerator, (UInt32) signature.numerator); + setIfNotNull (outTimeSig_Denominator, (UInt32) signature.denominator); - setIfNotNull (outDeltaSampleOffsetToNextBeat, (UInt32) 0); - setIfNotNull (outTimeSig_Numerator, (UInt32) 4); - setIfNotNull (outTimeSig_Denominator, (UInt32) 4); - setIfNotNull (outCurrentMeasureDownBeat, 0); return noErr; } @@ -2341,34 +2334,16 @@ private: Float64* outCurrentSampleInTimeLine, Boolean* outIsCycling, Float64* outCycleStartBeat, Float64* outCycleEndBeat) { - if (auto* ph = getPlayHead()) - { - AudioPlayHead::CurrentPositionInfo result; - - if (ph->getCurrentPosition (result)) - { - setIfNotNull (outIsPlaying, result.isPlaying); + const auto nowPlaying = getFromPlayHead (&AudioPlayHead::PositionInfo::getIsPlaying); + setIfNotNull (outIsPlaying, nowPlaying); + setIfNotNull (outTransportStateChanged, std::exchange (wasPlaying, nowPlaying) != nowPlaying); + setIfNotNull (outCurrentSampleInTimeLine, getFromPlayHead (&AudioPlayHead::PositionInfo::getTimeInSamples).orFallback (0)); + setIfNotNull (outIsCycling, getFromPlayHead (&AudioPlayHead::PositionInfo::getIsLooping)); - if (outTransportStateChanged != nullptr) - { - *outTransportStateChanged = result.isPlaying != wasPlaying; - wasPlaying = result.isPlaying; - } + const auto loopPoints = getFromPlayHead (&AudioPlayHead::PositionInfo::getLoopPoints).orFallback (AudioPlayHead::LoopPoints{}); + setIfNotNull (outCycleStartBeat, loopPoints.ppqStart); + setIfNotNull (outCycleEndBeat, loopPoints.ppqEnd); - setIfNotNull (outCurrentSampleInTimeLine, result.timeInSamples); - setIfNotNull (outIsCycling, result.isLooping); - setIfNotNull (outCycleStartBeat, result.ppqLoopStart); - setIfNotNull (outCycleEndBeat, result.ppqLoopEnd); - return noErr; - } - } - - setIfNotNull (outIsPlaying, false); - setIfNotNull (outTransportStateChanged, false); - setIfNotNull (outCurrentSampleInTimeLine, 0); - setIfNotNull (outIsCycling, false); - setIfNotNull (outCycleStartBeat, 0.0); - setIfNotNull (outCycleEndBeat, 0.0); return noErr; } @@ -2662,13 +2637,12 @@ public: } } - void embedViewController (JUCE_IOS_MAC_VIEW* pluginView, const CGSize& size) + void embedViewController (JUCE_IOS_MAC_VIEW* pluginView, [[maybe_unused]] const CGSize& size) { wrapper.setView (pluginView); waitingForViewCallback = false; #if JUCE_MAC - ignoreUnused (size); if (pluginView != nil) wrapper.resizeToFitView(); #else @@ -2704,7 +2678,7 @@ private: bool waitingForViewCallback = false; - bool createView (bool createGenericViewIfNeeded) + bool createView ([[maybe_unused]] bool createGenericViewIfNeeded) { JUCE_IOS_MAC_VIEW* pluginView = nil; UInt32 dataSize = 0; @@ -2778,8 +2752,6 @@ private: pluginView = [[AUGenericView alloc] initWithAudioUnit: plugin.audioUnit]; } - #else - ignoreUnused (createGenericViewIfNeeded); #endif wrapper.setView (pluginView); diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index cec1528a..6121dd84 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -384,10 +384,8 @@ public: void getCurrentProgramStateInformation (MemoryBlock& destData) override { getStateInformation (destData); } void setCurrentProgramStateInformation (const void* data, int sizeInBytes) override { setStateInformation (data, sizeInBytes); } - void setStateInformation (const void* data, int sizeInBytes) override + void setStateInformation (const void* data, [[maybe_unused]] int sizeInBytes) override { - ignoreUnused (sizeInBytes); - auto* p = static_cast (data); for (int i = 0; i < getParameters().size(); ++i) diff --git a/modules/juce_audio_processors/format_types/juce_LV2Common.h b/modules/juce_audio_processors/format_types/juce_LV2Common.h index d3f3275d..92a5a987 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2Common.h +++ b/modules/juce_audio_processors/format_types/juce_LV2Common.h @@ -615,6 +615,55 @@ static inline std::vector findStableBusOrder (const String& mainGro return result; } +/* See https://www.w3.org/TeamSubmission/turtle/#sec-grammar-grammar +*/ +static inline bool isNameStartChar (juce_wchar input) +{ + return ('A' <= input && input <= 'Z') + || input == '_' + || ('a' <= input && input <= 'z') + || (0x000c0 <= input && input <= 0x000d6) + || (0x000d8 <= input && input <= 0x000f6) + || (0x000f8 <= input && input <= 0x000ff) + || (0x00370 <= input && input <= 0x0037d) + || (0x0037f <= input && input <= 0x01fff) + || (0x0200c <= input && input <= 0x0200d) + || (0x02070 <= input && input <= 0x0218f) + || (0x02c00 <= input && input <= 0x02fef) + || (0x03001 <= input && input <= 0x0d7ff) + || (0x0f900 <= input && input <= 0x0fdcf) + || (0x0fdf0 <= input && input <= 0x0fffd) + || (0x10000 <= input && input <= 0xeffff); +} + +static inline bool isNameChar (juce_wchar input) +{ + return isNameStartChar (input) + || input == '-' + || ('0' <= input && input <= '9') + || input == 0x000b7 + || (0x00300 <= input && input <= 0x0036f) + || (0x0203f <= input && input <= 0x02040); +} + +static inline String sanitiseStringAsTtlName (const String& input) +{ + if (input.isEmpty()) + return {}; + + std::vector sanitised; + sanitised.reserve (static_cast (input.length())); + + sanitised.push_back (isNameStartChar (input[0]) ? input[0] : '_'); + + std::for_each (std::begin (input) + 1, std::end (input), [&] (juce_wchar x) + { + sanitised.push_back (isNameChar (x) ? x : '_'); + }); + + return String (CharPointer_UTF32 { sanitised.data() }, sanitised.size()); +} + } } diff --git a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp index 9ac149d7..4ef7f4b3 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp @@ -944,9 +944,10 @@ struct WorkSubmitter CriticalSection* workMutex; }; -template ::value, int> = 0> +template static auto toChars (Trivial value) { + static_assert (std::is_trivial_v); std::array result; writeUnaligned (result.data(), value); return result; @@ -956,7 +957,7 @@ template class WorkQueue { public: - static_assert (std::is_trivial::value, "Context must be copyable as bytes"); + static_assert (std::is_trivial_v, "Context must be copyable as bytes"); explicit WorkQueue (int size) : fifo (size), data (static_cast (size)) {} @@ -1277,10 +1278,8 @@ private: LV2_Options_Option* options, LV2_Worker_Schedule* schedule, LV2_Resize_Port_Resize* resize, - LV2_Log_Log* log) + [[maybe_unused]] LV2_Log_Log* log) { - ignoreUnused (log); - return { LV2_Feature { LV2_STATE__loadDefaultState, nullptr }, LV2_Feature { LV2_BUF_SIZE__boundedBlockLength, nullptr }, LV2_Feature { LV2_URID__map, map }, @@ -1840,7 +1839,12 @@ class World public: World() : world (lilv_world_new()) {} - void loadAll() { lilv_world_load_all (world.get()); } + void loadAllFromPaths (const NodeString& paths) + { + lilv_world_set_option (world.get(), LILV_OPTION_LV2_PATH, paths.get()); + lilv_world_load_all (world.get()); + } + void loadBundle (const NodeUri& uri) { lilv_world_load_bundle (world.get(), uri.get()); } void unloadBundle (const NodeUri& uri) { lilv_world_unload_bundle (world.get(), uri.get()); } @@ -2507,7 +2511,7 @@ public: // In this case, we find the closest label by searching the midpoints of the scale // point values. const auto index = std::distance (midPoints.begin(), - std::lower_bound (midPoints.begin(), midPoints.end(), normalisedValue)); + std::lower_bound (midPoints.begin(), midPoints.end(), denormalised)); jassert (isPositiveAndBelow (index, info.scalePoints.size())); return info.scalePoints[(size_t) index].label; } @@ -2549,6 +2553,7 @@ private: return {}; std::vector result; + result.reserve (set.size() - 1); for (auto it = std::next (set.begin()); it != set.end(); ++it) result.push_back ((std::prev (it)->value + it->value) * 0.5f); @@ -2866,11 +2871,10 @@ private: ports.forEachPort ([&] (const PortHeader& header) { - const auto emplaced = result.emplace (header.symbol, header.index); + [[maybe_unused]] const auto emplaced = result.emplace (header.symbol, header.index); // This will complain if there are duplicate port symbols. jassert (emplaced.second); - ignoreUnused (emplaced); }); return result; @@ -3656,8 +3660,8 @@ private: union Data { - static_assert (std::is_trivial::value, "PortBacking must be trivial"); - static_assert (std::is_trivial::value, "PatchBacking must be trivial"); + static_assert (std::is_trivial_v, "PortBacking must be trivial"); + static_assert (std::is_trivial_v, "PatchBacking must be trivial"); explicit Data (PortBacking p) : port (p) {} explicit Data (PatchBacking p) : patch (p) {} @@ -4877,10 +4881,8 @@ private: : freeWheelingPort->info.min; } - void pushMessage (MessageHeader header, uint32_t size, const void* data) + void pushMessage (MessageHeader header, [[maybe_unused]] uint32_t size, const void* data) { - ignoreUnused (size); - if (header.protocol == 0 || header.protocol == instance->urids.mLV2_UI__floatProtocol) { const auto value = readUnaligned (data); @@ -5187,7 +5189,7 @@ class LV2PluginFormat::Pimpl public: Pimpl() { - world->loadAll(); + loadAllPluginsFromPaths (getDefaultLocationsToSearch()); const auto tempFile = lv2ResourceFolder.getFile(); @@ -5250,9 +5252,9 @@ public: return findPluginByUri (description.fileOrIdentifier) != nullptr; } - StringArray searchPathsForPlugins (const FileSearchPath&, bool, bool) + StringArray searchPathsForPlugins (const FileSearchPath& paths, bool, bool) { - world->loadAll(); + loadAllPluginsFromPaths (paths); StringArray result; @@ -5262,7 +5264,30 @@ public: return result; } - FileSearchPath getDefaultLocationsToSearch() { return {}; } + FileSearchPath getDefaultLocationsToSearch() + { + #if JUCE_MAC + return { "~/Library/Audio/Plug-Ins/LV2;" + "~/.lv2;" + "/usr/local/lib/lv2;" + "/usr/lib/lv2;" + "/Library/Audio/Plug-Ins/LV2;" }; + #elif JUCE_WINDOWS + return { "%APPDATA%\\LV2;" + "%COMMONPROGRAMFILES%\\LV2" }; + #else + #if JUCE_64BIT + if (File ("/usr/lib64/lv2").exists() || File ("/usr/local/lib64/lv2").exists()) + return { "~/.lv2;" + "/usr/lib64/lv2;" + "/usr/local/lib64/lv2" }; + #endif + + return { "~/.lv2;" + "/usr/lib/lv2;" + "/usr/local/lib/lv2" }; + #endif + } const LilvUI* findEmbeddableUi (const lv2_host::Uis* pluginUis, std::true_type) { @@ -5455,6 +5480,12 @@ public: } private: + void loadAllPluginsFromPaths (const FileSearchPath& path) + { + const auto joined = path.toStringWithSeparator (LILV_PATH_SEP); + world->loadAllFromPaths (world->newString (joined.toRawUTF8())); + } + struct Free { void operator() (char* ptr) const noexcept { free (ptr); } }; using StringPtr = std::unique_ptr; diff --git a/modules/juce_audio_processors/format_types/juce_LV2SupportLibs.cpp b/modules/juce_audio_processors/format_types/juce_LV2SupportLibs.cpp index a4c269af..bc81cdb6 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2SupportLibs.cpp +++ b/modules/juce_audio_processors/format_types/juce_LV2SupportLibs.cpp @@ -50,6 +50,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4100 4200 4244 4267 4389 4702 4706 4800 4996 63 extern "C" { +#include + #define is_windows_path serd_is_windows_path #include "serd/src/base64.c" @@ -57,6 +59,20 @@ extern "C" #include "serd/src/env.c" #include "serd/src/n3.c" #undef TRY + +// node.c will replace isnan and isinf with _isnan and _finite if the former symbols are undefined. +// MinGW declares these as normal functions rather than as preprocessor definitions, causing the build to fail. +#if defined (_WIN32) && defined (__GNUC__) + +namespace Utils +{ + inline int _isnan (double x) noexcept { return isnan (x); } + inline int _finite (double x) noexcept { return ! isinf (x); } +} // namespace Utils + +using namespace Utils; +#endif + #include "serd/src/node.c" #include "serd/src/reader.c" #include "serd/src/string.c" diff --git a/modules/juce_audio_processors/format_types/juce_VST3Common.h b/modules/juce_audio_processors/format_types/juce_VST3Common.h index 77544c7a..cf7f2a81 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Common.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Common.h @@ -627,7 +627,7 @@ static bool validateLayouts (Iterator first, Iterator last, const std::vectornumChannels, [] (auto* ptr) { return ptr == nullptr; }); // Null channels are allowed if the bus is inactive - if ((mapIterator->isHostActive() && anyChannelIsNull) || ((int) mapIterator->size() != it->numChannels)) + if (mapIterator->isHostActive() && (anyChannelIsNull || (int) mapIterator->size() != it->numChannels)) return false; } @@ -1261,7 +1261,7 @@ private: const auto controlEvent = toVst3ControlEvent (msg); - if (! controlEvent.hasValue()) + if (! controlEvent.has_value()) return false; const auto controlParamID = midiMapping->getMapping (createSafeChannel (msg.getChannel()), @@ -1561,7 +1561,7 @@ private: Steinberg::Vst::ParamValue paramValue; }; - static Optional toVst3ControlEvent (const MidiMessage& msg) + static std::optional toVst3ControlEvent (const MidiMessage& msg) { if (msg.isController()) return Vst3MidiControlEvent { (Steinberg::Vst::CtrlNumber) msg.getControllerNumber(), msg.getControllerValue() / 127.0 }; diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h index 297776b3..cd757c39 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Headers.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Headers.h @@ -34,6 +34,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_LEVEL_MSVC (0, 4505 4702 6011 6031 6221 6386 6387 633 JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-copy-dtor", "-Wnon-virtual-dtor", + "-Wdeprecated", "-Wreorder", "-Wunsequenced", "-Wint-to-pointer-cast", @@ -67,7 +68,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-copy-dtor", "-Wtype-limits", "-Wcpp", "-W#warnings", - "-Wmaybe-uninitialized") + "-Wmaybe-uninitialized", + "-Wunused-but-set-variable") #undef DEVELOPMENT #define DEVELOPMENT 0 // This avoids a Clang warning in Steinberg code about unused values diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index cfa7b3cf..7865d50b 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -375,9 +375,8 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 tresult PLUGIN_API setDirty (TBool) override; //============================================================================== - tresult PLUGIN_API requestOpenEditor (FIDString name) override + tresult PLUGIN_API requestOpenEditor ([[maybe_unused]] FIDString name) override { - ignoreUnused (name); jassertfalse; return kResultFalse; } @@ -762,9 +761,9 @@ private: const auto iter = attributes.find (attr); if (iter != attributes.end()) - iter->second = Attribute (std::move (value)); + iter->second = Attribute (std::forward (value)); else - attributes.emplace (attr, Attribute (std::move (value))); + attributes.emplace (attr, Attribute (std::forward (value))); return kResultTrue; } @@ -1388,7 +1387,7 @@ static int compareWithString (Type (&charArray)[N], const String& str) } template -static void forEachARAFactory (IPluginFactory* pluginFactory, Callback&& cb) +static void forEachARAFactory ([[maybe_unused]] IPluginFactory* pluginFactory, [[maybe_unused]] Callback&& cb) { #if JUCE_PLUGINHOST_ARA && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) const auto numClasses = pluginFactory->countClasses(); @@ -1404,12 +1403,11 @@ static void forEachARAFactory (IPluginFactory* pluginFactory, Callback&& cb) break; } } - #else - ignoreUnused (pluginFactory, cb); #endif } -static std::shared_ptr getARAFactory (Steinberg::IPluginFactory* pluginFactory, const String& pluginName) +static std::shared_ptr getARAFactory ([[maybe_unused]] Steinberg::IPluginFactory* pluginFactory, + [[maybe_unused]] const String& pluginName) { std::shared_ptr factory; @@ -1432,8 +1430,6 @@ static std::shared_ptr getARAFactory (Steinberg::IPluginF return true; }); - #else - ignoreUnused (pluginFactory, pluginName); #endif return factory; @@ -1667,8 +1663,8 @@ private: return; } - const auto attachedResult = view->attached ((void*) pluginHandle, defaultVST3WindowType); - ignoreUnused (warnOnFailure (attachedResult)); + [[maybe_unused]] const auto attachedResult = view->attached ((void*) pluginHandle, defaultVST3WindowType); + [[maybe_unused]] const auto warning = warnOnFailure (attachedResult); if (attachedResult == kResultOk) attachedCalled = true; @@ -1689,11 +1685,10 @@ private: { if (scaleInterface != nullptr) { - const auto result = scaleInterface->setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getEffectiveScale()); - ignoreUnused (result); + [[maybe_unused]] const auto result = scaleInterface->setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getEffectiveScale()); #if ! JUCE_MAC - ignoreUnused (warnOnFailure (result)); + [[maybe_unused]] const auto warning = warnOnFailure (result); #endif } } @@ -1885,8 +1880,7 @@ struct VST3ComponentHolder if (classIdx >= 0) { PClassInfo info; - bool success = (factory->getClassInfo (classIdx, &info) == kResultOk); - ignoreUnused (success); + [[maybe_unused]] bool success = (factory->getClassInfo (classIdx, &info) == kResultOk); jassert (success); VSTComSmartPtr pf2; @@ -2217,6 +2211,7 @@ public: void setValue (float newValue) override { pluginInstance.cachedParamValues.set (vstParamIndex, newValue); + pluginInstance.parameterDispatcher.push (vstParamIndex, newValue); } /* If we're syncing the editor to the processor, the processor won't need to @@ -2392,7 +2387,7 @@ public: auto configureParameters = [this] { - refreshParameterList(); + initialiseParameterList(); synchroniseStates(); syncProgramNames(); }; @@ -2511,6 +2506,11 @@ public: using namespace Vst; + // If the plugin has already been activated (prepareToPlay has been called twice without + // a matching releaseResources call) deactivate it so that the speaker layout and bus + // activation can be updated safely. + deactivate(); + ProcessSetup setup; setup.symbolicSampleSize = isUsingDoublePrecision() ? kSample64 : kSample32; setup.maxSamplesPerBlock = estimatedSamplesPerBlock; @@ -2565,19 +2565,7 @@ public: void releaseResources() override { const SpinLock::ScopedLockType lock (processMutex); - - if (! isActive) - return; // Avoids redundantly calling things like setActive - - isActive = false; - - if (processor != nullptr) - warnOnFailureIfImplemented (processor->setProcessing (false)); - - if (holder->component != nullptr) - warnOnFailure (holder->component->setActive (false)); - - setStateForAllMidiBuses (false); + deactivate(); } bool supportsDoublePrecisionProcessing() const override @@ -2693,11 +2681,6 @@ public: inputParameterChanges->set (cachedParamValues.getParamID (index), value); }); - inputParameterChanges->forEach ([&] (Steinberg::int32 index, float value) - { - parameterDispatcher.push (index, value); - }); - processor->process (data); outputParameterChanges->forEach ([&] (Steinberg::int32 index, float value) @@ -3098,12 +3081,28 @@ public: } /** @note Not applicable to VST3 */ - void setCurrentProgramStateInformation (const void* data, int sizeInBytes) override + void setCurrentProgramStateInformation ([[maybe_unused]] const void* data, + [[maybe_unused]] int sizeInBytes) override { - ignoreUnused (data, sizeInBytes); } private: + void deactivate() + { + if (! isActive) + return; + + isActive = false; + + if (processor != nullptr) + warnOnFailureIfImplemented (processor->setProcessing (false)); + + if (holder->component != nullptr) + warnOnFailure (holder->component->setActive (false)); + + setStateForAllMidiBuses (false); + } + //============================================================================== #if JUCE_LINUX || JUCE_BSD SharedResourcePointer runLoop; @@ -3213,7 +3212,7 @@ private: } } - void refreshParameterList() override + void initialiseParameterList() { AudioProcessorParameterGroup newParameterTree; diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index fbbc1a4f..1f38a2a9 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -66,9 +66,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4355) #ifndef WM_APPCOMMAND #define WM_APPCOMMAND 0x0319 #endif - - extern "C" void _fpreset(); - extern "C" void _clearfp(); #elif ! JUCE_WINDOWS static void _fpreset() {} static void _clearfp() {} @@ -707,7 +704,7 @@ struct ModuleHandle : public ReferenceCountedObject if (auto hGlob = LoadResource (dllModule, res)) { auto* data = static_cast (LockResource (hGlob)); - return String::fromUTF8 (data, SizeofResource (dllModule, res)); + return String::fromUTF8 (data, (int) SizeofResource (dllModule, res)); } } } @@ -829,6 +826,34 @@ static const int defaultVSTBlockSizeValue = 512; JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996) +class TempChannelPointers +{ +public: + template + auto getArrayOfModifiableWritePointers (AudioBuffer& buffer) + { + auto& pointers = getPointers (Tag{}); + + jassert (buffer.getNumChannels() <= static_cast (pointers.capacity())); + pointers.resize (jmax (pointers.size(), (size_t) buffer.getNumChannels())); + + std::copy (buffer.getArrayOfWritePointers(), + buffer.getArrayOfWritePointers() + buffer.getNumChannels(), + pointers.begin()); + + return pointers.data(); + } + +private: + template struct Tag {}; + + auto& getPointers (Tag) { return floatPointers; } + auto& getPointers (Tag) { return doublePointers; } + + std::vector floatPointers { 128 }; + std::vector doublePointers { 128 }; +}; + //============================================================================== struct VSTPluginInstance final : public AudioPluginInstance, private Timer, @@ -2026,6 +2051,7 @@ private: bool lastProcessBlockCallWasBypass = false, vstSupportsBypass = false; mutable StringArray programNames; AudioBuffer outOfPlaceBuffer; + TempChannelPointers tempChannelPointers[2]; CriticalSection midiInLock; MidiBuffer incomingMidi; @@ -2456,16 +2482,16 @@ private: { if ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0) { - vstEffect->processReplacing (vstEffect, buffer.getArrayOfWritePointers(), - buffer.getArrayOfWritePointers(), sampleFrames); + vstEffect->processReplacing (vstEffect, tempChannelPointers[0].getArrayOfModifiableWritePointers (buffer), + tempChannelPointers[1].getArrayOfModifiableWritePointers (buffer), sampleFrames); } else { outOfPlaceBuffer.setSize (vstEffect->numOutputs, sampleFrames); outOfPlaceBuffer.clear(); - vstEffect->process (vstEffect, buffer.getArrayOfWritePointers(), - outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames); + vstEffect->process (vstEffect, tempChannelPointers[0].getArrayOfModifiableWritePointers (buffer), + tempChannelPointers[1].getArrayOfModifiableWritePointers (outOfPlaceBuffer), sampleFrames); for (int i = vstEffect->numOutputs; --i >= 0;) buffer.copyFrom (i, 0, outOfPlaceBuffer.getReadPointer (i), sampleFrames); @@ -2474,8 +2500,8 @@ private: inline void invokeProcessFunction (AudioBuffer& buffer, int32 sampleFrames) { - vstEffect->processDoubleReplacing (vstEffect, buffer.getArrayOfWritePointers(), - buffer.getArrayOfWritePointers(), sampleFrames); + vstEffect->processDoubleReplacing (vstEffect, tempChannelPointers[0].getArrayOfModifiableWritePointers (buffer), + tempChannelPointers[1].getArrayOfModifiableWritePointers (buffer), sampleFrames); } //============================================================================== @@ -3002,10 +3028,8 @@ public: } //============================================================================== - void mouseDown (const MouseEvent& e) override + void mouseDown ([[maybe_unused]] const MouseEvent& e) override { - ignoreUnused (e); - #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD toFront (true); #endif @@ -3110,10 +3134,10 @@ private: pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); #if JUCE_WINDOWS - originalWndProc = 0; + originalWndProc = nullptr; auto* pluginHWND = getPluginHWND(); - if (pluginHWND == 0) + if (pluginHWND == nullptr) { isOpen = false; setSize (300, 150); @@ -3153,7 +3177,7 @@ private: { ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND }; - SetWindowPos (pluginHWND, 0, + SetWindowPos (pluginHWND, nullptr, 0, 0, rw, rh, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); @@ -3223,11 +3247,11 @@ private: JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4244) auto* pluginHWND = getPluginHWND(); - if (originalWndProc != 0 && pluginHWND != 0 && IsWindow (pluginHWND)) + if (originalWndProc != nullptr && pluginHWND != nullptr && IsWindow (pluginHWND)) SetWindowLongPtr (pluginHWND, GWLP_WNDPROC, (LONG_PTR) originalWndProc); JUCE_END_IGNORE_WARNINGS_MSVC - originalWndProc = 0; + originalWndProc = nullptr; #elif JUCE_LINUX || JUCE_BSD pluginWindow = 0; #endif @@ -3416,10 +3440,12 @@ AudioProcessorEditor* VSTPluginInstance::createEditor() #endif } -bool VSTPluginInstance::updateSizeFromEditor (int w, int h) +bool VSTPluginInstance::updateSizeFromEditor ([[maybe_unused]] int w, [[maybe_unused]] int h) { + #if ! JUCE_IOS && ! JUCE_ANDROID if (auto* editor = dynamic_cast (getActiveEditor())) return editor->updateSizeFromEditor (w, h); + #endif return false; } diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index b0ff4b67..8bbc3a36 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -61,7 +61,7 @@ namespace juce { -#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX) +#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD)) static bool arrayContainsPlugin (const OwnedArray& list, const PluginDescription& desc) @@ -220,6 +220,7 @@ private: #include "utilities/juce_AudioProcessorValueTreeState.cpp" #include "utilities/juce_PluginHostType.cpp" #include "utilities/juce_NativeScaleFactorNotifier.cpp" +#include "utilities/juce_VSTCallbackHandler.cpp" #include "utilities/ARA/juce_ARA_utils.cpp" #include "format_types/juce_LV2PluginFormat.cpp" diff --git a/modules/juce_audio_processors/juce_audio_processors.h b/modules/juce_audio_processors/juce_audio_processors.h index bf9b568d..aa618eeb 100644 --- a/modules/juce_audio_processors/juce_audio_processors.h +++ b/modules/juce_audio_processors/juce_audio_processors.h @@ -35,12 +35,12 @@ ID: juce_audio_processors vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE audio processor classes description: Classes for loading and playing VST, AU, LADSPA, or internally-generated audio processors. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_gui_extra, juce_audio_basics OSXFrameworks: CoreAudio CoreMIDI AudioToolbox diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 53aa9c3d..f5815241 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -340,7 +340,7 @@ void AudioProcessor::removeListener (AudioProcessorListener* listenerToRemove) void AudioProcessor::setPlayConfigDetails (int newNumIns, int newNumOuts, double newSampleRate, int newBlockSize) { - bool success = true; + [[maybe_unused]] bool success = true; if (getTotalNumInputChannels() != newNumIns) success &= setChannelLayoutOfBus (true, 0, AudioChannelSet::canonicalChannelSet (newNumIns)); @@ -362,7 +362,6 @@ void AudioProcessor::setPlayConfigDetails (int newNumIns, int newNumOuts, double jassert (success && newNumIns == getTotalNumInputChannels() && newNumOuts == getTotalNumOutputChannels()); setRateAndBufferSizeDetails (newSampleRate, newBlockSize); - ignoreUnused (success); } void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept @@ -442,10 +441,8 @@ void AudioProcessor::validateParameter (AudioProcessorParameter* param) #endif } -void AudioProcessor::checkForDuplicateTrimmedParamID (AudioProcessorParameter* param) +void AudioProcessor::checkForDuplicateTrimmedParamID ([[maybe_unused]] AudioProcessorParameter* param) { - ignoreUnused (param); - #if JUCE_DEBUG && ! JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING if (auto* withID = dynamic_cast (param)) { @@ -476,10 +473,8 @@ void AudioProcessor::checkForDuplicateTrimmedParamID (AudioProcessorParameter* p #endif } -void AudioProcessor::checkForDuplicateParamID (AudioProcessorParameter* param) +void AudioProcessor::checkForDuplicateParamID ([[maybe_unused]] AudioProcessorParameter* param) { - ignoreUnused (param); - #if JUCE_DEBUG if (auto* withID = dynamic_cast (param)) { @@ -491,10 +486,8 @@ void AudioProcessor::checkForDuplicateParamID (AudioProcessorParameter* param) #endif } -void AudioProcessor::checkForDuplicateGroupIDs (const AudioProcessorParameterGroup& newGroup) +void AudioProcessor::checkForDuplicateGroupIDs ([[maybe_unused]] const AudioProcessorParameterGroup& newGroup) { - ignoreUnused (newGroup); - #if JUCE_DEBUG auto groups = newGroup.getSubgroups (true); groups.add (&newGroup); @@ -598,10 +591,9 @@ void AudioProcessor::processBypassed (AudioBuffer& buffer, MidiBuffer void AudioProcessor::processBlockBypassed (AudioBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); } void AudioProcessor::processBlockBypassed (AudioBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); } -void AudioProcessor::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) +void AudioProcessor::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] MidiBuffer& midiMessages) { - ignoreUnused (buffer, midiMessages); - // If you hit this assertion then either the caller called the double // precision version of processBlock on a processor which does not support it // (i.e. supportsDoublePrecisionProcessing() returns false), or the implementation @@ -1493,6 +1485,9 @@ AudioProcessorParameter* AudioProcessor::getParamChecked (int index) const return p; } +bool AudioProcessor::canAddBus ([[maybe_unused]] bool isInput) const { return false; } +bool AudioProcessor::canRemoveBus ([[maybe_unused]] bool isInput) const { return false; } + JUCE_END_IGNORE_WARNINGS_GCC_LIKE JUCE_END_IGNORE_WARNINGS_MSVC diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index 36e9769f..b0acefa9 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h @@ -418,7 +418,7 @@ public: @param set The AudioChannelSet which is to be probed. @param currentLayout If non-null, pretend that the current layout of the AudioProcessor is currentLayout. On exit, currentLayout will be modified to - to represent the buses layouts of the AudioProcessor as if the layout + represent the buses layouts of the AudioProcessor as if the layout of the receiver had been successfully changed. This is useful as changing the layout of the receiver may change the bus layout of other buses. @@ -524,7 +524,7 @@ public: @see addBus */ - virtual bool canAddBus (bool isInput) const { ignoreUnused (isInput); return false; } + virtual bool canAddBus (bool isInput) const; /** Callback to query if the last bus can currently be removed. @@ -537,7 +537,7 @@ public: The default implementation will always return false. */ - virtual bool canRemoveBus (bool isInput) const { ignoreUnused (isInput); return false; } + virtual bool canRemoveBus (bool isInput) const; /** Dynamically request an additional bus. @@ -1361,8 +1361,8 @@ protected: void addBus (bool isInput, const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true); - JUCE_NODISCARD BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const; - JUCE_NODISCARD BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const; + [[nodiscard]] BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const; + [[nodiscard]] BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const; }; /** Callback to query if adding/removing buses currently possible. diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp index 3b88ccee..7b20407c 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp @@ -216,13 +216,11 @@ void AudioProcessorEditor::setScaleFactor (float newScale) typedef ComponentPeer* (*createUnityPeerFunctionType) (Component&); createUnityPeerFunctionType juce_createUnityPeerFn = nullptr; -ComponentPeer* AudioProcessorEditor::createNewPeer (int styleFlags, void* nativeWindow) +ComponentPeer* AudioProcessorEditor::createNewPeer ([[maybe_unused]] int styleFlags, + [[maybe_unused]] void* nativeWindow) { if (juce_createUnityPeerFn != nullptr) - { - ignoreUnused (styleFlags, nativeWindow); return juce_createUnityPeerFn (*this); - } return Component::createNewPeer (styleFlags, nativeWindow); } diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp index ea943564..5e615433 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp @@ -23,24 +23,427 @@ ============================================================================== */ +// Implementation notes: +// On macOS, calling AudioUnitInitialize will internally call AudioObjectGetPropertyData, which +// takes a mutex. +// This same mutex is taken on the audio thread, before calling the audio device's IO callback. +// This is a property of the CoreAudio implementation - we can't remove or interact directly +// with these locks in JUCE. +// +// AudioProcessor instances expect that their callback lock will be taken before calling +// processBlock or processBlockBypassed. +// This means that, to avoid deadlocks, we *always* need to make sure that the CoreAudio mutex +// is locked before taking the callback lock. +// Given that we can't interact with the CoreAudio mutex directly, on the main thread we can't +// call any function that might internally interact with CoreAudio while the callback lock is +// taken. +// In particular, be careful not to call `prepareToPlay` on a hosted AudioUnit from the main +// thread while the callback lock is taken. +// The graph implementation currently makes sure to call prepareToPlay on the main thread, +// without taking the graph's callback lock. + namespace juce { -static void updateOnMessageThread (AsyncUpdater& updater) +/* Provides a comparison function for various types that have an associated NodeID, + for use with equal_range, lower_bound etc. +*/ +class ImplicitNode { - if (MessageManager::getInstance()->isThisTheMessageThread()) - updater.handleAsyncUpdate(); - else - updater.triggerAsyncUpdate(); -} +public: + using Node = AudioProcessorGraph::Node; + using NodeID = AudioProcessorGraph::NodeID; + using NodeAndChannel = AudioProcessorGraph::NodeAndChannel; + + ImplicitNode (NodeID x) : node (x) {} + ImplicitNode (NodeAndChannel x) : ImplicitNode (x.nodeID) {} + ImplicitNode (const Node* x) : ImplicitNode (x->nodeID) {} + ImplicitNode (const std::pair>& x) : ImplicitNode (x.first) {} + + /* This is the comparison function. */ + static bool compare (ImplicitNode a, ImplicitNode b) { return a.node < b.node; } + +private: + NodeID node; +}; + +//============================================================================== +/* A copyable type holding all the nodes, and allowing fast lookup by id. */ +class Nodes +{ +public: + using Node = AudioProcessorGraph::Node; + using NodeID = AudioProcessorGraph::NodeID; + + const ReferenceCountedArray& getNodes() const { return array; } + + Node::Ptr getNodeForId (NodeID nodeID) const + { + const auto iter = std::lower_bound (array.begin(), array.end(), nodeID, ImplicitNode::compare); + return iter != array.end() && (*iter)->nodeID == nodeID ? *iter : nullptr; + } + + Node::Ptr addNode (std::unique_ptr newProcessor, const NodeID nodeID) + { + if (newProcessor == nullptr) + { + // Cannot add a null audio processor! + jassertfalse; + return {}; + } + + if (std::any_of (array.begin(), + array.end(), + [&] (auto* n) { return n->getProcessor() == newProcessor.get(); })) + { + // This audio processor has already been added to the graph! + jassertfalse; + return {}; + } + + const auto iter = std::lower_bound (array.begin(), array.end(), nodeID, ImplicitNode::compare); + + if (iter != array.end() && (*iter)->nodeID == nodeID) + { + // This nodeID has already been used for a node in the graph! + jassertfalse; + return {}; + } + + return array.insert ((int) std::distance (array.begin(), iter), + new Node { nodeID, std::move (newProcessor) }); + } + + Node::Ptr removeNode (NodeID nodeID) + { + const auto iter = std::lower_bound (array.begin(), array.end(), nodeID, ImplicitNode::compare); + return iter != array.end() && (*iter)->nodeID == nodeID + ? array.removeAndReturn ((int) std::distance (array.begin(), iter)) + : nullptr; + } + + bool operator== (const Nodes& other) const { return array == other.array; } + bool operator!= (const Nodes& other) const { return array != other.array; } + +private: + ReferenceCountedArray array; +}; + +//============================================================================== +/* A value type holding a full set of graph connections. */ +class Connections +{ +public: + using Node = AudioProcessorGraph::Node; + using NodeID = AudioProcessorGraph::NodeID; + using Connection = AudioProcessorGraph::Connection; + using NodeAndChannel = AudioProcessorGraph::NodeAndChannel; + + static constexpr auto midiChannelIndex = AudioProcessorGraph::midiChannelIndex; + + bool addConnection (const Nodes& n, const Connection& c) + { + if (! canConnect (n, c)) + return false; + + sourcesForDestination[c.destination].insert (c.source); + jassert (isConnected (c)); + return true; + } + + bool removeConnection (const Connection& c) + { + const auto iter = sourcesForDestination.find (c.destination); + return iter != sourcesForDestination.cend() && iter->second.erase (c.source) == 1; + } + + bool removeIllegalConnections (const Nodes& n) + { + auto anyRemoved = false; + + for (auto& dest : sourcesForDestination) + { + const auto initialSize = dest.second.size(); + dest.second = removeIllegalConnections (n, std::move (dest.second), dest.first); + anyRemoved |= (dest.second.size() != initialSize); + } + + return anyRemoved; + } + + bool disconnectNode (NodeID n) + { + const auto matchingDestinations = getMatchingDestinations (n); + auto result = matchingDestinations.first != matchingDestinations.second; + sourcesForDestination.erase (matchingDestinations.first, matchingDestinations.second); + + for (auto& pair : sourcesForDestination) + { + const auto range = std::equal_range (pair.second.cbegin(), pair.second.cend(), n, ImplicitNode::compare); + result |= range.first != range.second; + pair.second.erase (range.first, range.second); + } + + return result; + } + + static bool isConnectionLegal (const Nodes& n, Connection c) + { + const auto source = n.getNodeForId (c.source .nodeID); + const auto dest = n.getNodeForId (c.destination.nodeID); + + const auto sourceChannel = c.source .channelIndex; + const auto destChannel = c.destination.channelIndex; + + const auto sourceIsMIDI = AudioProcessorGraph::midiChannelIndex == sourceChannel; + const auto destIsMIDI = AudioProcessorGraph::midiChannelIndex == destChannel; + + return sourceChannel >= 0 + && destChannel >= 0 + && source != dest + && sourceIsMIDI == destIsMIDI + && source != nullptr + && (sourceIsMIDI + ? source->getProcessor()->producesMidi() + : sourceChannel < source->getProcessor()->getTotalNumOutputChannels()) + && dest != nullptr + && (destIsMIDI + ? dest->getProcessor()->acceptsMidi() + : destChannel < dest->getProcessor()->getTotalNumInputChannels()); + } + + bool canConnect (const Nodes& n, Connection c) const + { + return isConnectionLegal (n, c) && ! isConnected (c); + } + + bool isConnected (Connection c) const + { + const auto iter = sourcesForDestination.find (c.destination); + + return iter != sourcesForDestination.cend() + && iter->second.find (c.source) != iter->second.cend(); + } + + bool isConnected (NodeID srcID, NodeID destID) const + { + const auto matchingDestinations = getMatchingDestinations (destID); + + return std::any_of (matchingDestinations.first, matchingDestinations.second, [srcID] (const auto& pair) + { + const auto iter = std::lower_bound (pair.second.cbegin(), pair.second.cend(), srcID, ImplicitNode::compare); + return iter != pair.second.cend() && iter->nodeID == srcID; + }); + } + + std::set getSourceNodesForDestination (NodeID destID) const + { + const auto matchingDestinations = getMatchingDestinations (destID); + + std::set result; + std::for_each (matchingDestinations.first, matchingDestinations.second, [&] (const auto& pair) + { + for (const auto& source : pair.second) + result.insert (source.nodeID); + }); + return result; + } + + std::set getSourcesForDestination (const NodeAndChannel& p) const + { + const auto iter = sourcesForDestination.find (p); + return iter != sourcesForDestination.cend() ? iter->second : std::set{}; + } + + std::vector getConnections() const + { + std::vector result; + + for (auto& pair : sourcesForDestination) + for (const auto& source : pair.second) + result.emplace_back (source, pair.first); + + std::sort (result.begin(), result.end()); + result.erase (std::unique (result.begin(), result.end()), result.end()); + return result; + } + + bool isAnInputTo (NodeID source, NodeID dest) const + { + return getConnectedRecursive (source, dest, {}).found; + } + + bool operator== (const Connections& other) const { return sourcesForDestination == other.sourcesForDestination; } + bool operator!= (const Connections& other) const { return sourcesForDestination != other.sourcesForDestination; } + +private: + using Map = std::map>; + + struct SearchState + { + std::set visited; + bool found = false; + }; + + SearchState getConnectedRecursive (NodeID source, NodeID dest, SearchState state) const + { + state.visited.insert (dest); + + for (const auto& s : getSourceNodesForDestination (dest)) + { + if (state.found || s == source) + return { std::move (state.visited), true }; + + if (state.visited.find (s) == state.visited.cend()) + state = getConnectedRecursive (source, s, std::move (state)); + } + + return state; + } + + static std::set removeIllegalConnections (const Nodes& nodes, + std::set sources, + NodeAndChannel destination) + { + for (auto source = sources.cbegin(); source != sources.cend();) + { + if (! isConnectionLegal (nodes, { *source, destination })) + source = sources.erase (source); + else + ++source; + } + + return sources; + } + + std::pair getMatchingDestinations (NodeID destID) const + { + return std::equal_range (sourcesForDestination.cbegin(), sourcesForDestination.cend(), destID, ImplicitNode::compare); + } + + Map sourcesForDestination; +}; + +//============================================================================== +/* Settings used to prepare a node for playback. */ +struct PrepareSettings +{ + using ProcessingPrecision = AudioProcessorGraph::ProcessingPrecision; + + ProcessingPrecision precision = ProcessingPrecision::singlePrecision; + double sampleRate = 0.0; + int blockSize = 0; + + auto tie() const noexcept { return std::tie (precision, sampleRate, blockSize); } + + bool operator== (const PrepareSettings& other) const { return tie() == other.tie(); } + bool operator!= (const PrepareSettings& other) const { return tie() != other.tie(); } +}; + +//============================================================================== +/* Keeps track of the PrepareSettings applied to each node. */ +class NodeStates +{ +public: + using Node = AudioProcessorGraph::Node; + using NodeID = AudioProcessorGraph::NodeID; + + /* Called from prepareToPlay and releaseResources with the PrepareSettings that should be + used next time the graph is rebuilt. + */ + void setState (Optional newSettings) + { + const std::lock_guard lock (mutex); + next = newSettings; + } + + /* Call from the audio thread only. */ + Optional getLastRequestedSettings() const { return next; } + + /* Call from the main thread only! + + Called after updating the graph topology to prepare any currently-unprepared nodes. + + To ensure that all nodes are initialised with the same sample rate, buffer size, etc. as + the enclosing graph, we must ensure that any operation that uses these details (preparing + individual nodes) is synchronized with prepare-to-play and release-resources on the + enclosing graph. + + If the new PrepareSettings are different to the last-seen settings, all nodes will + be prepared/unprepared as necessary. If the PrepareSettings have not changed, then only + new nodes will be prepared/unprepared. + + Returns the settings that were applied to the nodes. + */ + Optional applySettings (const Nodes& n) + { + const auto settingsChanged = [this] + { + const std::lock_guard lock (mutex); + const auto result = current != next; + current = next; + return result; + }(); + + // It may look like releaseResources and prepareToPlay could race with calls to processBlock + // here, because applySettings is called from the main thread, processBlock is called from + // the audio thread (normally), and there's no explicit mutex ensuring that the calls don't + // overlap. + // However, it is part of the AudioProcessor contract that users shall not call + // processBlock, prepareToPlay, and/or releaseResources concurrently. That is, there's an + // implied mutex synchronising these functions on each AudioProcessor. + // + // Inside processBlock, we always ensure that the current RenderSequence's PrepareSettings + // match the graph's settings before attempting to call processBlock on any of the graph + // nodes; as a result, it's impossible to start calling processBlock on a node on the audio + // thread while a render sequence rebuild (including prepareToPlay/releaseResources calls) + // is already in progress here. + // + // Due to the implied mutex between prepareToPlay/releaseResources/processBlock, it's also + // impossible to receive new PrepareSettings and to start a new RenderSequence rebuild while + // a processBlock call is in progress. + + if (settingsChanged) + { + for (const auto& node : n.getNodes()) + node->getProcessor()->releaseResources(); + + preparedNodes.clear(); + } + + if (current.hasValue()) + { + for (const auto& node : n.getNodes()) + { + if (preparedNodes.find (node->nodeID) != preparedNodes.cend()) + continue; + + preparedNodes.insert (node->nodeID); + node->getProcessor()->setProcessingPrecision (node->getProcessor()->supportsDoublePrecisionProcessing() ? current->precision + : AudioProcessor::singlePrecision); + node->getProcessor()->setRateAndBufferSizeDetails (current->sampleRate, current->blockSize); + node->getProcessor()->prepareToPlay (current->sampleRate, current->blockSize); + } + } + + return current; + } + +private: + std::mutex mutex; + std::set preparedNodes; + Optional current, next; +}; + +//============================================================================== template struct GraphRenderSequence { + using Node = AudioProcessorGraph::Node; + struct Context { - FloatType** audioBuffers; - MidiBuffer* midiBuffers; AudioPlayHead* audioPlayHead; int numSamples; }; @@ -79,10 +482,10 @@ struct GraphRenderSequence currentMidiOutputBuffer.clear(); { - const Context context { renderingBuffer.getArrayOfWritePointers(), midiBuffers.begin(), audioPlayHead, numSamples }; + const Context context { audioPlayHead, numSamples }; - for (auto* op : renderOps) - op->perform (context); + for (const auto& op : renderOps) + op->process (context); } for (int i = 0; i < buffer.getNumChannels(); ++i) @@ -93,50 +496,201 @@ struct GraphRenderSequence currentAudioInputBuffer = nullptr; } + JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4661) + void addClearChannelOp (int index) { - createOp ([=] (const Context& c) { FloatVectorOperations::clear (c.audioBuffers[index], c.numSamples); }); + struct ClearOp : public RenderOp + { + explicit ClearOp (int indexIn) : index (indexIn) {} + + void prepare (FloatType* const* renderBuffer, MidiBuffer*) override + { + channelBuffer = renderBuffer[index]; + } + + void process (const Context& c) override + { + FloatVectorOperations::clear (channelBuffer, c.numSamples); + } + + FloatType* channelBuffer = nullptr; + int index = 0; + }; + + renderOps.push_back (std::make_unique (index)); } void addCopyChannelOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { FloatVectorOperations::copy (c.audioBuffers[dstIndex], - c.audioBuffers[srcIndex], - c.numSamples); }); + struct CopyOp : public RenderOp + { + explicit CopyOp (int fromIn, int toIn) : from (fromIn), to (toIn) {} + + void prepare (FloatType* const* renderBuffer, MidiBuffer*) override + { + fromBuffer = renderBuffer[from]; + toBuffer = renderBuffer[to]; + } + + void process (const Context& c) override + { + FloatVectorOperations::copy (toBuffer, fromBuffer, c.numSamples); + } + + FloatType* fromBuffer = nullptr; + FloatType* toBuffer = nullptr; + int from = 0, to = 0; + }; + + renderOps.push_back (std::make_unique (srcIndex, dstIndex)); } void addAddChannelOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { FloatVectorOperations::add (c.audioBuffers[dstIndex], - c.audioBuffers[srcIndex], - c.numSamples); }); + struct AddOp : public RenderOp + { + explicit AddOp (int fromIn, int toIn) : from (fromIn), to (toIn) {} + + void prepare (FloatType* const* renderBuffer, MidiBuffer*) override + { + fromBuffer = renderBuffer[from]; + toBuffer = renderBuffer[to]; + } + + void process (const Context& c) override + { + FloatVectorOperations::add (toBuffer, fromBuffer, c.numSamples); + } + + FloatType* fromBuffer = nullptr; + FloatType* toBuffer = nullptr; + int from = 0, to = 0; + }; + + renderOps.push_back (std::make_unique (srcIndex, dstIndex)); } + JUCE_END_IGNORE_WARNINGS_MSVC + void addClearMidiBufferOp (int index) { - createOp ([=] (const Context& c) { c.midiBuffers[index].clear(); }); + struct ClearOp : public RenderOp + { + explicit ClearOp (int indexIn) : index (indexIn) {} + + void prepare (FloatType* const*, MidiBuffer* buffers) override + { + channelBuffer = buffers + index; + } + + void process (const Context&) override + { + channelBuffer->clear(); + } + + MidiBuffer* channelBuffer = nullptr; + int index = 0; + }; + + renderOps.push_back (std::make_unique (index)); } void addCopyMidiBufferOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { c.midiBuffers[dstIndex] = c.midiBuffers[srcIndex]; }); + struct CopyOp : public RenderOp + { + explicit CopyOp (int fromIn, int toIn) : from (fromIn), to (toIn) {} + + void prepare (FloatType* const*, MidiBuffer* buffers) override + { + fromBuffer = buffers + from; + toBuffer = buffers + to; + } + + void process (const Context&) override + { + *toBuffer = *fromBuffer; + } + + MidiBuffer* fromBuffer = nullptr; + MidiBuffer* toBuffer = nullptr; + int from = 0, to = 0; + }; + + renderOps.push_back (std::make_unique (srcIndex, dstIndex)); } void addAddMidiBufferOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { c.midiBuffers[dstIndex].addEvents (c.midiBuffers[srcIndex], - 0, c.numSamples, 0); }); + struct AddOp : public RenderOp + { + explicit AddOp (int fromIn, int toIn) : from (fromIn), to (toIn) {} + + void prepare (FloatType* const*, MidiBuffer* buffers) override + { + fromBuffer = buffers + from; + toBuffer = buffers + to; + } + + void process (const Context& c) override + { + toBuffer->addEvents (*fromBuffer, 0, c.numSamples, 0); + } + + MidiBuffer* fromBuffer = nullptr; + MidiBuffer* toBuffer = nullptr; + int from = 0, to = 0; + }; + + renderOps.push_back (std::make_unique (srcIndex, dstIndex)); } void addDelayChannelOp (int chan, int delaySize) { - renderOps.add (new DelayChannelOp (chan, delaySize)); + struct DelayChannelOp : public RenderOp + { + DelayChannelOp (int chan, int delaySize) + : buffer ((size_t) (delaySize + 1), (FloatType) 0), + channel (chan), + writeIndex (delaySize) + { + } + + void prepare (FloatType* const* renderBuffer, MidiBuffer*) override + { + channelBuffer = renderBuffer[channel]; + } + + void process (const Context& c) override + { + auto* data = channelBuffer; + + for (int i = c.numSamples; --i >= 0;) + { + buffer[(size_t) writeIndex] = *data; + *data++ = buffer[(size_t) readIndex]; + + if (++readIndex >= (int) buffer.size()) readIndex = 0; + if (++writeIndex >= (int) buffer.size()) writeIndex = 0; + } + } + + std::vector buffer; + FloatType* channelBuffer = nullptr; + const int channel; + int readIndex = 0, writeIndex; + }; + + renderOps.push_back (std::make_unique (chan, delaySize)); } - void addProcessOp (const AudioProcessorGraph::Node::Ptr& node, - const Array& audioChannelsUsed, int totalNumChans, int midiBuffer) + void addProcessOp (const Node::Ptr& node, + const Array& audioChannelsUsed, + int totalNumChans, + int midiBuffer) { - renderOps.add (new ProcessOp (node, audioChannelsUsed, totalNumChans, midiBuffer)); + renderOps.push_back (std::make_unique (node, audioChannelsUsed, totalNumChans, midiBuffer)); } void prepareBuffers (int blockSize) @@ -159,16 +713,9 @@ struct GraphRenderSequence for (auto&& m : midiBuffers) m.ensureSize (defaultMIDIBufferSize); - } - void releaseBuffers() - { - renderingBuffer.setSize (1, 1); - currentAudioOutputBuffer.setSize (1, 1); - currentAudioInputBuffer = nullptr; - currentMidiInputBuffer = nullptr; - currentMidiOutputBuffer.clear(); - midiBuffers.clear(); + for (const auto& op : renderOps) + op->prepare (renderingBuffer.getArrayOfWritePointers(), midiBuffers.data()); } int numBuffersNeeded = 0, numMidiBuffersNeeded = 0; @@ -184,89 +731,40 @@ struct GraphRenderSequence private: //============================================================================== - struct RenderingOp - { - RenderingOp() noexcept {} - virtual ~RenderingOp() {} - virtual void perform (const Context&) = 0; - - JUCE_LEAK_DETECTOR (RenderingOp) - }; - - OwnedArray renderOps; - - //============================================================================== - template ::value, int> = 0> - void createOp (LambdaType&& fn) - { - struct LambdaOp : public RenderingOp - { - LambdaOp (LambdaType&& f) : function (std::forward (f)) {} - void perform (const Context& c) override { function (c); } - - LambdaType function; - }; - - renderOps.add (new LambdaOp (std::forward (fn))); - } - - //============================================================================== - struct DelayChannelOp : public RenderingOp + struct RenderOp { - DelayChannelOp (int chan, int delaySize) - : channel (chan), - bufferSize (delaySize + 1), - writeIndex (delaySize) - { - buffer.calloc ((size_t) bufferSize); - } - - void perform (const Context& c) override - { - auto* data = c.audioBuffers[channel]; - - for (int i = c.numSamples; --i >= 0;) - { - buffer[writeIndex] = *data; - *data++ = buffer[readIndex]; - - if (++readIndex >= bufferSize) readIndex = 0; - if (++writeIndex >= bufferSize) writeIndex = 0; - } - } - - HeapBlock buffer; - const int channel, bufferSize; - int readIndex = 0, writeIndex; - - JUCE_DECLARE_NON_COPYABLE (DelayChannelOp) + virtual ~RenderOp() = default; + virtual void prepare (FloatType* const*, MidiBuffer*) = 0; + virtual void process (const Context&) = 0; }; - //============================================================================== - struct ProcessOp : public RenderingOp + struct ProcessOp : public RenderOp { - ProcessOp (const AudioProcessorGraph::Node::Ptr& n, + ProcessOp (const Node::Ptr& n, const Array& audioChannelsUsed, - int totalNumChans, int midiBuffer) + int totalNumChans, + int midiBufferIndex) : node (n), processor (*n->getProcessor()), audioChannelsToUse (audioChannelsUsed), - totalChans (jmax (1, totalNumChans)), - midiBufferToUse (midiBuffer) + audioChannels ((size_t) jmax (1, totalNumChans), nullptr), + midiBufferToUse (midiBufferIndex) { - audioChannels.calloc ((size_t) totalChans); - - while (audioChannelsToUse.size() < totalChans) + while (audioChannelsToUse.size() < (int) audioChannels.size()) audioChannelsToUse.add (0); } - void perform (const Context& c) override + void prepare (FloatType* const* renderBuffer, MidiBuffer* buffers) override { - processor.setPlayHead (c.audioPlayHead); + for (size_t i = 0; i < audioChannels.size(); ++i) + audioChannels[i] = renderBuffer[audioChannelsToUse.getUnchecked ((int) i)]; - for (int i = 0; i < totalChans; ++i) - audioChannels[i] = c.audioBuffers[audioChannelsToUse.getUnchecked (i)]; + midiBuffer = buffers + midiBufferToUse; + } + + void process (const Context& c) override + { + processor.setPlayHead (c.audioPlayHead); auto numAudioChannels = [this] { @@ -274,111 +772,102 @@ private: if (proc->getTotalNumInputChannels() == 0 && proc->getTotalNumOutputChannels() == 0) return 0; - return totalChans; + return (int) audioChannels.size(); }(); - AudioBuffer buffer (audioChannels, numAudioChannels, c.numSamples); + AudioBuffer buffer { audioChannels.data(), numAudioChannels, c.numSamples }; const ScopedLock lock (processor.getCallbackLock()); if (processor.isSuspended()) buffer.clear(); else - callProcess (buffer, c.midiBuffers[midiBufferToUse]); + callProcess (buffer, *midiBuffer); } - void callProcess (AudioBuffer& buffer, MidiBuffer& midiMessages) + void callProcess (AudioBuffer& buffer, MidiBuffer& midi) { if (processor.isUsingDoublePrecision()) { tempBufferDouble.makeCopyOf (buffer, true); - - if (node->isBypassed()) - node->processBlockBypassed (tempBufferDouble, midiMessages); - else - node->processBlock (tempBufferDouble, midiMessages); - + process (*node, tempBufferDouble, midi); buffer.makeCopyOf (tempBufferDouble, true); } else { - if (node->isBypassed()) - node->processBlockBypassed (buffer, midiMessages); - else - node->processBlock (buffer, midiMessages); + process (*node, buffer, midi); } } - void callProcess (AudioBuffer& buffer, MidiBuffer& midiMessages) + void callProcess (AudioBuffer& buffer, MidiBuffer& midi) { if (processor.isUsingDoublePrecision()) { - if (node->isBypassed()) - node->processBlockBypassed (buffer, midiMessages); - else - node->processBlock (buffer, midiMessages); + process (*node, buffer, midi); } else { tempBufferFloat.makeCopyOf (buffer, true); - - if (node->isBypassed()) - node->processBlockBypassed (tempBufferFloat, midiMessages); - else - node->processBlock (tempBufferFloat, midiMessages); - + process (*node, tempBufferFloat, midi); buffer.makeCopyOf (tempBufferFloat, true); } } - const AudioProcessorGraph::Node::Ptr node; + template + static void process (const Node& node, AudioBuffer& audio, MidiBuffer& midi) + { + if (node.isBypassed() && node.getProcessor()->getBypassParameter() == nullptr) + node.getProcessor()->processBlockBypassed (audio, midi); + else + node.getProcessor()->processBlock (audio, midi); + } + + const Node::Ptr node; AudioProcessor& processor; + MidiBuffer* midiBuffer = nullptr; Array audioChannelsToUse; - HeapBlock audioChannels; + std::vector audioChannels; AudioBuffer tempBufferFloat, tempBufferDouble; - const int totalChans, midiBufferToUse; - - JUCE_DECLARE_NON_COPYABLE (ProcessOp) + const int midiBufferToUse; }; + + std::vector> renderOps; }; //============================================================================== -//============================================================================== -template -struct RenderSequenceBuilder +class RenderSequenceBuilder { - RenderSequenceBuilder (AudioProcessorGraph& g, RenderSequence& s) - : graph (g), sequence (s), orderedNodes (createOrderedNodeList (graph)) +public: + using Node = AudioProcessorGraph::Node; + using NodeID = AudioProcessorGraph::NodeID; + using Connection = AudioProcessorGraph::Connection; + using NodeAndChannel = AudioProcessorGraph::NodeAndChannel; + + static constexpr auto midiChannelIndex = AudioProcessorGraph::midiChannelIndex; + + template + static auto build (const Nodes& n, const Connections& c) { - audioBuffers.add (AssignedBuffer::createReadOnlyEmpty()); // first buffer is read-only zeros - midiBuffers .add (AssignedBuffer::createReadOnlyEmpty()); + RenderSequence sequence; + const RenderSequenceBuilder builder (n, c, sequence); - for (int i = 0; i < orderedNodes.size(); ++i) + struct SequenceAndLatency { - createRenderingOpsForNode (*orderedNodes.getUnchecked(i), i); - markAnyUnusedBuffersAsFree (audioBuffers, i); - markAnyUnusedBuffersAsFree (midiBuffers, i); - } - - graph.setLatencySamples (totalLatency); + RenderSequence sequence; + int latencySamples = 0; + }; - s.numBuffersNeeded = audioBuffers.size(); - s.numMidiBuffersNeeded = midiBuffers.size(); + return SequenceAndLatency { std::move (sequence), builder.totalLatency }; } +private: //============================================================================== - using Node = AudioProcessorGraph::Node; - using NodeID = AudioProcessorGraph::NodeID; - - AudioProcessorGraph& graph; - RenderSequence& sequence; - const Array orderedNodes; struct AssignedBuffer { - AudioProcessorGraph::NodeAndChannel channel; + NodeAndChannel channel; static AssignedBuffer createReadOnlyEmpty() noexcept { return { { zeroNodeID(), 0 } }; } static AssignedBuffer createFree() noexcept { return { { freeNodeID(), 0 } }; } @@ -400,12 +889,6 @@ struct RenderSequenceBuilder enum { readOnlyEmptyBufferIndex = 0 }; - struct Delay - { - NodeID nodeID; - int delay; - }; - HashMap delays; int totalLatency = 0; @@ -414,32 +897,29 @@ struct RenderSequenceBuilder return delays[nodeID.uid]; } - int getInputLatencyForNode (NodeID nodeID) const + int getInputLatencyForNode (const Connections& c, NodeID nodeID) const { - int maxLatency = 0; - - for (auto&& c : graph.getConnections()) - if (c.destination.nodeID == nodeID) - maxLatency = jmax (maxLatency, getNodeDelay (c.source.nodeID)); - - return maxLatency; + const auto sources = c.getSourceNodesForDestination (nodeID); + return std::accumulate (sources.cbegin(), sources.cend(), 0, [this] (auto acc, auto source) + { + return jmax (acc, this->getNodeDelay (source)); + }); } //============================================================================== - static void getAllParentsOfNode (const Node* child, - std::unordered_set& parents, - const std::unordered_map>& otherParents) + void getAllParentsOfNode (const NodeID& child, + std::set& parents, + const std::map>& otherParents, + const Connections& c) { - for (auto&& i : child->inputs) + for (const auto& parentNode : c.getSourceNodesForDestination (child)) { - auto* parentNode = i.otherNode; - if (parentNode == child) continue; if (parents.insert (parentNode).second) { - auto parentParents = otherParents.find (parentNode); + const auto parentParents = otherParents.find (parentNode); if (parentParents != otherParents.end()) { @@ -447,46 +927,53 @@ struct RenderSequenceBuilder continue; } - getAllParentsOfNode (i.otherNode, parents, otherParents); + getAllParentsOfNode (parentNode, parents, otherParents, c); } } } - static auto createOrderedNodeList (const AudioProcessorGraph& graph) + Array createOrderedNodeList (const Nodes& n, const Connections& c) { Array result; - std::unordered_map> nodeParents; + std::map> nodeParents; - for (auto* node : graph.getNodes()) + for (auto& node : n.getNodes()) { + const auto nodeID = node->nodeID; int insertionIndex = 0; for (; insertionIndex < result.size(); ++insertionIndex) { - auto& parents = nodeParents[result.getUnchecked (insertionIndex)]; + auto& parents = nodeParents[result.getUnchecked (insertionIndex)->nodeID]; - if (parents.find (node) != parents.end()) + if (parents.find (nodeID) != parents.end()) break; } result.insert (insertionIndex, node); - getAllParentsOfNode (node, nodeParents[node], nodeParents); + getAllParentsOfNode (nodeID, nodeParents[node->nodeID], nodeParents, c); } return result; } - int findBufferForInputAudioChannel (Node& node, const int inputChan, - const int ourRenderingIndex, const int maxLatency) + //============================================================================== + template + int findBufferForInputAudioChannel (const Connections& c, + RenderSequence& sequence, + Node& node, + const int inputChan, + const int ourRenderingIndex, + const int maxLatency) { auto& processor = *node.getProcessor(); auto numOuts = processor.getTotalNumOutputChannels(); - auto sources = getSourcesForChannel (node, inputChan); + auto sources = c.getSourcesForDestination ({ node.nodeID, inputChan }); // Handle an unconnected input channel... - if (sources.isEmpty()) + if (sources.empty()) { if (inputChan >= numOuts) return readOnlyEmptyBufferIndex; @@ -500,7 +987,7 @@ struct RenderSequenceBuilder if (sources.size() == 1) { // channel with a straightforward single input.. - auto src = sources.getUnchecked(0); + auto src = *sources.begin(); int bufIndex = getBufferContaining (src); @@ -511,8 +998,7 @@ struct RenderSequenceBuilder jassert (bufIndex >= 0); } - if (inputChan < numOuts - && isBufferNeededLater (ourRenderingIndex, inputChan, src)) + if (inputChan < numOuts && isBufferNeededLater (c, ourRenderingIndex, inputChan, src)) { // can't mess up this channel because it's needed later by another node, // so we need to use a copy of it.. @@ -533,23 +1019,27 @@ struct RenderSequenceBuilder int reusableInputIndex = -1; int bufIndex = -1; - for (int i = 0; i < sources.size(); ++i) { - auto src = sources.getReference(i); - auto sourceBufIndex = getBufferContaining (src); - - if (sourceBufIndex >= 0 && ! isBufferNeededLater (ourRenderingIndex, inputChan, src)) + auto i = 0; + for (const auto& src : sources) { - // we've found one of our input chans that can be re-used.. - reusableInputIndex = i; - bufIndex = sourceBufIndex; + auto sourceBufIndex = getBufferContaining (src); - auto nodeDelay = getNodeDelay (src.nodeID); + if (sourceBufIndex >= 0 && ! isBufferNeededLater (c, ourRenderingIndex, inputChan, src)) + { + // we've found one of our input chans that can be re-used.. + reusableInputIndex = i; + bufIndex = sourceBufIndex; - if (nodeDelay < maxLatency) - sequence.addDelayChannelOp (bufIndex, maxLatency - nodeDelay); + auto nodeDelay = getNodeDelay (src.nodeID); - break; + if (nodeDelay < maxLatency) + sequence.addDelayChannelOp (bufIndex, maxLatency - nodeDelay); + + break; + } + + ++i; } } @@ -561,7 +1051,7 @@ struct RenderSequenceBuilder audioBuffers.getReference (bufIndex).setAssignedToNonExistentNode(); - auto srcIndex = getBufferContaining (sources.getFirst()); + auto srcIndex = getBufferContaining (*sources.begin()); if (srcIndex < 0) sequence.addClearChannelOp (bufIndex); // if not found, this is probably a feedback loop @@ -569,53 +1059,61 @@ struct RenderSequenceBuilder sequence.addCopyChannelOp (srcIndex, bufIndex); reusableInputIndex = 0; - auto nodeDelay = getNodeDelay (sources.getFirst().nodeID); + auto nodeDelay = getNodeDelay (sources.begin()->nodeID); if (nodeDelay < maxLatency) sequence.addDelayChannelOp (bufIndex, maxLatency - nodeDelay); } - for (int i = 0; i < sources.size(); ++i) { - if (i != reusableInputIndex) + auto i = 0; + for (const auto& src : sources) { - auto src = sources.getReference(i); - int srcIndex = getBufferContaining (src); - - if (srcIndex >= 0) + if (i != reusableInputIndex) { - auto nodeDelay = getNodeDelay (src.nodeID); + int srcIndex = getBufferContaining (src); - if (nodeDelay < maxLatency) + if (srcIndex >= 0) { - if (! isBufferNeededLater (ourRenderingIndex, inputChan, src)) - { - sequence.addDelayChannelOp (srcIndex, maxLatency - nodeDelay); - } - else // buffer is reused elsewhere, can't be delayed + auto nodeDelay = getNodeDelay (src.nodeID); + + if (nodeDelay < maxLatency) { - auto bufferToDelay = getFreeBuffer (audioBuffers); - sequence.addCopyChannelOp (srcIndex, bufferToDelay); - sequence.addDelayChannelOp (bufferToDelay, maxLatency - nodeDelay); - srcIndex = bufferToDelay; + if (! isBufferNeededLater (c, ourRenderingIndex, inputChan, src)) + { + sequence.addDelayChannelOp (srcIndex, maxLatency - nodeDelay); + } + else // buffer is reused elsewhere, can't be delayed + { + auto bufferToDelay = getFreeBuffer (audioBuffers); + sequence.addCopyChannelOp (srcIndex, bufferToDelay); + sequence.addDelayChannelOp (bufferToDelay, maxLatency - nodeDelay); + srcIndex = bufferToDelay; + } } - } - sequence.addAddChannelOp (srcIndex, bufIndex); + sequence.addAddChannelOp (srcIndex, bufIndex); + } } + + ++i; } } return bufIndex; } - int findBufferForInputMidiChannel (Node& node, int ourRenderingIndex) + template + int findBufferForInputMidiChannel (const Connections& c, + RenderSequence& sequence, + Node& node, + int ourRenderingIndex) { auto& processor = *node.getProcessor(); - auto sources = getSourcesForChannel (node, AudioProcessorGraph::midiChannelIndex); + auto sources = c.getSourcesForDestination ({ node.nodeID, midiChannelIndex }); // No midi inputs.. - if (sources.isEmpty()) + if (sources.empty()) { auto midiBufferToUse = getFreeBuffer (midiBuffers); // need to pick a buffer even if the processor doesn't use midi @@ -628,12 +1126,12 @@ struct RenderSequenceBuilder // One midi input.. if (sources.size() == 1) { - auto src = sources.getReference (0); + auto src = *sources.begin(); auto midiBufferToUse = getBufferContaining (src); if (midiBufferToUse >= 0) { - if (isBufferNeededLater (ourRenderingIndex, AudioProcessorGraph::midiChannelIndex, src)) + if (isBufferNeededLater (c, ourRenderingIndex, midiChannelIndex, src)) { // can't mess up this channel because it's needed later by another node, so we // need to use a copy of it.. @@ -655,18 +1153,22 @@ struct RenderSequenceBuilder int midiBufferToUse = -1; int reusableInputIndex = -1; - for (int i = 0; i < sources.size(); ++i) { - auto src = sources.getReference (i); - auto sourceBufIndex = getBufferContaining (src); - - if (sourceBufIndex >= 0 - && ! isBufferNeededLater (ourRenderingIndex, AudioProcessorGraph::midiChannelIndex, src)) + auto i = 0; + for (const auto& src : sources) { - // we've found one of our input buffers that can be re-used.. - reusableInputIndex = i; - midiBufferToUse = sourceBufIndex; - break; + auto sourceBufIndex = getBufferContaining (src); + + if (sourceBufIndex >= 0 + && ! isBufferNeededLater (c, ourRenderingIndex, midiChannelIndex, src)) + { + // we've found one of our input buffers that can be re-used.. + reusableInputIndex = i; + midiBufferToUse = sourceBufIndex; + break; + } + + ++i; } } @@ -676,7 +1178,7 @@ struct RenderSequenceBuilder midiBufferToUse = getFreeBuffer (midiBuffers); jassert (midiBufferToUse >= 0); - auto srcIndex = getBufferContaining (sources.getUnchecked(0)); + auto srcIndex = getBufferContaining (*sources.begin()); if (srcIndex >= 0) sequence.addCopyMidiBufferOp (srcIndex, midiBufferToUse); @@ -686,21 +1188,30 @@ struct RenderSequenceBuilder reusableInputIndex = 0; } - for (int i = 0; i < sources.size(); ++i) { - if (i != reusableInputIndex) + auto i = 0; + for (const auto& src : sources) { - auto srcIndex = getBufferContaining (sources.getUnchecked(i)); + if (i != reusableInputIndex) + { + auto srcIndex = getBufferContaining (src); - if (srcIndex >= 0) - sequence.addAddMidiBufferOp (srcIndex, midiBufferToUse); + if (srcIndex >= 0) + sequence.addAddMidiBufferOp (srcIndex, midiBufferToUse); + } + + ++i; } } return midiBufferToUse; } - void createRenderingOpsForNode (Node& node, const int ourRenderingIndex) + template + void createRenderingOpsForNode (const Connections& c, + RenderSequence& sequence, + Node& node, + const int ourRenderingIndex) { auto& processor = *node.getProcessor(); auto numIns = processor.getTotalNumInputChannels(); @@ -708,12 +1219,17 @@ struct RenderSequenceBuilder auto totalChans = jmax (numIns, numOuts); Array audioChannelsToUse; - auto maxLatency = getInputLatencyForNode (node.nodeID); + auto maxLatency = getInputLatencyForNode (c, node.nodeID); for (int inputChan = 0; inputChan < numIns; ++inputChan) { // get a list of all the inputs to this node - auto index = findBufferForInputAudioChannel (node, inputChan, ourRenderingIndex, maxLatency); + auto index = findBufferForInputAudioChannel (c, + sequence, + node, + inputChan, + ourRenderingIndex, + maxLatency); jassert (index >= 0); audioChannelsToUse.add (index); @@ -731,10 +1247,10 @@ struct RenderSequenceBuilder audioBuffers.getReference (index).channel = { node.nodeID, outputChan }; } - auto midiBufferToUse = findBufferForInputMidiChannel (node, ourRenderingIndex); + auto midiBufferToUse = findBufferForInputMidiChannel (c, sequence, node, ourRenderingIndex); if (processor.producesMidi()) - midiBuffers.getReference (midiBufferToUse).channel = { node.nodeID, AudioProcessorGraph::midiChannelIndex }; + midiBuffers.getReference (midiBufferToUse).channel = { node.nodeID, midiChannelIndex }; delays.set (node.nodeID.uid, maxLatency + processor.getLatencySamples()); @@ -745,18 +1261,6 @@ struct RenderSequenceBuilder } //============================================================================== - Array getSourcesForChannel (Node& node, int inputChannelIndex) - { - Array results; - AudioProcessorGraph::NodeAndChannel nc { node.nodeID, inputChannelIndex }; - - for (auto&& c : graph.getConnections()) - if (c.destination == nc) - results.add (c.source); - - return results; - } - static int getFreeBuffer (Array& buffers) { for (int i = 1; i < buffers.size(); ++i) @@ -767,7 +1271,7 @@ struct RenderSequenceBuilder return buffers.size() - 1; } - int getBufferContaining (AudioProcessorGraph::NodeAndChannel output) const noexcept + int getBufferContaining (NodeAndChannel output) const noexcept { int i = 0; @@ -782,16 +1286,19 @@ struct RenderSequenceBuilder return -1; } - void markAnyUnusedBuffersAsFree (Array& buffers, const int stepIndex) + void markAnyUnusedBuffersAsFree (const Connections& c, + Array& buffers, + const int stepIndex) { for (auto& b : buffers) - if (b.isAssigned() && ! isBufferNeededLater (stepIndex, -1, b.channel)) + if (b.isAssigned() && ! isBufferNeededLater (c, stepIndex, -1, b.channel)) b.setFree(); } - bool isBufferNeededLater (int stepIndexToSearchFrom, + bool isBufferNeededLater (const Connections& c, + int stepIndexToSearchFrom, int inputChannelOfIndexToIgnore, - AudioProcessorGraph::NodeAndChannel output) const + NodeAndChannel output) const { while (stepIndexToSearchFrom < orderedNodes.size()) { @@ -799,15 +1306,15 @@ struct RenderSequenceBuilder if (output.isMIDI()) { - if (inputChannelOfIndexToIgnore != AudioProcessorGraph::midiChannelIndex - && graph.isConnected ({ { output.nodeID, AudioProcessorGraph::midiChannelIndex }, - { node->nodeID, AudioProcessorGraph::midiChannelIndex } })) + if (inputChannelOfIndexToIgnore != midiChannelIndex + && c.isConnected ({ { output.nodeID, midiChannelIndex }, + { node->nodeID, midiChannelIndex } })) return true; } else { for (int i = 0; i < node->getProcessor()->getTotalNumInputChannels(); ++i) - if (i != inputChannelOfIndexToIgnore && graph.isConnected ({ output, { node->nodeID, i } })) + if (i != inputChannelOfIndexToIgnore && c.isConnected ({ output, { node->nodeID, i } })) return true; } @@ -818,625 +1325,513 @@ struct RenderSequenceBuilder return false; } - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RenderSequenceBuilder) -}; - -//============================================================================== -AudioProcessorGraph::Connection::Connection (NodeAndChannel src, NodeAndChannel dst) noexcept - : source (src), destination (dst) -{ -} - -bool AudioProcessorGraph::Connection::operator== (const Connection& other) const noexcept -{ - return source == other.source && destination == other.destination; -} - -bool AudioProcessorGraph::Connection::operator!= (const Connection& c) const noexcept -{ - return ! operator== (c); -} - -bool AudioProcessorGraph::Connection::operator< (const Connection& other) const noexcept -{ - if (source.nodeID != other.source.nodeID) - return source.nodeID < other.source.nodeID; - - if (destination.nodeID != other.destination.nodeID) - return destination.nodeID < other.destination.nodeID; - - if (source.channelIndex != other.source.channelIndex) - return source.channelIndex < other.source.channelIndex; - - return destination.channelIndex < other.destination.channelIndex; -} - -//============================================================================== -AudioProcessorGraph::Node::Node (NodeID n, std::unique_ptr p) noexcept - : nodeID (n), processor (std::move (p)) -{ - jassert (processor != nullptr); -} - -void AudioProcessorGraph::Node::prepare (double newSampleRate, int newBlockSize, - AudioProcessorGraph* graph, ProcessingPrecision precision) -{ - const ScopedLock lock (processorLock); - - if (! isPrepared) + template + RenderSequenceBuilder (const Nodes& n, const Connections& c, RenderSequence& sequence) + : orderedNodes (createOrderedNodeList (n, c)) { - setParentGraph (graph); - - // try to align the precision of the processor and the graph - processor->setProcessingPrecision (processor->supportsDoublePrecisionProcessing() ? precision - : singlePrecision); - - processor->setRateAndBufferSizeDetails (newSampleRate, newBlockSize); - processor->prepareToPlay (newSampleRate, newBlockSize); - - // This may be checked from other threads that haven't taken the processorLock, - // so we need to leave it until the processor has been completely prepared - isPrepared = true; - } -} + audioBuffers.add (AssignedBuffer::createReadOnlyEmpty()); // first buffer is read-only zeros + midiBuffers .add (AssignedBuffer::createReadOnlyEmpty()); -void AudioProcessorGraph::Node::unprepare() -{ - const ScopedLock lock (processorLock); + for (int i = 0; i < orderedNodes.size(); ++i) + { + createRenderingOpsForNode (c, sequence, *orderedNodes.getUnchecked (i), i); + markAnyUnusedBuffersAsFree (c, audioBuffers, i); + markAnyUnusedBuffersAsFree (c, midiBuffers, i); + } - if (isPrepared) - { - isPrepared = false; - processor->releaseResources(); + sequence.numBuffersNeeded = audioBuffers.size(); + sequence.numMidiBuffersNeeded = midiBuffers.size(); } -} - -void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph) const -{ - const ScopedLock lock (processorLock); +}; - if (auto* ioProc = dynamic_cast (processor.get())) - ioProc->setParentGraph (graph); -} +//============================================================================== +/* A full graph of audio processors, ready to process at a particular sample rate, block size, + and precision. -bool AudioProcessorGraph::Node::Connection::operator== (const Connection& other) const noexcept + Instances of this class will be created on the main thread, and then passed over to the audio + thread for processing. +*/ +class RenderSequence { - return otherNode == other.otherNode - && thisChannel == other.thisChannel - && otherChannel == other.otherChannel; -} +public: + using AudioGraphIOProcessor = AudioProcessorGraph::AudioGraphIOProcessor; -//============================================================================== -bool AudioProcessorGraph::Node::isBypassed() const noexcept -{ - if (processor != nullptr) + RenderSequence (PrepareSettings s, const Nodes& n, const Connections& c) + : RenderSequence (s, + RenderSequenceBuilder::build> (n, c), + RenderSequenceBuilder::build> (n, c)) { - if (auto* bypassParam = processor->getBypassParameter()) - return (bypassParam->getValue() != 0.0f); } - return bypassed; -} - -void AudioProcessorGraph::Node::setBypassed (bool shouldBeBypassed) noexcept -{ - if (processor != nullptr) + void process (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) { - if (auto* bypassParam = processor->getBypassParameter()) - bypassParam->setValueNotifyingHost (shouldBeBypassed ? 1.0f : 0.0f); + renderSequenceF.perform (audio, midi, playHead); } - bypassed = shouldBeBypassed; -} - -//============================================================================== -struct AudioProcessorGraph::RenderSequenceFloat : public GraphRenderSequence {}; -struct AudioProcessorGraph::RenderSequenceDouble : public GraphRenderSequence {}; - -//============================================================================== -AudioProcessorGraph::AudioProcessorGraph() -{ -} - -AudioProcessorGraph::~AudioProcessorGraph() -{ - cancelPendingUpdate(); - clearRenderingSequence(); - clear(); -} - -const String AudioProcessorGraph::getName() const -{ - return "Audio Graph"; -} - -//============================================================================== -void AudioProcessorGraph::topologyChanged() -{ - sendChangeMessage(); - - if (isPrepared) - updateOnMessageThread (*this); -} - -void AudioProcessorGraph::clear() -{ - const ScopedLock sl (getCallbackLock()); - - if (nodes.isEmpty()) - return; - - nodes.clear(); - topologyChanged(); -} - -AudioProcessorGraph::Node* AudioProcessorGraph::getNodeForId (NodeID nodeID) const -{ - for (auto* n : nodes) - if (n->nodeID == nodeID) - return n; - - return {}; -} - -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr newProcessor, NodeID nodeID) -{ - if (newProcessor == nullptr || newProcessor.get() == this) + void process (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) { - jassertfalse; - return {}; + renderSequenceD.perform (audio, midi, playHead); } - if (nodeID == NodeID()) - nodeID.uid = ++(lastNodeID.uid); - - for (auto* n : nodes) + void processIO (AudioGraphIOProcessor& io, AudioBuffer& audio, MidiBuffer& midi) { - if (n->getProcessor() == newProcessor.get() || n->nodeID == nodeID) - { - jassertfalse; // Cannot add two copies of the same processor, or duplicate node IDs! - return {}; - } + processIOBlock (io, renderSequenceF, audio, midi); } - if (lastNodeID < nodeID) - lastNodeID = nodeID; - - newProcessor->setPlayHead (getPlayHead()); - - Node::Ptr n (new Node (nodeID, std::move (newProcessor))); - + void processIO (AudioGraphIOProcessor& io, AudioBuffer& audio, MidiBuffer& midi) { - const ScopedLock sl (getCallbackLock()); - nodes.add (n.get()); + processIOBlock (io, renderSequenceD, audio, midi); } - n->setParentGraph (this); - topologyChanged(); - return n; -} - -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (NodeID nodeId) -{ - const ScopedLock sl (getCallbackLock()); + int getLatencySamples() const { return latencySamples; } + PrepareSettings getSettings() const { return settings; } - for (int i = nodes.size(); --i >= 0;) +private: + template + static void processIOBlock (AudioGraphIOProcessor& io, + SequenceType& sequence, + AudioBuffer& buffer, + MidiBuffer& midiMessages) { - if (nodes.getUnchecked (i)->nodeID == nodeId) + switch (io.getType()) { - disconnectNode (nodeId); - auto node = nodes.removeAndReturn (i); - topologyChanged(); - return node; - } - } - - return {}; -} - -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (Node* node) -{ - if (node != nullptr) - return removeNode (node->nodeID); - - jassertfalse; - return {}; -} - -//============================================================================== -void AudioProcessorGraph::getNodeConnections (Node& node, std::vector& connections) -{ - for (auto& i : node.inputs) - connections.push_back ({ { i.otherNode->nodeID, i.otherChannel }, { node.nodeID, i.thisChannel } }); - - for (auto& o : node.outputs) - connections.push_back ({ { node.nodeID, o.thisChannel }, { o.otherNode->nodeID, o.otherChannel } }); -} - -std::vector AudioProcessorGraph::getConnections() const -{ - std::vector connections; - - for (auto& n : nodes) - getNodeConnections (*n, connections); - - std::sort (connections.begin(), connections.end()); - auto last = std::unique (connections.begin(), connections.end()); - connections.erase (last, connections.end()); - - return connections; -} - -bool AudioProcessorGraph::isConnected (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept -{ - for (auto& o : source->outputs) - if (o.otherNode == dest && o.thisChannel == sourceChannel && o.otherChannel == destChannel) - return true; - - return false; -} - -bool AudioProcessorGraph::isConnected (const Connection& c) const noexcept -{ - if (auto* source = getNodeForId (c.source.nodeID)) - if (auto* dest = getNodeForId (c.destination.nodeID)) - return isConnected (source, c.source.channelIndex, - dest, c.destination.channelIndex); - - return false; -} - -bool AudioProcessorGraph::isConnected (NodeID srcID, NodeID destID) const noexcept -{ - if (auto* source = getNodeForId (srcID)) - if (auto* dest = getNodeForId (destID)) - for (auto& out : source->outputs) - if (out.otherNode == dest) - return true; - - return false; -} + case AudioGraphIOProcessor::audioOutputNode: + { + auto&& currentAudioOutputBuffer = sequence.currentAudioOutputBuffer; -bool AudioProcessorGraph::isAnInputTo (Node& src, Node& dst) const noexcept -{ - jassert (nodes.contains (&src)); - jassert (nodes.contains (&dst)); + for (int i = jmin (currentAudioOutputBuffer.getNumChannels(), buffer.getNumChannels()); --i >= 0;) + currentAudioOutputBuffer.addFrom (i, 0, buffer, i, 0, buffer.getNumSamples()); - return isAnInputTo (src, dst, nodes.size()); -} + break; + } -bool AudioProcessorGraph::isAnInputTo (Node& src, Node& dst, int recursionCheck) const noexcept -{ - for (auto&& i : dst.inputs) - if (i.otherNode == &src) - return true; + case AudioGraphIOProcessor::audioInputNode: + { + auto* currentInputBuffer = sequence.currentAudioInputBuffer; - if (recursionCheck > 0) - for (auto&& i : dst.inputs) - if (isAnInputTo (src, *i.otherNode, recursionCheck - 1)) - return true; + for (int i = jmin (currentInputBuffer->getNumChannels(), buffer.getNumChannels()); --i >= 0;) + buffer.copyFrom (i, 0, *currentInputBuffer, i, 0, buffer.getNumSamples()); - return false; -} + break; + } -bool AudioProcessorGraph::canConnect (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept -{ - bool sourceIsMIDI = sourceChannel == midiChannelIndex; - bool destIsMIDI = destChannel == midiChannelIndex; + case AudioGraphIOProcessor::midiOutputNode: + sequence.currentMidiOutputBuffer.addEvents (midiMessages, 0, buffer.getNumSamples(), 0); + break; - if (sourceChannel < 0 - || destChannel < 0 - || source == dest - || sourceIsMIDI != destIsMIDI) - return false; + case AudioGraphIOProcessor::midiInputNode: + midiMessages.addEvents (*sequence.currentMidiInputBuffer, 0, buffer.getNumSamples(), 0); + break; - if (source == nullptr - || (! sourceIsMIDI && sourceChannel >= source->processor->getTotalNumOutputChannels()) - || (sourceIsMIDI && ! source->processor->producesMidi())) - return false; + default: + break; + } + } - if (dest == nullptr - || (! destIsMIDI && destChannel >= dest->processor->getTotalNumInputChannels()) - || (destIsMIDI && ! dest->processor->acceptsMidi())) - return false; + template + RenderSequence (PrepareSettings s, Float f, Double d) + : settings (s), + renderSequenceF (std::move (f.sequence)), + renderSequenceD (std::move (d.sequence)), + latencySamples (f.latencySamples) + { + jassert (f.latencySamples == d.latencySamples); - return ! isConnected (source, sourceChannel, dest, destChannel); -} + renderSequenceF.prepareBuffers (settings.blockSize); + renderSequenceD.prepareBuffers (settings.blockSize); + } -bool AudioProcessorGraph::canConnect (const Connection& c) const -{ - if (auto* source = getNodeForId (c.source.nodeID)) - if (auto* dest = getNodeForId (c.destination.nodeID)) - return canConnect (source, c.source.channelIndex, - dest, c.destination.channelIndex); + PrepareSettings settings; + GraphRenderSequence renderSequenceF; + GraphRenderSequence renderSequenceD; + int latencySamples = 0; +}; - return false; -} +//============================================================================== +/* Facilitates wait-free render-sequence updates. -bool AudioProcessorGraph::addConnection (const Connection& c) + Topology updates always happen on the main thread (or synchronised with the main thread). + After updating the graph, the 'baked' graph is passed to RenderSequenceExchange::set. + At the top of the audio callback, RenderSequenceExchange::updateAudioThreadState will + attempt to install the most-recently-baked graph, if there's one waiting. +*/ +class RenderSequenceExchange : private Timer { - if (auto* source = getNodeForId (c.source.nodeID)) +public: + RenderSequenceExchange() { - if (auto* dest = getNodeForId (c.destination.nodeID)) - { - auto sourceChan = c.source.channelIndex; - auto destChan = c.destination.channelIndex; + startTimer (500); + } - if (canConnect (source, sourceChan, dest, destChan)) - { - source->outputs.add ({ dest, destChan, sourceChan }); - dest->inputs.add ({ source, sourceChan, destChan }); - jassert (isConnected (c)); - topologyChanged(); - return true; - } - } + ~RenderSequenceExchange() override + { + stopTimer(); } - return false; -} + void set (std::unique_ptr&& next) + { + const SpinLock::ScopedLockType lock (mutex); + mainThreadState = std::move (next); + isNew = true; + } -bool AudioProcessorGraph::removeConnection (const Connection& c) -{ - if (auto* source = getNodeForId (c.source.nodeID)) + /** Call from the audio thread only. */ + void updateAudioThreadState() { - if (auto* dest = getNodeForId (c.destination.nodeID)) - { - auto sourceChan = c.source.channelIndex; - auto destChan = c.destination.channelIndex; + const SpinLock::ScopedTryLockType lock (mutex); - if (isConnected (source, sourceChan, dest, destChan)) - { - source->outputs.removeAllInstancesOf ({ dest, destChan, sourceChan }); - dest->inputs.removeAllInstancesOf ({ source, sourceChan, destChan }); - topologyChanged(); - return true; - } + if (lock.isLocked() && isNew) + { + // Swap pointers rather than assigning to avoid calling delete here + std::swap (mainThreadState, audioThreadState); + isNew = false; } } - return false; -} + /** Call from the audio thread only. */ + RenderSequence* getAudioThreadState() const { return audioThreadState.get(); } -bool AudioProcessorGraph::disconnectNode (NodeID nodeID) -{ - if (auto* node = getNodeForId (nodeID)) +private: + void timerCallback() override { - std::vector connections; - getNodeConnections (*node, connections); - - if (! connections.empty()) - { - for (auto c : connections) - removeConnection (c); + const SpinLock::ScopedLockType lock (mutex); - return true; - } + if (! isNew) + mainThreadState.reset(); } - return false; + SpinLock mutex; + std::unique_ptr mainThreadState, audioThreadState; + bool isNew = false; +}; + +//============================================================================== +AudioProcessorGraph::Connection::Connection (NodeAndChannel src, NodeAndChannel dst) noexcept + : source (src), destination (dst) +{ } -bool AudioProcessorGraph::isLegal (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept +bool AudioProcessorGraph::Connection::operator== (const Connection& other) const noexcept { - return (sourceChannel == midiChannelIndex ? source->processor->producesMidi() - : isPositiveAndBelow (sourceChannel, source->processor->getTotalNumOutputChannels())) - && (destChannel == midiChannelIndex ? dest->processor->acceptsMidi() - : isPositiveAndBelow (destChannel, dest->processor->getTotalNumInputChannels())); + return source == other.source && destination == other.destination; } -bool AudioProcessorGraph::isConnectionLegal (const Connection& c) const +bool AudioProcessorGraph::Connection::operator!= (const Connection& c) const noexcept { - if (auto* source = getNodeForId (c.source.nodeID)) - if (auto* dest = getNodeForId (c.destination.nodeID)) - return isLegal (source, c.source.channelIndex, dest, c.destination.channelIndex); + return ! operator== (c); +} - return false; +bool AudioProcessorGraph::Connection::operator< (const Connection& other) const noexcept +{ + const auto tie = [] (auto& x) + { + return std::tie (x.source.nodeID, + x.destination.nodeID, + x.source.channelIndex, + x.destination.channelIndex); + }; + return tie (*this) < tie (other); } -bool AudioProcessorGraph::removeIllegalConnections() +//============================================================================== +class AudioProcessorGraph::Pimpl : public AsyncUpdater { - bool anyRemoved = false; +public: + explicit Pimpl (AudioProcessorGraph& o) : owner (&o) {} - for (auto* node : nodes) + ~Pimpl() override { - std::vector connections; - getNodeConnections (*node, connections); - - for (auto c : connections) - if (! isConnectionLegal (c)) - anyRemoved = removeConnection (c) || anyRemoved; + cancelPendingUpdate(); + clear (UpdateKind::sync); } - return anyRemoved; -} + const auto& getNodes() const { return nodes.getNodes(); } -//============================================================================== -void AudioProcessorGraph::clearRenderingSequence() -{ - std::unique_ptr oldSequenceF; - std::unique_ptr oldSequenceD; + void clear (UpdateKind updateKind) + { + if (getNodes().isEmpty()) + return; + + nodes = Nodes{}; + connections = Connections{}; + topologyChanged (updateKind); + } + auto getNodeForId (NodeID nodeID) const { - const ScopedLock sl (getCallbackLock()); - std::swap (renderSequenceFloat, oldSequenceF); - std::swap (renderSequenceDouble, oldSequenceD); + return nodes.getNodeForId (nodeID); } -} -bool AudioProcessorGraph::anyNodesNeedPreparing() const noexcept -{ - for (auto* node : nodes) - if (! node->isPrepared) - return true; + Node::Ptr addNode (std::unique_ptr newProcessor, + const NodeID nodeID, + UpdateKind updateKind) + { + if (newProcessor.get() == owner) + { + jassertfalse; + return nullptr; + } - return false; -} + const auto idToUse = nodeID == NodeID() ? NodeID { ++(lastNodeID.uid) } : nodeID; -void AudioProcessorGraph::buildRenderingSequence() -{ - auto newSequenceF = std::make_unique(); - auto newSequenceD = std::make_unique(); + auto added = nodes.addNode (std::move (newProcessor), idToUse); + + if (added == nullptr) + return nullptr; - RenderSequenceBuilder builderF (*this, *newSequenceF); - RenderSequenceBuilder builderD (*this, *newSequenceD); + if (lastNodeID < idToUse) + lastNodeID = idToUse; - const ScopedLock sl (getCallbackLock()); + setParentGraph (added->getProcessor()); - const auto currentBlockSize = getBlockSize(); - newSequenceF->prepareBuffers (currentBlockSize); - newSequenceD->prepareBuffers (currentBlockSize); + topologyChanged (updateKind); + return added; + } - if (anyNodesNeedPreparing()) + Node::Ptr removeNode (NodeID nodeID, UpdateKind updateKind) { - renderSequenceFloat.reset(); - renderSequenceDouble.reset(); + connections.disconnectNode (nodeID); + auto result = nodes.removeNode (nodeID); + topologyChanged (updateKind); + return result; + } - for (auto* node : nodes) - node->prepare (getSampleRate(), currentBlockSize, this, getProcessingPrecision()); + std::vector getConnections() const + { + return connections.getConnections(); } - isPrepared = 1; + bool isConnected (const Connection& c) const + { + return connections.isConnected (c); + } - std::swap (renderSequenceFloat, newSequenceF); - std::swap (renderSequenceDouble, newSequenceD); -} + bool isConnected (NodeID srcID, NodeID destID) const + { + return connections.isConnected (srcID, destID); + } -void AudioProcessorGraph::handleAsyncUpdate() -{ - buildRenderingSequence(); -} + bool isAnInputTo (const Node& src, const Node& dst) const + { + return isAnInputTo (src.nodeID, dst.nodeID); + } -//============================================================================== -void AudioProcessorGraph::prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) -{ + bool isAnInputTo (NodeID src, NodeID dst) const { - const ScopedLock sl (getCallbackLock()); - setRateAndBufferSizeDetails (sampleRate, estimatedSamplesPerBlock); + return connections.isAnInputTo (src, dst); + } - const auto newPrepareSettings = [&] - { - PrepareSettings settings; - settings.precision = getProcessingPrecision(); - settings.sampleRate = sampleRate; - settings.blockSize = estimatedSamplesPerBlock; - settings.valid = true; - return settings; - }(); + bool canConnect (const Connection& c) const + { + return connections.canConnect (nodes, c); + } - if (prepareSettings != newPrepareSettings) - { - unprepare(); - prepareSettings = newPrepareSettings; - } + bool addConnection (const Connection& c, UpdateKind updateKind) + { + if (! connections.addConnection (nodes, c)) + return false; + + jassert (isConnected (c)); + topologyChanged (updateKind); + return true; } - clearRenderingSequence(); + bool removeConnection (const Connection& c, UpdateKind updateKind) + { + if (! connections.removeConnection (c)) + return false; - updateOnMessageThread (*this); -} + topologyChanged (updateKind); + return true; + } -bool AudioProcessorGraph::supportsDoublePrecisionProcessing() const -{ - return true; -} + bool disconnectNode (NodeID nodeID, UpdateKind updateKind) + { + if (! connections.disconnectNode (nodeID)) + return false; -void AudioProcessorGraph::unprepare() -{ - prepareSettings.valid = false; + topologyChanged (updateKind); + return true; + } - isPrepared = 0; + bool isConnectionLegal (const Connection& c) const + { + return connections.isConnectionLegal (nodes, c); + } - for (auto* n : nodes) - n->unprepare(); -} + bool removeIllegalConnections (UpdateKind updateKind) + { + const auto result = connections.removeIllegalConnections (nodes); + topologyChanged (updateKind); + return result; + } -void AudioProcessorGraph::releaseResources() -{ - const ScopedLock sl (getCallbackLock()); + //============================================================================== + void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) + { + owner->setRateAndBufferSizeDetails (sampleRate, estimatedSamplesPerBlock); - cancelPendingUpdate(); + PrepareSettings settings; + settings.precision = owner->getProcessingPrecision(); + settings.sampleRate = sampleRate; + settings.blockSize = estimatedSamplesPerBlock; - unprepare(); + nodeStates.setState (settings); - if (renderSequenceFloat != nullptr) - renderSequenceFloat->releaseBuffers(); + topologyChanged (UpdateKind::sync); + } - if (renderSequenceDouble != nullptr) - renderSequenceDouble->releaseBuffers(); -} + void releaseResources() + { + nodeStates.setState (nullopt); + topologyChanged (UpdateKind::sync); + } -void AudioProcessorGraph::reset() -{ - const ScopedLock sl (getCallbackLock()); + void reset() + { + for (auto* n : getNodes()) + n->getProcessor()->reset(); + } - for (auto* n : nodes) - n->getProcessor()->reset(); -} + void setNonRealtime (bool isProcessingNonRealtime) + { + for (auto* n : getNodes()) + n->getProcessor()->setNonRealtime (isProcessingNonRealtime); + } -void AudioProcessorGraph::setNonRealtime (bool isProcessingNonRealtime) noexcept -{ - const ScopedLock sl (getCallbackLock()); + template + void processBlock (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) + { + renderSequenceExchange.updateAudioThreadState(); - AudioProcessor::setNonRealtime (isProcessingNonRealtime); + if (renderSequenceExchange.getAudioThreadState() == nullptr && MessageManager::getInstance()->isThisTheMessageThread()) + handleAsyncUpdate(); - for (auto* n : nodes) - n->getProcessor()->setNonRealtime (isProcessingNonRealtime); -} + if (owner->isNonRealtime()) + { + while (renderSequenceExchange.getAudioThreadState() == nullptr) + { + Thread::sleep (1); + renderSequenceExchange.updateAudioThreadState(); + } + } -double AudioProcessorGraph::getTailLengthSeconds() const { return 0; } -bool AudioProcessorGraph::acceptsMidi() const { return true; } -bool AudioProcessorGraph::producesMidi() const { return true; } -void AudioProcessorGraph::getStateInformation (MemoryBlock&) {} -void AudioProcessorGraph::setStateInformation (const void*, int) {} + auto* state = renderSequenceExchange.getAudioThreadState(); -template -static void processBlockForBuffer (AudioBuffer& buffer, MidiBuffer& midiMessages, - AudioProcessorGraph& graph, - std::unique_ptr& renderSequence, - std::atomic& isPrepared) -{ - if (graph.isNonRealtime()) - { - while (! isPrepared) - Thread::sleep (1); + // Only process if the graph has the correct blockSize, sampleRate etc. + if (state != nullptr && state->getSettings() == nodeStates.getLastRequestedSettings()) + { + state->process (audio, midi, playHead); + } + else + { + audio.clear(); + midi.clear(); + } + } - const ScopedLock sl (graph.getCallbackLock()); + /* Call from the audio thread only. */ + auto* getAudioThreadState() const { return renderSequenceExchange.getAudioThreadState(); } - if (renderSequence != nullptr) - renderSequence->perform (buffer, midiMessages, graph.getPlayHead()); +private: + void setParentGraph (AudioProcessor* p) const + { + if (auto* ioProc = dynamic_cast (p)) + ioProc->setParentGraph (owner); } - else + + void topologyChanged (UpdateKind updateKind) { - const ScopedLock sl (graph.getCallbackLock()); + owner->sendChangeMessage(); + + if (updateKind == UpdateKind::sync && MessageManager::getInstance()->isThisTheMessageThread()) + handleAsyncUpdate(); + else + triggerAsyncUpdate(); + } - if (isPrepared) + void handleAsyncUpdate() override + { + if (const auto newSettings = nodeStates.applySettings (nodes)) { - if (renderSequence != nullptr) - renderSequence->perform (buffer, midiMessages, graph.getPlayHead()); + for (const auto node : nodes.getNodes()) + setParentGraph (node->getProcessor()); + + auto sequence = std::make_unique (*newSettings, nodes, connections); + owner->setLatencySamples (sequence->getLatencySamples()); + renderSequenceExchange.set (std::move (sequence)); } else { - buffer.clear(); - midiMessages.clear(); + renderSequenceExchange.set (nullptr); } } + + AudioProcessorGraph* owner = nullptr; + Nodes nodes; + Connections connections; + NodeStates nodeStates; + RenderSequenceExchange renderSequenceExchange; + NodeID lastNodeID; +}; + +//============================================================================== +AudioProcessorGraph::AudioProcessorGraph() : pimpl (std::make_unique (*this)) {} +AudioProcessorGraph::~AudioProcessorGraph() = default; + +const String AudioProcessorGraph::getName() const { return "Audio Graph"; } +bool AudioProcessorGraph::supportsDoublePrecisionProcessing() const { return true; } +double AudioProcessorGraph::getTailLengthSeconds() const { return 0; } +bool AudioProcessorGraph::acceptsMidi() const { return true; } +bool AudioProcessorGraph::producesMidi() const { return true; } +void AudioProcessorGraph::getStateInformation (MemoryBlock&) {} +void AudioProcessorGraph::setStateInformation (const void*, int) {} + +void AudioProcessorGraph::processBlock (AudioBuffer& audio, MidiBuffer& midi) { return pimpl->processBlock (audio, midi, getPlayHead()); } +void AudioProcessorGraph::processBlock (AudioBuffer& audio, MidiBuffer& midi) { return pimpl->processBlock (audio, midi, getPlayHead()); } +std::vector AudioProcessorGraph::getConnections() const { return pimpl->getConnections(); } +bool AudioProcessorGraph::addConnection (const Connection& c, UpdateKind updateKind) { return pimpl->addConnection (c, updateKind); } +bool AudioProcessorGraph::removeConnection (const Connection& c, UpdateKind updateKind) { return pimpl->removeConnection (c, updateKind); } +void AudioProcessorGraph::prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) { return pimpl->prepareToPlay (sampleRate, estimatedSamplesPerBlock); } +void AudioProcessorGraph::clear (UpdateKind updateKind) { return pimpl->clear (updateKind); } +const ReferenceCountedArray& AudioProcessorGraph::getNodes() const noexcept { return pimpl->getNodes(); } +AudioProcessorGraph::Node* AudioProcessorGraph::getNodeForId (NodeID x) const { return pimpl->getNodeForId (x).get(); } +bool AudioProcessorGraph::disconnectNode (NodeID nodeID, UpdateKind updateKind) { return pimpl->disconnectNode (nodeID, updateKind); } +void AudioProcessorGraph::releaseResources() { return pimpl->releaseResources(); } +bool AudioProcessorGraph::removeIllegalConnections (UpdateKind updateKind) { return pimpl->removeIllegalConnections (updateKind); } +void AudioProcessorGraph::reset() { return pimpl->reset(); } +bool AudioProcessorGraph::canConnect (const Connection& c) const { return pimpl->canConnect (c); } +bool AudioProcessorGraph::isConnected (const Connection& c) const noexcept { return pimpl->isConnected (c); } +bool AudioProcessorGraph::isConnected (NodeID a, NodeID b) const noexcept { return pimpl->isConnected (a, b); } +bool AudioProcessorGraph::isConnectionLegal (const Connection& c) const { return pimpl->isConnectionLegal (c); } +bool AudioProcessorGraph::isAnInputTo (const Node& source, const Node& destination) const noexcept { return pimpl->isAnInputTo (source, destination); } +bool AudioProcessorGraph::isAnInputTo (NodeID source, NodeID destination) const noexcept { return pimpl->isAnInputTo (source, destination); } + +AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr newProcessor, + NodeID nodeId, + UpdateKind updateKind) +{ + return pimpl->addNode (std::move (newProcessor), nodeId, updateKind); } -void AudioProcessorGraph::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) +void AudioProcessorGraph::setNonRealtime (bool isProcessingNonRealtime) noexcept { - if ((! isPrepared) && MessageManager::getInstance()->isThisTheMessageThread()) - handleAsyncUpdate(); + AudioProcessor::setNonRealtime (isProcessingNonRealtime); + pimpl->setNonRealtime (isProcessingNonRealtime); +} - processBlockForBuffer (buffer, midiMessages, *this, renderSequenceFloat, isPrepared); +AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (NodeID nodeID, UpdateKind updateKind) +{ + return pimpl->removeNode (nodeID, updateKind); } -void AudioProcessorGraph::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) +AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (Node* node, UpdateKind updateKind) { - if ((! isPrepared) && MessageManager::getInstance()->isThisTheMessageThread()) - handleAsyncUpdate(); + if (node != nullptr) + return removeNode (node->nodeID, updateKind); - processBlockForBuffer (buffer, midiMessages, *this, renderSequenceDouble, isPrepared); + jassertfalse; + return {}; } //============================================================================== @@ -1445,9 +1840,7 @@ AudioProcessorGraph::AudioGraphIOProcessor::AudioGraphIOProcessor (const IODevic { } -AudioProcessorGraph::AudioGraphIOProcessor::~AudioGraphIOProcessor() -{ -} +AudioProcessorGraph::AudioGraphIOProcessor::~AudioGraphIOProcessor() = default; const String AudioProcessorGraph::AudioGraphIOProcessor::getName() const { @@ -1499,55 +1892,20 @@ bool AudioProcessorGraph::AudioGraphIOProcessor::supportsDoublePrecisionProcessi return true; } -template -static void processIOBlock (AudioProcessorGraph::AudioGraphIOProcessor& io, SequenceType& sequence, - AudioBuffer& buffer, MidiBuffer& midiMessages) -{ - switch (io.getType()) - { - case AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode: - { - auto&& currentAudioOutputBuffer = sequence.currentAudioOutputBuffer; - - for (int i = jmin (currentAudioOutputBuffer.getNumChannels(), buffer.getNumChannels()); --i >= 0;) - currentAudioOutputBuffer.addFrom (i, 0, buffer, i, 0, buffer.getNumSamples()); - - break; - } - - case AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode: - { - auto* currentInputBuffer = sequence.currentAudioInputBuffer; - - for (int i = jmin (currentInputBuffer->getNumChannels(), buffer.getNumChannels()); --i >= 0;) - buffer.copyFrom (i, 0, *currentInputBuffer, i, 0, buffer.getNumSamples()); - - break; - } - - case AudioProcessorGraph::AudioGraphIOProcessor::midiOutputNode: - sequence.currentMidiOutputBuffer.addEvents (midiMessages, 0, buffer.getNumSamples(), 0); - break; - - case AudioProcessorGraph::AudioGraphIOProcessor::midiInputNode: - midiMessages.addEvents (*sequence.currentMidiInputBuffer, 0, buffer.getNumSamples(), 0); - break; - - default: - break; - } -} - void AudioProcessorGraph::AudioGraphIOProcessor::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) { jassert (graph != nullptr); - processIOBlock (*this, *graph->renderSequenceFloat, buffer, midiMessages); + + if (auto* state = graph->pimpl->getAudioThreadState()) + state->processIO (*this, buffer, midiMessages); } void AudioProcessorGraph::AudioGraphIOProcessor::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) { jassert (graph != nullptr); - processIOBlock (*this, *graph->renderSequenceDouble, buffer, midiMessages); + + if (auto* state = graph->pimpl->getAudioThreadState()) + state->processIO (*this, buffer, midiMessages); } double AudioProcessorGraph::AudioGraphIOProcessor::getTailLengthSeconds() const @@ -1596,4 +1954,166 @@ void AudioProcessorGraph::AudioGraphIOProcessor::setParentGraph (AudioProcessorG } } +//============================================================================== +//============================================================================== +#if JUCE_UNIT_TESTS + +class AudioProcessorGraphTests : public UnitTest +{ +public: + AudioProcessorGraphTests() + : UnitTest ("AudioProcessorGraph", UnitTestCategories::audioProcessors) {} + + void runTest() override + { + const auto midiChannel = AudioProcessorGraph::midiChannelIndex; + + beginTest ("isConnected returns true when two nodes are connected"); + { + AudioProcessorGraph graph; + const auto nodeA = graph.addNode (BasicProcessor::make ({}, MidiIn::no, MidiOut::yes))->nodeID; + const auto nodeB = graph.addNode (BasicProcessor::make ({}, MidiIn::yes, MidiOut::no))->nodeID; + + expect (graph.canConnect ({ { nodeA, midiChannel }, { nodeB, midiChannel } })); + expect (! graph.canConnect ({ { nodeB, midiChannel }, { nodeA, midiChannel } })); + expect (! graph.canConnect ({ { nodeA, midiChannel }, { nodeA, midiChannel } })); + expect (! graph.canConnect ({ { nodeB, midiChannel }, { nodeB, midiChannel } })); + + expect (graph.getConnections().empty()); + expect (! graph.isConnected ({ { nodeA, midiChannel }, { nodeB, midiChannel } })); + expect (! graph.isConnected (nodeA, nodeB)); + + expect (graph.addConnection ({ { nodeA, midiChannel }, { nodeB, midiChannel } })); + + expect (graph.getConnections().size() == 1); + expect (graph.isConnected ({ { nodeA, midiChannel }, { nodeB, midiChannel } })); + expect (graph.isConnected (nodeA, nodeB)); + + expect (graph.disconnectNode (nodeA)); + + expect (graph.getConnections().empty()); + expect (! graph.isConnected ({ { nodeA, midiChannel }, { nodeB, midiChannel } })); + expect (! graph.isConnected (nodeA, nodeB)); + } + + beginTest ("graph lookups work with a large number of connections"); + { + AudioProcessorGraph graph; + + std::vector nodeIDs; + + constexpr auto numNodes = 100; + + for (auto i = 0; i < numNodes; ++i) + { + nodeIDs.push_back (graph.addNode (BasicProcessor::make (BasicProcessor::getStereoProperties(), + MidiIn::yes, + MidiOut::yes))->nodeID); + } + + for (auto it = nodeIDs.begin(); it != std::prev (nodeIDs.end()); ++it) + { + expect (graph.addConnection ({ { it[0], 0 }, { it[1], 0 } })); + expect (graph.addConnection ({ { it[0], 1 }, { it[1], 1 } })); + } + + // Check whether isConnected reports correct results when called + // with both connections and nodes + for (auto it = nodeIDs.begin(); it != std::prev (nodeIDs.end()); ++it) + { + expect (graph.isConnected ({ { it[0], 0 }, { it[1], 0 } })); + expect (graph.isConnected ({ { it[0], 1 }, { it[1], 1 } })); + expect (graph.isConnected (it[0], it[1])); + } + + const auto& nodes = graph.getNodes(); + + expect (! graph.isAnInputTo (*nodes[0], *nodes[0])); + + // Check whether isAnInputTo behaves correctly for a non-cyclic graph + for (auto it = std::next (nodes.begin()); it != std::prev (nodes.end()); ++it) + { + expect (! graph.isAnInputTo (**it, **it)); + + expect (graph.isAnInputTo (*nodes[0], **it)); + expect (! graph.isAnInputTo (**it, *nodes[0])); + + expect (graph.isAnInputTo (**it, *nodes[nodes.size() - 1])); + expect (! graph.isAnInputTo (*nodes[nodes.size() - 1], **it)); + } + + // Make the graph cyclic + graph.addConnection ({ { nodeIDs.back(), 0 }, { nodeIDs.front(), 0 } }); + graph.addConnection ({ { nodeIDs.back(), 1 }, { nodeIDs.front(), 1 } }); + + // Check whether isAnInputTo behaves correctly for a cyclic graph + for (const auto* node : graph.getNodes()) + { + expect (graph.isAnInputTo (*node, *node)); + + expect (graph.isAnInputTo (*nodes[0], *node)); + expect (graph.isAnInputTo (*node, *nodes[0])); + + expect (graph.isAnInputTo (*node, *nodes[nodes.size() - 1])); + expect (graph.isAnInputTo (*nodes[nodes.size() - 1], *node)); + } + } + } + +private: + enum class MidiIn { no, yes }; + enum class MidiOut { no, yes }; + + class BasicProcessor : public AudioProcessor + { + public: + explicit BasicProcessor (const AudioProcessor::BusesProperties& layout, MidiIn mIn, MidiOut mOut) + : AudioProcessor (layout), midiIn (mIn), midiOut (mOut) {} + + const String getName() const override { return "Basic Processor"; } + double getTailLengthSeconds() const override { return {}; } + bool acceptsMidi() const override { return midiIn == MidiIn ::yes; } + bool producesMidi() const override { return midiOut == MidiOut::yes; } + AudioProcessorEditor* createEditor() override { return {}; } + bool hasEditor() const override { return {}; } + int getNumPrograms() override { return 1; } + int getCurrentProgram() override { return {}; } + void setCurrentProgram (int) override {} + const String getProgramName (int) override { return {}; } + void changeProgramName (int, const String&) override {} + void getStateInformation (juce::MemoryBlock&) override {} + void setStateInformation (const void*, int) override {} + void prepareToPlay (double, int) override {} + void releaseResources() override {} + void processBlock (AudioBuffer&, MidiBuffer&) override {} + bool supportsDoublePrecisionProcessing() const override { return true; } + bool isMidiEffect() const override { return {}; } + void reset() override {} + void setNonRealtime (bool) noexcept override {} + + using AudioProcessor::processBlock; + + static std::unique_ptr make (const BusesProperties& layout, + MidiIn midiIn, + MidiOut midiOut) + { + return std::make_unique (layout, midiIn, midiOut); + } + + static BusesProperties getStereoProperties() + { + return BusesProperties().withInput ("in", AudioChannelSet::stereo()) + .withOutput ("out", AudioChannelSet::stereo()); + } + + private: + MidiIn midiIn; + MidiOut midiOut; + }; +}; + +static AudioProcessorGraphTests audioProcessorGraphTests; + +#endif + } // namespace juce diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h index 5b690882..8190d754 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h @@ -43,8 +43,7 @@ namespace juce @tags{Audio} */ class JUCE_API AudioProcessorGraph : public AudioProcessor, - public ChangeBroadcaster, - private AsyncUpdater + public ChangeBroadcaster { public: //============================================================================== @@ -81,15 +80,19 @@ public: /** Represents an input or output channel of a node in an AudioProcessorGraph. */ - struct NodeAndChannel + class NodeAndChannel { + auto tie() const { return std::tie (nodeID, channelIndex); } + + public: NodeID nodeID; int channelIndex; bool isMIDI() const noexcept { return channelIndex == midiChannelIndex; } - bool operator== (const NodeAndChannel& other) const noexcept { return nodeID == other.nodeID && channelIndex == other.channelIndex; } - bool operator!= (const NodeAndChannel& other) const noexcept { return ! operator== (other); } + bool operator== (const NodeAndChannel& other) const noexcept { return tie() == other.tie(); } + bool operator!= (const NodeAndChannel& other) const noexcept { return tie() != other.tie(); } + bool operator< (const NodeAndChannel& other) const noexcept { return tie() < other.tie(); } }; //============================================================================== @@ -119,64 +122,55 @@ public: //============================================================================== /** Returns if the node is bypassed or not. */ - bool isBypassed() const noexcept; + bool isBypassed() const noexcept + { + if (processor != nullptr) + { + if (auto* bypassParam = processor->getBypassParameter()) + return (bypassParam->getValue() != 0.0f); + } + + return bypassed; + } /** Tell this node to bypass processing. */ - void setBypassed (bool shouldBeBypassed) noexcept; + void setBypassed (bool shouldBeBypassed) noexcept + { + if (processor != nullptr) + { + if (auto* bypassParam = processor->getBypassParameter()) + bypassParam->setValueNotifyingHost (shouldBeBypassed ? 1.0f : 0.0f); + } + + bypassed = shouldBeBypassed; + } //============================================================================== /** A convenient typedef for referring to a pointer to a node object. */ using Ptr = ReferenceCountedObjectPtr; - private: - //============================================================================== - friend class AudioProcessorGraph; - template - friend struct GraphRenderSequence; - template - friend struct RenderSequenceBuilder; - - struct Connection - { - Node* otherNode; - int otherChannel, thisChannel; + /** @internal - bool operator== (const Connection&) const noexcept; - }; - - std::unique_ptr processor; - Array inputs, outputs; - bool isPrepared = false; - std::atomic bypassed { false }; - - Node (NodeID, std::unique_ptr) noexcept; - - void setParentGraph (AudioProcessorGraph*) const; - void prepare (double newSampleRate, int newBlockSize, AudioProcessorGraph*, ProcessingPrecision); - void unprepare(); - - template - void callProcessFunction (AudioBuffer& audio, - MidiBuffer& midi, - void (AudioProcessor::* function) (AudioBuffer&, MidiBuffer&)) - { - const ScopedLock lock (processorLock); - (processor.get()->*function) (audio, midi); - } + Returns true if setBypassed(true) was called on this node. + This behaviour is different from isBypassed(), which may additionally return true if + the node has a bypass parameter that is not set to 0. + */ + bool userRequestedBypass() const { return bypassed; } - template - void processBlock (AudioBuffer& audio, MidiBuffer& midi) - { - callProcessFunction (audio, midi, &AudioProcessor::processBlock); - } + /** @internal - template - void processBlockBypassed (AudioBuffer& audio, MidiBuffer& midi) + To create a new node, use AudioProcessorGraph::addNode. + */ + Node (NodeID n, std::unique_ptr p) noexcept + : nodeID (n), processor (std::move (p)) { - callProcessFunction (audio, midi, &AudioProcessor::processBlockBypassed); + jassert (processor != nullptr); } - CriticalSection processorLock; + private: + //============================================================================== + std::unique_ptr processor; + std::atomic bypassed { false }; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Node) }; @@ -207,23 +201,36 @@ public: NodeAndChannel destination { {}, 0 }; }; + //============================================================================== + /** Indicates how the graph should be updated after a change. + + If you need to make lots of changes to a graph (e.g. lots of separate calls + to addNode, addConnection etc.) you can avoid rebuilding the graph on each + change by using the async update kind. + */ + enum class UpdateKind + { + sync, ///< Indicates that the graph should be rebuilt immediately after modification. + async ///< Indicates that the graph rebuild should be deferred. + }; + //============================================================================== /** Deletes all nodes and connections from this graph. Any processor objects in the graph will be deleted. */ - void clear(); + void clear (UpdateKind = UpdateKind::sync); /** Returns the array of nodes in the graph. */ - const ReferenceCountedArray& getNodes() const noexcept { return nodes; } + const ReferenceCountedArray& getNodes() const noexcept; /** Returns the number of nodes in the graph. */ - int getNumNodes() const noexcept { return nodes.size(); } + int getNumNodes() const noexcept { return getNodes().size(); } /** Returns a pointer to one of the nodes in the graph. This will return nullptr if the index is out of range. @see getNodeForId */ - Node::Ptr getNode (int index) const noexcept { return nodes[index]; } + Node::Ptr getNode (int index) const noexcept { return getNodes()[index]; } /** Searches the graph for a node with the given ID number and returns it. If no such node was found, this returns nullptr. @@ -242,17 +249,17 @@ public: If this succeeds, it returns a pointer to the newly-created node. */ - Node::Ptr addNode (std::unique_ptr newProcessor, NodeID nodeId = {}); + Node::Ptr addNode (std::unique_ptr newProcessor, NodeID nodeId = {}, UpdateKind = UpdateKind::sync); /** Deletes a node within the graph which has the specified ID. This will also delete any connections that are attached to this node. */ - Node::Ptr removeNode (NodeID); + Node::Ptr removeNode (NodeID, UpdateKind = UpdateKind::sync); /** Deletes a node within the graph. This will also delete any connections that are attached to this node. */ - Node::Ptr removeNode (Node*); + Node::Ptr removeNode (Node*, UpdateKind = UpdateKind::sync); /** Returns the list of connections in the graph. */ std::vector getConnections() const; @@ -268,7 +275,12 @@ public: /** Does a recursive check to see if there's a direct or indirect series of connections between these two nodes. */ - bool isAnInputTo (Node& source, Node& destination) const noexcept; + bool isAnInputTo (const Node& source, const Node& destination) const noexcept; + + /** Does a recursive check to see if there's a direct or indirect series of connections + between these two nodes. + */ + bool isAnInputTo (NodeID source, NodeID destination) const noexcept; /** Returns true if it would be legal to connect the specified points. */ bool canConnect (const Connection&) const; @@ -278,13 +290,13 @@ public: If this isn't allowed (e.g. because you're trying to connect a midi channel to an audio one or other such nonsense), then it'll return false. */ - bool addConnection (const Connection&); + bool addConnection (const Connection&, UpdateKind = UpdateKind::sync); /** Deletes the given connection. */ - bool removeConnection (const Connection&); + bool removeConnection (const Connection&, UpdateKind = UpdateKind::sync); /** Removes all connections from the specified node. */ - bool disconnectNode (NodeID); + bool disconnectNode (NodeID, UpdateKind = UpdateKind::sync); /** Returns true if the given connection's channel numbers map on to valid channels at each end. @@ -298,7 +310,7 @@ public: This might be useful if some of the processors are doing things like changing their channel counts, which could render some connections obsolete. */ - bool removeIllegalConnections(); + bool removeIllegalConnections (UpdateKind = UpdateKind::sync); //============================================================================== /** A special type of AudioProcessor that can live inside an AudioProcessorGraph @@ -412,50 +424,8 @@ public: void setStateInformation (const void* data, int sizeInBytes) override; private: - struct PrepareSettings - { - ProcessingPrecision precision = ProcessingPrecision::singlePrecision; - double sampleRate = 0.0; - int blockSize = 0; - bool valid = false; - - using Tied = std::tuple; - - Tied tie() const noexcept { return std::tie (precision, sampleRate, blockSize, valid); } - - bool operator== (const PrepareSettings& other) const noexcept { return tie() == other.tie(); } - bool operator!= (const PrepareSettings& other) const noexcept { return tie() != other.tie(); } - }; - - //============================================================================== - ReferenceCountedArray nodes; - NodeID lastNodeID = {}; - - struct RenderSequenceFloat; - struct RenderSequenceDouble; - std::unique_ptr renderSequenceFloat; - std::unique_ptr renderSequenceDouble; - - PrepareSettings prepareSettings; - - friend class AudioGraphIOProcessor; - - std::atomic isPrepared { false }; - - void topologyChanged(); - void unprepare(); - void handleAsyncUpdate() override; - void clearRenderingSequence(); - void buildRenderingSequence(); - bool anyNodesNeedPreparing() const noexcept; - bool isConnected (Node* src, int sourceChannel, Node* dest, int destChannel) const noexcept; - bool isAnInputTo (Node& src, Node& dst, int recursionCheck) const noexcept; - bool canConnect (Node* src, int sourceChannel, Node* dest, int destChannel) const noexcept; - bool isLegal (Node* src, int sourceChannel, Node* dest, int destChannel) const noexcept; - static void getNodeConnections (Node&, std::vector&); + class Pimpl; + std::unique_ptr pimpl; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph) }; diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorListener.h b/modules/juce_audio_processors/processors/juce_AudioProcessorListener.h index 77516239..251ff76a 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorListener.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorListener.h @@ -78,7 +78,7 @@ public: @see latencyChanged */ - JUCE_NODISCARD ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); } + [[nodiscard]] ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); } /** Indicates that some attributes of the AudioProcessor's parameters have changed. @@ -88,7 +88,7 @@ public: @see parameterInfoChanged */ - JUCE_NODISCARD ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); } + [[nodiscard]] ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); } /** Indicates that the loaded program has changed. @@ -97,7 +97,7 @@ public: @see programChanged */ - JUCE_NODISCARD ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); } + [[nodiscard]] ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); } /** Indicates that the plugin state has changed (but not its parameters!). @@ -110,7 +110,7 @@ public: @see nonParameterStateChanged */ - JUCE_NODISCARD ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); } + [[nodiscard]] ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); } /** Returns the default set of flags that will be used when AudioProcessor::updateHostDisplay() is called with no arguments. diff --git a/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp b/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp index ad908494..d153c3d2 100644 --- a/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp +++ b/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp @@ -102,6 +102,8 @@ class ParameterComponent : public Component, { public: using ParameterListener::ParameterListener; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ParameterComponent) }; //============================================================================== diff --git a/modules/juce_audio_processors/processors/juce_HostedAudioProcessorParameter.h b/modules/juce_audio_processors/processors/juce_HostedAudioProcessorParameter.h index 0485808d..f72d160c 100644 --- a/modules/juce_audio_processors/processors/juce_HostedAudioProcessorParameter.h +++ b/modules/juce_audio_processors/processors/juce_HostedAudioProcessorParameter.h @@ -32,7 +32,7 @@ namespace juce @tags{Audio} */ -struct HostedAudioProcessorParameter : public AudioProcessorParameter +struct JUCE_API HostedAudioProcessorParameter : public AudioProcessorParameter { using AudioProcessorParameter::AudioProcessorParameter; diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp index dc7414c5..6e819cda 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp @@ -834,138 +834,122 @@ ARAEditorView* ARADocumentControllerSpecialisation::doCreateEditorView() return new ARAEditorView (getDocumentController()); } -bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAvailable (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAvailable ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioSource, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioSourceContentGrade (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioSourceContentGrade ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsAudioSourceContentAvailable() requires overriding // doGetAudioSourceContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (audioSource, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioSourceContentReader (ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioSourceContentReader ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsAudioSourceContentAvailable() requires overriding // doCreateAudioSourceContentReader() accordingly! jassertfalse; - juce::ignoreUnused (audioSource, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsAudioModificationContentAvailable (const ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioModificationContentAvailable ([[maybe_unused]] const ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioModification, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioModificationContentGrade (const ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioModificationContentGrade ([[maybe_unused]] const ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsAudioModificationContentAvailable() requires overriding // doGetAudioModificationContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (audioModification, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioModificationContentReader (ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioModificationContentReader ([[maybe_unused]] ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsAudioModificationContentAvailable() requires overriding // doCreateAudioModificationContentReader() accordingly! jassertfalse; - juce::ignoreUnused (audioModification, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsPlaybackRegionContentAvailable (const ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsPlaybackRegionContentAvailable ([[maybe_unused]] const ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (playbackRegion, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetPlaybackRegionContentGrade (const ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetPlaybackRegionContentGrade ([[maybe_unused]] const ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsPlaybackRegionContentAvailable() requires overriding // doGetPlaybackRegionContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (playbackRegion, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreatePlaybackRegionContentReader (ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreatePlaybackRegionContentReader ([[maybe_unused]] ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsPlaybackRegionContentAvailable() requires overriding // doCreatePlaybackRegionContentReader() accordingly! jassertfalse; - juce::ignoreUnused (playbackRegion, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAnalysisIncomplete (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAnalysisIncomplete ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioSource, type); return false; } -void ARADocumentControllerSpecialisation::doRequestAudioSourceContentAnalysis (ARA::PlugIn::AudioSource* audioSource, - std::vector const& contentTypes) +void ARADocumentControllerSpecialisation::doRequestAudioSourceContentAnalysis ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] std::vector const& contentTypes) { - juce::ignoreUnused (audioSource, contentTypes); } ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmsCount() { return 0; } const ARA::ARAProcessingAlgorithmProperties* - ARADocumentControllerSpecialisation::doGetProcessingAlgorithmProperties (ARA::ARAInt32 algorithmIndex) + ARADocumentControllerSpecialisation::doGetProcessingAlgorithmProperties ([[maybe_unused]] ARA::ARAInt32 algorithmIndex) { - juce::ignoreUnused (algorithmIndex); return nullptr; } -ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmForAudioSource (const ARA::PlugIn::AudioSource* audioSource) +ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmForAudioSource ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource) { // doGetProcessingAlgorithmForAudioSource() must be implemented if the supported // algorithm count is greater than zero. if (getDocumentController()->getProcessingAlgorithmsCount() > 0) jassertfalse; - juce::ignoreUnused (audioSource); return 0; } -void ARADocumentControllerSpecialisation::doRequestProcessingAlgorithmForAudioSource (ARA::PlugIn::AudioSource* audioSource, - ARA::ARAInt32 algorithmIndex) +void ARADocumentControllerSpecialisation::doRequestProcessingAlgorithmForAudioSource ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAInt32 algorithmIndex) { // doRequestProcessingAlgorithmForAudioSource() must be implemented if the supported // algorithm count is greater than zero. - if (getDocumentController()->getProcessingAlgorithmsCount() > 0) - jassertfalse; - - juce::ignoreUnused (audioSource, algorithmIndex); + jassert (getDocumentController()->getProcessingAlgorithmsCount() <= 0); } } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.h b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.h index b06a8312..8b04fbb0 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.h @@ -123,7 +123,7 @@ public: template static const ARA::ARAFactory* createARAFactory() { - static_assert (std::is_base_of::value, + static_assert (std::is_base_of_v, "DocumentController specialization types must inherit from ARADocumentControllerSpecialisation"); return ARA::PlugIn::PlugInEntry::getPlugInEntry>()->getFactory(); } diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp index 918aee43..3db14330 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp @@ -196,4 +196,98 @@ void ARAPlaybackRegion::notifyContentChanged (ARAContentUpdateScopes scopeFlags, notifyARAHost); } +//============================================================================== +void ARADocumentListener::willBeginEditing ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didEndEditing ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::willNotifyModelUpdates ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didNotifyModelUpdates ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::willUpdateDocumentProperties ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARADocumentListener::didUpdateDocumentProperties ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddMusicalContextToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARADocumentListener::willRemoveMusicalContextFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARADocumentListener::didReorderMusicalContextsInDocument ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddRegionSequenceToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARADocumentListener::willRemoveRegionSequenceFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARADocumentListener::didReorderRegionSequencesInDocument ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddAudioSourceToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAAudioSource* audioSource) {} +void ARADocumentListener::willRemoveAudioSourceFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAAudioSource* audioSource) {} +void ARADocumentListener::willDestroyDocument ([[maybe_unused]] ARADocument* document) {} + +//============================================================================== +void ARAMusicalContextListener::willUpdateMusicalContextProperties ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAMusicalContextListener::didUpdateMusicalContextProperties ([[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARAMusicalContextListener::doUpdateMusicalContextContent ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAMusicalContextListener::didAddRegionSequenceToMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARAMusicalContextListener::willRemoveRegionSequenceFromMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARAMusicalContextListener::didReorderRegionSequencesInMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARAMusicalContextListener::willDestroyMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext) {} + +//============================================================================== +void ARAPlaybackRegionListener::willUpdatePlaybackRegionProperties ([[maybe_unused]] ARAPlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAPlaybackRegionListener::didUpdatePlaybackRegionProperties ([[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAPlaybackRegionListener::didUpdatePlaybackRegionContent ([[maybe_unused]] ARAPlaybackRegion* playbackRegion, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAPlaybackRegionListener::willDestroyPlaybackRegion ([[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} + +//============================================================================== +void ARARegionSequenceListener::willUpdateRegionSequenceProperties ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARARegionSequenceListener::didUpdateRegionSequenceProperties ([[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARARegionSequenceListener::willRemovePlaybackRegionFromRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARARegionSequenceListener::didAddPlaybackRegionToRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARARegionSequenceListener::willDestroyRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence) {} + +//============================================================================== +void ARAAudioSourceListener::willUpdateAudioSourceProperties ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAAudioSourceListener::didUpdateAudioSourceProperties ([[maybe_unused]] ARAAudioSource* audioSource) {} +void ARAAudioSourceListener::doUpdateAudioSourceContent ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAAudioSourceListener::didUpdateAudioSourceAnalysisProgress ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARA::ARAAnalysisProgressState state, + [[maybe_unused]] float progress) {} +void ARAAudioSourceListener::willEnableAudioSourceSamplesAccess ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool enable) {} +void ARAAudioSourceListener::didEnableAudioSourceSamplesAccess ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool enable) {} +void ARAAudioSourceListener::willDeactivateAudioSourceForUndoHistory ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool deactivate) {} +void ARAAudioSourceListener::didDeactivateAudioSourceForUndoHistory ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool deactivate) {} +void ARAAudioSourceListener::didAddAudioModificationToAudioSource ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioSourceListener::willRemoveAudioModificationFromAudioSource ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioSourceListener::willDestroyAudioSource ([[maybe_unused]] ARAAudioSource* audioSource) {} + +//============================================================================== +void ARAAudioModificationListener::willUpdateAudioModificationProperties ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAAudioModificationListener::didUpdateAudioModificationProperties ([[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioModificationListener::didUpdateAudioModificationContent ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAAudioModificationListener::willDeactivateAudioModificationForUndoHistory ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] bool deactivate) {} +void ARAAudioModificationListener::didDeactivateAudioModificationForUndoHistory ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] bool deactivate) {} +void ARAAudioModificationListener::didAddPlaybackRegionToAudioModification ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAAudioModificationListener::willRemovePlaybackRegionFromAudioModification ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAAudioModificationListener::willDestroyAudioModification ([[maybe_unused]] ARAAudioModification* audioModification) {} + } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h index e5434e3c..2f3096f2 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h @@ -181,76 +181,49 @@ public: /** Destructor */ virtual ~ARADocumentListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the document enters an editing state. @param document The document about to enter an editing state. */ - virtual void willBeginEditing (ARADocument* document) - { - ignoreUnused (document); - } + virtual void willBeginEditing (ARADocument* document); /** Called after the document exits an editing state. @param document The document about exit an editing state. */ - virtual void didEndEditing (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didEndEditing (ARADocument* document); /** Called before sending model updates do the host. @param document The document whose model updates are about to be sent. */ - virtual void willNotifyModelUpdates (ARADocument* document) - { - ignoreUnused (document); - } + virtual void willNotifyModelUpdates (ARADocument* document); /** Called after sending model updates do the host. @param document The document whose model updates have just been sent. */ - virtual void didNotifyModelUpdates (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didNotifyModelUpdates (ARADocument* document); /** Called before the document's properties are updated. @param document The document whose properties will be updated. @param newProperties The document properties that will be assigned to \p document. */ virtual void willUpdateDocumentProperties (ARADocument* document, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (document, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the document's properties are updated. @param document The document whose properties were updated. */ - virtual void didUpdateDocumentProperties (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didUpdateDocumentProperties (ARADocument* document); /** Called after a musical context is added to the document. @param document The document that \p musicalContext was added to. @param musicalContext The musical context that was added to \p document. */ - virtual void didAddMusicalContextToDocument (ARADocument* document, ARAMusicalContext* musicalContext) - { - ignoreUnused (document, musicalContext); - } + virtual void didAddMusicalContextToDocument (ARADocument* document, ARAMusicalContext* musicalContext); /** Called before a musical context is removed from the document. @param document The document that \p musicalContext will be removed from. @param musicalContext The musical context that will be removed from \p document. */ - virtual void willRemoveMusicalContextFromDocument (ARADocument* document, - ARAMusicalContext* musicalContext) - { - ignoreUnused (document, musicalContext); - } + virtual void willRemoveMusicalContextFromDocument (ARADocument* document, ARAMusicalContext* musicalContext); /** Called after the musical contexts are reordered in an ARA document @@ -259,29 +232,19 @@ public: @param document The document with reordered musical contexts. */ - virtual void didReorderMusicalContextsInDocument (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didReorderMusicalContextsInDocument (ARADocument* document); /** Called after a region sequence is added to the document. @param document The document that \p regionSequence was added to. @param regionSequence The region sequence that was added to \p document. */ - virtual void didAddRegionSequenceToDocument (ARADocument* document, ARARegionSequence* regionSequence) - { - ignoreUnused (document, regionSequence); - } + virtual void didAddRegionSequenceToDocument (ARADocument* document, ARARegionSequence* regionSequence); /** Called before a region sequence is removed from the document. @param document The document that \p regionSequence will be removed from. @param regionSequence The region sequence that will be removed from \p document. */ - virtual void willRemoveRegionSequenceFromDocument (ARADocument* document, - ARARegionSequence* regionSequence) - { - ignoreUnused (document, regionSequence); - } + virtual void willRemoveRegionSequenceFromDocument (ARADocument* document, ARARegionSequence* regionSequence); /** Called after the region sequences are reordered in an ARA document @@ -290,38 +253,24 @@ public: @param document The document with reordered region sequences. */ - virtual void didReorderRegionSequencesInDocument (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didReorderRegionSequencesInDocument (ARADocument* document); /** Called after an audio source is added to the document. @param document The document that \p audioSource was added to. @param audioSource The audio source that was added to \p document. */ - virtual void didAddAudioSourceToDocument (ARADocument* document, ARAAudioSource* audioSource) - { - ignoreUnused (document, audioSource); - } + virtual void didAddAudioSourceToDocument (ARADocument* document, ARAAudioSource* audioSource); /** Called before an audio source is removed from the document. @param document The document that \p audioSource will be removed from . @param audioSource The audio source that will be removed from \p document. */ - virtual void willRemoveAudioSourceFromDocument (ARADocument* document, ARAAudioSource* audioSource) - { - ignoreUnused (document, audioSource); - } + virtual void willRemoveAudioSourceFromDocument (ARADocument* document, ARAAudioSource* audioSource); /** Called before the document is destroyed by the ARA host. @param document The document that will be destroyed. */ - virtual void willDestroyDocument (ARADocument* document) - { - ignoreUnused (document); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyDocument (ARADocument* document); }; //============================================================================== @@ -395,55 +344,36 @@ class JUCE_API ARAMusicalContextListener public: virtual ~ARAMusicalContextListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the musical context's properties are updated. @param musicalContext The musical context whose properties will be updated. @param newProperties The musical context properties that will be assigned to \p musicalContext. */ virtual void willUpdateMusicalContextProperties (ARAMusicalContext* musicalContext, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (musicalContext, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the musical context's properties are updated by the host. @param musicalContext The musical context whose properties were updated. */ - virtual void didUpdateMusicalContextProperties (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } + virtual void didUpdateMusicalContextProperties (ARAMusicalContext* musicalContext); /** Called when the musical context's content (i.e tempo entries or chords) changes. @param musicalContext The musical context with updated content. @param scopeFlags The scope of the content update indicating what has changed. */ - virtual void doUpdateMusicalContextContent (ARAMusicalContext* musicalContext, - ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (musicalContext, scopeFlags); - } + virtual void doUpdateMusicalContextContent (ARAMusicalContext* musicalContext, ARAContentUpdateScopes scopeFlags); /** Called after a region sequence is added to the musical context. @param musicalContext The musical context that \p regionSequence was added to. @param regionSequence The region sequence that was added to \p musicalContext. */ - virtual void didAddRegionSequenceToMusicalContext (ARAMusicalContext* musicalContext, - ARARegionSequence* regionSequence) - { - ignoreUnused (musicalContext, regionSequence); - } + virtual void didAddRegionSequenceToMusicalContext (ARAMusicalContext* musicalContext, ARARegionSequence* regionSequence); /** Called before a region sequence is removed from the musical context. @param musicalContext The musical context that \p regionSequence will be removed from. @param regionSequence The region sequence that will be removed from \p musicalContext. */ virtual void willRemoveRegionSequenceFromMusicalContext (ARAMusicalContext* musicalContext, - ARARegionSequence* regionSequence) - { - ignoreUnused (musicalContext, regionSequence); - } + ARARegionSequence* regionSequence); /** Called after the region sequences are reordered in an ARA MusicalContext @@ -452,20 +382,12 @@ public: @param musicalContext The musical context with reordered region sequences. */ - virtual void didReorderRegionSequencesInMusicalContext (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } + virtual void didReorderRegionSequencesInMusicalContext (ARAMusicalContext* musicalContext); /** Called before the musical context is destroyed. @param musicalContext The musical context that will be destroyed. */ - virtual void willDestroyMusicalContext (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyMusicalContext (ARAMusicalContext* musicalContext); }; //============================================================================== @@ -528,45 +450,29 @@ public: /** Destructor. */ virtual ~ARAPlaybackRegionListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the playback region's properties are updated. @param playbackRegion The playback region whose properties will be updated. @param newProperties The playback region properties that will be assigned to \p playbackRegion. */ virtual void willUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (playbackRegion, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the playback region's properties are updated. @param playbackRegion The playback region whose properties were updated. */ - virtual void didUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (playbackRegion); - } + virtual void didUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion); /** Called when the playback region's content (i.e. samples or notes) changes. @param playbackRegion The playback region with updated content. @param scopeFlags The scope of the content update. */ virtual void didUpdatePlaybackRegionContent (ARAPlaybackRegion* playbackRegion, - ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (playbackRegion, scopeFlags); - } + ARAContentUpdateScopes scopeFlags); /** Called before the playback region is destroyed. @param playbackRegion The playback region that will be destroyed. */ - virtual void willDestroyPlaybackRegion (ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (playbackRegion); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyPlaybackRegion (ARAPlaybackRegion* playbackRegion); }; //============================================================================== @@ -665,55 +571,36 @@ public: /** Destructor. */ virtual ~ARARegionSequenceListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the region sequence's properties are updated. @param regionSequence The region sequence whose properties will be updated. @param newProperties The region sequence properties that will be assigned to \p regionSequence. */ virtual void willUpdateRegionSequenceProperties (ARARegionSequence* regionSequence, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (regionSequence, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the region sequence's properties are updated. @param regionSequence The region sequence whose properties were updated. */ - virtual void didUpdateRegionSequenceProperties (ARARegionSequence* regionSequence) - { - ignoreUnused (regionSequence); - } + virtual void didUpdateRegionSequenceProperties (ARARegionSequence* regionSequence); /** Called before a playback region is removed from the region sequence. @param regionSequence The region sequence that \p playbackRegion will be removed from. @param playbackRegion The playback region that will be removed from \p regionSequence. */ virtual void willRemovePlaybackRegionFromRegionSequence (ARARegionSequence* regionSequence, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (regionSequence, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called after a playback region is added to the region sequence. @param regionSequence The region sequence that \p playbackRegion was added to. @param playbackRegion The playback region that was added to \p regionSequence. */ virtual void didAddPlaybackRegionToRegionSequence (ARARegionSequence* regionSequence, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (regionSequence, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before the region sequence is destroyed. @param regionSequence The region sequence that will be destroyed. */ - virtual void willDestroyRegionSequence (ARARegionSequence* regionSequence) - { - ignoreUnused (regionSequence); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyRegionSequence (ARARegionSequence* regionSequence); }; //============================================================================== @@ -800,34 +687,23 @@ public: /** Destructor. */ virtual ~ARAAudioSourceListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the audio source's properties are updated. @param audioSource The audio source whose properties will be updated. @param newProperties The audio source properties that will be assigned to \p audioSource. */ virtual void willUpdateAudioSourceProperties (ARAAudioSource* audioSource, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (audioSource, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the audio source's properties are updated. @param audioSource The audio source whose properties were updated. */ - virtual void didUpdateAudioSourceProperties (ARAAudioSource* audioSource) - { - ignoreUnused (audioSource); - } + virtual void didUpdateAudioSourceProperties (ARAAudioSource* audioSource); /** Called when the audio source's content (i.e. samples or notes) changes. @param audioSource The audio source with updated content. @param scopeFlags The scope of the content update. */ - virtual void doUpdateAudioSourceContent (ARAAudioSource* audioSource, ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (audioSource, scopeFlags); - } + virtual void doUpdateAudioSourceContent (ARAAudioSource* audioSource, ARAContentUpdateScopes scopeFlags); /** Called to notify progress when an audio source is being analyzed. @param audioSource The audio source being analyzed. @@ -836,76 +712,54 @@ public: */ virtual void didUpdateAudioSourceAnalysisProgress (ARAAudioSource* audioSource, ARA::ARAAnalysisProgressState state, - float progress) - { - ignoreUnused (audioSource, state, progress); - } + float progress); /** Called before access to an audio source's samples is enabled or disabled. @param audioSource The audio source whose sample access state will be changed. @param enable A bool indicating whether or not sample access will be enabled or disabled. */ - virtual void willEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, bool enable) - { - ignoreUnused (audioSource, enable); - } + virtual void willEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, + bool enable); /** Called after access to an audio source's samples is enabled or disabled. @param audioSource The audio source whose sample access state was changed. @param enable A bool indicating whether or not sample access was enabled or disabled. */ - virtual void didEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, bool enable) - { - ignoreUnused (audioSource, enable); - } + virtual void didEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, + bool enable); /** Called before an audio source is activated or deactivated when being removed / added from the host's undo history. @param audioSource The audio source that will be activated or deactivated @param deactivate A bool indicating whether \p audioSource was deactivated or activated. */ - virtual void willDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, bool deactivate) - { - ignoreUnused (audioSource, deactivate); - } + virtual void willDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, + bool deactivate); /** Called after an audio source is activated or deactivated when being removed / added from the host's undo history. @param audioSource The audio source that was activated or deactivated @param deactivate A bool indicating whether \p audioSource was deactivated or activated. */ - virtual void didDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, bool deactivate) - { - ignoreUnused (audioSource, deactivate); - } + virtual void didDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, + bool deactivate); /** Called after an audio modification is added to the audio source. @param audioSource The region sequence that \p audioModification was added to. @param audioModification The playback region that was added to \p audioSource. */ virtual void didAddAudioModificationToAudioSource (ARAAudioSource* audioSource, - ARAAudioModification* audioModification) - { - ignoreUnused (audioSource, audioModification); - } + ARAAudioModification* audioModification); /** Called before an audio modification is removed from the audio source. @param audioSource The audio source that \p audioModification will be removed from. @param audioModification The audio modification that will be removed from \p audioSource. */ virtual void willRemoveAudioModificationFromAudioSource (ARAAudioSource* audioSource, - ARAAudioModification* audioModification) - { - ignoreUnused (audioSource, audioModification); - } + ARAAudioModification* audioModification); /** Called before the audio source is destroyed. @param audioSource The audio source that will be destroyed. */ - virtual void willDestroyAudioSource (ARAAudioSource* audioSource) - { - ignoreUnused (audioSource); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyAudioSource (ARAAudioSource* audioSource); }; //============================================================================== @@ -1004,82 +858,57 @@ public: /** Destructor. */ virtual ~ARAAudioModificationListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the audio modification's properties are updated. @param audioModification The audio modification whose properties will be updated. @param newProperties The audio modification properties that will be assigned to \p audioModification. */ virtual void willUpdateAudioModificationProperties (ARAAudioModification* audioModification, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (audioModification, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the audio modification's properties are updated. @param audioModification The audio modification whose properties were updated. */ - virtual void didUpdateAudioModificationProperties (ARAAudioModification* audioModification) - { - ignoreUnused (audioModification); - } + virtual void didUpdateAudioModificationProperties (ARAAudioModification* audioModification); /** Called when the audio modification's content (i.e. samples or notes) changes. @param audioModification The audio modification with updated content. @param scopeFlags The scope of the content update. */ - virtual void didUpdateAudioModificationContent (ARAAudioModification* audioModification, ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (audioModification, scopeFlags); - } + virtual void didUpdateAudioModificationContent (ARAAudioModification* audioModification, + ARAContentUpdateScopes scopeFlags); /** Called before an audio modification is activated or deactivated when being removed / added from the host's undo history. @param audioModification The audio modification that was activated or deactivated @param deactivate A bool indicating whether \p audioModification was deactivated or activated. */ - virtual void willDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, bool deactivate) - { - ignoreUnused (audioModification, deactivate); - } + virtual void willDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, + bool deactivate); /** Called after an audio modification is activated or deactivated when being removed / added from the host's undo history. @param audioModification The audio modification that was activated or deactivated @param deactivate A bool indicating whether \p audioModification was deactivated or activated. */ - virtual void didDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, bool deactivate) - { - ignoreUnused (audioModification, deactivate); - } + virtual void didDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, + bool deactivate); /** Called after a playback region is added to the audio modification. @param audioModification The audio modification that \p playbackRegion was added to. @param playbackRegion The playback region that was added to \p audioModification. */ virtual void didAddPlaybackRegionToAudioModification (ARAAudioModification* audioModification, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (audioModification, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before a playback region is removed from the audio modification. @param audioModification The audio modification that \p playbackRegion will be removed from. @param playbackRegion The playback region that will be removed from \p audioModification. */ virtual void willRemovePlaybackRegionFromAudioModification (ARAAudioModification* audioModification, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (audioModification, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before the audio modification is destroyed. @param audioModification The audio modification that will be destroyed. */ - virtual void willDestroyAudioModification (ARAAudioModification* audioModification) - { - ignoreUnused (audioModification); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyAudioModification (ARAAudioModification* audioModification); }; //============================================================================== diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp index fcece498..c80e1027 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp @@ -28,12 +28,10 @@ namespace juce { -bool ARARenderer::processBlock (AudioBuffer& buffer, - AudioProcessor::Realtime realtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept +bool ARARenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime realtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept { - ignoreUnused (buffer, realtime, positionInfo); - // If you hit this assertion then either the caller called the double // precision version of processBlock on a processor which does not support it // (i.e. supportsDoublePrecisionProcessing() returns false), or the implementation @@ -43,6 +41,12 @@ bool ARARenderer::processBlock (AudioBuffer& buffer, return false; } +void ARARenderer::prepareToPlay ([[maybe_unused]] double sampleRate, + [[maybe_unused]] int maximumSamplesPerBlock, + [[maybe_unused]] int numChannels, + [[maybe_unused]] AudioProcessor::ProcessingPrecision precision, + [[maybe_unused]] AlwaysNonRealtime alwaysNonRealtime) {} + //============================================================================== #if ARA_VALIDATE_API_CALLS void ARAPlaybackRenderer::addPlaybackRegion (ARA::ARAPlaybackRegionRef playbackRegionRef) noexcept @@ -62,6 +66,21 @@ void ARAPlaybackRenderer::removePlaybackRegion (ARA::ARAPlaybackRegionRef playba } #endif +bool ARAPlaybackRenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime realtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept +{ + return false; +} + +//============================================================================== +bool ARAEditorRenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime isNonRealtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept +{ + return true; +} + //============================================================================== void ARAEditorView::doNotifySelection (const ARA::PlugIn::ViewSelection* viewSelection) noexcept { @@ -89,4 +108,7 @@ void ARAEditorView::removeListener (Listener* l) listeners.remove (l); } +void ARAEditorView::Listener::onNewSelection ([[maybe_unused]] const ARAViewSelection& viewSelection) {} +void ARAEditorView::Listener::onHideRegionSequences ([[maybe_unused]] const std::vector& regionSequences) {} + } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h index e23aeded..490e5667 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h @@ -59,10 +59,7 @@ public: int maximumSamplesPerBlock, int numChannels, AudioProcessor::ProcessingPrecision precision, - AlwaysNonRealtime alwaysNonRealtime = AlwaysNonRealtime::no) - { - ignoreUnused (sampleRate, maximumSamplesPerBlock, numChannels, precision, alwaysNonRealtime); - } + AlwaysNonRealtime alwaysNonRealtime = AlwaysNonRealtime::no); /** Frees render resources allocated in prepareToPlay(). */ virtual void releaseResources() {} @@ -128,11 +125,7 @@ public: bool processBlock (AudioBuffer& buffer, AudioProcessor::Realtime realtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept override - { - ignoreUnused (buffer, realtime, positionInfo); - return false; - } + const AudioPlayHead::PositionInfo& positionInfo) noexcept override; using ARARenderer::processBlock; @@ -191,11 +184,7 @@ public: // isNonRealtime of the process context - typically preview is limited to realtime. bool processBlock (AudioBuffer& buffer, AudioProcessor::Realtime isNonRealtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept override - { - ignoreUnused (buffer, isNonRealtime, positionInfo); - return true; - } + const AudioPlayHead::PositionInfo& positionInfo) noexcept override; using ARARenderer::processBlock; @@ -204,7 +193,7 @@ private: }; //============================================================================== -/** Base class for a renderer fulfilling the ARAEditorView role as described in the ARA SDK. +/** Base class for fulfilling the ARAEditorView role as described in the ARA SDK. Instances of this class are constructed by the DocumentController. If you are subclassing ARAEditorView, make sure to call the base class implementation of overridden functions. @@ -218,7 +207,7 @@ public: // Shadowing templated getters to default to JUCE versions of the returned classes template - std::vector const& getHiddenRegionSequences() const noexcept + const std::vector& getHiddenRegionSequences() const noexcept { return ARA::PlugIn::EditorView::getHiddenRegionSequences(); } @@ -227,7 +216,7 @@ public: void doNotifySelection (const ARA::PlugIn::ViewSelection* currentSelection) noexcept override; // Base class implementation must be called if overridden - void doNotifyHideRegionSequences (std::vector const& regionSequences) noexcept override; + void doNotifyHideRegionSequences (const std::vector& regionSequences) noexcept override; /** A base class for listeners that want to know about changes to an ARAEditorView object. @@ -239,25 +228,15 @@ public: /** Destructor. */ virtual ~Listener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called when the editor view's selection changes. @param viewSelection The current selection state */ - virtual void onNewSelection (const ARA::PlugIn::ViewSelection& viewSelection) - { - ignoreUnused (viewSelection); - } + virtual void onNewSelection (const ARAViewSelection& viewSelection); /** Called when region sequences are flagged as hidden in the host UI. @param regionSequences A vector containing all hidden region sequences. */ - virtual void onHideRegionSequences (std::vector const& regionSequences) - { - ignoreUnused (regionSequences); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void onHideRegionSequences (const std::vector& regionSequences); }; /** \copydoc ARAListenableModelClass::addListener */ diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorParameterWithID.h b/modules/juce_audio_processors/utilities/juce_AudioProcessorParameterWithID.h index a75834c8..15f7882c 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorParameterWithID.h +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorParameterWithID.h @@ -71,34 +71,34 @@ public: using Category = AudioProcessorParameter::Category; /** An optional label for the parameter's value */ - JUCE_NODISCARD auto withLabel (String x) const { return withMember (*this, &This::label, std::move (x)); } + [[nodiscard]] auto withLabel (String x) const { return withMember (*this, &This::label, std::move (x)); } /** The semantics of this parameter */ - JUCE_NODISCARD auto withCategory (Category x) const { return withMember (*this, &This::category, std::move (x)); } + [[nodiscard]] auto withCategory (Category x) const { return withMember (*this, &This::category, std::move (x)); } /** @see AudioProcessorParameter::isMetaParameter() */ - JUCE_NODISCARD auto withMeta (bool x) const { return withMember (*this, &This::meta, std::move (x)); } + [[nodiscard]] auto withMeta (bool x) const { return withMember (*this, &This::meta, std::move (x)); } /** @see AudioProcessorParameter::isAutomatable() */ - JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (*this, &This::automatable, std::move (x)); } + [[nodiscard]] auto withAutomatable (bool x) const { return withMember (*this, &This::automatable, std::move (x)); } /** @see AudioProcessorParameter::isOrientationInverted() */ - JUCE_NODISCARD auto withInverted (bool x) const { return withMember (*this, &This::inverted, std::move (x)); } + [[nodiscard]] auto withInverted (bool x) const { return withMember (*this, &This::inverted, std::move (x)); } /** An optional label for the parameter's value */ - JUCE_NODISCARD auto getLabel() const { return label; } + [[nodiscard]] auto getLabel() const { return label; } /** The semantics of this parameter */ - JUCE_NODISCARD auto getCategory() const { return category; } + [[nodiscard]] auto getCategory() const { return category; } /** @see AudioProcessorParameter::isMetaParameter() */ - JUCE_NODISCARD auto getMeta() const { return meta; } + [[nodiscard]] auto getMeta() const { return meta; } /** @see AudioProcessorParameter::isAutomatable() */ - JUCE_NODISCARD auto getAutomatable() const { return automatable; } + [[nodiscard]] auto getAutomatable() const { return automatable; } /** @see AudioProcessorParameter::isOrientationInverted() */ - JUCE_NODISCARD auto getInverted() const { return inverted; } + [[nodiscard]] auto getInverted() const { return inverted; } private: String label; diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp index caf7eb79..7e75bc14 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp @@ -251,7 +251,7 @@ AudioProcessorValueTreeState::AudioProcessorValueTreeState (AudioProcessor& proc } } - state->processor.addParameterGroup (move (group)); + state->processor.addParameterGroup (std::move (group)); } AudioProcessorValueTreeState* state; diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h index 4c498f9b..a6e0de39 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h @@ -42,38 +42,38 @@ class AudioProcessorValueTreeStateParameterAttributes public: /** @see RangedAudioParameterAttributes::withStringFromValueFunction() */ - JUCE_NODISCARD auto withStringFromValueFunction (StringFromValue x) const { return withMember (*this, &This::attributes, attributes.withStringFromValueFunction (std::move (x))); } + [[nodiscard]] auto withStringFromValueFunction (StringFromValue x) const { return withMember (*this, &This::attributes, attributes.withStringFromValueFunction (std::move (x))); } /** @see RangedAudioParameterAttributes::withValueFromStringFunction() */ - JUCE_NODISCARD auto withValueFromStringFunction (ValueFromString x) const { return withMember (*this, &This::attributes, attributes.withValueFromStringFunction (std::move (x))); } + [[nodiscard]] auto withValueFromStringFunction (ValueFromString x) const { return withMember (*this, &This::attributes, attributes.withValueFromStringFunction (std::move (x))); } /** @see RangedAudioParameterAttributes::withLabel() */ - JUCE_NODISCARD auto withLabel (String x) const { return withMember (*this, &This::attributes, attributes.withLabel (std::move (x))); } + [[nodiscard]] auto withLabel (String x) const { return withMember (*this, &This::attributes, attributes.withLabel (std::move (x))); } /** @see RangedAudioParameterAttributes::withCategory() */ - JUCE_NODISCARD auto withCategory (Category x) const { return withMember (*this, &This::attributes, attributes.withCategory (std::move (x))); } + [[nodiscard]] auto withCategory (Category x) const { return withMember (*this, &This::attributes, attributes.withCategory (std::move (x))); } /** @see RangedAudioParameterAttributes::withMeta() */ - JUCE_NODISCARD auto withMeta (bool x) const { return withMember (*this, &This::attributes, attributes.withMeta (std::move (x))); } + [[nodiscard]] auto withMeta (bool x) const { return withMember (*this, &This::attributes, attributes.withMeta (std::move (x))); } /** @see RangedAudioParameterAttributes::withAutomatable() */ - JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (*this, &This::attributes, attributes.withAutomatable (std::move (x))); } + [[nodiscard]] auto withAutomatable (bool x) const { return withMember (*this, &This::attributes, attributes.withAutomatable (std::move (x))); } /** @see RangedAudioParameterAttributes::withInverted() */ - JUCE_NODISCARD auto withInverted (bool x) const { return withMember (*this, &This::attributes, attributes.withInverted (std::move (x))); } + [[nodiscard]] auto withInverted (bool x) const { return withMember (*this, &This::attributes, attributes.withInverted (std::move (x))); } /** Pass 'true' if this parameter has discrete steps, or 'false' if the parameter is continuous. Using an AudioParameterChoice or AudioParameterInt might be a better choice than setting this flag. */ - JUCE_NODISCARD auto withDiscrete (bool x) const { return withMember (*this, &This::discrete, std::move (x)); } + [[nodiscard]] auto withDiscrete (bool x) const { return withMember (*this, &This::discrete, std::move (x)); } /** Pass 'true' if this parameter only has two valid states. Using an AudioParameterBool might be a better choice than setting this flag. */ - JUCE_NODISCARD auto withBoolean (bool x) const { return withMember (*this, &This::boolean, std::move (x)); } + [[nodiscard]] auto withBoolean (bool x) const { return withMember (*this, &This::boolean, std::move (x)); } /** @returns all attributes that might also apply to an AudioParameterFloat */ - JUCE_NODISCARD const auto& getAudioParameterFloatAttributes() const { return attributes; } + [[nodiscard]] const auto& getAudioParameterFloatAttributes() const { return attributes; } /** @returns 'true' if this parameter has discrete steps, or 'false' if the parameter is continuous. */ - JUCE_NODISCARD const auto& getDiscrete() const { return discrete; } + [[nodiscard]] const auto& getDiscrete() const { return discrete; } /** @returns 'true' if this parameter only has two valid states. */ - JUCE_NODISCARD const auto& getBoolean() const { return boolean; } + [[nodiscard]] const auto& getBoolean() const { return boolean; } private: AudioParameterFloatAttributes attributes; @@ -135,12 +135,7 @@ public: void add (std::unique_ptr... items) { parameters.reserve (parameters.size() + sizeof... (items)); - - // We can replace this with some nicer code once generic lambdas become available. A - // sequential context like an array initialiser is required to ensure we get the correct - // order from the parameter pack. - int unused[] { (parameters.emplace_back (MakeContents() (std::move (items))), 0)... }; - ignoreUnused (unused); + (parameters.push_back (makeParameterStorage (std::move (items))), ...); } template > @@ -150,7 +145,7 @@ public: std::transform (std::make_move_iterator (begin), std::make_move_iterator (end), std::back_inserter (parameters), - MakeContents()); + [] (auto item) { return makeParameterStorage (std::move (item)); }); } ParameterLayout (const ParameterLayout& other) = delete; @@ -191,14 +186,11 @@ public: std::unique_ptr contents; }; - struct MakeContents final + template + static std::unique_ptr> makeParameterStorage (std::unique_ptr contents) { - template - std::unique_ptr operator() (std::unique_ptr item) const - { - return std::unique_ptr (new ParameterStorage (std::move (item))); - } - }; + return std::make_unique> (std::move (contents)); + } void add() {} @@ -498,7 +490,7 @@ public: valueRange, defaultParameterValue, AudioProcessorValueTreeStateParameterAttributes().withLabel (labelText) - .withStringFromValueFunction ([valueToTextFunction] (float v, int) { return valueToTextFunction (v); }) + .withStringFromValueFunction (adaptSignature (std::move (valueToTextFunction))) .withValueFromStringFunction (std::move (textToValueFunction)) .withMeta (isMetaParameter) .withAutomatable (isAutomatableParameter) @@ -515,6 +507,14 @@ public: bool isBoolean() const override; private: + static std::function adaptSignature (std::function func) + { + if (func == nullptr) + return nullptr; + + return [func = std::move (func)] (float v, int) { return func (v); }; + } + void valueChanged (float) override; std::function onValueChanged; diff --git a/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp b/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp index 6651bddf..78f7ea23 100644 --- a/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp +++ b/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp @@ -56,7 +56,7 @@ void PluginHostType::switchToHostApplication() const #endif } -bool PluginHostType::isInAAXAudioSuite (AudioProcessor& processor) +bool PluginHostType::isInAAXAudioSuite ([[maybe_unused]] AudioProcessor& processor) { #if JucePlugin_Build_AAX if (PluginHostType::getPluginLoadedAs() == AudioProcessor::wrapperType_AAX @@ -66,14 +66,11 @@ bool PluginHostType::isInAAXAudioSuite (AudioProcessor& processor) } #endif - ignoreUnused (processor); return false; } -Image PluginHostType::getHostIcon (int size) const +Image PluginHostType::getHostIcon ([[maybe_unused]] int size) const { - ignoreUnused (size); - #if JucePlugin_Enable_IAA && JucePlugin_Build_Standalone && JUCE_IOS && (! JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP) if (isInterAppAudioConnected()) return juce_getIAAHostIcon (size); @@ -101,10 +98,12 @@ const char* PluginHostType::getHostDescription() const noexcept case AdobeAudition: return "Adobe Audition"; case AdobePremierePro: return "Adobe Premiere"; case AppleGarageBand: return "Apple GarageBand"; + case AppleInfoHelper: return "com.apple.audio.InfoHelper"; case AppleLogic: return "Apple Logic"; case AppleMainStage: return "Apple MainStage"; case Ardour: return "Ardour"; case AULab: return "AU Lab"; + case AUVal: return "auval"; case AvidProTools: return "ProTools"; case BitwigStudio: return "Bitwig Studio"; case CakewalkSonar8: return "Cakewalk Sonar 8"; @@ -215,6 +214,8 @@ PluginHostType::HostType PluginHostType::getHostType() if (hostFilename.containsIgnoreCase ("pluginval")) return pluginval; if (hostFilename.containsIgnoreCase ("AudioPluginHost")) return JUCEPluginHost; if (hostFilename.containsIgnoreCase ("Vienna Ensemble Pro")) return ViennaEnsemblePro; + if (hostFilename.containsIgnoreCase ("auvaltool")) return AUVal; + if (hostFilename.containsIgnoreCase ("com.apple.audio.infohelper")) return AppleInfoHelper; if (hostIdReportedByWrapper == "com.apple.logic.pro") return AppleLogic; if (hostIdReportedByWrapper == "com.apple.garageband") return AppleGarageBand; diff --git a/modules/juce_audio_processors/utilities/juce_PluginHostType.h b/modules/juce_audio_processors/utilities/juce_PluginHostType.h index c222899f..cf5f0e40 100644 --- a/modules/juce_audio_processors/utilities/juce_PluginHostType.h +++ b/modules/juce_audio_processors/utilities/juce_PluginHostType.h @@ -58,10 +58,12 @@ public: AdobeAudition, /**< Represents Adobe Audition. */ AdobePremierePro, /**< Represents Adobe Premiere Pro. */ AppleGarageBand, /**< Represents Apple GarageBand. */ + AppleInfoHelper, /**< Represents Apple com.apple.audio.InfoHelper. */ AppleLogic, /**< Represents Apple Logic Pro. */ AppleMainStage, /**< Represents Apple Main Stage. */ Ardour, /**< Represents Ardour. */ AULab, /**< Represents AU Lab. */ + AUVal, /**< Represents Apple AU validator. */ AvidProTools, /**< Represents Avid Pro Tools. */ BitwigStudio, /**< Represents Bitwig Studio. */ CakewalkSonar8, /**< Represents Cakewalk Sonar 8. */ @@ -121,10 +123,14 @@ public: || type == AbletonLiveGeneric; } /** Returns true if the host is Adobe Audition. */ bool isAdobeAudition() const noexcept { return type == AdobeAudition; } + /** Returns true if the host is com.apple.audio.InfoHelper. */ + bool isAppleInfoHelper() const noexcept { return type == AppleInfoHelper; } /** Returns true if the host is Ardour. */ bool isArdour() const noexcept { return type == Ardour; } /** Returns true if the host is AU Lab. */ bool isAULab() const noexcept { return type == AULab; } + /** Returns true if the host is auval. */ + bool isAUVal() const noexcept { return type == AUVal; } /** Returns true if the host is Bitwig Studio. */ bool isBitwigStudio() const noexcept { return type == BitwigStudio; } /** Returns true if the host is any version of Steinberg Cubase. */ diff --git a/modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h b/modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h index 1fad305d..c24c52b9 100644 --- a/modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h +++ b/modules/juce_audio_processors/utilities/juce_RangedAudioParameter.h @@ -49,34 +49,34 @@ public: using ValueFromString = std::function; /** An optional lambda function that converts a non-normalised value to a string with a maximum length. This may be used by hosts to display the parameter's value. */ - JUCE_NODISCARD auto withStringFromValueFunction (StringFromValue x) const { return withMember (asDerived(), &Derived::stringFromValue, std::move (x)); } + [[nodiscard]] auto withStringFromValueFunction (StringFromValue x) const { return withMember (asDerived(), &Derived::stringFromValue, std::move (x)); } /** An optional lambda function that parses a string and converts it into a non-normalised value. Some hosts use this to allow users to type in parameter values. */ - JUCE_NODISCARD auto withValueFromStringFunction (ValueFromString x) const { return withMember (asDerived(), &Derived::valueFromString, std::move (x)); } + [[nodiscard]] auto withValueFromStringFunction (ValueFromString x) const { return withMember (asDerived(), &Derived::valueFromString, std::move (x)); } /** See AudioProcessorParameterWithIDAttributes::withLabel() */ - JUCE_NODISCARD auto withLabel (String x) const { return withMember (asDerived(), &Derived::attributes, attributes.withLabel (std::move (x))); } + [[nodiscard]] auto withLabel (String x) const { return withMember (asDerived(), &Derived::attributes, attributes.withLabel (std::move (x))); } /** See AudioProcessorParameterWithIDAttributes::withCategory() */ - JUCE_NODISCARD auto withCategory (Category x) const { return withMember (asDerived(), &Derived::attributes, attributes.withCategory (std::move (x))); } + [[nodiscard]] auto withCategory (Category x) const { return withMember (asDerived(), &Derived::attributes, attributes.withCategory (std::move (x))); } /** See AudioProcessorParameter::isMetaParameter() */ - JUCE_NODISCARD auto withMeta (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withMeta (std::move (x))); } + [[nodiscard]] auto withMeta (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withMeta (std::move (x))); } /** See AudioProcessorParameter::isAutomatable() */ - JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withAutomatable (std::move (x))); } + [[nodiscard]] auto withAutomatable (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withAutomatable (std::move (x))); } /** See AudioProcessorParameter::isOrientationInverted() */ - JUCE_NODISCARD auto withInverted (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withInverted (std::move (x))); } + [[nodiscard]] auto withInverted (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withInverted (std::move (x))); } /** An optional lambda function that converts a non-normalised value to a string with a maximum length. This may be used by hosts to display the parameter's value. */ - JUCE_NODISCARD const auto& getStringFromValueFunction() const { return stringFromValue; } + [[nodiscard]] const auto& getStringFromValueFunction() const { return stringFromValue; } /** An optional lambda function that parses a string and converts it into a non-normalised value. Some hosts use this to allow users to type in parameter values. */ - JUCE_NODISCARD const auto& getValueFromStringFunction() const { return valueFromString; } + [[nodiscard]] const auto& getValueFromStringFunction() const { return valueFromString; } /** Gets attributes that would also apply to an AudioProcessorParameterWithID */ - JUCE_NODISCARD const auto& getAudioProcessorParameterWithIDAttributes() const { return attributes; } + [[nodiscard]] const auto& getAudioProcessorParameterWithIDAttributes() const { return attributes; } private: auto& asDerived() const { return *static_cast (this); } diff --git a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp new file mode 100644 index 00000000..e8b42e9b --- /dev/null +++ b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp @@ -0,0 +1,39 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +pointer_sized_int VSTCallbackHandler::handleVstPluginCanDo ([[maybe_unused]] int32 index, + [[maybe_unused]] pointer_sized_int value, + [[maybe_unused]] void* ptr, + [[maybe_unused]] float opt) +{ + return 0; +} + +void VSTCallbackHandler::handleVstHostCallbackAvailable ([[maybe_unused]] std::function&& callback) {} + +} // namespace juce diff --git a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h index d5a4ea5e..9fe3a0ad 100644 --- a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h +++ b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h @@ -46,11 +46,7 @@ struct VSTCallbackHandler virtual pointer_sized_int handleVstPluginCanDo (int32 index, pointer_sized_int value, void* ptr, - float opt) - { - ignoreUnused (index, value, ptr, opt); - return 0; - } + float opt); /** This is called by the VST plug-in wrapper when it receives unhandled vendor specific calls from the host. @@ -71,10 +67,7 @@ struct VSTCallbackHandler /** This is called once by the VST plug-in wrapper after its constructor. You can use the supplied function to query the VST host. */ - virtual void handleVstHostCallbackAvailable (std::function&& callback) - { - ignoreUnused (callback); - } + virtual void handleVstHostCallbackAvailable (std::function&& callback); }; } // namespace juce diff --git a/modules/juce_audio_utils/audio_cd/juce_AudioCDReader.h b/modules/juce_audio_utils/audio_cd/juce_AudioCDReader.h index d616a33b..8f2277cf 100644 --- a/modules/juce_audio_utils/audio_cd/juce_AudioCDReader.h +++ b/modules/juce_audio_utils/audio_cd/juce_AudioCDReader.h @@ -68,7 +68,7 @@ public: ~AudioCDReader() override; /** Implementation of the AudioFormatReader method. */ - bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, + bool readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override; /** Checks whether the CD has been removed from the drive. */ diff --git a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp index 3ffc4438..809162f5 100644 --- a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp @@ -1193,11 +1193,18 @@ void AudioDeviceSelectorComponent::updateAllControls() void AudioDeviceSelectorComponent::handleBluetoothButton() { - if (! RuntimePermissions::isGranted (RuntimePermissions::bluetoothMidi)) - RuntimePermissions::request (RuntimePermissions::bluetoothMidi, nullptr); - if (RuntimePermissions::isGranted (RuntimePermissions::bluetoothMidi)) + { BluetoothMidiDevicePairingDialogue::open(); + } + else + { + RuntimePermissions::request (RuntimePermissions::bluetoothMidi, [] (auto) + { + if (RuntimePermissions::isGranted (RuntimePermissions::bluetoothMidi)) + BluetoothMidiDevicePairingDialogue::open(); + }); + } } ListBox* AudioDeviceSelectorComponent::getMidiInputSelectorListBox() const noexcept diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp index 4f0e5a2d..377b70ed 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp @@ -83,6 +83,66 @@ private: int8 values[2]; }; + +//============================================================================== +template +class AudioBufferReader : public AudioFormatReader +{ +public: + AudioBufferReader (const AudioBuffer* bufferIn, double rate) + : AudioFormatReader (nullptr, "AudioBuffer"), buffer (bufferIn) + { + sampleRate = rate; + bitsPerSample = 32; + lengthInSamples = buffer->getNumSamples(); + numChannels = (unsigned int) buffer->getNumChannels(); + usesFloatingPointData = std::is_floating_point_v; + } + + bool readSamples (int* const* destChannels, + int numDestChannels, + int startOffsetInDestBuffer, + int64 startSampleInFile, + int numSamples) override + { + clearSamplesBeyondAvailableLength (destChannels, numDestChannels, startOffsetInDestBuffer, + startSampleInFile, numSamples, lengthInSamples); + + const auto numAvailableSamples = (int) ((int64) buffer->getNumSamples() - startSampleInFile); + const auto numSamplesToCopy = std::clamp (numAvailableSamples, 0, numSamples); + + if (numSamplesToCopy == 0) + return true; + + for (int i = 0; i < numDestChannels; ++i) + { + if (void* targetChannel = destChannels[i]) + { + const auto dest = DestType (targetChannel) + startOffsetInDestBuffer; + + if (i < buffer->getNumChannels()) + dest.convertSamples (SourceType (buffer->getReadPointer (i) + startSampleInFile), numSamplesToCopy); + else + dest.clearSamples (numSamples); + } + } + + return true; + } + +private: + using SourceNumericalType = + std::conditional_t, AudioData::Int32, + std::conditional_t, AudioData::Float32, void>>; + + using DestinationNumericalType = std::conditional_t, AudioData::Float32, AudioData::Int32>; + + using DestType = AudioData::Pointer; + using SourceType = AudioData::Pointer; + + const AudioBuffer* buffer; +}; + //============================================================================== class AudioThumbnail::LevelDataSource : public TimeSliceClient { @@ -687,6 +747,16 @@ void AudioThumbnail::setReader (AudioFormatReader* newReader, int64 hash) setDataSource (new LevelDataSource (*this, newReader, hash)); } +void AudioThumbnail::setSource (const AudioBuffer* newSource, double rate, int64 hash) +{ + setReader (new AudioBufferReader (newSource, rate), hash); +} + +void AudioThumbnail::setSource (const AudioBuffer* newSource, double rate, int64 hash) +{ + setReader (new AudioBufferReader (newSource, rate), hash); +} + int64 AudioThumbnail::getHashCode() const { return source == nullptr ? 0 : source->hashCode; diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnail.h b/modules/juce_audio_utils/gui/juce_AudioThumbnail.h index ca912c89..156aeaa0 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnail.h +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnail.h @@ -99,6 +99,18 @@ public: */ void setReader (AudioFormatReader* newReader, int64 hashCode) override; + /** Sets an AudioBuffer as the source for the thumbnail. + + The buffer contents aren't copied and you must ensure that the lifetime of the buffer is + valid for as long as the AudioThumbnail uses it as its source. Calling this function will + start reading the audio in a background thread (unless the hash code can be looked-up + successfully in the thumbnail cache). + */ + void setSource (const AudioBuffer* newSource, double sampleRate, int64 hashCode); + + /** Same as the other setSource() overload except for int data. */ + void setSource (const AudioBuffer* newSource, double sampleRate, int64 hashCode); + /** Resets the thumbnail, ready for adding data with the specified format. If you're going to generate a thumbnail yourself, call this before using addBlock() to add the data. diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnailCache.cpp b/modules/juce_audio_utils/gui/juce_AudioThumbnailCache.cpp index 4900cc48..59800c31 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnailCache.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnailCache.cpp @@ -64,7 +64,7 @@ AudioThumbnailCache::AudioThumbnailCache (const int maxNumThumbs) maxNumThumbsToStore (maxNumThumbs) { jassert (maxNumThumbsToStore > 0); - thread.startThread (2); + thread.startThread (Thread::Priority::low); } AudioThumbnailCache::~AudioThumbnailCache() diff --git a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp index fe12591f..765c7a86 100644 --- a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp @@ -119,7 +119,7 @@ void AudioVisualiserComponent::clear() c->clear(); } -void AudioVisualiserComponent::pushBuffer (const float** d, int numChannels, int num) +void AudioVisualiserComponent::pushBuffer (const float* const* d, int numChannels, int num) { numChannels = jmin (numChannels, channels.size()); diff --git a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.h b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.h index 28cd33fe..b1ba56c6 100644 --- a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.h +++ b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.h @@ -87,7 +87,7 @@ public: The number of channels provided here is expected to match the number of channels that this AudioVisualiserComponent has been told to use. */ - void pushBuffer (const float** channelData, int numChannels, int numSamples); + void pushBuffer (const float* const* channelData, int numChannels, int numSamples); /** Pushes a single sample (per channel). The number of channels provided here is expected to match the number of channels diff --git a/modules/juce_audio_utils/gui/juce_MPEKeyboardComponent.h b/modules/juce_audio_utils/gui/juce_MPEKeyboardComponent.h index e070fcdb..b149bd6b 100644 --- a/modules/juce_audio_utils/gui/juce_MPEKeyboardComponent.h +++ b/modules/juce_audio_utils/gui/juce_MPEKeyboardComponent.h @@ -57,13 +57,13 @@ public: //============================================================================== /** Sets the note-on velocity, or "strike", value that will be used when triggering new notes. */ - void setVelocity (float newVelocity) { velocity = jlimit (newVelocity, 0.0f, 1.0f); } + void setVelocity (float newVelocity) { velocity = jlimit (0.0f, 1.0f, newVelocity); } /** Sets the pressure value that will be used for new notes. */ - void setPressure (float newPressure) { pressure = jlimit (newPressure, 0.0f, 1.0f); } + void setPressure (float newPressure) { pressure = jlimit (0.0f, 1.0f, newPressure); } /** Sets the note-off velocity, or "lift", value that will be used when notes are released. */ - void setLift (float newLift) { lift = jlimit (newLift, 0.0f, 1.0f); } + void setLift (float newLift) { lift = jlimit (0.0f, 1.0f, newLift); } /** Use this to enable the mouse source pressure to be used for the initial note-on velocity, or "strike", value if the mouse source supports it. diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index be3ff67d..fbd90eac 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -478,4 +478,9 @@ void MidiKeyboardComponent::handleNoteOff (MidiKeyboardState*, int /*midiChannel noPendingUpdates.store (false); } +//============================================================================== +bool MidiKeyboardComponent::mouseDownOnKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) { return true; } +bool MidiKeyboardComponent::mouseDraggedToKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) { return true; } +void MidiKeyboardComponent::mouseUpOnKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) {} + } // namespace juce diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h index 70dedb68..2c9c6ab6 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h @@ -193,7 +193,7 @@ public: @see mouseDraggedToKey */ - virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); return true; } + virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e); /** Callback when the mouse is dragged from one key onto another. @@ -202,13 +202,13 @@ public: @see mouseDownOnKey */ - virtual bool mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); return true; } + virtual bool mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e); /** Callback when the mouse is released from a key. @see mouseDownOnKey */ - virtual void mouseUpOnKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); } + virtual void mouseUpOnKey (int midiNoteNumber, const MouseEvent& e); /** Allows text to be drawn on the white notes. diff --git a/modules/juce_audio_utils/juce_audio_utils.h b/modules/juce_audio_utils/juce_audio_utils.h index 6d0c1a72..c7170cdb 100644 --- a/modules/juce_audio_utils/juce_audio_utils.h +++ b/modules/juce_audio_utils/juce_audio_utils.h @@ -35,12 +35,12 @@ ID: juce_audio_utils vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE extra audio utility classes description: Classes for audio-related GUI and miscellaneous tasks. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_audio_processors, juce_audio_formats, juce_audio_devices OSXFrameworks: CoreAudioKit DiscRecording diff --git a/modules/juce_audio_utils/native/juce_linux_AudioCDReader.cpp b/modules/juce_audio_utils/native/juce_linux_AudioCDReader.cpp index a653858d..739b81bb 100644 --- a/modules/juce_audio_utils/native/juce_linux_AudioCDReader.cpp +++ b/modules/juce_audio_utils/native/juce_linux_AudioCDReader.cpp @@ -50,7 +50,7 @@ void AudioCDReader::refreshTrackLengths() { } -bool AudioCDReader::readSamples (int**, int, int, +bool AudioCDReader::readSamples (int* const*, int, int, int64, int) { return false; diff --git a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm index 9b5ee4e6..9eb0d6e0 100644 --- a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm +++ b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm @@ -171,14 +171,13 @@ void AudioCDReader::refreshTrackLengths() if (toc.exists()) { XmlDocument doc (toc); - const char* error = CDReaderHelpers::getTrackOffsets (doc, trackStartSamples); - ignoreUnused (error); // could be logged.. + [[maybe_unused]] const char* error = CDReaderHelpers::getTrackOffsets (doc, trackStartSamples); lengthInSamples = trackStartSamples.getLast() - trackStartSamples.getFirst(); } } -bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool AudioCDReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { while (numSamples > 0) diff --git a/modules/juce_audio_utils/native/juce_win32_AudioCDReader.cpp b/modules/juce_audio_utils/native/juce_win32_AudioCDReader.cpp index f1e00439..69fb26f5 100644 --- a/modules/juce_audio_utils/native/juce_win32_AudioCDReader.cpp +++ b/modules/juce_audio_utils/native/juce_win32_AudioCDReader.cpp @@ -1035,7 +1035,7 @@ AudioCDReader::~AudioCDReader() delete device; } -bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, +bool AudioCDReader::readSamples (int* const* destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { using namespace CDReaderHelpers; diff --git a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp index bb1c5580..58d64eba 100644 --- a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp +++ b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp @@ -30,10 +30,10 @@ template struct ChannelInfo { ChannelInfo() = default; - ChannelInfo (Value** dataIn, int numChannelsIn) + ChannelInfo (Value* const* dataIn, int numChannelsIn) : data (dataIn), numChannels (numChannelsIn) {} - Value** data = nullptr; + Value* const* data = nullptr; int numChannels = 0; }; @@ -98,7 +98,7 @@ static void initialiseIoBuffers (ChannelInfo ins, for (auto i = processorOuts; i < processorIns; ++i) { - channels[totalNumChans] = tempBuffer.getWritePointer (i - outs.numChannels); + channels[totalNumChans] = tempBuffer.getWritePointer (i - processorOuts); prepareInputChannel (i); ++totalNumChans; } @@ -235,9 +235,9 @@ void AudioProcessorPlayer::setMidiOutput (MidiOutput* midiOutputToUse) } //============================================================================== -void AudioProcessorPlayer::audioDeviceIOCallbackWithContext (const float** const inputChannelData, +void AudioProcessorPlayer::audioDeviceIOCallbackWithContext (const float* const* const inputChannelData, const int numInputChannels, - float** const outputChannelData, + float* const* const outputChannelData, const int numOutputChannels, const int numSamples, const AudioIODeviceCallbackContext& context) @@ -281,12 +281,14 @@ void AudioProcessorPlayer::audioDeviceIOCallbackWithContext (const float** const sampleCount (sampleCountIn), seconds ((double) sampleCountIn / sampleRateIn) { - processor.setPlayHead (this); + if (useThisPlayhead) + processor.setPlayHead (this); } ~PlayHead() override { - processor.setPlayHead (nullptr); + if (useThisPlayhead) + processor.setPlayHead (nullptr); } private: @@ -303,6 +305,7 @@ void AudioProcessorPlayer::audioDeviceIOCallbackWithContext (const float** const Optional hostTimeNs; uint64_t sampleCount; double seconds; + bool useThisPlayhead = processor.getPlayHead() == nullptr; }; PlayHead playHead { *processor, diff --git a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.h b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.h index 8f14d52e..9ba98ba9 100644 --- a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.h +++ b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.h @@ -92,7 +92,7 @@ public: //============================================================================== /** @internal */ - void audioDeviceIOCallbackWithContext (const float**, int, float**, int, int, const AudioIODeviceCallbackContext&) override; + void audioDeviceIOCallbackWithContext (const float* const*, int, float* const*, int, int, const AudioIODeviceCallbackContext&) override; /** @internal */ void audioDeviceAboutToStart (AudioIODevice*) override; /** @internal */ diff --git a/modules/juce_audio_utils/players/juce_SoundPlayer.cpp b/modules/juce_audio_utils/players/juce_SoundPlayer.cpp index 3426fa3b..90abda88 100644 --- a/modules/juce_audio_utils/players/juce_SoundPlayer.cpp +++ b/modules/juce_audio_utils/players/juce_SoundPlayer.cpp @@ -242,15 +242,16 @@ void SoundPlayer::playTestSound() } //============================================================================== -void SoundPlayer::audioDeviceIOCallback (const float** inputChannelData, - int numInputChannels, - float** outputChannelData, - int numOutputChannels, - int numSamples) +void SoundPlayer::audioDeviceIOCallbackWithContext (const float* const* inputChannelData, + int numInputChannels, + float* const* outputChannelData, + int numOutputChannels, + int numSamples, + const AudioIODeviceCallbackContext& context) { - player.audioDeviceIOCallback (inputChannelData, numInputChannels, - outputChannelData, numOutputChannels, - numSamples); + player.audioDeviceIOCallbackWithContext (inputChannelData, numInputChannels, + outputChannelData, numOutputChannels, + numSamples, context); } void SoundPlayer::audioDeviceAboutToStart (AudioIODevice* device) diff --git a/modules/juce_audio_utils/players/juce_SoundPlayer.h b/modules/juce_audio_utils/players/juce_SoundPlayer.h index e4c36aca..07edc7d3 100644 --- a/modules/juce_audio_utils/players/juce_SoundPlayer.h +++ b/modules/juce_audio_utils/players/juce_SoundPlayer.h @@ -110,7 +110,7 @@ public: //============================================================================== /** @internal */ - void audioDeviceIOCallback (const float**, int, float**, int, int) override; + void audioDeviceIOCallbackWithContext (const float* const*, int, float* const*, int, int, const AudioIODeviceCallbackContext&) override; /** @internal */ void audioDeviceAboutToStart (AudioIODevice*) override; /** @internal */ diff --git a/modules/juce_box2d/juce_box2d.h b/modules/juce_box2d/juce_box2d.h index cf952719..64593859 100644 --- a/modules/juce_box2d/juce_box2d.h +++ b/modules/juce_box2d/juce_box2d.h @@ -35,12 +35,12 @@ ID: juce_box2d vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE wrapper for the Box2D physics engine description: The Box2D physics engine and some utility classes. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_graphics diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index 05f95799..316e5452 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -649,7 +649,7 @@ public: @see add */ template - typename std::enable_if::value, void>::type + std::enable_if_t, void> addArray (const OtherArrayType& arrayToAddFrom, int startIndex, int numElementsToAdd = -1) @@ -727,32 +727,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, TargetValueType elementToLookFor) const - { - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - - const ScopedLockType lock (getLock()); - - for (int s = 0, e = values.size();;) - { - if (s >= e) - return -1; - - if (comparator.compareElements (elementToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - return -1; - - if (comparator.compareElements (elementToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - } + int indexOfSorted (ElementComparator& comparator, TargetValueType elementToLookFor) const; //============================================================================== /** Removes an element from the array. @@ -1106,14 +1081,7 @@ public: @see addSorted, indexOfSorted, sortArray */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) - { - const ScopedLockType lock (getLock()); - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false); //============================================================================== /** Returns the CriticalSection that locks this array. @@ -1150,4 +1118,43 @@ private: } }; +//============================================================================== +template +template +int Array::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + TargetValueType elementToLookFor) const +{ + const ScopedLockType lock (getLock()); + + for (int s = 0, e = values.size();;) + { + if (s >= e) + return -1; + + if (comparator.compareElements (elementToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + return -1; + + if (comparator.compareElements (elementToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } +} + +template +template +void Array::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) +{ + const ScopedLockType lock (getLock()); + sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/containers/juce_ArrayBase.cpp b/modules/juce_core/containers/juce_ArrayBase.cpp index 1553e05b..9d2657c3 100644 --- a/modules/juce_core/containers/juce_ArrayBase.cpp +++ b/modules/juce_core/containers/juce_ArrayBase.cpp @@ -105,9 +105,9 @@ class ArrayBaseTests : public UnitTest using NoncopyableType = ArrayBaseTestsHelpers::NonTriviallyCopyableType; #if ! (defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__)) - static_assert (std::is_trivially_copyable::value, + static_assert (std::is_trivially_copyable_v, "Test TriviallyCopyableType is not trivially copyable"); - static_assert (! std::is_trivially_copyable::value, + static_assert (! std::is_trivially_copyable_v, "Test NonTriviallyCopyableType is trivially copyable"); #endif diff --git a/modules/juce_core/containers/juce_ArrayBase.h b/modules/juce_core/containers/juce_ArrayBase.h index 515bf0f2..353fcfae 100644 --- a/modules/juce_core/containers/juce_ArrayBase.h +++ b/modules/juce_core/containers/juce_ArrayBase.h @@ -43,8 +43,8 @@ private: using ParameterType = typename TypeHelpers::ParameterType::type; template - using AllowConversion = typename std::enable_if, - std::tuple>::value>::type; + using AllowConversion = std::enable_if_t, + std::tuple>>; public: //============================================================================== @@ -304,7 +304,7 @@ public: } template - typename std::enable_if::value, int>::type + std::enable_if_t, int> addArray (const OtherArrayType& arrayToAddFrom, int startIndex, int numElementsToAdd = -1) { @@ -385,64 +385,49 @@ public: private: //============================================================================== - template #if defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__) - using IsTriviallyCopyable = std::is_scalar; + static constexpr auto isTriviallyCopyable = std::is_scalar_v; #else - using IsTriviallyCopyable = std::is_trivially_copyable; + static constexpr auto isTriviallyCopyable = std::is_trivially_copyable_v; #endif - template - using TriviallyCopyableVoid = typename std::enable_if::value, void>::type; - - template - using NonTriviallyCopyableVoid = typename std::enable_if::value, void>::type; - //============================================================================== - template - TriviallyCopyableVoid addArrayInternal (const ElementType* otherElements, int numElements) - { - if (numElements > 0) - memcpy (elements + numUsed, otherElements, (size_t) numElements * sizeof (ElementType)); - } - - template - TriviallyCopyableVoid addArrayInternal (const Type* otherElements, int numElements) - { - auto* start = elements + numUsed; - - while (--numElements >= 0) - new (start++) ElementType (*(otherElements++)); - } - - template - NonTriviallyCopyableVoid addArrayInternal (const Type* otherElements, int numElements) + template + void addArrayInternal (const Type* otherElements, int numElements) { - auto* start = elements + numUsed; + if constexpr (isTriviallyCopyable && std::is_same_v) + { + if (numElements > 0) + memcpy (elements + numUsed, otherElements, (size_t) numElements * sizeof (ElementType)); + } + else + { + auto* start = elements + numUsed; - while (--numElements >= 0) - new (start++) ElementType (*(otherElements++)); + while (--numElements >= 0) + new (start++) ElementType (*(otherElements++)); + } } //============================================================================== - template - TriviallyCopyableVoid setAllocatedSizeInternal (int numElements) + void setAllocatedSizeInternal (int numElements) { - elements.realloc ((size_t) numElements); - } - - template - NonTriviallyCopyableVoid setAllocatedSizeInternal (int numElements) - { - HeapBlock newElements (numElements); - - for (int i = 0; i < numUsed; ++i) + if constexpr (isTriviallyCopyable) { - new (newElements + i) ElementType (std::move (elements[i])); - elements[i].~ElementType(); + elements.realloc ((size_t) numElements); } + else + { + HeapBlock newElements (numElements); + + for (int i = 0; i < numUsed; ++i) + { + new (newElements + i) ElementType (std::move (elements[i])); + elements[i].~ElementType(); + } - elements = std::move (newElements); + elements = std::move (newElements); + } } //============================================================================== @@ -458,106 +443,106 @@ private: return elements + indexToInsertAt; } - template - TriviallyCopyableVoid createInsertSpaceInternal (int indexToInsertAt, int numElements) - { - auto* start = elements + indexToInsertAt; - auto numElementsToShift = numUsed - indexToInsertAt; - memmove (start + numElements, start, (size_t) numElementsToShift * sizeof (ElementType)); - } - - template - NonTriviallyCopyableVoid createInsertSpaceInternal (int indexToInsertAt, int numElements) + void createInsertSpaceInternal (int indexToInsertAt, int numElements) { - auto* end = elements + numUsed; - auto* newEnd = end + numElements; - auto numElementsToShift = numUsed - indexToInsertAt; - - for (int i = 0; i < numElementsToShift; ++i) + if constexpr (isTriviallyCopyable) { - new (--newEnd) ElementType (std::move (*(--end))); - end->~ElementType(); + auto* start = elements + indexToInsertAt; + auto numElementsToShift = numUsed - indexToInsertAt; + memmove (start + numElements, start, (size_t) numElementsToShift * sizeof (ElementType)); } - } - - //============================================================================== - template - TriviallyCopyableVoid removeElementsInternal (int indexToRemoveAt, int numElementsToRemove) - { - auto* start = elements + indexToRemoveAt; - auto numElementsToShift = numUsed - (indexToRemoveAt + numElementsToRemove); - memmove (start, start + numElementsToRemove, (size_t) numElementsToShift * sizeof (ElementType)); - } - - template - NonTriviallyCopyableVoid removeElementsInternal (int indexToRemoveAt, int numElementsToRemove) - { - auto numElementsToShift = numUsed - (indexToRemoveAt + numElementsToRemove); - auto* destination = elements + indexToRemoveAt; - auto* source = destination + numElementsToRemove; - - for (int i = 0; i < numElementsToShift; ++i) - moveAssignElement (destination++, std::move (*(source++))); + else + { + auto* end = elements + numUsed; + auto* newEnd = end + numElements; + auto numElementsToShift = numUsed - indexToInsertAt; - for (int i = 0; i < numElementsToRemove; ++i) - (destination++)->~ElementType(); + for (int i = 0; i < numElementsToShift; ++i) + { + new (--newEnd) ElementType (std::move (*(--end))); + end->~ElementType(); + } + } } //============================================================================== - template - TriviallyCopyableVoid moveInternal (int currentIndex, int newIndex) noexcept + void removeElementsInternal (int indexToRemoveAt, int numElementsToRemove) { - char tempCopy[sizeof (ElementType)]; - memcpy (tempCopy, elements + currentIndex, sizeof (ElementType)); - - if (newIndex > currentIndex) + if constexpr (isTriviallyCopyable) { - memmove (elements + currentIndex, - elements + currentIndex + 1, - (size_t) (newIndex - currentIndex) * sizeof (ElementType)); + auto* start = elements + indexToRemoveAt; + auto numElementsToShift = numUsed - (indexToRemoveAt + numElementsToRemove); + memmove (start, start + numElementsToRemove, (size_t) numElementsToShift * sizeof (ElementType)); } else { - memmove (elements + newIndex + 1, - elements + newIndex, - (size_t) (currentIndex - newIndex) * sizeof (ElementType)); - } + auto numElementsToShift = numUsed - (indexToRemoveAt + numElementsToRemove); + auto* destination = elements + indexToRemoveAt; + auto* source = destination + numElementsToRemove; - memcpy (elements + newIndex, tempCopy, sizeof (ElementType)); + for (int i = 0; i < numElementsToShift; ++i) + moveAssignElement (destination++, std::move (*(source++))); + + for (int i = 0; i < numElementsToRemove; ++i) + (destination++)->~ElementType(); + } } - template - NonTriviallyCopyableVoid moveInternal (int currentIndex, int newIndex) noexcept + //============================================================================== + void moveInternal (int currentIndex, int newIndex) noexcept { - auto* e = elements + currentIndex; - ElementType tempCopy (std::move (*e)); - auto delta = newIndex - currentIndex; - - if (delta > 0) + if constexpr (isTriviallyCopyable) { - for (int i = 0; i < delta; ++i) + char tempCopy[sizeof (ElementType)]; + memcpy (tempCopy, elements + currentIndex, sizeof (ElementType)); + + if (newIndex > currentIndex) { - moveAssignElement (e, std::move (*(e + 1))); - ++e; + memmove (elements + currentIndex, + elements + currentIndex + 1, + (size_t) (newIndex - currentIndex) * sizeof (ElementType)); } + else + { + memmove (elements + newIndex + 1, + elements + newIndex, + (size_t) (currentIndex - newIndex) * sizeof (ElementType)); + } + + memcpy (elements + newIndex, tempCopy, sizeof (ElementType)); } else { - for (int i = 0; i < -delta; ++i) + auto* e = elements + currentIndex; + ElementType tempCopy (std::move (*e)); + auto delta = newIndex - currentIndex; + + if (delta > 0) { - moveAssignElement (e, std::move (*(e - 1))); - --e; + for (int i = 0; i < delta; ++i) + { + moveAssignElement (e, std::move (*(e + 1))); + ++e; + } + } + else + { + for (int i = 0; i < -delta; ++i) + { + moveAssignElement (e, std::move (*(e - 1))); + --e; + } } - } - moveAssignElement (e, std::move (tempCopy)); + moveAssignElement (e, std::move (tempCopy)); + } } //============================================================================== template void addImpl (Elements&&... toAdd) { - ignoreUnused (std::initializer_list { (((void) checkSourceIsNotAMember (toAdd)), 0)... }); + (checkSourceIsNotAMember (toAdd), ...); ensureAllocatedSize (numUsed + (int) sizeof... (toAdd)); addAssumingCapacityIsReady (std::forward (toAdd)...); } @@ -565,23 +550,21 @@ private: template void addAssumingCapacityIsReady (Elements&&... toAdd) { - ignoreUnused (std::initializer_list { ((void) (new (elements + numUsed++) ElementType (std::forward (toAdd))), 0)... }); + (new (elements + numUsed++) ElementType (std::forward (toAdd)), ...); } //============================================================================== - template - typename std::enable_if::value, void>::type - moveAssignElement (ElementType* destination, ElementType&& source) + void moveAssignElement (ElementType* destination, ElementType&& source) { - *destination = std::move (source); - } - - template - typename std::enable_if::value, void>::type - moveAssignElement (ElementType* destination, ElementType&& source) - { - destination->~ElementType(); - new (destination) ElementType (std::move (source)); + if constexpr (std::is_move_assignable_v) + { + *destination = std::move (source); + } + else + { + destination->~ElementType(); + new (destination) ElementType (std::move (source)); + } } void checkSourceIsNotAMember (const ElementType& element) diff --git a/modules/juce_core/containers/juce_ElementComparator.h b/modules/juce_core/containers/juce_ElementComparator.h index 5bf7d5e1..8f7ce2bb 100644 --- a/modules/juce_core/containers/juce_ElementComparator.h +++ b/modules/juce_core/containers/juce_ElementComparator.h @@ -123,7 +123,7 @@ static void sortArray (ElementComparator& comparator, @param lastElement the index of the last element in the range (this is non-inclusive) */ template -static int findInsertIndexInSortedArray (ElementComparator& comparator, +static int findInsertIndexInSortedArray ([[maybe_unused]] ElementComparator& comparator, ElementType* const array, const ElementType newElement, int firstElement, @@ -131,9 +131,6 @@ static int findInsertIndexInSortedArray (ElementComparator& comparator, { jassert (firstElement <= lastElement); - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - while (firstElement < lastElement) { if (comparator.compareElements (newElement, array [firstElement]) == 0) diff --git a/modules/juce_core/containers/juce_Optional.h b/modules/juce_core/containers/juce_Optional.h index 6e2333ce..b7609278 100644 --- a/modules/juce_core/containers/juce_Optional.h +++ b/modules/juce_core/containers/juce_Optional.h @@ -23,38 +23,19 @@ namespace juce { -namespace detail -{ -namespace adlSwap -{ -using std::swap; - -template -constexpr auto isNothrowSwappable = noexcept (swap (std::declval(), std::declval())); -} // namespace adlSwap -} // namespace detail - -/** A type representing the null state of an Optional. - Similar to std::nullopt_t. -*/ -struct Nullopt -{ - explicit constexpr Nullopt (int) {} -}; - -/** An object that can be used when constructing and comparing Optional instances. - Similar to std::nullopt. -*/ -constexpr Nullopt nullopt { 0 }; +using Nullopt = std::nullopt_t; +constexpr auto nullopt = std::nullopt; // Without this, our tests can emit "unreachable code" warnings during // link time code generation. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4702) +#define JUCE_OPTIONAL_OPERATORS X(==) X(!=) X(<) X(<=) X(>) X(>=) + /** A simple optional type. - Has similar (not necessarily identical!) semantics to std::optional. + In new code, you should probably prefer using std::optional directly. This is intended to stand-in for std::optional while JUCE's minimum supported language standard is lower than C++17. When the minimum language @@ -72,224 +53,104 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4702) template class Optional { - template - struct NotConstructibleFromSimilarType - { - static constexpr auto value = ! std::is_constructible&>::value - && ! std::is_constructible&>::value - && ! std::is_constructible&&>::value - && ! std::is_constructible&&>::value - && ! std::is_convertible&, T>::value - && ! std::is_convertible&, T>::value - && ! std::is_convertible&&, T>::value - && ! std::is_convertible&&, T>::value; - }; - - template - using OptionalCopyConstructorEnabled = std::enable_if_t::value && NotConstructibleFromSimilarType::value>; - - template - using OptionalMoveConstructorEnabled = std::enable_if_t::value && NotConstructibleFromSimilarType::value>; - - template - static auto notAssignableFromSimilarType = NotConstructibleFromSimilarType::value - && ! std::is_assignable&>::value - && ! std::is_assignable&>::value - && ! std::is_assignable&&>::value - && ! std::is_assignable&&>::value; - - template - using OptionalCopyAssignmentEnabled = std::enable_if_t::value - && std::is_assignable::value - && NotConstructibleFromSimilarType::value>; - - template - using OptionalMoveAssignmentEnabled = std::enable_if_t::value - && std::is_nothrow_assignable::value - && NotConstructibleFromSimilarType::value>; + template struct IsOptional : std::false_type {}; + template struct IsOptional> : std::true_type {}; public: - Optional() : placeholder() {} - - Optional (Nullopt) noexcept : placeholder() {} - - template ::value - && ! std::is_same, Optional>::value>> - Optional (U&& value) noexcept (noexcept (Value (std::forward (value)))) - : storage (std::forward (value)), valid (true) - { - } - - Optional (Optional&& other) noexcept (noexcept (std::declval().constructFrom (other))) - : placeholder() - { - constructFrom (other); - } + Optional() = default; + Optional (const Optional&) = default; + Optional (Optional&&) = default; + Optional& operator= (const Optional&) = default; + Optional& operator= (Optional&&) = default; - Optional (const Optional& other) - : placeholder(), valid (other.valid) - { - if (valid) - new (&storage) Value (*other); - } + Optional (Nullopt) noexcept {} - template > - Optional (Optional&& other) noexcept (noexcept (std::declval().constructFrom (other))) - : placeholder() - { - constructFrom (other); - } + template >::value, int> = 0> + Optional (Head&& head, Tail&&... tail) + noexcept (std::is_nothrow_constructible_v, Head, Tail...>) + : opt (std::forward (head), std::forward (tail)...) {} - template > + template Optional (const Optional& other) - : placeholder(), valid (other.hasValue()) - { - if (valid) - new (&storage) Value (*other); - } + noexcept (std::is_nothrow_constructible_v, const std::optional&>) + : opt (other.opt) {} - Optional& operator= (Nullopt) noexcept - { - reset(); - return *this; - } + template + Optional (Optional&& other) + noexcept (std::is_nothrow_constructible_v, std::optional&&>) + : opt (std::move (other.opt)) {} - template ::value - && std::is_nothrow_move_assignable::value>> - Optional& operator= (Optional&& other) noexcept (noexcept (std::declval().assign (std::declval()))) + template >::value, int> = 0> + Optional& operator= (Other&& other) + noexcept (std::is_nothrow_assignable_v, Other>) { - assign (other); + opt = std::forward (other); return *this; } - template , Optional>::value - && std::is_constructible::value - && std::is_assignable::value - && (! std::is_scalar::value || ! std::is_same, Value>::value)>> - Optional& operator= (U&& value) + template + Optional& operator= (const Optional& other) + noexcept (std::is_nothrow_assignable_v, const std::optional&>) { - if (valid) - **this = std::forward (value); - else - new (&storage) Value (std::forward (value)); - - valid = true; + opt = other.opt; return *this; } - /** Maintains the strong exception safety guarantee. */ - Optional& operator= (const Optional& other) + template + Optional& operator= (Optional&& other) + noexcept (std::is_nothrow_assignable_v, std::optional&&>) { - auto copy = other; - assign (copy); + opt = std::move (other.opt); return *this; } - template > - Optional& operator= (Optional&& other) noexcept (noexcept (std::declval().assign (other))) + template + auto& emplace (Other&&... other) { - assign (other); - return *this; + return opt.emplace (std::forward (other)...); } - /** Maintains the strong exception safety guarantee. */ - template > - Optional& operator= (const Optional& other) + void reset() noexcept { - auto copy = other; - assign (copy); - return *this; + opt.reset(); } - ~Optional() noexcept + void swap (Optional& other) + noexcept (std::is_nothrow_swappable_v>) { - reset(); + opt.swap (other.opt); } - Value* operator->() noexcept { return reinterpret_cast< Value*> (&storage); } - const Value* operator->() const noexcept { return reinterpret_cast (&storage); } - - Value& operator*() noexcept { return *operator->(); } - const Value& operator*() const noexcept { return *operator->(); } + decltype (auto) operator->() { return opt.operator->(); } + decltype (auto) operator->() const { return opt.operator->(); } + decltype (auto) operator* () { return opt.operator* (); } + decltype (auto) operator* () const { return opt.operator* (); } - explicit operator bool() const noexcept { return valid; } - bool hasValue() const noexcept { return valid; } + explicit operator bool() const noexcept { return opt.has_value(); } + bool hasValue() const noexcept { return opt.has_value(); } - void reset() - { - if (std::exchange (valid, false)) - operator*().~Value(); - } + template + decltype (auto) orFallback (U&& fallback) const& { return opt.value_or (std::forward (fallback)); } - /** Like std::optional::value_or */ template - Value orFallback (U&& fallback) const { return *this ? **this : std::forward (fallback); } + decltype (auto) orFallback (U&& fallback) & { return opt.value_or (std::forward (fallback)); } - template - Value& emplace (Args&&... args) - { - reset(); - new (&storage) Value (std::forward (args)...); - valid = true; - return **this; - } + #define X(op) \ + template friend bool operator op (const Optional&, const Optional&); \ + template friend bool operator op (const Optional&, Nullopt); \ + template friend bool operator op (Nullopt, const Optional&); \ + template friend bool operator op (const Optional&, const U&); \ + template friend bool operator op (const T&, const Optional&); - void swap (Optional& other) noexcept (std::is_nothrow_move_constructible::value - && detail::adlSwap::isNothrowSwappable) - { - if (hasValue() && other.hasValue()) - { - using std::swap; - swap (**this, *other); - } - else if (hasValue() || other.hasValue()) - { - (hasValue() ? other : *this).constructFrom (hasValue() ? *this : other); - } - } - -private: - template - void constructFrom (Optional& other) noexcept (noexcept (Value (std::move (*other)))) - { - if (! other.hasValue()) - return; + JUCE_OPTIONAL_OPERATORS - new (&storage) Value (std::move (*other)); - valid = true; - other.reset(); - } + #undef X +private: template - void assign (Optional& other) noexcept (noexcept (std::declval() = std::move (*other)) && noexcept (std::declval().constructFrom (other))) - { - if (valid) - { - if (other.hasValue()) - { - **this = std::move (*other); - other.reset(); - } - else - { - reset(); - } - } - else - { - constructFrom (other); - } - } + friend class Optional; - union - { - char placeholder; - Value storage; - }; - bool valid = false; + std::optional opt; }; JUCE_END_IGNORE_WARNINGS_MSVC @@ -300,102 +161,17 @@ Optional> makeOptional (Value&& v) return std::forward (v); } -template -bool operator== (const Optional& lhs, const Optional& rhs) -{ - if (lhs.hasValue() != rhs.hasValue()) return false; - if (! lhs.hasValue()) return true; - return *lhs == *rhs; -} +#define X(op) \ + template bool operator op (const Optional& lhs, const Optional& rhs) { return lhs.opt op rhs.opt; } \ + template bool operator op (const Optional& lhs, Nullopt rhs) { return lhs.opt op rhs; } \ + template bool operator op (Nullopt lhs, const Optional& rhs) { return lhs op rhs.opt; } \ + template bool operator op (const Optional& lhs, const U& rhs) { return lhs.opt op rhs; } \ + template bool operator op (const T& lhs, const Optional& rhs) { return lhs op rhs.opt; } -template -bool operator!= (const Optional& lhs, const Optional& rhs) -{ - if (lhs.hasValue() != rhs.hasValue()) return true; - if (! lhs.hasValue()) return false; - return *lhs != *rhs; -} - -template -bool operator< (const Optional& lhs, const Optional& rhs) -{ - if (! rhs.hasValue()) return false; - if (! lhs.hasValue()) return true; - return *lhs < *rhs; -} +JUCE_OPTIONAL_OPERATORS -template -bool operator<= (const Optional& lhs, const Optional& rhs) -{ - if (! lhs.hasValue()) return true; - if (! rhs.hasValue()) return false; - return *lhs <= *rhs; -} - -template -bool operator> (const Optional& lhs, const Optional& rhs) -{ - if (! lhs.hasValue()) return false; - if (! rhs.hasValue()) return true; - return *lhs > *rhs; -} - -template -bool operator>= (const Optional& lhs, const Optional& rhs) -{ - if (! rhs.hasValue()) return true; - if (! lhs.hasValue()) return false; - return *lhs >= *rhs; -} +#undef X -template -bool operator== (const Optional& opt, Nullopt) noexcept { return ! opt.hasValue(); } -template -bool operator== (Nullopt, const Optional& opt) noexcept { return ! opt.hasValue(); } -template -bool operator!= (const Optional& opt, Nullopt) noexcept { return opt.hasValue(); } -template -bool operator!= (Nullopt, const Optional& opt) noexcept { return opt.hasValue(); } -template -bool operator< (const Optional&, Nullopt) noexcept { return false; } -template -bool operator< (Nullopt, const Optional& opt) noexcept { return opt.hasValue(); } -template -bool operator<= (const Optional& opt, Nullopt) noexcept { return ! opt.hasValue(); } -template -bool operator<= (Nullopt, const Optional&) noexcept { return true; } -template -bool operator> (const Optional& opt, Nullopt) noexcept { return opt.hasValue(); } -template -bool operator> (Nullopt, const Optional&) noexcept { return false; } -template -bool operator>= (const Optional&, Nullopt) noexcept { return true; } -template -bool operator>= (Nullopt, const Optional& opt) noexcept { return ! opt.hasValue(); } - -template -bool operator== (const Optional& opt, const U& value) { return opt.hasValue() ? *opt == value : false; } -template -bool operator== (const T& value, const Optional& opt) { return opt.hasValue() ? value == *opt : false; } -template -bool operator!= (const Optional& opt, const U& value) { return opt.hasValue() ? *opt != value : true; } -template -bool operator!= (const T& value, const Optional& opt) { return opt.hasValue() ? value != *opt : true; } -template -bool operator< (const Optional& opt, const U& value) { return opt.hasValue() ? *opt < value : true; } -template -bool operator< (const T& value, const Optional& opt) { return opt.hasValue() ? value < *opt : false; } -template -bool operator<= (const Optional& opt, const U& value) { return opt.hasValue() ? *opt <= value : true; } -template -bool operator<= (const T& value, const Optional& opt) { return opt.hasValue() ? value <= *opt : false; } -template -bool operator> (const Optional& opt, const U& value) { return opt.hasValue() ? *opt > value : false; } -template -bool operator> (const T& value, const Optional& opt) { return opt.hasValue() ? value > *opt : true; } -template -bool operator>= (const Optional& opt, const U& value) { return opt.hasValue() ? *opt >= value : false; } -template -bool operator>= (const T& value, const Optional& opt) { return opt.hasValue() ? value >= *opt : true; } +#undef JUCE_OPTIONAL_OPERATORS } // namespace juce diff --git a/modules/juce_core/containers/juce_Optional_test.cpp b/modules/juce_core/containers/juce_Optional_test.cpp index cc2b7994..b3e10de8 100644 --- a/modules/juce_core/containers/juce_Optional_test.cpp +++ b/modules/juce_core/containers/juce_Optional_test.cpp @@ -66,7 +66,8 @@ public: Optional original (ptr); expect (ptr.use_count() == 2); auto other = std::move (original); - expect (! original.hasValue()); + // A moved-from optional still contains a value! + expect (original.hasValue()); expect (other.hasValue()); expect (ptr.use_count() == 2); } @@ -104,7 +105,7 @@ public: aOpt = std::move (bOpt); expect (aOpt.hasValue()); - expect (! bOpt.hasValue()); + expect (bOpt.hasValue()); expect (a.use_count() == 1); expect (b.use_count() == 2); @@ -158,7 +159,7 @@ public: empty = std::move (aOpt); expect (empty.hasValue()); - expect (! aOpt.hasValue()); + expect (aOpt.hasValue()); expect (a.use_count() == 2); } @@ -265,7 +266,7 @@ public: expect (! a.hasValue()); } - beginTest ("Strong exception safety is maintained when copying over populated object"); + beginTest ("Exception safety of contained type is maintained when copying over populated object"); { bool threw = false; Optional a = ThrowOnCopy(); @@ -283,7 +284,7 @@ public: expect (threw); expect (a.hasValue()); - expect (a->value == 5); + expect (a->value == -100); } beginTest ("Assigning from nullopt clears the instance"); diff --git a/modules/juce_core/containers/juce_OwnedArray.h b/modules/juce_core/containers/juce_OwnedArray.h index 5bc789ed..c89b1125 100644 --- a/modules/juce_core/containers/juce_OwnedArray.h +++ b/modules/juce_core/containers/juce_OwnedArray.h @@ -46,7 +46,6 @@ namespace juce */ template - class OwnedArray { public: @@ -531,17 +530,7 @@ public: @see add, sort, indexOfSorted */ template - int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - auto index = findInsertIndexInSortedArray (comparator, values.begin(), newObject, 0, values.size()); - insert (index, newObject); - return index; - } + int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept; /** Finds the index of an object in the array, assuming that the array is sorted. @@ -556,33 +545,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - int s = 0, e = values.size(); - - while (s < e) - { - if (comparator.compareElements (objectToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - break; - - if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - - return -1; - } + int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept; //============================================================================== /** Removes an object from the array. @@ -818,18 +781,7 @@ public: @see sortArray, indexOfSorted */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - - if (size() > 1) - sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false) noexcept; //============================================================================== /** Returns the CriticalSection that locks this array. @@ -870,4 +822,57 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) }; +//============================================================================== +template +template +int OwnedArray::addSorted ( + [[maybe_unused]] ElementComparator& comparator, + ObjectClass* newObject) noexcept +{ + const ScopedLockType lock (getLock()); + auto index = findInsertIndexInSortedArray (comparator, values.begin(), newObject, 0, values.size()); + insert (index, newObject); + return index; +} + +template +template +int OwnedArray::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + const ObjectClass* objectToLookFor) const noexcept +{ + const ScopedLockType lock (getLock()); + int s = 0, e = values.size(); + + while (s < e) + { + if (comparator.compareElements (objectToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + break; + + if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } + + return -1; +} + +template +template +void OwnedArray::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) noexcept +{ + const ScopedLockType lock (getLock()); + + if (size() > 1) + sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/containers/juce_ReferenceCountedArray.h b/modules/juce_core/containers/juce_ReferenceCountedArray.h index c281a1c4..fe7dbdf5 100644 --- a/modules/juce_core/containers/juce_ReferenceCountedArray.h +++ b/modules/juce_core/containers/juce_ReferenceCountedArray.h @@ -563,31 +563,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, - const ObjectClass* objectToLookFor) const noexcept - { - ignoreUnused (comparator); - const ScopedLockType lock (getLock()); - int s = 0, e = values.size(); - - while (s < e) - { - if (comparator.compareElements (objectToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - break; - - if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - - return -1; - } + int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept; //============================================================================== /** Removes an object from the array. @@ -828,16 +804,7 @@ public: @see sortArray */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - sortArray (comparator, values.begin(), 0, values.size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false) noexcept; //============================================================================== /** Reduces the amount of storage being used by the array. @@ -904,4 +871,43 @@ private: } }; +//============================================================================== +template +template +int ReferenceCountedArray::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + const ObjectClass* objectToLookFor) const noexcept +{ + const ScopedLockType lock (getLock()); + int s = 0, e = values.size(); + + while (s < e) + { + if (comparator.compareElements (objectToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + break; + + if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } + + return -1; +} + +template +template +void ReferenceCountedArray::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) noexcept +{ + const ScopedLockType lock (getLock()); + sortArray (comparator, values.begin(), 0, values.size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index 2321da3d..e84baa02 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -493,18 +493,6 @@ struct var::Instance static constexpr VariantType attributesObject { VariantType::ObjectTag{} }; }; -constexpr var::VariantType var::Instance::attributesVoid; -constexpr var::VariantType var::Instance::attributesUndefined; -constexpr var::VariantType var::Instance::attributesInt; -constexpr var::VariantType var::Instance::attributesInt64; -constexpr var::VariantType var::Instance::attributesBool; -constexpr var::VariantType var::Instance::attributesDouble; -constexpr var::VariantType var::Instance::attributesMethod; -constexpr var::VariantType var::Instance::attributesArray; -constexpr var::VariantType var::Instance::attributesString; -constexpr var::VariantType var::Instance::attributesBinary; -constexpr var::VariantType var::Instance::attributesObject; - //============================================================================== var::var() noexcept : type (&Instance::attributesVoid) {} var::var (const VariantType& t) noexcept : type (&t) {} diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 20561f39..d19f14b8 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -953,7 +953,7 @@ File File::createTempFile (StringRef fileNameEnding) } bool File::createSymbolicLink (const File& linkFileToCreate, - const String& nativePathOfTarget, + [[maybe_unused]] const String& nativePathOfTarget, bool overwriteExisting) { if (linkFileToCreate.exists()) @@ -986,7 +986,6 @@ bool File::createSymbolicLink (const File& linkFileToCreate, nativePathOfTarget.toWideCharPointer(), targetFile.isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE; #else - ignoreUnused (nativePathOfTarget); jassertfalse; // symbolic links not supported on this platform! return false; #endif diff --git a/modules/juce_core/files/juce_FileSearchPath.cpp b/modules/juce_core/files/juce_FileSearchPath.cpp index 1cd0af2e..6b4ad398 100644 --- a/modules/juce_core/files/juce_FileSearchPath.cpp +++ b/modules/juce_core/files/juce_FileSearchPath.cpp @@ -67,14 +67,19 @@ File FileSearchPath::operator[] (int index) const } String FileSearchPath::toString() const +{ + return toStringWithSeparator (";"); +} + +String FileSearchPath::toStringWithSeparator (StringRef separator) const { auto dirs = directories; for (auto& d : dirs) - if (d.containsChar (';')) + if (d.contains (separator)) d = d.quoted(); - return dirs.joinIntoString (";"); + return dirs.joinIntoString (separator); } void FileSearchPath::add (const File& dir, int insertIndex) diff --git a/modules/juce_core/files/juce_FileSearchPath.h b/modules/juce_core/files/juce_FileSearchPath.h index 144419d0..8b48162b 100644 --- a/modules/juce_core/files/juce_FileSearchPath.h +++ b/modules/juce_core/files/juce_FileSearchPath.h @@ -78,6 +78,9 @@ public: /** Returns the search path as a semicolon-separated list of directories. */ String toString() const; + /** Returns the search paths, joined with the provided separator. */ + String toStringWithSeparator (StringRef separator) const; + //============================================================================== /** Adds a new directory to the search path. diff --git a/modules/juce_core/files/juce_common_MimeTypes.cpp b/modules/juce_core/files/juce_common_MimeTypes.cpp index 65660074..42e150e9 100644 --- a/modules/juce_core/files/juce_common_MimeTypes.cpp +++ b/modules/juce_core/files/juce_common_MimeTypes.cpp @@ -26,685 +26,738 @@ namespace juce { -struct MimeTypeTableEntry +namespace { - const char* fileExtension, *mimeType; - static MimeTypeTableEntry table[641]; +struct Entry +{ + const char* fileExtension; + const char* mimeType; }; -static StringArray getMatches (const String& toMatch, - const char* MimeTypeTableEntry::* matchField, - const char* MimeTypeTableEntry::* returnField) +class Table { - StringArray result; +public: + void addEntry (const Entry& entry) + { + typeForExtension.emplace (entry.fileExtension, entry.mimeType); + extensionForType.emplace (entry.mimeType, entry.fileExtension); + } - for (auto type : MimeTypeTableEntry::table) - if (toMatch == type.*matchField) - result.add (type.*returnField); + StringArray getTypesForExtension (const String& extension) const + { + return getValuesForKey (typeForExtension, extension); + } - return result; -} + StringArray getExtensionsForType (const String& type) const + { + return getValuesForKey (extensionForType, type); + } -namespace MimeTypeTable -{ + static Table& get() + { + static Table table; + return table; + } + +private: + Table() = default; + + static StringArray getValuesForKey (const std::multimap& map, const String& key) + { + const auto [begin, end] = map.equal_range (key); + + StringArray result; + std::for_each (begin, end, [&] (const auto& pair) { result.add (pair.second); }); + + return result; + } + + static inline constexpr Entry initialEntries[] + { + { "3dm", "x-world/x-3dmf" }, + { "3dmf", "x-world/x-3dmf" }, + { "a", "application/octet-stream" }, + { "aab", "application/x-authorware-bin" }, + { "aam", "application/x-authorware-map" }, + { "aas", "application/x-authorware-seg" }, + { "abc", "text/vnd.abc" }, + { "acgi", "text/html" }, + { "afl", "video/animaflex" }, + { "ai", "application/postscript" }, + { "aif", "audio/aiff" }, + { "aif", "audio/x-aiff" }, + { "aifc", "audio/aiff" }, + { "aifc", "audio/x-aiff" }, + { "aiff", "audio/aiff" }, + { "aiff", "audio/x-aiff" }, + { "aim", "application/x-aim" }, + { "aip", "text/x-audiosoft-intra" }, + { "ani", "application/x-navi-animation" }, + { "aos", "application/x-nokia-9000-communicator-add-on-software" }, + { "aps", "application/mime" }, + { "arc", "application/octet-stream" }, + { "arj", "application/arj" }, + { "arj", "application/octet-stream" }, + { "art", "image/x-jg" }, + { "asf", "video/x-ms-asf" }, + { "asm", "text/x-asm" }, + { "asp", "text/asp" }, + { "asx", "application/x-mplayer2" }, + { "asx", "video/x-ms-asf" }, + { "asx", "video/x-ms-asf-plugin" }, + { "au", "audio/basic" }, + { "au", "audio/x-au" }, + { "avi", "application/x-troff-msvideo" }, + { "avi", "video/avi" }, + { "avi", "video/msvideo" }, + { "avi", "video/x-msvideo" }, + { "avs", "video/avs-video" }, + { "bcpio", "application/x-bcpio" }, + { "bin", "application/mac-binary" }, + { "bin", "application/macbinary" }, + { "bin", "application/octet-stream" }, + { "bin", "application/x-binary" }, + { "bin", "application/x-macbinary" }, + { "bm", "image/bmp" }, + { "bmp", "image/bmp" }, + { "bmp", "image/x-windows-bmp" }, + { "boo", "application/book" }, + { "book", "application/book" }, + { "boz", "application/x-bzip2" }, + { "bsh", "application/x-bsh" }, + { "bz", "application/x-bzip" }, + { "bz2", "application/x-bzip2" }, + { "c", "text/plain" }, + { "c", "text/x-c" }, + { "c++", "text/plain" }, + { "cat", "application/vnd.ms-pki.seccat" }, + { "cc", "text/plain" }, + { "cc", "text/x-c" }, + { "ccad", "application/clariscad" }, + { "cco", "application/x-cocoa" }, + { "cdf", "application/cdf" }, + { "cdf", "application/x-cdf" }, + { "cdf", "application/x-netcdf" }, + { "cer", "application/pkix-cert" }, + { "cer", "application/x-x509-ca-cert" }, + { "cha", "application/x-chat" }, + { "chat", "application/x-chat" }, + { "class", "application/java" }, + { "class", "application/java-byte-code" }, + { "class", "application/x-java-class" }, + { "com", "application/octet-stream" }, + { "com", "text/plain" }, + { "conf", "text/plain" }, + { "cpio", "application/x-cpio" }, + { "cpp", "text/x-c" }, + { "cpt", "application/mac-compactpro" }, + { "cpt", "application/x-compactpro" }, + { "cpt", "application/x-cpt" }, + { "crl", "application/pkcs-crl" }, + { "crl", "application/pkix-crl" }, + { "crt", "application/pkix-cert" }, + { "crt", "application/x-x509-ca-cert" }, + { "crt", "application/x-x509-user-cert" }, + { "csh", "application/x-csh" }, + { "csh", "text/x-script.csh" }, + { "css", "application/x-pointplus" }, + { "css", "text/css" }, + { "cxx", "text/plain" }, + { "dcr", "application/x-director" }, + { "deepv", "application/x-deepv" }, + { "def", "text/plain" }, + { "der", "application/x-x509-ca-cert" }, + { "dif", "video/x-dv" }, + { "dir", "application/x-director" }, + { "dl", "video/dl" }, + { "dl", "video/x-dl" }, + { "doc", "application/msword" }, + { "dot", "application/msword" }, + { "dp", "application/commonground" }, + { "drw", "application/drafting" }, + { "dump", "application/octet-stream" }, + { "dv", "video/x-dv" }, + { "dvi", "application/x-dvi" }, + { "dwf", "drawing/x-dwf" }, + { "dwf", "model/vnd.dwf" }, + { "dwg", "application/acad" }, + { "dwg", "image/vnd.dwg" }, + { "dwg", "image/x-dwg" }, + { "dxf", "application/dxf" }, + { "dxf", "image/vnd.dwg" }, + { "dxf", "image/x-dwg" }, + { "dxr", "application/x-director" }, + { "el", "text/x-script.elisp" }, + { "elc", "application/x-bytecode.elisp" }, + { "elc", "application/x-elc" }, + { "env", "application/x-envoy" }, + { "eps", "application/postscript" }, + { "es", "application/x-esrehber" }, + { "etx", "text/x-setext" }, + { "evy", "application/envoy" }, + { "evy", "application/x-envoy" }, + { "exe", "application/octet-stream" }, + { "f", "text/plain" }, + { "f", "text/x-fortran" }, + { "f77", "text/x-fortran" }, + { "f90", "text/plain" }, + { "f90", "text/x-fortran" }, + { "fdf", "application/vnd.fdf" }, + { "fif", "application/fractals" }, + { "fif", "image/fif" }, + { "fli", "video/fli" }, + { "fli", "video/x-fli" }, + { "flo", "image/florian" }, + { "flx", "text/vnd.fmi.flexstor" }, + { "fmf", "video/x-atomic3d-feature" }, + { "for", "text/plain" }, + { "for", "text/x-fortran" }, + { "fpx", "image/vnd.fpx" }, + { "fpx", "image/vnd.net-fpx" }, + { "frl", "application/freeloader" }, + { "funk", "audio/make" }, + { "g", "text/plain" }, + { "g3", "image/g3fax" }, + { "gif", "image/gif" }, + { "gl", "video/gl" }, + { "gl", "video/x-gl" }, + { "gsd", "audio/x-gsm" }, + { "gsm", "audio/x-gsm" }, + { "gsp", "application/x-gsp" }, + { "gss", "application/x-gss" }, + { "gtar", "application/x-gtar" }, + { "gz", "application/x-compressed" }, + { "gz", "application/x-gzip" }, + { "gzip", "application/x-gzip" }, + { "gzip", "multipart/x-gzip" }, + { "h", "text/plain" }, + { "h", "text/x-h" }, + { "hdf", "application/x-hdf" }, + { "help", "application/x-helpfile" }, + { "hgl", "application/vnd.hp-hpgl" }, + { "hh", "text/plain" }, + { "hh", "text/x-h" }, + { "hlb", "text/x-script" }, + { "hlp", "application/hlp" }, + { "hlp", "application/x-helpfile" }, + { "hlp", "application/x-winhelp" }, + { "hpg", "application/vnd.hp-hpgl" }, + { "hpgl", "application/vnd.hp-hpgl" }, + { "hqx", "application/binhex" }, + { "hqx", "application/binhex4" }, + { "hqx", "application/mac-binhex" }, + { "hqx", "application/mac-binhex40" }, + { "hqx", "application/x-binhex40" }, + { "hqx", "application/x-mac-binhex40" }, + { "hta", "application/hta" }, + { "htc", "text/x-component" }, + { "htm", "text/html" }, + { "html", "text/html" }, + { "htmls", "text/html" }, + { "htt", "text/webviewhtml" }, + { "htx", "text/html" }, + { "ice", "x-conference/x-cooltalk" }, + { "ico", "image/x-icon" }, + { "idc", "text/plain" }, + { "ief", "image/ief" }, + { "iefs", "image/ief" }, + { "iges", "application/iges" }, + { "iges", "model/iges" }, + { "igs", "application/iges" }, + { "igs", "model/iges" }, + { "ima", "application/x-ima" }, + { "imap", "application/x-httpd-imap" }, + { "inf", "application/inf" }, + { "ins", "application/x-internett-signup" }, + { "ip", "application/x-ip2" }, + { "isu", "video/x-isvideo" }, + { "it", "audio/it" }, + { "iv", "application/x-inventor" }, + { "ivr", "i-world/i-vrml" }, + { "ivy", "application/x-livescreen" }, + { "jam", "audio/x-jam" }, + { "jav", "text/plain" }, + { "jav", "text/x-java-source" }, + { "java", "text/plain" }, + { "java", "text/x-java-source" }, + { "jcm", "application/x-java-commerce" }, + { "jfif", "image/jpeg" }, + { "jfif", "image/pjpeg" }, + { "jpe", "image/jpeg" }, + { "jpe", "image/pjpeg" }, + { "jpeg", "image/jpeg" }, + { "jpeg", "image/pjpeg" }, + { "jpg", "image/jpeg" }, + { "jpg", "image/pjpeg" }, + { "jps", "image/x-jps" }, + { "js", "application/x-javascript" }, + { "json", "application/json" }, + { "jut", "image/jutvision" }, + { "kar", "audio/midi" }, + { "kar", "music/x-karaoke" }, + { "ksh", "application/x-ksh" }, + { "ksh", "text/x-script.ksh" }, + { "la", "audio/nspaudio" }, + { "la", "audio/x-nspaudio" }, + { "lam", "audio/x-liveaudio" }, + { "latex", "application/x-latex" }, + { "lha", "application/lha" }, + { "lha", "application/octet-stream" }, + { "lha", "application/x-lha" }, + { "lhx", "application/octet-stream" }, + { "list", "text/plain" }, + { "lma", "audio/nspaudio" }, + { "lma", "audio/x-nspaudio" }, + { "log", "text/plain" }, + { "lsp", "application/x-lisp" }, + { "lsp", "text/x-script.lisp" }, + { "lst", "text/plain" }, + { "lsx", "text/x-la-asf" }, + { "ltx", "application/x-latex" }, + { "lzh", "application/octet-stream" }, + { "lzh", "application/x-lzh" }, + { "lzx", "application/lzx" }, + { "lzx", "application/octet-stream" }, + { "lzx", "application/x-lzx" }, + { "m", "text/plain" }, + { "m", "text/x-m" }, + { "m1v", "video/mpeg" }, + { "m2a", "audio/mpeg" }, + { "m2v", "video/mpeg" }, + { "m3u", "audio/x-mpequrl" }, + { "man", "application/x-troff-man" }, + { "map", "application/x-navimap" }, + { "mar", "text/plain" }, + { "mbd", "application/mbedlet" }, + { "mc$", "application/x-magic-cap-package-1.0" }, + { "mcd", "application/mcad" }, + { "mcd", "application/x-mathcad" }, + { "mcf", "image/vasa" }, + { "mcf", "text/mcf" }, + { "mcp", "application/netmc" }, + { "me", "application/x-troff-me" }, + { "mht", "message/rfc822" }, + { "mhtml", "message/rfc822" }, + { "mid", "application/x-midi" }, + { "mid", "audio/midi" }, + { "mid", "audio/x-mid" }, + { "mid", "audio/x-midi" }, + { "mid", "music/crescendo" }, + { "mid", "x-music/x-midi" }, + { "midi", "application/x-midi" }, + { "midi", "audio/midi" }, + { "midi", "audio/x-mid" }, + { "midi", "audio/x-midi" }, + { "midi", "music/crescendo" }, + { "midi", "x-music/x-midi" }, + { "mif", "application/x-frame" }, + { "mif", "application/x-mif" }, + { "mime", "message/rfc822" }, + { "mime", "www/mime" }, + { "mjf", "audio/x-vnd.audioexplosion.mjuicemediafile" }, + { "mjpg", "video/x-motion-jpeg" }, + { "mm", "application/base64" }, + { "mm", "application/x-meme" }, + { "mme", "application/base64" }, + { "mod", "audio/mod" }, + { "mod", "audio/x-mod" }, + { "moov", "video/quicktime" }, + { "mov", "video/quicktime" }, + { "movie", "video/x-sgi-movie" }, + { "mp2", "audio/mpeg" }, + { "mp2", "audio/x-mpeg" }, + { "mp2", "video/mpeg" }, + { "mp2", "video/x-mpeg" }, + { "mp2", "video/x-mpeq2a" }, + { "mp3", "audio/mpeg" }, + { "mp3", "audio/mpeg3" }, + { "mp3", "audio/x-mpeg-3" }, + { "mp3", "video/mpeg" }, + { "mp3", "video/x-mpeg" }, + { "mpa", "audio/mpeg" }, + { "mpa", "video/mpeg" }, + { "mpc", "application/x-project" }, + { "mpe", "video/mpeg" }, + { "mpeg", "video/mpeg" }, + { "mpg", "audio/mpeg" }, + { "mpg", "video/mpeg" }, + { "mpga", "audio/mpeg" }, + { "mpp", "application/vnd.ms-project" }, + { "mpt", "application/x-project" }, + { "mpv", "application/x-project" }, + { "mpx", "application/x-project" }, + { "mrc", "application/marc" }, + { "ms", "application/x-troff-ms" }, + { "mv", "video/x-sgi-movie" }, + { "my", "audio/make" }, + { "mzz", "application/x-vnd.audioexplosion.mzz" }, + { "nap", "image/naplps" }, + { "naplps", "image/naplps" }, + { "nc", "application/x-netcdf" }, + { "ncm", "application/vnd.nokia.configuration-message" }, + { "nif", "image/x-niff" }, + { "niff", "image/x-niff" }, + { "nix", "application/x-mix-transfer" }, + { "nsc", "application/x-conference" }, + { "nvd", "application/x-navidoc" }, + { "o", "application/octet-stream" }, + { "oda", "application/oda" }, + { "omc", "application/x-omc" }, + { "omcd", "application/x-omcdatamaker" }, + { "omcr", "application/x-omcregerator" }, + { "p", "text/x-pascal" }, + { "p10", "application/pkcs10" }, + { "p10", "application/x-pkcs10" }, + { "p12", "application/pkcs-12" }, + { "p12", "application/x-pkcs12" }, + { "p7a", "application/x-pkcs7-signature" }, + { "p7c", "application/pkcs7-mime" }, + { "p7c", "application/x-pkcs7-mime" }, + { "p7m", "application/pkcs7-mime" }, + { "p7m", "application/x-pkcs7-mime" }, + { "p7r", "application/x-pkcs7-certreqresp" }, + { "p7s", "application/pkcs7-signature" }, + { "part", "application/pro_eng" }, + { "pas", "text/pascal" }, + { "pbm", "image/x-portable-bitmap" }, + { "pcl", "application/vnd.hp-pcl" }, + { "pcl", "application/x-pcl" }, + { "pct", "image/x-pict" }, + { "pcx", "image/x-pcx" }, + { "pdb", "chemical/x-pdb" }, + { "pdf", "application/pdf" }, + { "pfunk", "audio/make" }, + { "pfunk", "audio/make.my.funk" }, + { "pgm", "image/x-portable-graymap" }, + { "pgm", "image/x-portable-greymap" }, + { "pic", "image/pict" }, + { "pict", "image/pict" }, + { "pkg", "application/x-newton-compatible-pkg" }, + { "pko", "application/vnd.ms-pki.pko" }, + { "pl", "text/plain" }, + { "pl", "text/x-script.perl" }, + { "plx", "application/x-pixclscript" }, + { "pm", "image/x-xpixmap" }, + { "pm", "text/x-script.perl-module" }, + { "pm4", "application/x-pagemaker" }, + { "pm5", "application/x-pagemaker" }, + { "png", "image/png" }, + { "pnm", "application/x-portable-anymap" }, + { "pnm", "image/x-portable-anymap" }, + { "pot", "application/mspowerpoint" }, + { "pot", "application/vnd.ms-powerpoint" }, + { "pov", "model/x-pov" }, + { "ppa", "application/vnd.ms-powerpoint" }, + { "ppm", "image/x-portable-pixmap" }, + { "pps", "application/mspowerpoint" }, + { "pps", "application/vnd.ms-powerpoint" }, + { "ppt", "application/mspowerpoint" }, + { "ppt", "application/powerpoint" }, + { "ppt", "application/vnd.ms-powerpoint" }, + { "ppt", "application/x-mspowerpoint" }, + { "ppz", "application/mspowerpoint" }, + { "pre", "application/x-freelance" }, + { "prt", "application/pro_eng" }, + { "ps", "application/postscript" }, + { "psd", "application/octet-stream" }, + { "pvu", "paleovu/x-pv" }, + { "pwz", "application/vnd.ms-powerpoint" }, + { "py", "text/x-script.python" }, + { "pyc", "application/x-bytecode.python" }, + { "qcp", "audio/vnd.qcelp" }, + { "qd3", "x-world/x-3dmf" }, + { "qd3d", "x-world/x-3dmf" }, + { "qif", "image/x-quicktime" }, + { "qt", "video/quicktime" }, + { "qtc", "video/x-qtc" }, + { "qti", "image/x-quicktime" }, + { "qtif", "image/x-quicktime" }, + { "ra", "audio/x-pn-realaudio" }, + { "ra", "audio/x-pn-realaudio-plugin" }, + { "ra", "audio/x-realaudio" }, + { "ram", "audio/x-pn-realaudio" }, + { "ras", "application/x-cmu-raster" }, + { "ras", "image/cmu-raster" }, + { "ras", "image/x-cmu-raster" }, + { "rast", "image/cmu-raster" }, + { "rexx", "text/x-script.rexx" }, + { "rf", "image/vnd.rn-realflash" }, + { "rgb", "image/x-rgb" }, + { "rm", "application/vnd.rn-realmedia" }, + { "rm", "audio/x-pn-realaudio" }, + { "rmi", "audio/mid" }, + { "rmm", "audio/x-pn-realaudio" }, + { "rmp", "audio/x-pn-realaudio" }, + { "rmp", "audio/x-pn-realaudio-plugin" }, + { "rng", "application/ringing-tones" }, + { "rng", "application/vnd.nokia.ringing-tone" }, + { "rnx", "application/vnd.rn-realplayer" }, + { "roff", "application/x-troff" }, + { "rp", "image/vnd.rn-realpix" }, + { "rpm", "audio/x-pn-realaudio-plugin" }, + { "rt", "text/richtext" }, + { "rt", "text/vnd.rn-realtext" }, + { "rtf", "application/rtf" }, + { "rtf", "application/x-rtf" }, + { "rtf", "text/richtext" }, + { "rtx", "application/rtf" }, + { "rtx", "text/richtext" }, + { "rv", "video/vnd.rn-realvideo" }, + { "s", "text/x-asm" }, + { "s3m", "audio/s3m" }, + { "saveme", "application/octet-stream" }, + { "sbk", "application/x-tbook" }, + { "scm", "application/x-lotusscreencam" }, + { "scm", "text/x-script.guile" }, + { "scm", "text/x-script.scheme" }, + { "scm", "video/x-scm" }, + { "sdml", "text/plain" }, + { "sdp", "application/sdp" }, + { "sdp", "application/x-sdp" }, + { "sdr", "application/sounder" }, + { "sea", "application/sea" }, + { "sea", "application/x-sea" }, + { "set", "application/set" }, + { "sgm", "text/sgml" }, + { "sgm", "text/x-sgml" }, + { "sgml", "text/sgml" }, + { "sgml", "text/x-sgml" }, + { "sh", "application/x-bsh" }, + { "sh", "application/x-sh" }, + { "sh", "application/x-shar" }, + { "sh", "text/x-script.sh" }, + { "shar", "application/x-bsh" }, + { "shar", "application/x-shar" }, + { "shtml", "text/html" }, + { "shtml", "text/x-server-parsed-html" }, + { "sid", "audio/x-psid" }, + { "sit", "application/x-sit" }, + { "sit", "application/x-stuffit" }, + { "skd", "application/x-koan" }, + { "skm", "application/x-koan" }, + { "skp", "application/x-koan" }, + { "skt", "application/x-koan" }, + { "sl", "application/x-seelogo" }, + { "smi", "application/smil" }, + { "smil", "application/smil" }, + { "snd", "audio/basic" }, + { "snd", "audio/x-adpcm" }, + { "sol", "application/solids" }, + { "spc", "application/x-pkcs7-certificates" }, + { "spc", "text/x-speech" }, + { "spl", "application/futuresplash" }, + { "spr", "application/x-sprite" }, + { "sprite", "application/x-sprite" }, + { "src", "application/x-wais-source" }, + { "ssi", "text/x-server-parsed-html" }, + { "ssm", "application/streamingmedia" }, + { "sst", "application/vnd.ms-pki.certstore" }, + { "step", "application/step" }, + { "stl", "application/sla" }, + { "stl", "application/vnd.ms-pki.stl" }, + { "stl", "application/x-navistyle" }, + { "stp", "application/step" }, + { "sv4cpio,", "application/x-sv4cpio" }, + { "sv4crc", "application/x-sv4crc" }, + { "svf", "image/vnd.dwg" }, + { "svf", "image/x-dwg" }, + { "svr", "application/x-world" }, + { "svr", "x-world/x-svr" }, + { "swf", "application/x-shockwave-flash" }, + { "t", "application/x-troff" }, + { "talk", "text/x-speech" }, + { "tar", "application/x-tar" }, + { "tbk", "application/toolbook" }, + { "tbk", "application/x-tbook" }, + { "tcl", "application/x-tcl" }, + { "tcl", "text/x-script.tcl" }, + { "tcsh", "text/x-script.tcsh" }, + { "tex", "application/x-tex" }, + { "texi", "application/x-texinfo" }, + { "texinfo,", "application/x-texinfo" }, + { "text", "application/plain" }, + { "text", "text/plain" }, + { "tgz", "application/gnutar" }, + { "tgz", "application/x-compressed" }, + { "tif", "image/tiff" }, + { "tif", "image/x-tiff" }, + { "tiff", "image/tiff" }, + { "tiff", "image/x-tiff" }, + { "tr", "application/x-troff" }, + { "tsi", "audio/tsp-audio" }, + { "tsp", "application/dsptype" }, + { "tsp", "audio/tsplayer" }, + { "tsv", "text/tab-separated-values" }, + { "turbot", "image/florian" }, + { "txt", "text/plain" }, + { "uil", "text/x-uil" }, + { "uni", "text/uri-list" }, + { "unis", "text/uri-list" }, + { "unv", "application/i-deas" }, + { "uri", "text/uri-list" }, + { "uris", "text/uri-list" }, + { "ustar", "application/x-ustar" }, + { "ustar", "multipart/x-ustar" }, + { "uu", "application/octet-stream" }, + { "uu", "text/x-uuencode" }, + { "uue", "text/x-uuencode" }, + { "vcd", "application/x-cdlink" }, + { "vcs", "text/x-vcalendar" }, + { "vda", "application/vda" }, + { "vdo", "video/vdo" }, + { "vew", "application/groupwise" }, + { "viv", "video/vivo" }, + { "viv", "video/vnd.vivo" }, + { "vivo", "video/vivo" }, + { "vivo", "video/vnd.vivo" }, + { "vmd", "application/vocaltec-media-desc" }, + { "vmf", "application/vocaltec-media-file" }, + { "voc", "audio/voc" }, + { "voc", "audio/x-voc" }, + { "vos", "video/vosaic" }, + { "vox", "audio/voxware" }, + { "vqe", "audio/x-twinvq-plugin" }, + { "vqf", "audio/x-twinvq" }, + { "vql", "audio/x-twinvq-plugin" }, + { "vrml", "application/x-vrml" }, + { "vrml", "model/vrml" }, + { "vrml", "x-world/x-vrml" }, + { "vrt", "x-world/x-vrt" }, + { "vsd", "application/x-visio" }, + { "vst", "application/x-visio" }, + { "vsw", "application/x-visio" }, + { "w60", "application/wordperfect6.0" }, + { "w61", "application/wordperfect6.1" }, + { "w6w", "application/msword" }, + { "wav", "audio/wav" }, + { "wav", "audio/x-wav" }, + { "wb1", "application/x-qpro" }, + { "wbmp", "image/vnd.wap.wbmp" }, + { "web", "application/vnd.xara" }, + { "wiz", "application/msword" }, + { "wk1", "application/x-123" }, + { "wmf", "windows/metafile" }, + { "wml", "text/vnd.wap.wml" }, + { "wmlc", "application/vnd.wap.wmlc" }, + { "wmls", "text/vnd.wap.wmlscript" }, + { "wmlsc", "application/vnd.wap.wmlscriptc" }, + { "word", "application/msword" }, + { "wp", "application/wordperfect" }, + { "wp5", "application/wordperfect" }, + { "wp5", "application/wordperfect6.0" }, + { "wp6", "application/wordperfect" }, + { "wpd", "application/wordperfect" }, + { "wpd", "application/x-wpwin" }, + { "wq1", "application/x-lotus" }, + { "wri", "application/mswrite" }, + { "wri", "application/x-wri" }, + { "wrl", "application/x-world" }, + { "wrl", "model/vrml" }, + { "wrl", "x-world/x-vrml" }, + { "wrz", "model/vrml" }, + { "wrz", "x-world/x-vrml" }, + { "wsc", "text/scriplet" }, + { "wsrc", "application/x-wais-source" }, + { "wtk", "application/x-wintalk" }, + { "xbm", "image/x-xbitmap" }, + { "xbm", "image/x-xbm" }, + { "xbm", "image/xbm" }, + { "xdr", "video/x-amt-demorun" }, + { "xgz", "xgl/drawing" }, + { "xif", "image/vnd.xiff" }, + { "xl", "application/excel" }, + { "xla", "application/excel" }, + { "xla", "application/x-excel" }, + { "xla", "application/x-msexcel" }, + { "xlb", "application/excel" }, + { "xlb", "application/vnd.ms-excel" }, + { "xlb", "application/x-excel" }, + { "xlc", "application/excel" }, + { "xlc", "application/vnd.ms-excel" }, + { "xlc", "application/x-excel" }, + { "xld", "application/excel" }, + { "xld", "application/x-excel" }, + { "xlk", "application/excel" }, + { "xlk", "application/x-excel" }, + { "xll", "application/excel" }, + { "xll", "application/vnd.ms-excel" }, + { "xll", "application/x-excel" }, + { "xlm", "application/excel" }, + { "xlm", "application/vnd.ms-excel" }, + { "xlm", "application/x-excel" }, + { "xls", "application/excel" }, + { "xls", "application/vnd.ms-excel" }, + { "xls", "application/x-excel" }, + { "xls", "application/x-msexcel" }, + { "xlt", "application/excel" }, + { "xlt", "application/x-excel" }, + { "xlv", "application/excel" }, + { "xlv", "application/x-excel" }, + { "xlw", "application/excel" }, + { "xlw", "application/vnd.ms-excel" }, + { "xlw", "application/x-excel" }, + { "xlw", "application/x-msexcel" }, + { "xm", "audio/xm" }, + { "xml", "application/xml" }, + { "xml", "text/xml" }, + { "xmz", "xgl/movie" }, + { "xpix", "application/x-vnd.ls-xpix" }, + { "xpm", "image/x-xpixmap" }, + { "xpm", "image/xpm" }, + { "x-png", "image/png" }, + { "xsr", "video/x-amt-showrun" }, + { "xwd", "image/x-xwd" }, + { "xwd", "image/x-xwindowdump" }, + { "xyz", "chemical/x-pdb" }, + { "z", "application/x-compress" }, + { "z", "application/x-compressed" }, + { "zip", "application/x-compressed" }, + { "zip", "application/x-zip-compressed" }, + { "zip", "application/zip" }, + { "zip", "multipart/x-zip" }, + { "zoo", "application/octet-stream" }, + }; + + template + static std::multimap createMultiMap (EntryToPair&& entryToPair) + { + std::pair transformed[std::size (initialEntries)]; + std::transform (std::begin (initialEntries), + std::end (initialEntries), + std::begin (transformed), + entryToPair); -StringArray getMimeTypesForFileExtension (const String& fileExtension) + return { std::begin (transformed), + std::end (transformed) }; + } + + std::multimap typeForExtension = createMultiMap ([] (auto e) + { + return std::make_pair (e.fileExtension, e.mimeType); + }); + + std::multimap extensionForType = createMultiMap ([] (auto e) + { + return std::make_pair (e.mimeType, e.fileExtension); + }); +}; + +} // namespace + +void MimeTypeTable::registerCustomMimeTypeForFileExtension (const String& mimeType, const String& fileExtension) { - return getMatches (fileExtension, &MimeTypeTableEntry::fileExtension, &MimeTypeTableEntry::mimeType); + Table::get().addEntry ({ fileExtension.toRawUTF8(), mimeType.toRawUTF8() }); } -StringArray getFileExtensionsForMimeType (const String& mimeType) +StringArray MimeTypeTable::getMimeTypesForFileExtension (const String& fileExtension) { - return getMatches (mimeType, &MimeTypeTableEntry::mimeType, &MimeTypeTableEntry::fileExtension); + return Table::get().getTypesForExtension (fileExtension); } -} // namespace MimeTypeTable - -//============================================================================== -MimeTypeTableEntry MimeTypeTableEntry::table[641] = +StringArray MimeTypeTable::getFileExtensionsForMimeType (const String& mimeType) { - {"3dm", "x-world/x-3dmf"}, - {"3dmf", "x-world/x-3dmf"}, - {"a", "application/octet-stream"}, - {"aab", "application/x-authorware-bin"}, - {"aam", "application/x-authorware-map"}, - {"aas", "application/x-authorware-seg"}, - {"abc", "text/vnd.abc"}, - {"acgi", "text/html"}, - {"afl", "video/animaflex"}, - {"ai", "application/postscript"}, - {"aif", "audio/aiff"}, - {"aif", "audio/x-aiff"}, - {"aifc", "audio/aiff"}, - {"aifc", "audio/x-aiff"}, - {"aiff", "audio/aiff"}, - {"aiff", "audio/x-aiff"}, - {"aim", "application/x-aim"}, - {"aip", "text/x-audiosoft-intra"}, - {"ani", "application/x-navi-animation"}, - {"aos", "application/x-nokia-9000-communicator-add-on-software"}, - {"aps", "application/mime"}, - {"arc", "application/octet-stream"}, - {"arj", "application/arj"}, - {"arj", "application/octet-stream"}, - {"art", "image/x-jg"}, - {"asf", "video/x-ms-asf"}, - {"asm", "text/x-asm"}, - {"asp", "text/asp"}, - {"asx", "application/x-mplayer2"}, - {"asx", "video/x-ms-asf"}, - {"asx", "video/x-ms-asf-plugin"}, - {"au", "audio/basic"}, - {"au", "audio/x-au"}, - {"avi", "application/x-troff-msvideo"}, - {"avi", "video/avi"}, - {"avi", "video/msvideo"}, - {"avi", "video/x-msvideo"}, - {"avs", "video/avs-video"}, - {"bcpio", "application/x-bcpio"}, - {"bin", "application/mac-binary"}, - {"bin", "application/macbinary"}, - {"bin", "application/octet-stream"}, - {"bin", "application/x-binary"}, - {"bin", "application/x-macbinary"}, - {"bm", "image/bmp"}, - {"bmp", "image/bmp"}, - {"bmp", "image/x-windows-bmp"}, - {"boo", "application/book"}, - {"book", "application/book"}, - {"boz", "application/x-bzip2"}, - {"bsh", "application/x-bsh"}, - {"bz", "application/x-bzip"}, - {"bz2", "application/x-bzip2"}, - {"c", "text/plain"}, - {"c", "text/x-c"}, - {"c++", "text/plain"}, - {"cat", "application/vnd.ms-pki.seccat"}, - {"cc", "text/plain"}, - {"cc", "text/x-c"}, - {"ccad", "application/clariscad"}, - {"cco", "application/x-cocoa"}, - {"cdf", "application/cdf"}, - {"cdf", "application/x-cdf"}, - {"cdf", "application/x-netcdf"}, - {"cer", "application/pkix-cert"}, - {"cer", "application/x-x509-ca-cert"}, - {"cha", "application/x-chat"}, - {"chat", "application/x-chat"}, - {"class", "application/java"}, - {"class", "application/java-byte-code"}, - {"class", "application/x-java-class"}, - {"com", "application/octet-stream"}, - {"com", "text/plain"}, - {"conf", "text/plain"}, - {"cpio", "application/x-cpio"}, - {"cpp", "text/x-c"}, - {"cpt", "application/mac-compactpro"}, - {"cpt", "application/x-compactpro"}, - {"cpt", "application/x-cpt"}, - {"crl", "application/pkcs-crl"}, - {"crl", "application/pkix-crl"}, - {"crt", "application/pkix-cert"}, - {"crt", "application/x-x509-ca-cert"}, - {"crt", "application/x-x509-user-cert"}, - {"csh", "application/x-csh"}, - {"csh", "text/x-script.csh"}, - {"css", "application/x-pointplus"}, - {"css", "text/css"}, - {"cxx", "text/plain"}, - {"dcr", "application/x-director"}, - {"deepv", "application/x-deepv"}, - {"def", "text/plain"}, - {"der", "application/x-x509-ca-cert"}, - {"dif", "video/x-dv"}, - {"dir", "application/x-director"}, - {"dl", "video/dl"}, - {"dl", "video/x-dl"}, - {"doc", "application/msword"}, - {"dot", "application/msword"}, - {"dp", "application/commonground"}, - {"drw", "application/drafting"}, - {"dump", "application/octet-stream"}, - {"dv", "video/x-dv"}, - {"dvi", "application/x-dvi"}, - {"dwf", "drawing/x-dwf"}, - {"dwf", "model/vnd.dwf"}, - {"dwg", "application/acad"}, - {"dwg", "image/vnd.dwg"}, - {"dwg", "image/x-dwg"}, - {"dxf", "application/dxf"}, - {"dxf", "image/vnd.dwg"}, - {"dxf", "image/x-dwg"}, - {"dxr", "application/x-director"}, - {"el", "text/x-script.elisp"}, - {"elc", "application/x-bytecode.elisp"}, - {"elc", "application/x-elc"}, - {"env", "application/x-envoy"}, - {"eps", "application/postscript"}, - {"es", "application/x-esrehber"}, - {"etx", "text/x-setext"}, - {"evy", "application/envoy"}, - {"evy", "application/x-envoy"}, - {"exe", "application/octet-stream"}, - {"f", "text/plain"}, - {"f", "text/x-fortran"}, - {"f77", "text/x-fortran"}, - {"f90", "text/plain"}, - {"f90", "text/x-fortran"}, - {"fdf", "application/vnd.fdf"}, - {"fif", "application/fractals"}, - {"fif", "image/fif"}, - {"fli", "video/fli"}, - {"fli", "video/x-fli"}, - {"flo", "image/florian"}, - {"flx", "text/vnd.fmi.flexstor"}, - {"fmf", "video/x-atomic3d-feature"}, - {"for", "text/plain"}, - {"for", "text/x-fortran"}, - {"fpx", "image/vnd.fpx"}, - {"fpx", "image/vnd.net-fpx"}, - {"frl", "application/freeloader"}, - {"funk", "audio/make"}, - {"g", "text/plain"}, - {"g3", "image/g3fax"}, - {"gif", "image/gif"}, - {"gl", "video/gl"}, - {"gl", "video/x-gl"}, - {"gsd", "audio/x-gsm"}, - {"gsm", "audio/x-gsm"}, - {"gsp", "application/x-gsp"}, - {"gss", "application/x-gss"}, - {"gtar", "application/x-gtar"}, - {"gz", "application/x-compressed"}, - {"gz", "application/x-gzip"}, - {"gzip", "application/x-gzip"}, - {"gzip", "multipart/x-gzip"}, - {"h", "text/plain"}, - {"h", "text/x-h"}, - {"hdf", "application/x-hdf"}, - {"help", "application/x-helpfile"}, - {"hgl", "application/vnd.hp-hpgl"}, - {"hh", "text/plain"}, - {"hh", "text/x-h"}, - {"hlb", "text/x-script"}, - {"hlp", "application/hlp"}, - {"hlp", "application/x-helpfile"}, - {"hlp", "application/x-winhelp"}, - {"hpg", "application/vnd.hp-hpgl"}, - {"hpgl", "application/vnd.hp-hpgl"}, - {"hqx", "application/binhex"}, - {"hqx", "application/binhex4"}, - {"hqx", "application/mac-binhex"}, - {"hqx", "application/mac-binhex40"}, - {"hqx", "application/x-binhex40"}, - {"hqx", "application/x-mac-binhex40"}, - {"hta", "application/hta"}, - {"htc", "text/x-component"}, - {"htm", "text/html"}, - {"html", "text/html"}, - {"htmls", "text/html"}, - {"htt", "text/webviewhtml"}, - {"htx", "text/html"}, - {"ice", "x-conference/x-cooltalk"}, - {"ico", "image/x-icon"}, - {"idc", "text/plain"}, - {"ief", "image/ief"}, - {"iefs", "image/ief"}, - {"iges", "application/iges"}, - {"iges", "model/iges"}, - {"igs", "application/iges"}, - {"igs", "model/iges"}, - {"ima", "application/x-ima"}, - {"imap", "application/x-httpd-imap"}, - {"inf", "application/inf"}, - {"ins", "application/x-internett-signup"}, - {"ip", "application/x-ip2"}, - {"isu", "video/x-isvideo"}, - {"it", "audio/it"}, - {"iv", "application/x-inventor"}, - {"ivr", "i-world/i-vrml"}, - {"ivy", "application/x-livescreen"}, - {"jam", "audio/x-jam"}, - {"jav", "text/plain"}, - {"jav", "text/x-java-source"}, - {"java", "text/plain"}, - {"java", "text/x-java-source"}, - {"jcm", "application/x-java-commerce"}, - {"jfif", "image/jpeg"}, - {"jfif", "image/pjpeg"}, - {"jpe", "image/jpeg"}, - {"jpe", "image/pjpeg"}, - {"jpeg", "image/jpeg"}, - {"jpeg", "image/pjpeg"}, - {"jpg", "image/jpeg"}, - {"jpg", "image/pjpeg"}, - {"jps", "image/x-jps"}, - {"js", "application/x-javascript"}, - {"jut", "image/jutvision"}, - {"kar", "audio/midi"}, - {"kar", "music/x-karaoke"}, - {"ksh", "application/x-ksh"}, - {"ksh", "text/x-script.ksh"}, - {"la", "audio/nspaudio"}, - {"la", "audio/x-nspaudio"}, - {"lam", "audio/x-liveaudio"}, - {"latex", "application/x-latex"}, - {"lha", "application/lha"}, - {"lha", "application/octet-stream"}, - {"lha", "application/x-lha"}, - {"lhx", "application/octet-stream"}, - {"list", "text/plain"}, - {"lma", "audio/nspaudio"}, - {"lma", "audio/x-nspaudio"}, - {"log", "text/plain"}, - {"lsp", "application/x-lisp"}, - {"lsp", "text/x-script.lisp"}, - {"lst", "text/plain"}, - {"lsx", "text/x-la-asf"}, - {"ltx", "application/x-latex"}, - {"lzh", "application/octet-stream"}, - {"lzh", "application/x-lzh"}, - {"lzx", "application/lzx"}, - {"lzx", "application/octet-stream"}, - {"lzx", "application/x-lzx"}, - {"m", "text/plain"}, - {"m", "text/x-m"}, - {"m1v", "video/mpeg"}, - {"m2a", "audio/mpeg"}, - {"m2v", "video/mpeg"}, - {"m3u", "audio/x-mpequrl"}, - {"man", "application/x-troff-man"}, - {"map", "application/x-navimap"}, - {"mar", "text/plain"}, - {"mbd", "application/mbedlet"}, - {"mc$", "application/x-magic-cap-package-1.0"}, - {"mcd", "application/mcad"}, - {"mcd", "application/x-mathcad"}, - {"mcf", "image/vasa"}, - {"mcf", "text/mcf"}, - {"mcp", "application/netmc"}, - {"me", "application/x-troff-me"}, - {"mht", "message/rfc822"}, - {"mhtml", "message/rfc822"}, - {"mid", "application/x-midi"}, - {"mid", "audio/midi"}, - {"mid", "audio/x-mid"}, - {"mid", "audio/x-midi"}, - {"mid", "music/crescendo"}, - {"mid", "x-music/x-midi"}, - {"midi", "application/x-midi"}, - {"midi", "audio/midi"}, - {"midi", "audio/x-mid"}, - {"midi", "audio/x-midi"}, - {"midi", "music/crescendo"}, - {"midi", "x-music/x-midi"}, - {"mif", "application/x-frame"}, - {"mif", "application/x-mif"}, - {"mime", "message/rfc822"}, - {"mime", "www/mime"}, - {"mjf", "audio/x-vnd.audioexplosion.mjuicemediafile"}, - {"mjpg", "video/x-motion-jpeg"}, - {"mm", "application/base64"}, - {"mm", "application/x-meme"}, - {"mme", "application/base64"}, - {"mod", "audio/mod"}, - {"mod", "audio/x-mod"}, - {"moov", "video/quicktime"}, - {"mov", "video/quicktime"}, - {"movie", "video/x-sgi-movie"}, - {"mp2", "audio/mpeg"}, - {"mp2", "audio/x-mpeg"}, - {"mp2", "video/mpeg"}, - {"mp2", "video/x-mpeg"}, - {"mp2", "video/x-mpeq2a"}, - {"mp3", "audio/mpeg"}, - {"mp3", "audio/mpeg3"}, - {"mp3", "audio/x-mpeg-3"}, - {"mp3", "video/mpeg"}, - {"mp3", "video/x-mpeg"}, - {"mpa", "audio/mpeg"}, - {"mpa", "video/mpeg"}, - {"mpc", "application/x-project"}, - {"mpe", "video/mpeg"}, - {"mpeg", "video/mpeg"}, - {"mpg", "audio/mpeg"}, - {"mpg", "video/mpeg"}, - {"mpga", "audio/mpeg"}, - {"mpp", "application/vnd.ms-project"}, - {"mpt", "application/x-project"}, - {"mpv", "application/x-project"}, - {"mpx", "application/x-project"}, - {"mrc", "application/marc"}, - {"ms", "application/x-troff-ms"}, - {"mv", "video/x-sgi-movie"}, - {"my", "audio/make"}, - {"mzz", "application/x-vnd.audioexplosion.mzz"}, - {"nap", "image/naplps"}, - {"naplps", "image/naplps"}, - {"nc", "application/x-netcdf"}, - {"ncm", "application/vnd.nokia.configuration-message"}, - {"nif", "image/x-niff"}, - {"niff", "image/x-niff"}, - {"nix", "application/x-mix-transfer"}, - {"nsc", "application/x-conference"}, - {"nvd", "application/x-navidoc"}, - {"o", "application/octet-stream"}, - {"oda", "application/oda"}, - {"omc", "application/x-omc"}, - {"omcd", "application/x-omcdatamaker"}, - {"omcr", "application/x-omcregerator"}, - {"p", "text/x-pascal"}, - {"p10", "application/pkcs10"}, - {"p10", "application/x-pkcs10"}, - {"p12", "application/pkcs-12"}, - {"p12", "application/x-pkcs12"}, - {"p7a", "application/x-pkcs7-signature"}, - {"p7c", "application/pkcs7-mime"}, - {"p7c", "application/x-pkcs7-mime"}, - {"p7m", "application/pkcs7-mime"}, - {"p7m", "application/x-pkcs7-mime"}, - {"p7r", "application/x-pkcs7-certreqresp"}, - {"p7s", "application/pkcs7-signature"}, - {"part", "application/pro_eng"}, - {"pas", "text/pascal"}, - {"pbm", "image/x-portable-bitmap"}, - {"pcl", "application/vnd.hp-pcl"}, - {"pcl", "application/x-pcl"}, - {"pct", "image/x-pict"}, - {"pcx", "image/x-pcx"}, - {"pdb", "chemical/x-pdb"}, - {"pdf", "application/pdf"}, - {"pfunk", "audio/make"}, - {"pfunk", "audio/make.my.funk"}, - {"pgm", "image/x-portable-graymap"}, - {"pgm", "image/x-portable-greymap"}, - {"pic", "image/pict"}, - {"pict", "image/pict"}, - {"pkg", "application/x-newton-compatible-pkg"}, - {"pko", "application/vnd.ms-pki.pko"}, - {"pl", "text/plain"}, - {"pl", "text/x-script.perl"}, - {"plx", "application/x-pixclscript"}, - {"pm", "image/x-xpixmap"}, - {"pm", "text/x-script.perl-module"}, - {"pm4", "application/x-pagemaker"}, - {"pm5", "application/x-pagemaker"}, - {"png", "image/png"}, - {"pnm", "application/x-portable-anymap"}, - {"pnm", "image/x-portable-anymap"}, - {"pot", "application/mspowerpoint"}, - {"pot", "application/vnd.ms-powerpoint"}, - {"pov", "model/x-pov"}, - {"ppa", "application/vnd.ms-powerpoint"}, - {"ppm", "image/x-portable-pixmap"}, - {"pps", "application/mspowerpoint"}, - {"pps", "application/vnd.ms-powerpoint"}, - {"ppt", "application/mspowerpoint"}, - {"ppt", "application/powerpoint"}, - {"ppt", "application/vnd.ms-powerpoint"}, - {"ppt", "application/x-mspowerpoint"}, - {"ppz", "application/mspowerpoint"}, - {"pre", "application/x-freelance"}, - {"prt", "application/pro_eng"}, - {"ps", "application/postscript"}, - {"psd", "application/octet-stream"}, - {"pvu", "paleovu/x-pv"}, - {"pwz", "application/vnd.ms-powerpoint"}, - {"py", "text/x-script.python"}, - {"pyc", "application/x-bytecode.python"}, - {"qcp", "audio/vnd.qcelp"}, - {"qd3", "x-world/x-3dmf"}, - {"qd3d", "x-world/x-3dmf"}, - {"qif", "image/x-quicktime"}, - {"qt", "video/quicktime"}, - {"qtc", "video/x-qtc"}, - {"qti", "image/x-quicktime"}, - {"qtif", "image/x-quicktime"}, - {"ra", "audio/x-pn-realaudio"}, - {"ra", "audio/x-pn-realaudio-plugin"}, - {"ra", "audio/x-realaudio"}, - {"ram", "audio/x-pn-realaudio"}, - {"ras", "application/x-cmu-raster"}, - {"ras", "image/cmu-raster"}, - {"ras", "image/x-cmu-raster"}, - {"rast", "image/cmu-raster"}, - {"rexx", "text/x-script.rexx"}, - {"rf", "image/vnd.rn-realflash"}, - {"rgb", "image/x-rgb"}, - {"rm", "application/vnd.rn-realmedia"}, - {"rm", "audio/x-pn-realaudio"}, - {"rmi", "audio/mid"}, - {"rmm", "audio/x-pn-realaudio"}, - {"rmp", "audio/x-pn-realaudio"}, - {"rmp", "audio/x-pn-realaudio-plugin"}, - {"rng", "application/ringing-tones"}, - {"rng", "application/vnd.nokia.ringing-tone"}, - {"rnx", "application/vnd.rn-realplayer"}, - {"roff", "application/x-troff"}, - {"rp", "image/vnd.rn-realpix"}, - {"rpm", "audio/x-pn-realaudio-plugin"}, - {"rt", "text/richtext"}, - {"rt", "text/vnd.rn-realtext"}, - {"rtf", "application/rtf"}, - {"rtf", "application/x-rtf"}, - {"rtf", "text/richtext"}, - {"rtx", "application/rtf"}, - {"rtx", "text/richtext"}, - {"rv", "video/vnd.rn-realvideo"}, - {"s", "text/x-asm"}, - {"s3m", "audio/s3m"}, - {"saveme", "application/octet-stream"}, - {"sbk", "application/x-tbook"}, - {"scm", "application/x-lotusscreencam"}, - {"scm", "text/x-script.guile"}, - {"scm", "text/x-script.scheme"}, - {"scm", "video/x-scm"}, - {"sdml", "text/plain"}, - {"sdp", "application/sdp"}, - {"sdp", "application/x-sdp"}, - {"sdr", "application/sounder"}, - {"sea", "application/sea"}, - {"sea", "application/x-sea"}, - {"set", "application/set"}, - {"sgm", "text/sgml"}, - {"sgm", "text/x-sgml"}, - {"sgml", "text/sgml"}, - {"sgml", "text/x-sgml"}, - {"sh", "application/x-bsh"}, - {"sh", "application/x-sh"}, - {"sh", "application/x-shar"}, - {"sh", "text/x-script.sh"}, - {"shar", "application/x-bsh"}, - {"shar", "application/x-shar"}, - {"shtml", "text/html"}, - {"shtml", "text/x-server-parsed-html"}, - {"sid", "audio/x-psid"}, - {"sit", "application/x-sit"}, - {"sit", "application/x-stuffit"}, - {"skd", "application/x-koan"}, - {"skm", "application/x-koan"}, - {"skp", "application/x-koan"}, - {"skt", "application/x-koan"}, - {"sl", "application/x-seelogo"}, - {"smi", "application/smil"}, - {"smil", "application/smil"}, - {"snd", "audio/basic"}, - {"snd", "audio/x-adpcm"}, - {"sol", "application/solids"}, - {"spc", "application/x-pkcs7-certificates"}, - {"spc", "text/x-speech"}, - {"spl", "application/futuresplash"}, - {"spr", "application/x-sprite"}, - {"sprite", "application/x-sprite"}, - {"src", "application/x-wais-source"}, - {"ssi", "text/x-server-parsed-html"}, - {"ssm", "application/streamingmedia"}, - {"sst", "application/vnd.ms-pki.certstore"}, - {"step", "application/step"}, - {"stl", "application/sla"}, - {"stl", "application/vnd.ms-pki.stl"}, - {"stl", "application/x-navistyle"}, - {"stp", "application/step"}, - {"sv4cpio,", "application/x-sv4cpio"}, - {"sv4crc", "application/x-sv4crc"}, - {"svf", "image/vnd.dwg"}, - {"svf", "image/x-dwg"}, - {"svr", "application/x-world"}, - {"svr", "x-world/x-svr"}, - {"swf", "application/x-shockwave-flash"}, - {"t", "application/x-troff"}, - {"talk", "text/x-speech"}, - {"tar", "application/x-tar"}, - {"tbk", "application/toolbook"}, - {"tbk", "application/x-tbook"}, - {"tcl", "application/x-tcl"}, - {"tcl", "text/x-script.tcl"}, - {"tcsh", "text/x-script.tcsh"}, - {"tex", "application/x-tex"}, - {"texi", "application/x-texinfo"}, - {"texinfo,", "application/x-texinfo"}, - {"text", "application/plain"}, - {"text", "text/plain"}, - {"tgz", "application/gnutar"}, - {"tgz", "application/x-compressed"}, - {"tif", "image/tiff"}, - {"tif", "image/x-tiff"}, - {"tiff", "image/tiff"}, - {"tiff", "image/x-tiff"}, - {"tr", "application/x-troff"}, - {"tsi", "audio/tsp-audio"}, - {"tsp", "application/dsptype"}, - {"tsp", "audio/tsplayer"}, - {"tsv", "text/tab-separated-values"}, - {"turbot", "image/florian"}, - {"txt", "text/plain"}, - {"uil", "text/x-uil"}, - {"uni", "text/uri-list"}, - {"unis", "text/uri-list"}, - {"unv", "application/i-deas"}, - {"uri", "text/uri-list"}, - {"uris", "text/uri-list"}, - {"ustar", "application/x-ustar"}, - {"ustar", "multipart/x-ustar"}, - {"uu", "application/octet-stream"}, - {"uu", "text/x-uuencode"}, - {"uue", "text/x-uuencode"}, - {"vcd", "application/x-cdlink"}, - {"vcs", "text/x-vcalendar"}, - {"vda", "application/vda"}, - {"vdo", "video/vdo"}, - {"vew", "application/groupwise"}, - {"viv", "video/vivo"}, - {"viv", "video/vnd.vivo"}, - {"vivo", "video/vivo"}, - {"vivo", "video/vnd.vivo"}, - {"vmd", "application/vocaltec-media-desc"}, - {"vmf", "application/vocaltec-media-file"}, - {"voc", "audio/voc"}, - {"voc", "audio/x-voc"}, - {"vos", "video/vosaic"}, - {"vox", "audio/voxware"}, - {"vqe", "audio/x-twinvq-plugin"}, - {"vqf", "audio/x-twinvq"}, - {"vql", "audio/x-twinvq-plugin"}, - {"vrml", "application/x-vrml"}, - {"vrml", "model/vrml"}, - {"vrml", "x-world/x-vrml"}, - {"vrt", "x-world/x-vrt"}, - {"vsd", "application/x-visio"}, - {"vst", "application/x-visio"}, - {"vsw", "application/x-visio"}, - {"w60", "application/wordperfect6.0"}, - {"w61", "application/wordperfect6.1"}, - {"w6w", "application/msword"}, - {"wav", "audio/wav"}, - {"wav", "audio/x-wav"}, - {"wb1", "application/x-qpro"}, - {"wbmp", "image/vnd.wap.wbmp"}, - {"web", "application/vnd.xara"}, - {"wiz", "application/msword"}, - {"wk1", "application/x-123"}, - {"wmf", "windows/metafile"}, - {"wml", "text/vnd.wap.wml"}, - {"wmlc", "application/vnd.wap.wmlc"}, - {"wmls", "text/vnd.wap.wmlscript"}, - {"wmlsc", "application/vnd.wap.wmlscriptc"}, - {"word", "application/msword"}, - {"wp", "application/wordperfect"}, - {"wp5", "application/wordperfect"}, - {"wp5", "application/wordperfect6.0"}, - {"wp6", "application/wordperfect"}, - {"wpd", "application/wordperfect"}, - {"wpd", "application/x-wpwin"}, - {"wq1", "application/x-lotus"}, - {"wri", "application/mswrite"}, - {"wri", "application/x-wri"}, - {"wrl", "application/x-world"}, - {"wrl", "model/vrml"}, - {"wrl", "x-world/x-vrml"}, - {"wrz", "model/vrml"}, - {"wrz", "x-world/x-vrml"}, - {"wsc", "text/scriplet"}, - {"wsrc", "application/x-wais-source"}, - {"wtk", "application/x-wintalk"}, - {"xbm", "image/x-xbitmap"}, - {"xbm", "image/x-xbm"}, - {"xbm", "image/xbm"}, - {"xdr", "video/x-amt-demorun"}, - {"xgz", "xgl/drawing"}, - {"xif", "image/vnd.xiff"}, - {"xl", "application/excel"}, - {"xla", "application/excel"}, - {"xla", "application/x-excel"}, - {"xla", "application/x-msexcel"}, - {"xlb", "application/excel"}, - {"xlb", "application/vnd.ms-excel"}, - {"xlb", "application/x-excel"}, - {"xlc", "application/excel"}, - {"xlc", "application/vnd.ms-excel"}, - {"xlc", "application/x-excel"}, - {"xld", "application/excel"}, - {"xld", "application/x-excel"}, - {"xlk", "application/excel"}, - {"xlk", "application/x-excel"}, - {"xll", "application/excel"}, - {"xll", "application/vnd.ms-excel"}, - {"xll", "application/x-excel"}, - {"xlm", "application/excel"}, - {"xlm", "application/vnd.ms-excel"}, - {"xlm", "application/x-excel"}, - {"xls", "application/excel"}, - {"xls", "application/vnd.ms-excel"}, - {"xls", "application/x-excel"}, - {"xls", "application/x-msexcel"}, - {"xlt", "application/excel"}, - {"xlt", "application/x-excel"}, - {"xlv", "application/excel"}, - {"xlv", "application/x-excel"}, - {"xlw", "application/excel"}, - {"xlw", "application/vnd.ms-excel"}, - {"xlw", "application/x-excel"}, - {"xlw", "application/x-msexcel"}, - {"xm", "audio/xm"}, - {"xml", "application/xml"}, - {"xml", "text/xml"}, - {"xmz", "xgl/movie"}, - {"xpix", "application/x-vnd.ls-xpix"}, - {"xpm", "image/x-xpixmap"}, - {"xpm", "image/xpm"}, - {"x-png", "image/png"}, - {"xsr", "video/x-amt-showrun"}, - {"xwd", "image/x-xwd"}, - {"xwd", "image/x-xwindowdump"}, - {"xyz", "chemical/x-pdb"}, - {"z", "application/x-compress"}, - {"z", "application/x-compressed"}, - {"zip", "application/x-compressed"}, - {"zip", "application/x-zip-compressed"}, - {"zip", "application/zip"}, - {"zip", "multipart/x-zip"}, - {"zoo", "application/octet-stream"} -}; + return Table::get().getExtensionsForType (mimeType); +} } // namespace juce diff --git a/modules/juce_core/files/juce_common_MimeTypes.h b/modules/juce_core/files/juce_common_MimeTypes.h index 1d79b41b..d3b3e7be 100644 --- a/modules/juce_core/files/juce_common_MimeTypes.h +++ b/modules/juce_core/files/juce_common_MimeTypes.h @@ -28,15 +28,18 @@ namespace juce { -namespace MimeTypeTable +struct MimeTypeTable { /* @internal */ -StringArray getMimeTypesForFileExtension (const String& fileExtension); +static void registerCustomMimeTypeForFileExtension (const String& mimeType, const String& fileExtension); /* @internal */ -StringArray getFileExtensionsForMimeType (const String& mimeType); +static StringArray getMimeTypesForFileExtension (const String& fileExtension); -} // namespace MimeTypeTable +/* @internal */ +static StringArray getFileExtensionsForMimeType (const String& mimeType); + +}; } // namespace juce diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 3ad6c775..1582571c 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -1278,7 +1278,7 @@ struct JavascriptEngine::RootObject : public DynamicObject Expression* parseFunctionCall (FunctionCall* call, ExpPtr& function) { std::unique_ptr s (call); - s->object.reset (function.release()); + s->object = std::move (function); match (TokenTypes::openParen); while (currentType != TokenTypes::closeParen) @@ -1304,7 +1304,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (matchIf (TokenTypes::openBracket)) { std::unique_ptr s (new ArraySubscript (location)); - s->object.reset (input.release()); + s->object = std::move (input); s->index.reset (parseExpression()); match (TokenTypes::closeBracket); return parseSuffixes (s.release()); @@ -1513,7 +1513,7 @@ struct JavascriptEngine::RootObject : public DynamicObject Expression* parseTernaryOperator (ExpPtr& condition) { std::unique_ptr e (new ConditionalOp (location)); - e->condition.reset (condition.release()); + e->condition = std::move (condition); e->trueBranch.reset (parseExpression()); match (TokenTypes::colon); e->falseBranch.reset (parseExpression()); @@ -1539,9 +1539,9 @@ struct JavascriptEngine::RootObject : public DynamicObject setMethod ("clone", cloneFn); } - static Identifier getClassName() { static const Identifier i ("Object"); return i; } - static var dump (Args a) { DBG (JSON::toString (a.thisObject)); ignoreUnused (a); return var::undefined(); } - static var cloneFn (Args a) { return a.thisObject.clone(); } + static Identifier getClassName() { static const Identifier i ("Object"); return i; } + static var dump ([[maybe_unused]] Args a) { DBG (JSON::toString (a.thisObject)); return var::undefined(); } + static var cloneFn (Args a) { return a.thisObject.clone(); } }; //============================================================================== diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp index e79c1c91..99884b30 100644 --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -186,6 +186,7 @@ #include "zip/juce_ZipFile.cpp" #include "files/juce_FileFilter.cpp" #include "files/juce_WildcardFileFilter.cpp" +#include "native/juce_native_ThreadPriorities.h" //============================================================================== #if ! JUCE_WINDOWS diff --git a/modules/juce_core/juce_core.h b/modules/juce_core/juce_core.h index 1aafb16f..4ce05eb8 100644 --- a/modules/juce_core/juce_core.h +++ b/modules/juce_core/juce_core.h @@ -32,12 +32,12 @@ ID: juce_core vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE core classes description: The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality. website: http://www.juce.com/juce license: ISC - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: OSXFrameworks: Cocoa Foundation IOKit diff --git a/modules/juce_core/maths/juce_BigInteger.cpp b/modules/juce_core/maths/juce_BigInteger.cpp index 226ddccc..fd780c88 100644 --- a/modules/juce_core/maths/juce_BigInteger.cpp +++ b/modules/juce_core/maths/juce_BigInteger.cpp @@ -258,7 +258,7 @@ uint32 BigInteger::getBitRangeAsInt (const int startBit, int numBits) const noex return n & (((uint32) 0xffffffff) >> endSpace); } -void BigInteger::setBitRangeAsInt (const int startBit, int numBits, uint32 valueToSet) +BigInteger& BigInteger::setBitRangeAsInt (const int startBit, int numBits, uint32 valueToSet) { if (numBits > 32) { @@ -271,10 +271,12 @@ void BigInteger::setBitRangeAsInt (const int startBit, int numBits, uint32 value setBit (startBit + i, (valueToSet & 1) != 0); valueToSet >>= 1; } + + return *this; } //============================================================================== -void BigInteger::clear() noexcept +BigInteger& BigInteger::clear() noexcept { heapAllocation.free(); allocatedSize = numPreallocatedInts; @@ -283,9 +285,11 @@ void BigInteger::clear() noexcept for (int i = 0; i < numPreallocatedInts; ++i) preallocated[i] = 0; + + return *this; } -void BigInteger::setBit (const int bit) +BigInteger& BigInteger::setBit (const int bit) { if (bit >= 0) { @@ -297,17 +301,21 @@ void BigInteger::setBit (const int bit) getValues() [bitToIndex (bit)] |= bitToMask (bit); } + + return *this; } -void BigInteger::setBit (const int bit, const bool shouldBeSet) +BigInteger& BigInteger::setBit (const int bit, const bool shouldBeSet) { if (shouldBeSet) setBit (bit); else clearBit (bit); + + return *this; } -void BigInteger::clearBit (const int bit) noexcept +BigInteger& BigInteger::clearBit (const int bit) noexcept { if (bit >= 0 && bit <= highestBit) { @@ -316,20 +324,25 @@ void BigInteger::clearBit (const int bit) noexcept if (bit == highestBit) highestBit = getHighestBit(); } + + return *this; } -void BigInteger::setRange (int startBit, int numBits, const bool shouldBeSet) +BigInteger& BigInteger::setRange (int startBit, int numBits, const bool shouldBeSet) { while (--numBits >= 0) setBit (startBit++, shouldBeSet); + + return *this; } -void BigInteger::insertBit (const int bit, const bool shouldBeSet) +BigInteger& BigInteger::insertBit (const int bit, const bool shouldBeSet) { if (bit >= 0) shiftBits (1, bit); setBit (bit, shouldBeSet); + return *this; } //============================================================================== @@ -855,7 +868,7 @@ void BigInteger::shiftRight (int bits, const int startBit) } } -void BigInteger::shiftBits (int bits, const int startBit) +BigInteger& BigInteger::shiftBits (int bits, const int startBit) { if (highestBit >= 0) { @@ -864,6 +877,8 @@ void BigInteger::shiftBits (int bits, const int startBit) else if (bits > 0) shiftLeft (bits, startBit); } + + return *this; } //============================================================================== diff --git a/modules/juce_core/maths/juce_BigInteger.h b/modules/juce_core/maths/juce_BigInteger.h index 43051381..8d35e5f1 100644 --- a/modules/juce_core/maths/juce_BigInteger.h +++ b/modules/juce_core/maths/juce_BigInteger.h @@ -102,16 +102,16 @@ public: //============================================================================== /** Resets the value to 0. */ - void clear() noexcept; + BigInteger& clear() noexcept; /** Clears a particular bit in the number. */ - void clearBit (int bitNumber) noexcept; + BigInteger& clearBit (int bitNumber) noexcept; /** Sets a specified bit to 1. */ - void setBit (int bitNumber); + BigInteger& setBit (int bitNumber); /** Sets or clears a specified bit. */ - void setBit (int bitNumber, bool shouldBeSet); + BigInteger& setBit (int bitNumber, bool shouldBeSet); /** Sets a range of bits to be either on or off. @@ -119,10 +119,10 @@ public: @param numBits the number of bits to change @param shouldBeSet whether to turn these bits on or off */ - void setRange (int startBit, int numBits, bool shouldBeSet); + BigInteger& setRange (int startBit, int numBits, bool shouldBeSet); /** Inserts a bit an a given position, shifting up any bits above it. */ - void insertBit (int bitNumber, bool shouldBeSet); + BigInteger& insertBit (int bitNumber, bool shouldBeSet); /** Returns a range of bits as a new BigInteger. @@ -145,14 +145,14 @@ public: Copies the given integer onto a range of bits, starting at startBit, and using up to numBits of the available bits. */ - void setBitRangeAsInt (int startBit, int numBits, uint32 valueToSet); + BigInteger& setBitRangeAsInt (int startBit, int numBits, uint32 valueToSet); /** Shifts a section of bits left or right. @param howManyBitsLeft how far to move the bits (+ve numbers shift it left, -ve numbers shift it right). @param startBit the first bit to affect - if this is > 0, only bits above that index will be affected. */ - void shiftBits (int howManyBitsLeft, int startBit); + BigInteger& shiftBits (int howManyBitsLeft, int startBit); /** Returns the total number of set bits in the value. */ int countNumberOfSetBits() const noexcept; diff --git a/modules/juce_core/maths/juce_Expression.cpp b/modules/juce_core/maths/juce_Expression.cpp index f4dd5e45..49542942 100644 --- a/modules/juce_core/maths/juce_Expression.cpp +++ b/modules/juce_core/maths/juce_Expression.cpp @@ -424,9 +424,8 @@ struct Expression::Helpers String getName() const { return "-"; } TermPtr negated() { return input; } - TermPtr createTermToEvaluateInput (const Scope& scope, const Term* t, double overallTarget, Term* topLevelTerm) const + TermPtr createTermToEvaluateInput (const Scope& scope, [[maybe_unused]] const Term* t, double overallTarget, Term* topLevelTerm) const { - ignoreUnused (t); jassert (t == input); const Term* const dest = findDestinationFor (topLevelTerm, this); diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index 166c3a70..cc61820e 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -548,7 +548,7 @@ inline int nextPowerOfTwo (int n) noexcept int findHighestSetBit (uint32 n) noexcept; /** Returns the number of bits in a 32-bit integer. */ -inline int countNumberOfBits (uint32 n) noexcept +constexpr int countNumberOfBits (uint32 n) noexcept { n -= ((n >> 1) & 0x55555555); n = (((n >> 2) & 0x33333333) + (n & 0x33333333)); @@ -559,7 +559,7 @@ inline int countNumberOfBits (uint32 n) noexcept } /** Returns the number of bits in a 64-bit integer. */ -inline int countNumberOfBits (uint64 n) noexcept +constexpr int countNumberOfBits (uint64 n) noexcept { return countNumberOfBits ((uint32) n) + countNumberOfBits ((uint32) (n >> 32)); } @@ -654,11 +654,8 @@ namespace TypeHelpers @tags{Core} */ - template struct SmallestFloatType { using type = float; }; - - #ifndef DOXYGEN - template <> struct SmallestFloatType { using type = double; }; - #endif + template + using SmallestFloatType = std::conditional_t, double, float>; /** These templates are designed to take an integer type, and return an unsigned int version with the same size. diff --git a/modules/juce_core/maths/juce_Range.h b/modules/juce_core/maths/juce_Range.h index 9ea8e319..9a711959 100644 --- a/modules/juce_core/maths/juce_Range.h +++ b/modules/juce_core/maths/juce_Range.h @@ -63,14 +63,14 @@ public: } /** Returns a range with a given start and length. */ - JUCE_NODISCARD static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept + [[nodiscard]] static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept { jassert (length >= ValueType()); return Range (startValue, startValue + length); } /** Returns a range with the specified start position and a length of zero. */ - JUCE_NODISCARD constexpr static Range emptyRange (const ValueType start) noexcept + [[nodiscard]] constexpr static Range emptyRange (const ValueType start) noexcept { return Range (start, start); } @@ -104,13 +104,13 @@ public: If the new start position is higher than the current end of the range, the end point will be pushed along to equal it, returning an empty range at the new position. */ - JUCE_NODISCARD constexpr Range withStart (const ValueType newStart) const noexcept + [[nodiscard]] constexpr Range withStart (const ValueType newStart) const noexcept { return Range (newStart, jmax (newStart, end)); } /** Returns a range with the same length as this one, but moved to have the given start position. */ - JUCE_NODISCARD constexpr Range movedToStartAt (const ValueType newStart) const noexcept + [[nodiscard]] constexpr Range movedToStartAt (const ValueType newStart) const noexcept { return Range (newStart, end + (newStart - start)); } @@ -130,13 +130,13 @@ public: If the new end position is below the current start of the range, the start point will be pushed back to equal the new end point. */ - JUCE_NODISCARD constexpr Range withEnd (const ValueType newEnd) const noexcept + [[nodiscard]] constexpr Range withEnd (const ValueType newEnd) const noexcept { return Range (jmin (start, newEnd), newEnd); } /** Returns a range with the same length as this one, but moved to have the given end position. */ - JUCE_NODISCARD constexpr Range movedToEndAt (const ValueType newEnd) const noexcept + [[nodiscard]] constexpr Range movedToEndAt (const ValueType newEnd) const noexcept { return Range (start + (newEnd - end), newEnd); } @@ -152,7 +152,7 @@ public: /** Returns a range with the same start as this one, but a different length. Lengths less than zero are treated as zero. */ - JUCE_NODISCARD constexpr Range withLength (const ValueType newLength) const noexcept + [[nodiscard]] constexpr Range withLength (const ValueType newLength) const noexcept { return Range (start, start + newLength); } @@ -161,7 +161,7 @@ public: given amount. @returns The returned range will be (start - amount, end + amount) */ - JUCE_NODISCARD constexpr Range expanded (ValueType amount) const noexcept + [[nodiscard]] constexpr Range expanded (ValueType amount) const noexcept { return Range (start - amount, end + amount); } @@ -231,21 +231,21 @@ public: /** Returns the range that is the intersection of the two ranges, or an empty range with an undefined start position if they don't overlap. */ - JUCE_NODISCARD constexpr Range getIntersectionWith (Range other) const noexcept + [[nodiscard]] constexpr Range getIntersectionWith (Range other) const noexcept { return Range (jmax (start, other.start), jmin (end, other.end)); } /** Returns the smallest range that contains both this one and the other one. */ - JUCE_NODISCARD constexpr Range getUnionWith (Range other) const noexcept + [[nodiscard]] constexpr Range getUnionWith (Range other) const noexcept { return Range (jmin (start, other.start), jmax (end, other.end)); } /** Returns the smallest range that contains both this one and the given value. */ - JUCE_NODISCARD constexpr Range getUnionWith (const ValueType valueToInclude) const noexcept + [[nodiscard]] constexpr Range getUnionWith (const ValueType valueToInclude) const noexcept { return Range (jmin (valueToInclude, start), jmax (valueToInclude, end)); @@ -270,7 +270,7 @@ public: } /** Scans an array of values for its min and max, and returns these as a Range. */ - template ::value, int> = 0> + template , int> = 0> static Range findMinAndMax (const ValueType* values, Integral numValues) noexcept { if (numValues <= 0) diff --git a/modules/juce_core/memory/juce_ContainerDeletePolicy.h b/modules/juce_core/memory/juce_ContainerDeletePolicy.h index 1e3fcd2e..2eddc07d 100644 --- a/modules/juce_core/memory/juce_ContainerDeletePolicy.h +++ b/modules/juce_core/memory/juce_ContainerDeletePolicy.h @@ -49,7 +49,7 @@ struct ContainerDeletePolicy // implementation of all methods trying to use the OwnedArray (e.g. the destructor // of the class owning it) into cpp files where they can see to the definition // of ObjectType. This should fix the error. - ignoreUnused (sizeof (ObjectType)); + [[maybe_unused]] constexpr auto size = sizeof (ObjectType); delete object; } diff --git a/modules/juce_core/memory/juce_HeapBlock.h b/modules/juce_core/memory/juce_HeapBlock.h index 66a669ec..1d114cc4 100644 --- a/modules/juce_core/memory/juce_HeapBlock.h +++ b/modules/juce_core/memory/juce_HeapBlock.h @@ -87,8 +87,8 @@ class HeapBlock { private: template - using AllowConversion = typename std::enable_if::type, - typename std::remove_pointer::type>::value>::type; + using AllowConversion = std::enable_if_t, + std::remove_pointer_t>>; public: //============================================================================== @@ -107,7 +107,7 @@ public: If you want an array of zero values, you can use the calloc() method or the other constructor that takes an InitialisationState parameter. */ - template ::value, int> = 0> + template , int> = 0> explicit HeapBlock (SizeType numElements) : data (static_cast (std::malloc (static_cast (numElements) * sizeof (ElementType)))) { @@ -119,7 +119,7 @@ public: The initialiseToZero parameter determines whether the new memory should be cleared, or left uninitialised. */ - template ::value, int> = 0> + template , int> = 0> HeapBlock (SizeType numElements, bool initialiseToZero) : data (static_cast (initialiseToZero ? std::calloc (static_cast (numElements), sizeof (ElementType)) @@ -152,7 +152,7 @@ public: /** Converting move constructor. Only enabled if this is a HeapBlock and the other object is a HeapBlock, - where std::is_base_of::value == true. + where std::is_base_of_v == true. */ template > HeapBlock (HeapBlock&& other) noexcept @@ -163,7 +163,7 @@ public: /** Converting move assignment operator. Only enabled if this is a HeapBlock and the other object is a HeapBlock, - where std::is_base_of::value == true. + where std::is_base_of_v == true. */ template > HeapBlock& operator= (HeapBlock&& other) noexcept diff --git a/modules/juce_core/memory/juce_Memory.h b/modules/juce_core/memory/juce_Memory.h index eeac405a..3110ad17 100644 --- a/modules/juce_core/memory/juce_Memory.h +++ b/modules/juce_core/memory/juce_Memory.h @@ -84,9 +84,10 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept to a region that has suitable alignment for `Type`, e.g. regions returned from malloc/calloc that should be suitable for any non-over-aligned type. */ -template ::value, int>::type = 0> +template inline Type unalignedPointerCast (void* ptr) noexcept { + static_assert (std::is_pointer_v); return reinterpret_cast (ptr); } @@ -97,9 +98,10 @@ inline Type unalignedPointerCast (void* ptr) noexcept to a region that has suitable alignment for `Type`, e.g. regions returned from malloc/calloc that should be suitable for any non-over-aligned type. */ -template ::value, int>::type = 0> +template inline Type unalignedPointerCast (const void* ptr) noexcept { + static_assert (std::is_pointer_v); return reinterpret_cast (ptr); } diff --git a/modules/juce_core/memory/juce_WeakReference.h b/modules/juce_core/memory/juce_WeakReference.h index fbb3cecd..e552df83 100644 --- a/modules/juce_core/memory/juce_WeakReference.h +++ b/modules/juce_core/memory/juce_WeakReference.h @@ -116,9 +116,6 @@ public: */ bool wasObjectDeleted() const noexcept { return holder != nullptr && holder->get() == nullptr; } - bool operator== (ObjectType* object) const noexcept { return get() == object; } - bool operator!= (ObjectType* object) const noexcept { return get() != object; } - //============================================================================== /** This class is used internally by the WeakReference class - don't use it directly in your code! diff --git a/modules/juce_core/misc/juce_Functional.h b/modules/juce_core/misc/juce_Functional.h index 6ed1729a..e2a8bbfd 100644 --- a/modules/juce_core/misc/juce_Functional.h +++ b/modules/juce_core/misc/juce_Functional.h @@ -30,15 +30,10 @@ namespace detail using Void = void; template - struct EqualityComparableToNullptr - : std::false_type {}; + constexpr auto equalityComparableToNullptr = false; template - struct EqualityComparableToNullptr() != nullptr)>> - : std::true_type {}; - - template - constexpr bool shouldCheckAgainstNullptr = EqualityComparableToNullptr::value; + constexpr auto equalityComparableToNullptr() != nullptr)>> = true; } // namespace detail #endif @@ -53,23 +48,22 @@ namespace detail */ struct NullCheckedInvocation { - template , int> = 0> + template static void invoke (Callable&& fn, Args&&... args) { - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Waddress") + if constexpr (detail::equalityComparableToNullptr) + { + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Waddress") - if (fn != nullptr) - fn (std::forward (args)...); + if (fn != nullptr) + fn (std::forward (args)...); - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - } - - template , int> = 0> - static void invoke (Callable&& fn, Args&&... args) - { - fn (std::forward (args)...); + JUCE_END_IGNORE_WARNINGS_GCC_LIKE + } + else + { + fn (std::forward (args)...); + } } template @@ -82,14 +76,56 @@ struct NullCheckedInvocation Adapted from https://ericniebler.com/2013/08/07/universal-references-and-the-copy-constructo/ */ template -using DisableIfSameOrDerived = typename std::enable_if_t>::value>; +using DisableIfSameOrDerived = std::enable_if_t>>; /** Copies an object, sets one of the copy's members to the specified value, and then returns the copy. */ -template -Object withMember (Object copy, Member OtherObject::* member, Member&& value) +template +Object withMember (Object copy, Member OtherObject::* member, Other&& value) { - copy.*member = std::forward (value); + copy.*member = std::forward (value); return copy; } +/** An easy way to ensure that a function is called at the end of the current + scope. + + Usage: + @code + { + if (flag == true) + return; + + // While this code executes, flag is true e.g. to prevent reentrancy + flag = true; + // When we exit this scope, flag must be false + const ScopeGuard scope { [&] { flag = false; } }; + + if (checkInitialCondition()) + return; // Scope's lambda will fire here... + + if (checkCriticalCondition()) + throw std::runtime_error{}; // ...or here... + + doWorkHavingEstablishedPreconditions(); + } // ...or here! + @endcode +*/ +template struct ScopeGuard : Fn { ~ScopeGuard() { Fn::operator()(); } }; +template ScopeGuard (Fn) -> ScopeGuard; + +#ifndef DOXYGEN +namespace detail +{ +template +static constexpr auto toFnPtr (Functor functor, Return (Functor::*) (Args...) const) +{ + return static_cast (functor); +} +} // namespace detail +#endif + +/** Converts a captureless lambda to its equivalent function pointer type. */ +template +static constexpr auto toFnPtr (Functor functor) { return detail::toFnPtr (functor, &Functor::operator()); } + } // namespace juce diff --git a/modules/juce_core/misc/juce_RuntimePermissions.h b/modules/juce_core/misc/juce_RuntimePermissions.h index 3f1cd113..ca8d139f 100644 --- a/modules/juce_core/misc/juce_RuntimePermissions.h +++ b/modules/juce_core/misc/juce_RuntimePermissions.h @@ -86,7 +86,22 @@ public: writeExternalStorage = 4, /** Permission to use camera */ - camera = 5 + camera = 5, + + /** Permission to read audio files that your app didn't create. + Has the same effect as readExternalStorage on iOS and Android versions before 33. + */ + readMediaAudio = 6, + + /** Permission to read image files that your app didn't create. + Has the same effect as readExternalStorage on iOS and Android versions before 33. + */ + readMediaImages = 7, + + /** Permission to read video files that your app didn't create. + Has the same effect as readExternalStorage on iOS and Android versions before 33. + */ + readMediaVideo = 8 }; //============================================================================== diff --git a/modules/juce_core/native/juce_BasicNativeHeaders.h b/modules/juce_core/native/juce_BasicNativeHeaders.h index e0d78f4d..f444f9c0 100644 --- a/modules/juce_core/native/juce_BasicNativeHeaders.h +++ b/modules/juce_core/native/juce_BasicNativeHeaders.h @@ -113,18 +113,7 @@ #include #include #include - - #if ! JUCE_CXX17_IS_AVAILABLE - #pragma push_macro ("WIN_NOEXCEPT") - #define WIN_NOEXCEPT - #endif - #include - - #if ! JUCE_CXX17_IS_AVAILABLE - #pragma pop_macro ("WIN_NOEXCEPT") - #endif - #include #include #include @@ -214,6 +203,7 @@ #include #include #include + #include #include #include #include diff --git a/modules/juce_core/native/juce_android_AndroidDocument.cpp b/modules/juce_core/native/juce_android_AndroidDocument.cpp index e3dba249..d86eb2f0 100644 --- a/modules/juce_core/native/juce_android_AndroidDocument.cpp +++ b/modules/juce_core/native/juce_android_AndroidDocument.cpp @@ -101,8 +101,7 @@ struct AndroidDocumentDetail auto* env = getEnv(); LocalRef array { env->NewObjectArray (sizeof... (args), JavaString, nullptr) }; - int unused[] { (env->SetObjectArrayElement (array.get(), Ix, args.get()), 0)... }; - ignoreUnused (unused); + (env->SetObjectArrayElement (array.get(), Ix, args.get()), ...); return array; } @@ -745,21 +744,17 @@ struct AndroidDocument::Utils }; //============================================================================== -void AndroidDocumentPermission::takePersistentReadWriteAccess (const URL& url) +void AndroidDocumentPermission::takePersistentReadWriteAccess ([[maybe_unused]] const URL& url) { #if JUCE_ANDROID AndroidDocumentDetail::setPermissions (url, ContentResolver19.takePersistableUriPermission); - #else - ignoreUnused (url); #endif } -void AndroidDocumentPermission::releasePersistentReadWriteAccess (const URL& url) +void AndroidDocumentPermission::releasePersistentReadWriteAccess ([[maybe_unused]] const URL& url) { #if JUCE_ANDROID AndroidDocumentDetail::setPermissions (url, ContentResolver19.releasePersistableUriPermission); - #else - ignoreUnused (url); #endif } @@ -817,7 +812,7 @@ AndroidDocument AndroidDocument::fromFile (const File& filePath) : nullptr }; } -AndroidDocument AndroidDocument::fromDocument (const URL& documentUrl) +AndroidDocument AndroidDocument::fromDocument ([[maybe_unused]] const URL& documentUrl) { #if JUCE_ANDROID if (getAndroidSDKVersion() < 19) @@ -839,12 +834,11 @@ AndroidDocument AndroidDocument::fromDocument (const URL& documentUrl) return AndroidDocument { Utils::createPimplForSdk (javaUri) }; #else - ignoreUnused (documentUrl); return AndroidDocument{}; #endif } -AndroidDocument AndroidDocument::fromTree (const URL& treeUrl) +AndroidDocument AndroidDocument::fromTree ([[maybe_unused]] const URL& treeUrl) { #if JUCE_ANDROID if (getAndroidSDKVersion() < 21) @@ -874,7 +868,6 @@ AndroidDocument AndroidDocument::fromTree (const URL& treeUrl) return AndroidDocument { Utils::createPimplForSdk (documentUri) }; #else - ignoreUnused (treeUrl); return AndroidDocument{}; #endif } diff --git a/modules/juce_core/native/juce_android_JNIHelpers.cpp b/modules/juce_core/native/juce_android_JNIHelpers.cpp index 972c6e1d..45eb542f 100644 --- a/modules/juce_core/native/juce_android_JNIHelpers.cpp +++ b/modules/juce_core/native/juce_android_JNIHelpers.cpp @@ -62,7 +62,7 @@ static const uint8 invocationHandleByteCode[] = CALLBACK (juce_invokeImplementer, "dispatchInvoke", "(JLjava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;") \ CALLBACK (juce_dispatchDelete, "dispatchFinalize", "(J)V") - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceInvocationHandler, "com/rmsl/juce/JuceInvocationHandler", 10, invocationHandleByteCode, sizeof (invocationHandleByteCode)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceInvocationHandler, "com/rmsl/juce/JuceInvocationHandler", 10, invocationHandleByteCode) #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ @@ -116,7 +116,7 @@ struct SystemJavaClassComparator }; //============================================================================== -JNIClassBase::JNIClassBase (const char* cp, int classMinSDK, const void* bc, size_t n) +JNIClassBase::JNIClassBase (const char* cp, int classMinSDK, const uint8* bc, size_t n) : classPath (cp), byteCode (bc), byteCodeSize (n), minSDK (classMinSDK), classRef (nullptr) { SystemJavaClassComparator comparator; @@ -552,12 +552,12 @@ static const uint8 javaFragmentOverlay[] = #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (construct, "", "()V") \ METHOD (close, "close", "()V") \ - CALLBACK (FragmentOverlay::onActivityResultNative, "onActivityResultNative", "(JIILandroid/content/Intent;)V") \ - CALLBACK (FragmentOverlay::onCreateNative, "onCreateNative", "(JLandroid/os/Bundle;)V") \ - CALLBACK (FragmentOverlay::onStartNative, "onStartNative", "(J)V") \ - CALLBACK (FragmentOverlay::onRequestPermissionsResultNative, "onRequestPermissionsResultNative", "(JI[Ljava/lang/String;[I)V") + CALLBACK (generatedCallback<&FragmentOverlay::onActivityResultCallback>, "onActivityResultNative", "(JIILandroid/content/Intent;)V") \ + CALLBACK (generatedCallback<&FragmentOverlay::onCreatedCallback>, "onCreateNative", "(JLandroid/os/Bundle;)V") \ + CALLBACK (generatedCallback<&FragmentOverlay::onStartCallback>, "onStartNative", "(J)V") \ + CALLBACK (generatedCallback<&FragmentOverlay::onRequestPermissionsResultCallback>, "onRequestPermissionsResultNative", "(JI[Ljava/lang/String;[I)V") - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceFragmentOverlay, "com/rmsl/juce/FragmentOverlay", 16, javaFragmentOverlay, sizeof(javaFragmentOverlay)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceFragmentOverlay, "com/rmsl/juce/FragmentOverlay", 16, javaFragmentOverlay) #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ @@ -590,47 +590,39 @@ void FragmentOverlay::open() env->CallVoidMethod (native.get(), AndroidDialogFragment.show, fm.get(), javaString ("FragmentOverlay").get()); } -void FragmentOverlay::onActivityResultNative (JNIEnv* env, jobject, jlong host, - jint requestCode, jint resultCode, jobject data) +void FragmentOverlay::onCreatedCallback (JNIEnv* env, FragmentOverlay& t, jobject obj) { - if (auto* myself = reinterpret_cast (host)) - myself->onActivityResult (requestCode, resultCode, LocalRef (env->NewLocalRef (data))); + t.onCreated (LocalRef { env->NewLocalRef (obj) }); } -void FragmentOverlay::onCreateNative (JNIEnv* env, jobject, jlong host, jobject bundle) +void FragmentOverlay::onStartCallback (JNIEnv*, FragmentOverlay& t) { - if (auto* myself = reinterpret_cast (host)) - myself->onCreated (LocalRef (env->NewLocalRef (bundle))); + t.onStart(); } -void FragmentOverlay::onStartNative (JNIEnv*, jobject, jlong host) +void FragmentOverlay::onRequestPermissionsResultCallback (JNIEnv* env, FragmentOverlay& t, jint requestCode, jobjectArray jPermissions, jintArray jGrantResults) { - if (auto* myself = reinterpret_cast (host)) - myself->onStart(); -} + Array grantResults; + int n = (jGrantResults != nullptr ? env->GetArrayLength (jGrantResults) : 0); -void FragmentOverlay::onRequestPermissionsResultNative (JNIEnv* env, jobject, jlong host, jint requestCode, - jobjectArray jPermissions, jintArray jGrantResults) -{ - if (auto* myself = reinterpret_cast (host)) + if (n > 0) { - Array grantResults; - int n = (jGrantResults != nullptr ? env->GetArrayLength (jGrantResults) : 0); + auto* data = env->GetIntArrayElements (jGrantResults, nullptr); - if (n > 0) - { - auto* data = env->GetIntArrayElements (jGrantResults, nullptr); + for (int i = 0; i < n; ++i) + grantResults.add (data[i]); - for (int i = 0; i < n; ++i) - grantResults.add (data[i]); + env->ReleaseIntArrayElements (jGrantResults, data, 0); + } - env->ReleaseIntArrayElements (jGrantResults, data, 0); - } + t.onRequestPermissionsResult (requestCode, + javaStringArrayToJuce (LocalRef (jPermissions)), + grantResults); +} - myself->onRequestPermissionsResult (requestCode, - javaStringArrayToJuce (LocalRef (jPermissions)), - grantResults); - } +void FragmentOverlay::onActivityResultCallback (JNIEnv* env, FragmentOverlay& t, jint requestCode, jint resultCode, jobject data) +{ + t.onActivityResult (requestCode, resultCode, LocalRef (env->NewLocalRef (data))); } jobject FragmentOverlay::getNativeHandle() @@ -650,8 +642,9 @@ public: void onStart() override { - getEnv()->CallVoidMethod (getNativeHandle(), AndroidFragment.startActivityForResult, - intent.get(), requestCode); + if (! std::exchange (activityHasStarted, true)) + getEnv()->CallVoidMethod (getNativeHandle(), AndroidFragment.startActivityForResult, + intent.get(), requestCode); } void onActivityResult (int activityRequestCode, int resultCode, LocalRef data) override @@ -667,6 +660,7 @@ private: GlobalRef intent; int requestCode; std::function)> callback; + bool activityHasStarted = false; }; void startAndroidActivityForResult (const LocalRef& intent, int requestCode, diff --git a/modules/juce_core/native/juce_android_JNIHelpers.h b/modules/juce_core/native/juce_android_JNIHelpers.h index bdfa4c38..aeb49f97 100644 --- a/modules/juce_core/native/juce_android_JNIHelpers.h +++ b/modules/juce_core/native/juce_android_JNIHelpers.h @@ -172,7 +172,7 @@ struct SystemJavaClassComparator; class JNIClassBase { public: - JNIClassBase (const char* classPath, int minSDK, const void* byteCode, size_t byteCodeSize); + JNIClassBase (const char* classPath, int minSDK, const uint8* byteCode, size_t byteCodeSize); virtual ~JNIClassBase(); operator jclass() const noexcept { return classRef; } @@ -210,6 +210,9 @@ private: }; //============================================================================== +template constexpr auto numBytes (const T (&) [N]) { return N; } + constexpr auto numBytes (std::nullptr_t) { return static_cast (0); } + #define CREATE_JNI_METHOD(methodID, stringName, params) methodID = resolveMethod (env, stringName, params); #define CREATE_JNI_STATICMETHOD(methodID, stringName, params) methodID = resolveStaticMethod (env, stringName, params); #define CREATE_JNI_FIELD(fieldID, stringName, signature) fieldID = resolveField (env, stringName, signature); @@ -219,26 +222,26 @@ private: #define DECLARE_JNI_FIELD(fieldID, stringName, signature) jfieldID fieldID; #define DECLARE_JNI_CALLBACK(fieldID, stringName, signature) -#define DECLARE_JNI_CLASS_WITH_BYTECODE(CppClassName, javaPath, minSDK, byteCodeData, byteCodeSize) \ - class CppClassName ## _Class : public JNIClassBase \ - { \ - public: \ - CppClassName ## _Class() : JNIClassBase (javaPath, minSDK, byteCodeData, byteCodeSize) {} \ - \ - void initialiseFields (JNIEnv* env) \ - { \ - Array callbacks; \ - JNI_CLASS_MEMBERS (CREATE_JNI_METHOD, CREATE_JNI_STATICMETHOD, CREATE_JNI_FIELD, CREATE_JNI_STATICFIELD, CREATE_JNI_CALLBACK); \ - resolveCallbacks (env, callbacks); \ - } \ - \ - JNI_CLASS_MEMBERS (DECLARE_JNI_METHOD, DECLARE_JNI_METHOD, DECLARE_JNI_FIELD, DECLARE_JNI_FIELD, DECLARE_JNI_CALLBACK) \ - }; \ - static CppClassName ## _Class CppClassName; +#define DECLARE_JNI_CLASS_WITH_BYTECODE(CppClassName, javaPath, minSDK, byteCodeData) \ + class CppClassName ## _Class : public JNIClassBase \ + { \ + public: \ + CppClassName ## _Class() : JNIClassBase (javaPath, minSDK, byteCodeData, numBytes (byteCodeData)) {} \ + \ + void initialiseFields (JNIEnv* env) \ + { \ + Array callbacks; \ + JNI_CLASS_MEMBERS (CREATE_JNI_METHOD, CREATE_JNI_STATICMETHOD, CREATE_JNI_FIELD, CREATE_JNI_STATICFIELD, CREATE_JNI_CALLBACK); \ + resolveCallbacks (env, callbacks); \ + } \ + \ + JNI_CLASS_MEMBERS (DECLARE_JNI_METHOD, DECLARE_JNI_METHOD, DECLARE_JNI_FIELD, DECLARE_JNI_FIELD, DECLARE_JNI_CALLBACK) \ + }; \ + static inline const CppClassName ## _Class CppClassName; //============================================================================== #define DECLARE_JNI_CLASS_WITH_MIN_SDK(CppClassName, javaPath, minSDK) \ - DECLARE_JNI_CLASS_WITH_BYTECODE (CppClassName, javaPath, minSDK, nullptr, 0) + DECLARE_JNI_CLASS_WITH_BYTECODE (CppClassName, javaPath, minSDK, nullptr) //============================================================================== #define DECLARE_JNI_CLASS(CppClassName, javaPath) \ @@ -1005,20 +1008,20 @@ public: const Array& /*grantResults*/) {} virtual void onActivityResult (int /*requestCode*/, int /*resultCode*/, LocalRef /*data*/) {} + /** @internal */ + static void onCreatedCallback (JNIEnv*, FragmentOverlay&, jobject obj); + /** @internal */ + static void onStartCallback (JNIEnv*, FragmentOverlay&); + /** @internal */ + static void onRequestPermissionsResultCallback (JNIEnv*, FragmentOverlay&, jint requestCode, jobjectArray jPermissions, jintArray jGrantResults); + /** @internal */ + static void onActivityResultCallback (JNIEnv*, FragmentOverlay&, jint requestCode, jint resultCode, jobject data); + protected: jobject getNativeHandle(); private: - GlobalRef native; - -public: - /* internal: do not use */ - static void onActivityResultNative (JNIEnv*, jobject, jlong, jint, jint, jobject); - static void onCreateNative (JNIEnv*, jobject, jlong, jobject); - static void onStartNative (JNIEnv*, jobject, jlong); - static void onRequestPermissionsResultNative (JNIEnv*, jobject, jlong, jint, - jobjectArray, jintArray); }; //============================================================================== @@ -1030,4 +1033,30 @@ void startAndroidActivityForResult (const LocalRef& intent, int request bool androidHasSystemFeature (const String& property); String audioManagerGetProperty (const String& property); +namespace detail +{ + +template +inline constexpr auto generatedCallbackImpl = + juce::toFnPtr (JNICALL [] (JNIEnv* env, jobject, jlong host, Args... args) -> Result + { + if (auto* object = reinterpret_cast (host)) + return Fn (env, *object, args...); + + return {}; + }); + +template +constexpr auto generateCallbackImpl (Result (*) (JNIEnv*, Class&, Args...)) { return generatedCallbackImpl; } + +template +constexpr auto generateCallbackImpl (Result (*) (JNIEnv*, const Class&, Args...)) { return generatedCallbackImpl; } + +} // namespace detail + +// Evaluates to a static function that forwards to the provided Fn, assuming that the +// 'host' argument points to an object on which it is valid to call Fn +template +inline constexpr auto generatedCallback = detail::generateCallbackImpl (Fn); + } // namespace juce diff --git a/modules/juce_core/native/juce_android_Network.cpp b/modules/juce_core/native/juce_android_Network.cpp index f5a3afa8..c128cc69 100644 --- a/modules/juce_core/native/juce_android_Network.cpp +++ b/modules/juce_core/native/juce_android_Network.cpp @@ -195,7 +195,7 @@ DECLARE_JNI_CLASS (StringBuffer, "java/lang/StringBuffer") METHOD (isExhausted, "isExhausted", "()Z") \ METHOD (setPosition, "setPosition", "(J)Z") \ -DECLARE_JNI_CLASS_WITH_BYTECODE (HTTPStream, "com/rmsl/juce/JuceHTTPStream", 16, javaJuceHttpStream, sizeof(javaJuceHttpStream)) +DECLARE_JNI_CLASS_WITH_BYTECODE (HTTPStream, "com/rmsl/juce/JuceHTTPStream", 16, javaJuceHttpStream) #undef JNI_CLASS_MEMBERS //============================================================================== diff --git a/modules/juce_core/native/juce_android_RuntimePermissions.cpp b/modules/juce_core/native/juce_android_RuntimePermissions.cpp index 1bbc073b..285b92c1 100644 --- a/modules/juce_core/native/juce_android_RuntimePermissions.cpp +++ b/modules/juce_core/native/juce_android_RuntimePermissions.cpp @@ -24,15 +24,47 @@ namespace juce { //============================================================================== -static String jucePermissionToAndroidPermission (RuntimePermissions::PermissionID permission) +static StringArray jucePermissionToAndroidPermissions (RuntimePermissions::PermissionID permission) { + const auto externalStorageOrMedia = [] (const auto* newPermission) + { + return getAndroidSDKVersion() < 33 ? "android.permission.READ_EXTERNAL_STORAGE" : newPermission; + }; + switch (permission) { - case RuntimePermissions::recordAudio: return "android.permission.RECORD_AUDIO"; - case RuntimePermissions::bluetoothMidi: return "android.permission.ACCESS_FINE_LOCATION"; - case RuntimePermissions::readExternalStorage: return "android.permission.READ_EXTERNAL_STORAGE"; - case RuntimePermissions::writeExternalStorage: return "android.permission.WRITE_EXTERNAL_STORAGE"; - case RuntimePermissions::camera: return "android.permission.CAMERA"; + case RuntimePermissions::recordAudio: return { "android.permission.RECORD_AUDIO" }; + case RuntimePermissions::bluetoothMidi: + { + if (getAndroidSDKVersion() < 31) + return { "android.permission.ACCESS_FINE_LOCATION" }; + + return { "android.permission.BLUETOOTH_SCAN", + "android.permission.BLUETOOTH_CONNECT" }; + } + + case RuntimePermissions::writeExternalStorage: return { "android.permission.WRITE_EXTERNAL_STORAGE" }; + case RuntimePermissions::camera: return { "android.permission.CAMERA" }; + + case RuntimePermissions::readExternalStorage: + { + // See: https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE + if (getAndroidSDKVersion() < 33) + return { "android.permission.READ_EXTERNAL_STORAGE" }; + + return { "android.permission.READ_MEDIA_AUDIO", + "android.permission.READ_MEDIA_IMAGES", + "android.permission.READ_MEDIA_VIDEO" }; + } + + case RuntimePermissions::readMediaAudio: + return { externalStorageOrMedia ("android.permission.READ_MEDIA_AUDIO") }; + + case RuntimePermissions::readMediaImages: + return { externalStorageOrMedia ("android.permission.READ_MEDIA_IMAGES") }; + + case RuntimePermissions::readMediaVideo: + return { externalStorageOrMedia ("android.permission.READ_MEDIA_VIDEO") }; } // invalid permission @@ -42,53 +74,29 @@ static String jucePermissionToAndroidPermission (RuntimePermissions::PermissionI static RuntimePermissions::PermissionID androidPermissionToJucePermission (const String& permission) { - if (permission == "android.permission.RECORD_AUDIO") return RuntimePermissions::recordAudio; - else if (permission == "android.permission.ACCESS_FINE_LOCATION") return RuntimePermissions::bluetoothMidi; - else if (permission == "android.permission.READ_EXTERNAL_STORAGE") return RuntimePermissions::readExternalStorage; - else if (permission == "android.permission.WRITE_EXTERNAL_STORAGE") return RuntimePermissions::writeExternalStorage; - else if (permission == "android.permission.CAMERA") return RuntimePermissions::camera; + static const std::map map + { + { "android.permission.RECORD_AUDIO", RuntimePermissions::recordAudio }, + { "android.permission.ACCESS_FINE_LOCATION", RuntimePermissions::bluetoothMidi }, + { "android.permission.READ_EXTERNAL_STORAGE", RuntimePermissions::readExternalStorage }, + { "android.permission.WRITE_EXTERNAL_STORAGE", RuntimePermissions::writeExternalStorage }, + { "android.permission.CAMERA", RuntimePermissions::camera }, + { "android.permission.READ_MEDIA_AUDIO", RuntimePermissions::readMediaAudio }, + { "android.permission.READ_MEDIA_IMAGES", RuntimePermissions::readMediaImages }, + { "android.permission.READ_MEDIA_VIDEO", RuntimePermissions::readMediaVideo }, + { "android.permission.BLUETOOTH_SCAN", RuntimePermissions::bluetoothMidi }, + }; - return static_cast (-1); + const auto iter = map.find (permission); + return iter != map.cend() ? iter->second + : static_cast (-1); } //============================================================================== struct PermissionsRequest { - PermissionsRequest() {} - - // using "= default" on the following method triggers an internal compiler error - // in Android NDK 17 - PermissionsRequest (const PermissionsRequest& o) - : callback (o.callback), permission (o.permission) - {} - - PermissionsRequest (PermissionsRequest&& o) - : callback (std::move (o.callback)), permission (o.permission) - { - o.permission = static_cast (-1); - } - - PermissionsRequest (RuntimePermissions::Callback && callbackToUse, - RuntimePermissions::PermissionID permissionToRequest) - : callback (std::move (callbackToUse)), permission (permissionToRequest) - {} - - PermissionsRequest& operator= (const PermissionsRequest & o) - { - callback = o.callback; - permission = o.permission; - return *this; - } - - PermissionsRequest& operator= (PermissionsRequest && o) - { - callback = std::move (o.callback); - permission = o.permission; - return *this; - } - RuntimePermissions::Callback callback; - RuntimePermissions::PermissionID permission; + RuntimePermissions::PermissionID permission = static_cast (-1); }; //============================================================================== @@ -165,8 +173,7 @@ struct PermissionsOverlay : FragmentOverlay { auto &request = requests.front(); - StringArray permissionsArray{ - jucePermissionToAndroidPermission (request.permission)}; + auto permissionsArray = jucePermissionToAndroidPermissions (request.permission); auto jPermissionsArray = juceStringArrayToJava (permissionsArray); @@ -199,9 +206,16 @@ struct PermissionsOverlay : FragmentOverlay //============================================================================== void RuntimePermissions::request (PermissionID permission, Callback callback) { - auto requestedPermission = jucePermissionToAndroidPermission (permission); + const auto requestedPermissions = jucePermissionToAndroidPermissions (permission); + + const auto allPermissionsInManifest = std::all_of (requestedPermissions.begin(), + requestedPermissions.end(), + [] (const auto& p) + { + return isPermissionDeclaredInManifest (p); + }); - if (! isPermissionDeclaredInManifest (requestedPermission)) + if (! allPermissionsInManifest) { // Error! If you want to be able to request this runtime permission, you // also need to declare it in your app's manifest. You can do so via @@ -220,7 +234,7 @@ void RuntimePermissions::request (PermissionID permission, Callback callback) return; } - PermissionsRequest request (std::move (callback), permission); + PermissionsRequest request { std::move (callback), permission }; static CriticalSection overlayGuard; ScopedLock lock (overlayGuard); @@ -250,12 +264,15 @@ bool RuntimePermissions::isGranted (PermissionID permission) { auto* env = getEnv(); - auto requestedPermission = jucePermissionToAndroidPermission (permission); - int result = env->CallIntMethod (getAppContext().get(), AndroidContext.checkCallingOrSelfPermission, - javaString (requestedPermission).get()); + const auto requestedPermissions = jucePermissionToAndroidPermissions (permission); + return std::all_of (requestedPermissions.begin(), requestedPermissions.end(), [env] (const auto& p) + { + return 0 == env->CallIntMethod (getAppContext().get(), + AndroidContext.checkCallingOrSelfPermission, + javaString (p).get()); + }); - return result == 0 /* PERMISSION_GRANTED */; } } // namespace juce diff --git a/modules/juce_core/native/juce_android_SystemStats.cpp b/modules/juce_core/native/juce_android_SystemStats.cpp index 8c3e416d..4000613c 100644 --- a/modules/juce_core/native/juce_android_SystemStats.cpp +++ b/modules/juce_core/native/juce_android_SystemStats.cpp @@ -47,6 +47,22 @@ namespace AndroidStatsHelpers javaString (name).get()))); } + static String getAndroidID() + { + auto* env = getEnv(); + + if (auto settings = (jclass) env->FindClass ("android/provider/Settings$Secure")) + { + if (auto fId = env->GetStaticFieldID (settings, "ANDROID_ID", "Ljava/lang/String;")) + { + auto androidID = (jstring) env->GetStaticObjectField (settings, fId); + return juceString (LocalRef (androidID)); + } + } + + return ""; + } + static String getLocaleValue (bool isRegion) { auto* env = getEnv(); @@ -170,6 +186,15 @@ String SystemStats::getUserLanguage() { return AndroidStatsHelpers::getLocale String SystemStats::getUserRegion() { return AndroidStatsHelpers::getLocaleValue (true); } String SystemStats::getDisplayLanguage() { return getUserLanguage() + "-" + getUserRegion(); } +String SystemStats::getUniqueDeviceID() +{ + auto id = String ((uint64_t) AndroidStatsHelpers::getAndroidID().hashCode64()); + + // Please tell someone at JUCE if this occurs + jassert (id.isNotEmpty()); + return id; +} + //============================================================================== void CPUInformation::initialise() noexcept { diff --git a/modules/juce_core/native/juce_android_Threads.cpp b/modules/juce_core/native/juce_android_Threads.cpp index 796328aa..fe608855 100644 --- a/modules/juce_core/native/juce_android_Threads.cpp +++ b/modules/juce_core/native/juce_android_Threads.cpp @@ -344,36 +344,95 @@ LocalRef getMainActivity() noexcept } //============================================================================== -// sets the process to 0=low priority, 1=normal, 2=high, 3=realtime -JUCE_API void JUCE_CALLTYPE Process::setPriority (ProcessPriority prior) +using RealtimeThreadFactory = pthread_t (*) (void* (*entry) (void*), void* userPtr); +// This is defined in the juce_audio_devices module, with different definitions depending on +// whether OpenSL/Oboe are enabled. +RealtimeThreadFactory getAndroidRealtimeThreadFactory(); + +#if ! JUCE_MODULE_AVAILABLE_juce_audio_devices +RealtimeThreadFactory getAndroidRealtimeThreadFactory() { return nullptr; } +#endif + +extern JavaVM* androidJNIJavaVM; + +static auto setPriorityOfThisThread (Thread::Priority p) { - // TODO + return setpriority (PRIO_PROCESS, + (id_t) gettid(), + ThreadPriorities::getNativePriority (p)) == 0; +} - struct sched_param param; - int policy, maxp, minp; +bool Thread::createNativeThread (Priority) +{ + const auto threadEntryProc = [] (void* userData) -> void* + { + auto* myself = static_cast (userData); - const int p = (int) prior; + setPriorityOfThisThread (myself->priority); - if (p <= 1) - policy = SCHED_OTHER; - else - policy = SCHED_RR; + juce_threadEntryPoint (myself); - minp = sched_get_priority_min (policy); - maxp = sched_get_priority_max (policy); + if (androidJNIJavaVM != nullptr) + { + void* env = nullptr; + androidJNIJavaVM->GetEnv (&env, JNI_VERSION_1_2); - if (p < 2) - param.sched_priority = 0; - else if (p == 2 ) - // Set to middle of lower realtime priority range - param.sched_priority = minp + (maxp - minp) / 4; - else - // Set to middle of higher realtime priority range - param.sched_priority = minp + (3 * (maxp - minp) / 4); + // only detach if we have actually been attached + if (env != nullptr) + androidJNIJavaVM->DetachCurrentThread(); + } + + return nullptr; + }; + + if (isRealtime()) + { + if (const auto factory = getAndroidRealtimeThreadFactory()) + { + threadHandle = (void*) factory (threadEntryProc, this); + threadId = (ThreadID) threadHandle.load(); + return threadId != nullptr; + } + else + { + jassertfalse; + } + } + + PosixThreadAttribute attr { threadStackSize }; + threadId = threadHandle = makeThreadHandle (attr, this, threadEntryProc); - pthread_setschedparam (pthread_self(), policy, ¶m); + return threadId != nullptr; } +void Thread::killThread() +{ + if (threadHandle != nullptr) + jassertfalse; // pthread_cancel not available! +} + +Thread::Priority Thread::getPriority() const +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + const auto native = getpriority (PRIO_PROCESS, (id_t) gettid()); + return ThreadPriorities::getJucePriority (native); +} + +bool Thread::setPriority (Priority priorityIn) +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + if (isRealtime()) + return false; + + const auto priorityToUse = priority = priorityIn; + return setPriorityOfThisThread (priorityToUse) == 0; +} + +//============================================================================== +JUCE_API void JUCE_CALLTYPE Process::setPriority (ProcessPriority) {} + JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept { StringArray lines; diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp index 84abf88e..5366995f 100644 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -304,6 +304,64 @@ void CPUInformation::initialise() noexcept #endif } +String SystemStats::getUniqueDeviceID() +{ + static const auto deviceId = []() + { + const auto call = [] (auto command) -> String + { + ChildProcess proc; + + if (proc.start (command, ChildProcess::wantStdOut)) + return proc.readAllProcessOutput(); + + return {}; + }; + + auto data = call ("cat /sys/class/dmi/id/board_serial"); + + // 'board_serial' is enough on its own, fallback to bios stuff if we can't find it. + if (data.isEmpty()) + { + data = call ("cat /sys/class/dmi/id/bios_date") + + call ("cat /sys/class/dmi/id/bios_release") + + call ("cat /sys/class/dmi/id/bios_vendor") + + call ("cat /sys/class/dmi/id/bios_version"); + } + + auto cpuData = call ("lscpu"); + + if (cpuData.isNotEmpty()) + { + auto getCpuInfo = [&cpuData] (auto key) -> String + { + auto index = cpuData.indexOf (key); + + if (index >= 0) + { + auto start = cpuData.indexOf (index, ":"); + auto end = cpuData.indexOf (start, "\n"); + + return cpuData.substring (start + 1, end).trim(); + } + + return {}; + }; + + data += getCpuInfo ("CPU family:"); + data += getCpuInfo ("Model:"); + data += getCpuInfo ("Model name:"); + data += getCpuInfo ("Vendor ID:"); + } + + return String ((uint64_t) data.hashCode64()); + }(); + + // Please tell someone at JUCE if this occurs + jassert (deviceId.isNotEmpty()); + return deviceId; +} + //============================================================================== uint32 juce_millisecondsSinceStartup() noexcept { diff --git a/modules/juce_core/native/juce_linux_Threads.cpp b/modules/juce_core/native/juce_linux_Threads.cpp index 9f9c07b7..6abf6586 100644 --- a/modules/juce_core/native/juce_linux_Threads.cpp +++ b/modules/juce_core/native/juce_linux_Threads.cpp @@ -28,27 +28,49 @@ namespace juce live in juce_posix_SharedCode.h! */ -//============================================================================== -JUCE_API void JUCE_CALLTYPE Process::setPriority (const ProcessPriority prior) +bool Thread::createNativeThread (Priority) { - auto policy = (prior <= NormalPriority) ? SCHED_OTHER : SCHED_RR; - auto minp = sched_get_priority_min (policy); - auto maxp = sched_get_priority_max (policy); - - struct sched_param param; + PosixThreadAttribute attr { threadStackSize }; + PosixSchedulerPriority::getNativeSchedulerAndPriority (realtimeOptions, {}).apply (attr); - switch (prior) + threadId = threadHandle = makeThreadHandle (attr, this, [] (void* userData) -> void* { - case LowPriority: - case NormalPriority: param.sched_priority = 0; break; - case HighPriority: param.sched_priority = minp + (maxp - minp) / 4; break; - case RealtimePriority: param.sched_priority = minp + (3 * (maxp - minp) / 4); break; - default: jassertfalse; break; - } - - pthread_setschedparam (pthread_self(), policy, ¶m); + auto* myself = static_cast (userData); + + juce_threadEntryPoint (myself); + + return nullptr; + }); + + return threadId != nullptr; +} + +void Thread::killThread() +{ + if (threadHandle != nullptr) + pthread_cancel ((pthread_t) threadHandle.load()); +} + +// Until we implement Nice awareness, these don't do anything on Linux. +Thread::Priority Thread::getPriority() const +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + return priority; } +bool Thread::setPriority (Priority newPriority) +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + // Return true to make it compatible with other platforms. + priority = newPriority; + return true; +} + +//============================================================================== +JUCE_API void JUCE_CALLTYPE Process::setPriority (ProcessPriority) {} + static bool swapUserAndEffectiveUser() { auto result1 = setreuid (geteuid(), getuid()); diff --git a/modules/juce_core/native/juce_mac_CFHelpers.h b/modules/juce_core/native/juce_mac_CFHelpers.h index edeca6df..57a17db1 100644 --- a/modules/juce_core/native/juce_mac_CFHelpers.h +++ b/modules/juce_core/native/juce_mac_CFHelpers.h @@ -37,7 +37,7 @@ struct CFObjectDeleter }; template -using CFUniquePtr = std::unique_ptr::type, CFObjectDeleter>; +using CFUniquePtr = std::unique_ptr, CFObjectDeleter>; template struct CFObjectHolder diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index dcee53f1..ffd68758 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -397,7 +397,7 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, //============================================================================== -bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) +bool JUCE_CALLTYPE Process::openDocument (const String& fileName, [[maybe_unused]] const String& parameters) { JUCE_AUTORELEASEPOOL { @@ -406,8 +406,6 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& : [NSURL URLWithString: fileNameAsNS]; #if JUCE_IOS - ignoreUnused (parameters); - if (@available (iOS 10.0, *)) { [[UIApplication sharedApplication] openURL: filenameAsURL diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 51939b48..56110874 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -58,14 +58,12 @@ void MACAddress::findAllAddresses (Array& result) } //============================================================================== -bool JUCE_CALLTYPE Process::openEmailWithAttachments (const String& targetEmailAddress, - const String& emailSubject, - const String& bodyText, - const StringArray& filesToAttach) +bool JUCE_CALLTYPE Process::openEmailWithAttachments ([[maybe_unused]] const String& targetEmailAddress, + [[maybe_unused]] const String& emailSubject, + [[maybe_unused]] const String& bodyText, + [[maybe_unused]] const StringArray& filesToAttach) { #if JUCE_IOS - ignoreUnused (targetEmailAddress, emailSubject, bodyText, filesToAttach); - //xxx probably need to use MFMailComposeViewController jassertfalse; return false; @@ -282,9 +280,9 @@ public: return newRequest; } - void didFailWithError (NSError* error) + void didFailWithError ([[maybe_unused]] NSError* error) { - DBG (nsStringToJuce ([error description])); ignoreUnused (error); + DBG (nsStringToJuce ([error description])); nsUrlErrorCode = [error code]; hasFailed = true; initialised = true; @@ -951,10 +949,8 @@ public: connection.reset(); } - bool connect (WebInputStream::Listener* webInputListener, int numRetries = 0) + bool connect (WebInputStream::Listener* webInputListener, [[maybe_unused]] int numRetries = 0) { - ignoreUnused (numRetries); - { const ScopedLock lock (createConnectionLock); diff --git a/modules/juce_core/native/juce_mac_ObjCHelpers.h b/modules/juce_core/native/juce_mac_ObjCHelpers.h index 8995472d..7f17c07b 100644 --- a/modules/juce_core/native/juce_mac_ObjCHelpers.h +++ b/modules/juce_core/native/juce_mac_ObjCHelpers.h @@ -342,15 +342,6 @@ namespace detail { return joinCompileTimeStr (v, makeCompileTimeStr (others...)); } - - template - static constexpr auto toFnPtr (Functor functor, Return (Functor::*) (Args...) const) - { - return static_cast (functor); - } - - template - static constexpr auto toFnPtr (Functor functor) { return toFnPtr (functor, &Functor::operator()); } } // namespace detail //============================================================================== @@ -391,12 +382,12 @@ struct ObjCClass template void addIvar (const char* name) { - BOOL b = class_addIvar (cls, name, sizeof (Type), (uint8_t) rint (log2 (sizeof (Type))), @encode (Type)); - jassert (b); ignoreUnused (b); + [[maybe_unused]] BOOL b = class_addIvar (cls, name, sizeof (Type), (uint8_t) rint (log2 (sizeof (Type))), @encode (Type)); + jassert (b); } template - void addMethod (SEL selector, Fn callbackFn) { addMethod (selector, detail::toFnPtr (callbackFn)); } + void addMethod (SEL selector, Fn callbackFn) { addMethod (selector, toFnPtr (callbackFn)); } template void addMethod (SEL selector, Result (*callbackFn) (id, SEL, Args...)) @@ -408,8 +399,8 @@ struct ObjCClass void addProtocol (Protocol* protocol) { - BOOL b = class_addProtocol (cls, protocol); - jassert (b); ignoreUnused (b); + [[maybe_unused]] BOOL b = class_addProtocol (cls, protocol); + jassert (b); } template @@ -492,13 +483,31 @@ Class* getJuceClassFromNSObject (NSObject* obj) return obj != nullptr ? getIvar (obj, "cppObject") : nullptr; } -template -ReturnT (^CreateObjCBlock(Class* object, ReturnT (Class::*fn)(Params...))) (Params...) +namespace detail { - __block Class* _this = object; - __block ReturnT (Class::*_fn)(Params...) = fn; +template struct Signature; +template struct Signature {}; + +template +constexpr auto getSignature (Result (Class::*) (Args...)) { return Signature{}; } + +template +constexpr auto getSignature (Result (Class::*) (Args...) const) { return Signature{}; } - return [[^ReturnT (Params... params) { return (_this->*_fn) (params...); } copy] autorelease]; +template +auto createObjCBlockImpl (Class* object, Fn func, Signature) +{ + __block auto _this = object; + __block auto _func = func; + + return [[^Result (Params... params) { return (_this->*_func) (params...); } copy] autorelease]; +} +} // namespace detail + +template +auto CreateObjCBlock (Class* object, MemberFunc fn) +{ + return detail::createObjCBlockImpl (object, fn, detail::getSignature (fn)); } template @@ -526,22 +535,26 @@ class ScopedNotificationCenterObserver public: ScopedNotificationCenterObserver() = default; - ScopedNotificationCenterObserver (id observerIn, SEL selector, NSNotificationName nameIn, id objectIn) - : observer (observerIn), name (nameIn), object (objectIn) + ScopedNotificationCenterObserver (id observerIn, + SEL selector, + NSNotificationName nameIn, + id objectIn, + Class klassIn = [NSNotificationCenter class]) + : observer (observerIn), name (nameIn), object (objectIn), klass (klassIn) { - [[NSNotificationCenter defaultCenter] addObserver: observer - selector: selector - name: name - object: object]; + [[klass defaultCenter] addObserver: observer + selector: selector + name: name + object: object]; } ~ScopedNotificationCenterObserver() { if (observer != nullptr && name != nullptr) { - [[NSNotificationCenter defaultCenter] removeObserver: observer - name: name - object: object]; + [[klass defaultCenter] removeObserver: observer + name: name + object: object]; } } @@ -552,8 +565,7 @@ public: ScopedNotificationCenterObserver& operator= (ScopedNotificationCenterObserver&& other) noexcept { - auto moved = std::move (other); - swap (moved); + ScopedNotificationCenterObserver (std::move (other)).swap (*this); return *this; } @@ -566,11 +578,13 @@ private: std::swap (other.observer, observer); std::swap (other.name, name); std::swap (other.object, object); + std::swap (other.klass, klass); } id observer = nullptr; NSNotificationName name = nullptr; id object = nullptr; + Class klass = nullptr; }; } // namespace juce diff --git a/modules/juce_core/native/juce_mac_SystemStats.mm b/modules/juce_core/native/juce_mac_SystemStats.mm index 077cce68..2b6939e0 100644 --- a/modules/juce_core/native/juce_mac_SystemStats.mm +++ b/modules/juce_core/native/juce_mac_SystemStats.mm @@ -135,9 +135,10 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() case 11: return MacOS_11; case 12: return MacOS_12; + case 13: return MacOS_13; } - return UnknownOS; + return MacOSX; #endif } @@ -152,6 +153,10 @@ String SystemStats::getOperatingSystemName() String SystemStats::getDeviceDescription() { + if (auto* userInfo = [[NSProcessInfo processInfo] environment]) + if (auto* simDeviceName = [userInfo objectForKey: @"SIMULATOR_MODEL_IDENTIFIER"]) + return nsStringToJuce (simDeviceName); + #if JUCE_IOS const char* name = "hw.machine"; #else @@ -165,22 +170,7 @@ String SystemStats::getDeviceDescription() HeapBlock model (size); if (sysctlbyname (name, model, &size, nullptr, 0) >= 0) - { - String description (model.get()); - - #if JUCE_IOS - if (description == "x86_64") // running in the simulator - { - if (auto* userInfo = [[NSProcessInfo processInfo] environment]) - { - if (auto* simDeviceName = [userInfo objectForKey: @"SIMULATOR_DEVICE_NAME"]) - return nsStringToJuce (simDeviceName); - } - } - #endif - - return description; - } + return String (model.get()); } return {}; @@ -351,4 +341,34 @@ int SystemStats::getPageSize() return (int) NSPageSize(); } +String SystemStats::getUniqueDeviceID() +{ + static const auto deviceId = [] + { + ChildProcess proc; + + if (proc.start ("ioreg -rd1 -c IOPlatformExpertDevice", ChildProcess::wantStdOut)) + { + constexpr const char key[] = "\"IOPlatformUUID\""; + constexpr const auto keyLen = (int) sizeof (key); + + auto output = proc.readAllProcessOutput(); + auto index = output.indexOf (key); + + if (index >= 0) + { + auto start = output.indexOf (index + keyLen, "\""); + auto end = output.indexOf (start + 1, "\""); + return output.substring (start + 1, end).replace("-", ""); + } + } + + return String(); + }(); + + // Please tell someone at JUCE if this occurs + jassert (deviceId.isNotEmpty()); + return deviceId; +} + } // namespace juce diff --git a/modules/juce_core/native/juce_mac_Threads.mm b/modules/juce_core/native/juce_mac_Threads.mm index 9a88832a..7c692be7 100644 --- a/modules/juce_core/native/juce_mac_Threads.mm +++ b/modules/juce_core/native/juce_mac_Threads.mm @@ -29,9 +29,139 @@ namespace juce */ #if JUCE_IOS -bool isIOSAppActive = true; + bool isIOSAppActive = true; #endif +API_AVAILABLE (macos (10.10)) +static auto getNativeQOS (Thread::Priority priority) +{ + switch (priority) + { + case Thread::Priority::highest: return QOS_CLASS_USER_INTERACTIVE; + case Thread::Priority::high: return QOS_CLASS_USER_INITIATED; + case Thread::Priority::low: return QOS_CLASS_UTILITY; + case Thread::Priority::background: return QOS_CLASS_BACKGROUND; + case Thread::Priority::normal: break; + } + + return QOS_CLASS_DEFAULT; +} + +API_AVAILABLE (macos (10.10)) +static auto getJucePriority (qos_class_t qos) +{ + switch (qos) + { + case QOS_CLASS_USER_INTERACTIVE: return Thread::Priority::highest; + case QOS_CLASS_USER_INITIATED: return Thread::Priority::high; + case QOS_CLASS_UTILITY: return Thread::Priority::low; + case QOS_CLASS_BACKGROUND: return Thread::Priority::background; + + case QOS_CLASS_UNSPECIFIED: + case QOS_CLASS_DEFAULT: break; + } + + return Thread::Priority::normal; +} + +bool Thread::createNativeThread (Priority priority) +{ + PosixThreadAttribute attr { threadStackSize }; + + if (@available (macos 10.10, *)) + pthread_attr_set_qos_class_np (attr.get(), getNativeQOS (priority), 0); + else + PosixSchedulerPriority::getNativeSchedulerAndPriority (realtimeOptions, priority).apply (attr); + + threadId = threadHandle = makeThreadHandle (attr, this, [] (void* userData) -> void* + { + auto* myself = static_cast (userData); + + JUCE_AUTORELEASEPOOL + { + juce_threadEntryPoint (myself); + } + + return nullptr; + }); + + return threadId != nullptr; +} + +void Thread::killThread() +{ + if (threadHandle != nullptr) + pthread_cancel ((pthread_t) threadHandle.load()); +} + +Thread::Priority Thread::getPriority() const +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + if (! isRealtime()) + { + if (@available (macOS 10.10, *)) + return getJucePriority (qos_class_self()); + + // fallback for older versions of macOS + const auto min = jmax (0, sched_get_priority_min (SCHED_OTHER)); + const auto max = jmax (0, sched_get_priority_max (SCHED_OTHER)); + + if (min != 0 && max != 0) + { + const auto native = PosixSchedulerPriority::findCurrentSchedulerAndPriority().getPriority(); + const auto mapped = jmap (native, min, max, 0, 4); + return ThreadPriorities::getJucePriority (mapped); + } + } + + return {}; +} + +bool Thread::setPriority (Priority priority) +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + if (isRealtime()) + { + // macOS/iOS needs to know how much time you need! + jassert (realtimeOptions->workDurationMs > 0); + + mach_timebase_info_data_t timebase; + mach_timebase_info (&timebase); + + const auto periodMs = realtimeOptions->workDurationMs; + const auto ticksPerMs = ((double) timebase.denom * 1000000.0) / (double) timebase.numer; + const auto periodTicks = (uint32_t) jmin ((double) std::numeric_limits::max(), periodMs * ticksPerMs); + + thread_time_constraint_policy_data_t policy; + policy.period = periodTicks; + policy.computation = jmin ((uint32_t) 50000, policy.period); + policy.constraint = policy.period; + policy.preemptible = true; + + return thread_policy_set (pthread_mach_thread_np (pthread_self()), + THREAD_TIME_CONSTRAINT_POLICY, + (thread_policy_t) &policy, + THREAD_TIME_CONSTRAINT_POLICY_COUNT) == KERN_SUCCESS; + } + + if (@available (macOS 10.10, *)) + return pthread_set_qos_class_self_np (getNativeQOS (priority), 0) == 0; + + #if JUCE_ARM + // M1 platforms should never reach this code!!!!!! + jassertfalse; + #endif + + // Just in case older versions of macOS support SCHED_OTHER priorities. + const auto psp = PosixSchedulerPriority::getNativeSchedulerAndPriority ({}, priority); + + struct sched_param param; + param.sched_priority = psp.getPriority(); + return pthread_setschedparam (pthread_self(), psp.getScheduler(), ¶m) == 0; +} + //============================================================================== JUCE_API bool JUCE_CALLTYPE Process::isForegroundProcess() { diff --git a/modules/juce_core/native/juce_native_ThreadPriorities.h b/modules/juce_core/native/juce_native_ThreadPriorities.h new file mode 100644 index 00000000..3af00464 --- /dev/null +++ b/modules/juce_core/native/juce_native_ThreadPriorities.h @@ -0,0 +1,109 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +struct ThreadPriorities +{ + struct Entry + { + Thread::Priority priority; + int native; + }; + + #if JUCE_ANDROID + enum AndroidThreadPriority + { + THREAD_PRIORITY_AUDIO = -16, + THREAD_PRIORITY_FOREGROUND = -2, + THREAD_PRIORITY_MORE_FAVORABLE = -1, + THREAD_PRIORITY_DEFAULT = 0, + THREAD_PRIORITY_LESS_FAVORABLE = 1, + THREAD_PRIORITY_BACKGROUND = 10, + THREAD_PRIORITY_LOWEST = 19 + }; + #endif + + inline static constexpr Entry table[] + { + #if JUCE_ANDROID + { Thread::Priority::highest, AndroidThreadPriority::THREAD_PRIORITY_AUDIO }, + { Thread::Priority::high, AndroidThreadPriority::THREAD_PRIORITY_FOREGROUND }, + { Thread::Priority::normal, AndroidThreadPriority::THREAD_PRIORITY_DEFAULT }, + { Thread::Priority::low, AndroidThreadPriority::THREAD_PRIORITY_BACKGROUND - 5 }, + { Thread::Priority::background, AndroidThreadPriority::THREAD_PRIORITY_BACKGROUND }, + #endif + + #if JUCE_LINUX || JUCE_BSD + { Thread::Priority::highest, 0 }, + { Thread::Priority::high, 0 }, + { Thread::Priority::normal, 0 }, + { Thread::Priority::low, 0 }, + { Thread::Priority::background, 0 }, + #endif + + #if JUCE_MAC || JUCE_IOS + { Thread::Priority::highest, 4 }, + { Thread::Priority::high, 3 }, + { Thread::Priority::normal, 2 }, + { Thread::Priority::low, 1 }, + { Thread::Priority::background, 0 }, + #endif + + #if JUCE_WINDOWS + { Thread::Priority::highest, THREAD_PRIORITY_TIME_CRITICAL }, + { Thread::Priority::high, THREAD_PRIORITY_HIGHEST }, + { Thread::Priority::normal, THREAD_PRIORITY_NORMAL }, + { Thread::Priority::low, THREAD_PRIORITY_LOWEST }, + { Thread::Priority::background, THREAD_PRIORITY_IDLE }, + #endif + }; + + static_assert (std::size (table) == 5, + "The platform may be unsupported or there may be a priority entry missing."); + + static Thread::Priority getJucePriority (const int value) + { + const auto iter = std::min_element (std::begin (table), + std::end (table), + [value] (const auto& a, const auto& b) + { + return std::abs (a.native - value) < std::abs (b.native - value); + }); + + jassert (iter != std::end (table)); + return iter != std::end (table) ? iter->priority : Thread::Priority{}; + } + + static int getNativePriority (const Thread::Priority value) + { + const auto iter = std::find_if (std::begin (table), + std::end (table), + [value] (const auto& entry) { return entry.priority == value; }); + + jassert (iter != std::end (table)); + return iter != std::end (table) ? iter->native : 0; + } +}; + +} // namespace juce diff --git a/modules/juce_core/native/juce_posix_NamedPipe.cpp b/modules/juce_core/native/juce_posix_NamedPipe.cpp index dde81fab..7d0e1ba5 100644 --- a/modules/juce_core/native/juce_posix_NamedPipe.cpp +++ b/modules/juce_core/native/juce_posix_NamedPipe.cpp @@ -254,8 +254,7 @@ void NamedPipe::close() pimpl->stopReadOperation = true; const char buffer[] { 0 }; - const auto done = ::write (pimpl->pipeIn.get(), buffer, numElementsInArray (buffer)); - ignoreUnused (done); + [[maybe_unused]] const auto done = ::write (pimpl->pipeIn.get(), buffer, numElementsInArray (buffer)); } } diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 66ff9669..a2649055 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -140,10 +140,9 @@ bool File::setAsCurrentWorkingDirectory() const //============================================================================== // The unix siginterrupt function is deprecated - this does the same job. -int juce_siginterrupt (int sig, int flag) +int juce_siginterrupt ([[maybe_unused]] int sig, [[maybe_unused]] int flag) { #if JUCE_WASM - ignoreUnused (sig, flag); return 0; #else #if JUCE_ANDROID @@ -693,8 +692,7 @@ int File::getVolumeSerialNumber() const void juce_runSystemCommand (const String&); void juce_runSystemCommand (const String& command) { - int result = system (command.toUTF8()); - ignoreUnused (result); + [[maybe_unused]] int result = system (command.toUTF8()); } String juce_getOutputFromCommand (const String&); @@ -851,98 +849,131 @@ void InterProcessLock::exit() pimpl.reset(); } -//============================================================================== -#if JUCE_ANDROID -extern JavaVM* androidJNIJavaVM; -#endif - -static void* threadEntryProc (void* userData) +class PosixThreadAttribute { - auto* myself = static_cast (userData); - - JUCE_AUTORELEASEPOOL +public: + explicit PosixThreadAttribute (size_t stackSize) { - juce_threadEntryPoint (myself); + if (valid) + pthread_attr_setstacksize (&attr, stackSize); } - #if JUCE_ANDROID - if (androidJNIJavaVM != nullptr) + ~PosixThreadAttribute() { - void* env = nullptr; - androidJNIJavaVM->GetEnv(&env, JNI_VERSION_1_2); - - // only detach if we have actually been attached - if (env != nullptr) - androidJNIJavaVM->DetachCurrentThread(); + if (valid) + pthread_attr_destroy (&attr); } - #endif - return nullptr; -} - -#if JUCE_ANDROID && JUCE_MODULE_AVAILABLE_juce_audio_devices && (JUCE_USE_ANDROID_OPENSLES || JUCE_USE_ANDROID_OBOE) - #define JUCE_ANDROID_REALTIME_THREAD_AVAILABLE 1 -#endif + auto* get() { return valid ? &attr : nullptr; } -#if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE -extern pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr); -#endif +private: + pthread_attr_t attr; + bool valid { pthread_attr_init (&attr) == 0 }; +}; -void Thread::launchThread() +class PosixSchedulerPriority { - #if JUCE_ANDROID - if (isAndroidRealtimeThread) +public: + static PosixSchedulerPriority findCurrentSchedulerAndPriority() { - #if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE - threadHandle = (void*) juce_createRealtimeAudioThread (threadEntryProc, this); - threadId = (ThreadID) threadHandle.get(); - - return; - #else - jassertfalse; - #endif + int scheduler{}; + sched_param param{}; + pthread_getschedparam (pthread_self(), &scheduler, ¶m); + return { scheduler, param.sched_priority }; } - #endif - threadHandle = {}; - pthread_t handle = {}; - pthread_attr_t attr; - pthread_attr_t* attrPtr = nullptr; - - if (pthread_attr_init (&attr) == 0) + static PosixSchedulerPriority getNativeSchedulerAndPriority (const Optional& rt, + [[maybe_unused]] Thread::Priority prio) { - attrPtr = &attr; - pthread_attr_setstacksize (attrPtr, threadStackSize); - } + const auto isRealtime = rt.hasValue(); + + const auto priority = [&] + { + if (isRealtime) + { + const auto min = jmax (0, sched_get_priority_min (SCHED_RR)); + const auto max = jmax (1, sched_get_priority_max (SCHED_RR)); + + return jmap (rt->priority, 0, 10, min, max); + } + + // We only use this helper if we're on an old macos/ios platform that might + // still respect legacy pthread priorities for SCHED_OTHER. + #if JUCE_MAC || JUCE_IOS + const auto min = jmax (0, sched_get_priority_min (SCHED_OTHER)); + const auto max = jmax (0, sched_get_priority_max (SCHED_OTHER)); + + const auto p = [prio] + { + switch (prio) + { + case Thread::Priority::highest: return 4; + case Thread::Priority::high: return 3; + case Thread::Priority::normal: return 2; + case Thread::Priority::low: return 1; + case Thread::Priority::background: return 0; + } + + return 3; + }(); + + if (min != 0 && max != 0) + return jmap (p, 0, 4, min, max); + #endif + + return 0; + }(); + + #if JUCE_MAC || JUCE_IOS + const auto scheduler = SCHED_OTHER; + #elif JUCE_LINUX || JUCE_BSD + const auto backgroundSched = prio == Thread::Priority::background ? SCHED_IDLE + : SCHED_OTHER; + const auto scheduler = isRealtime ? SCHED_RR : backgroundSched; + #else + const auto scheduler = 0; + #endif + return { scheduler, priority }; + } - if (pthread_create (&handle, attrPtr, threadEntryProc, this) == 0) + void apply ([[maybe_unused]] PosixThreadAttribute& attr) const { - pthread_detach (handle); - threadHandle = (void*) handle; - threadId = (ThreadID) threadHandle.get(); + #if JUCE_LINUX || JUCE_BSD + const struct sched_param param { getPriority() }; + + pthread_attr_setinheritsched (attr.get(), PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy (attr.get(), getScheduler()); + pthread_attr_setschedparam (attr.get(), ¶m); + #endif } - if (attrPtr != nullptr) - pthread_attr_destroy (attrPtr); -} + constexpr int getScheduler() const { return scheduler; } + constexpr int getPriority() const { return priority; } -void Thread::closeThreadHandle() +private: + constexpr PosixSchedulerPriority (int schedulerIn, int priorityIn) + : scheduler (schedulerIn), priority (priorityIn) {} + + int scheduler; + int priority; +}; + +static void* makeThreadHandle (PosixThreadAttribute& attr, Thread* userData, void* (*threadEntryProc) (void*)) { - threadId = {}; - threadHandle = {}; + pthread_t handle = {}; + + if (pthread_create (&handle, attr.get(), threadEntryProc, userData) != 0) + return nullptr; + + pthread_detach (handle); + return (void*) handle; } -void Thread::killThread() +void Thread::closeThreadHandle() { - if (threadHandle.get() != nullptr) - { - #if JUCE_ANDROID - jassertfalse; // pthread_cancel not available! - #else - pthread_cancel ((pthread_t) threadHandle.get()); - #endif - } + threadId = {}; + threadHandle = nullptr; } void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) @@ -963,41 +994,6 @@ void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) #endif } -bool Thread::setThreadPriority (void* handle, int priority) -{ - constexpr auto maxInputPriority = 10; - - #if JUCE_LINUX || JUCE_BSD - constexpr auto lowestRrPriority = 8; - #else - constexpr auto lowestRrPriority = 0; - #endif - - struct sched_param param; - int policy; - - if (handle == nullptr) - handle = (void*) pthread_self(); - - if (pthread_getschedparam ((pthread_t) handle, &policy, ¶m) != 0) - return false; - - policy = priority < lowestRrPriority ? SCHED_OTHER : SCHED_RR; - - const auto minPriority = sched_get_priority_min (policy); - const auto maxPriority = sched_get_priority_max (policy); - - param.sched_priority = [&] - { - if (policy == SCHED_OTHER) - return 0; - - return jmap (priority, lowestRrPriority, maxInputPriority, minPriority, maxPriority); - }(); - - return pthread_setschedparam ((pthread_t) handle, policy, ¶m) == 0; -} - Thread::ThreadID JUCE_CALLTYPE Thread::getCurrentThreadId() { return (ThreadID) pthread_self(); @@ -1017,7 +1013,7 @@ void JUCE_CALLTYPE Thread::yield() #define SUPPORT_AFFINITIES 1 #endif -void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask) +void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask ([[maybe_unused]] uint32 affinityMask) { #if SUPPORT_AFFINITIES cpu_set_t affinity; @@ -1044,7 +1040,6 @@ void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask) // affinities aren't supported because either the appropriate header files weren't found, // or the SUPPORT_AFFINITIES macro was turned off jassertfalse; - ignoreUnused (affinityMask); #endif } @@ -1262,145 +1257,4 @@ bool ChildProcess::start (const StringArray& args, int streamFlags) #endif -//============================================================================== -struct HighResolutionTimer::Pimpl -{ - explicit Pimpl (HighResolutionTimer& t) - : owner (t) - {} - - ~Pimpl() - { - jassert (periodMs == 0); - stop(); - } - - void start (int newPeriod) - { - if (periodMs == newPeriod) - return; - - if (thread.get_id() == std::this_thread::get_id()) - { - periodMs = newPeriod; - return; - } - - stop(); - - periodMs = newPeriod; - - thread = std::thread ([this, newPeriod] - { - setThisThreadToRealtime ((uint64) newPeriod); - - auto lastPeriod = periodMs.load(); - Clock clock (lastPeriod); - - std::unique_lock unique_lock (timerMutex); - - while (periodMs != 0) - { - clock.next(); - while (periodMs != 0 && clock.wait (stopCond, unique_lock)); - - if (periodMs == 0) - break; - - owner.hiResTimerCallback(); - - auto nextPeriod = periodMs.load(); - - if (lastPeriod != nextPeriod) - { - lastPeriod = nextPeriod; - clock = Clock (lastPeriod); - } - } - - periodMs = 0; - }); - } - - void stop() - { - periodMs = 0; - - const auto thread_id = thread.get_id(); - - if (thread_id == std::thread::id() || thread_id == std::this_thread::get_id()) - return; - - { - std::unique_lock unique_lock (timerMutex); - stopCond.notify_one(); - } - - thread.join(); - } - - HighResolutionTimer& owner; - std::atomic periodMs { 0 }; - -private: - std::thread thread; - std::condition_variable stopCond; - std::mutex timerMutex; - - class Clock - { - public: - explicit Clock (std::chrono::steady_clock::rep millis) noexcept - : time (std::chrono::steady_clock::now()), - delta (std::chrono::milliseconds (millis)) - {} - - bool wait (std::condition_variable& cond, std::unique_lock& lock) noexcept - { - return cond.wait_until (lock, time) != std::cv_status::timeout; - } - - void next() noexcept - { - time += delta; - } - - private: - std::chrono::time_point time; - std::chrono::steady_clock::duration delta; - }; - - static bool setThisThreadToRealtime (uint64 periodMs) - { - const auto thread = pthread_self(); - - #if JUCE_MAC || JUCE_IOS - mach_timebase_info_data_t timebase; - mach_timebase_info (&timebase); - - const auto ticksPerMs = ((double) timebase.denom * 1000000.0) / (double) timebase.numer; - const auto periodTicks = (uint32_t) jmin ((double) std::numeric_limits::max(), periodMs * ticksPerMs); - - thread_time_constraint_policy_data_t policy; - policy.period = periodTicks; - policy.computation = jmin ((uint32_t) 50000, policy.period); - policy.constraint = policy.period; - policy.preemptible = true; - - return thread_policy_set (pthread_mach_thread_np (thread), - THREAD_TIME_CONSTRAINT_POLICY, - (thread_policy_t) &policy, - THREAD_TIME_CONSTRAINT_POLICY_COUNT) == KERN_SUCCESS; - - #else - ignoreUnused (periodMs); - struct sched_param param; - param.sched_priority = sched_get_priority_max (SCHED_RR); - return pthread_setschedparam (thread, SCHED_RR, ¶m) == 0; - #endif - } - - JUCE_DECLARE_NON_COPYABLE (Pimpl) -}; - } // namespace juce diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index 7d93f26a..6bc65bf2 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -960,7 +960,7 @@ bool File::createShortcut (const String& description, const File& linkFileToCrea ComSmartPtr shellLink; ComSmartPtr persistFile; - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); return SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) && SUCCEEDED (shellLink->SetPath (getFullPathName().toWideCharPointer())) diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 2fa3befb..63163d14 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -23,11 +23,6 @@ namespace juce { -#if JUCE_MSVC && ! defined (__INTEL_COMPILER) - #pragma intrinsic (__cpuid) - #pragma intrinsic (__rdtsc) -#endif - void Logger::outputDebugString (const String& text) { OutputDebugString ((text + "\n").toWideCharPointer()); @@ -39,9 +34,50 @@ void Logger::outputDebugString (const String& text) JUCE_API void juceDLL_free (void* block) { std::free (block); } #endif +static int findNumberOfPhysicalCores() noexcept +{ + #if JUCE_MINGW + // Not implemented in MinGW + jassertfalse; + + return 1; + #else + + DWORD bufferSize = 0; + GetLogicalProcessorInformation (nullptr, &bufferSize); + + const auto numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION)); + + if (numBuffers == 0) + { + jassertfalse; + return 0; + }; + + HeapBlock buffer (numBuffers); + + if (! GetLogicalProcessorInformation (buffer, &bufferSize)) + { + jassertfalse; + return 0; + } + + return (int) std::count_if (buffer.get(), buffer.get() + numBuffers, [] (const auto& info) + { + return info.Relationship == RelationProcessorCore; + }); + + #endif // JUCE_MINGW +} + //============================================================================== +#if JUCE_INTEL + #if JUCE_MSVC && ! defined (__INTEL_COMPILER) + #pragma intrinsic (__cpuid) + #pragma intrinsic (__rdtsc) + #endif -#if JUCE_MINGW || JUCE_CLANG + #if JUCE_MINGW || JUCE_CLANG static void callCPUID (int result[4], uint32 type) { uint32 la = (uint32) result[0], lb = (uint32) result[1], @@ -59,12 +95,12 @@ static void callCPUID (int result[4], uint32 type) result[0] = (int) la; result[1] = (int) lb; result[2] = (int) lc; result[3] = (int) ld; } -#else + #else static void callCPUID (int result[4], int infoType) { __cpuid (result, infoType); } -#endif + #endif String SystemStats::getCpuVendor() { @@ -103,34 +139,6 @@ String SystemStats::getCpuModel() return String (name).trim(); } -static int findNumberOfPhysicalCores() noexcept -{ - #if JUCE_MINGW - // Not implemented in MinGW - jassertfalse; - - return 1; - #else - - int numPhysicalCores = 0; - DWORD bufferSize = 0; - GetLogicalProcessorInformation (nullptr, &bufferSize); - - if (auto numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) - { - HeapBlock buffer (numBuffers); - - if (GetLogicalProcessorInformation (buffer, &bufferSize)) - for (size_t i = 0; i < numBuffers; ++i) - if (buffer[i].Relationship == RelationProcessorCore) - ++numPhysicalCores; - } - - return numPhysicalCores; - #endif // JUCE_MINGW -} - -//============================================================================== void CPUInformation::initialise() noexcept { int info[4] = { 0 }; @@ -176,6 +184,49 @@ void CPUInformation::initialise() noexcept if (numPhysicalCPUs <= 0) numPhysicalCPUs = numLogicalCPUs; } +#elif JUCE_ARM +String SystemStats::getCpuVendor() +{ + static const auto cpuVendor = [] + { + static constexpr auto* path = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0\\VendorIdentifier"; + auto vendor = RegistryKeyWrapper::getValue (path, {}, 0).trim(); + + return vendor.isEmpty() ? String ("Unknown Vendor") : vendor; + }(); + + return cpuVendor; +} + +String SystemStats::getCpuModel() +{ + static const auto cpuModel = [] + { + static constexpr auto* path = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0\\ProcessorNameString"; + auto model = RegistryKeyWrapper::getValue (path, {}, 0).trim(); + + return model.isEmpty() ? String ("Unknown Model") : model; + }(); + + return cpuModel; +} + +void CPUInformation::initialise() noexcept +{ + // Windows for arm requires at least armv7 which has neon support + hasNeon = true; + + SYSTEM_INFO systemInfo; + GetNativeSystemInfo (&systemInfo); + numLogicalCPUs = (int) systemInfo.dwNumberOfProcessors; + numPhysicalCPUs = findNumberOfPhysicalCores(); + + if (numPhysicalCPUs <= 0) + numPhysicalCPUs = numLogicalCPUs; +} +#else + #error Unknown CPU architecture type +#endif #if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS struct DebugFlagsInitialiser @@ -263,7 +314,7 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() if (major == 5 && minor == 0) return Win2000; jassertfalse; - return UnknownOS; + return Windows; } String SystemStats::getOperatingSystemName() @@ -298,6 +349,7 @@ String SystemStats::getOperatingSystemName() case MacOSX_10_15: JUCE_FALLTHROUGH case MacOS_11: JUCE_FALLTHROUGH case MacOS_12: JUCE_FALLTHROUGH + case MacOS_13: JUCE_FALLTHROUGH case UnknownOS: JUCE_FALLTHROUGH case WASM: JUCE_FALLTHROUGH @@ -405,8 +457,7 @@ public: #endif #if JUCE_WIN32_TIMER_PERIOD > 0 - auto res = timeBeginPeriod (JUCE_WIN32_TIMER_PERIOD); - ignoreUnused (res); + [[maybe_unused]] auto res = timeBeginPeriod (JUCE_WIN32_TIMER_PERIOD); jassert (res == TIMERR_NOERROR); #endif @@ -441,11 +492,21 @@ double Time::getMillisecondCounterHiRes() noexcept { return hiResCounterHa //============================================================================== static int64 juce_getClockCycleCounter() noexcept { - #if JUCE_MSVC + #if JUCE_MSVC + #if JUCE_INTEL // MS intrinsics version... return (int64) __rdtsc(); - - #elif JUCE_GCC || JUCE_CLANG + #elif JUCE_ARM + #if defined (_M_ARM) + return __rdpmccntr64(); + #elif defined (_M_ARM64) + return _ReadStatusReg (ARM64_PMCCNTR_EL0); + #else + #error Unknown arm architecture + #endif + #endif + #elif JUCE_GCC || JUCE_CLANG + #if JUCE_INTEL // GNU inline asm version... unsigned int hi = 0, lo = 0; @@ -461,9 +522,15 @@ static int64 juce_getClockCycleCounter() noexcept : "cc", "eax", "ebx", "ecx", "edx", "memory"); return (int64) ((((uint64) hi) << 32) | lo); - #else - #error "unknown compiler?" - #endif + #elif JUCE_ARM + int64 retval; + + __asm__ __volatile__ ("mrs %0, cntvct_el0" : "=r"(retval)); + return retval; + #endif + #else + #error "unknown compiler?" + #endif } int SystemStats::getCpuSpeedInMegahertz() @@ -592,4 +659,33 @@ String SystemStats::getDisplayLanguage() return languagesBuffer.data(); } +String SystemStats::getUniqueDeviceID() +{ + #define PROVIDER(string) (DWORD) (string[0] << 24 | string[1] << 16 | string[2] << 8 | string[3]) + + auto bufLen = GetSystemFirmwareTable (PROVIDER ("RSMB"), PROVIDER ("RSDT"), nullptr, 0); + + if (bufLen > 0) + { + HeapBlock buffer { bufLen }; + GetSystemFirmwareTable (PROVIDER ("RSMB"), PROVIDER ("RSDT"), (void*) buffer.getData(), bufLen); + + return [&] + { + uint64_t hash = 0; + const auto start = buffer.getData(); + const auto end = start + jmin (1024, (int) bufLen); + + for (auto dataPtr = start; dataPtr != end; ++dataPtr) + hash = hash * (uint64_t) 101 + *dataPtr; + + return String (hash); + }(); + } + + // Please tell someone at JUCE if this occurs + jassertfalse; + return {}; +} + } // namespace juce diff --git a/modules/juce_core/native/juce_win32_Threads.cpp b/modules/juce_core/native/juce_win32_Threads.cpp index 8d15042f..590a9976 100644 --- a/modules/juce_core/native/juce_win32_Threads.cpp +++ b/modules/juce_core/native/juce_win32_Threads.cpp @@ -51,7 +51,6 @@ void CriticalSection::enter() const noexcept { EnterCriticalSection ((CRI bool CriticalSection::tryEnter() const noexcept { return TryEnterCriticalSection ((CRITICAL_SECTION*) &lock) != FALSE; } void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRITICAL_SECTION*) &lock); } - //============================================================================== static unsigned int STDMETHODCALLTYPE threadEntryProc (void* userData) { @@ -65,36 +64,77 @@ static unsigned int STDMETHODCALLTYPE threadEntryProc (void* userData) return 0; } -void Thread::launchThread() +static bool setPriorityInternal (bool isRealtime, HANDLE handle, Thread::Priority priority) +{ + auto nativeThreadFlag = isRealtime ? THREAD_PRIORITY_TIME_CRITICAL + : ThreadPriorities::getNativePriority (priority); + + if (isRealtime) // This should probably be a fail state too? + Process::setPriority (Process::ProcessPriority::RealtimePriority); + + return SetThreadPriority (handle, nativeThreadFlag); +} + +bool Thread::createNativeThread (Priority priority) { unsigned int newThreadId; threadHandle = (void*) _beginthreadex (nullptr, (unsigned int) threadStackSize, - &threadEntryProc, this, 0, &newThreadId); - threadId = (ThreadID) (pointer_sized_int) newThreadId; + &threadEntryProc, this, CREATE_SUSPENDED, + &newThreadId); + + if (threadHandle != nullptr) + { + threadId = (ThreadID) (pointer_sized_int) newThreadId; + + if (setPriorityInternal (isRealtime(), threadHandle, priority)) + { + ResumeThread (threadHandle); + return true; + } + + killThread(); + closeThreadHandle(); + } + + return false; +} + +Thread::Priority Thread::getPriority() const +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + const auto native = GetThreadPriority (threadHandle); + return ThreadPriorities::getJucePriority (native); +} + +bool Thread::setPriority (Priority priority) +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + return setPriorityInternal (isRealtime(), this, priority); } void Thread::closeThreadHandle() { - CloseHandle ((HANDLE) threadHandle.get()); + CloseHandle (threadHandle); threadId = nullptr; threadHandle = nullptr; } void Thread::killThread() { - if (threadHandle.get() != nullptr) + if (threadHandle != nullptr) { #if JUCE_DEBUG OutputDebugStringA ("** Warning - Forced thread termination **\n"); #endif JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6258) - TerminateThread (threadHandle.get(), 0); + TerminateThread (threadHandle, 0); JUCE_END_IGNORE_WARNINGS_MSVC } } -void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) +void JUCE_CALLTYPE Thread::setCurrentThreadName ([[maybe_unused]] const String& name) { #if JUCE_DEBUG && JUCE_MSVC struct @@ -119,8 +159,6 @@ void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) { OutputDebugStringA ("** Warning - Encountered noncontinuable exception **\n"); } - #else - ignoreUnused (name); #endif } @@ -129,23 +167,6 @@ Thread::ThreadID JUCE_CALLTYPE Thread::getCurrentThreadId() return (ThreadID) (pointer_sized_int) GetCurrentThreadId(); } -bool Thread::setThreadPriority (void* handle, int priority) -{ - int pri = THREAD_PRIORITY_TIME_CRITICAL; - - if (priority < 1) pri = THREAD_PRIORITY_IDLE; - else if (priority < 2) pri = THREAD_PRIORITY_LOWEST; - else if (priority < 5) pri = THREAD_PRIORITY_BELOW_NORMAL; - else if (priority < 7) pri = THREAD_PRIORITY_NORMAL; - else if (priority < 9) pri = THREAD_PRIORITY_ABOVE_NORMAL; - else if (priority < 10) pri = THREAD_PRIORITY_HIGHEST; - - if (handle == nullptr) - handle = GetCurrentThread(); - - return SetThreadPriority (handle, pri) != FALSE; -} - void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) { SetThreadAffinityMask (GetCurrentThread(), affinityMask); @@ -217,11 +238,11 @@ void juce_repeatLastProcessPriority() } } -void JUCE_CALLTYPE Process::setPriority (ProcessPriority prior) +void JUCE_CALLTYPE Process::setPriority (ProcessPriority newPriority) { - if (lastProcessPriority != (int) prior) + if (lastProcessPriority != (int) newPriority) { - lastProcessPriority = (int) prior; + lastProcessPriority = (int) newPriority; juce_repeatLastProcessPriority(); } } @@ -527,56 +548,4 @@ bool ChildProcess::start (const StringArray& args, int streamFlags) return start (escaped.trim(), streamFlags); } -//============================================================================== -struct HighResolutionTimer::Pimpl -{ - Pimpl (HighResolutionTimer& t) noexcept : owner (t) - { - } - - ~Pimpl() - { - jassert (periodMs == 0); - } - - void start (int newPeriod) - { - if (newPeriod != periodMs) - { - stop(); - periodMs = newPeriod; - - TIMECAPS tc; - if (timeGetDevCaps (&tc, sizeof (tc)) == TIMERR_NOERROR) - { - const int actualPeriod = jlimit ((int) tc.wPeriodMin, (int) tc.wPeriodMax, newPeriod); - - timerID = timeSetEvent ((UINT) actualPeriod, tc.wPeriodMin, callbackFunction, (DWORD_PTR) this, - TIME_PERIODIC | TIME_CALLBACK_FUNCTION | 0x100 /*TIME_KILL_SYNCHRONOUS*/); - } - } - } - - void stop() - { - periodMs = 0; - timeKillEvent (timerID); - } - - HighResolutionTimer& owner; - int periodMs = 0; - -private: - unsigned int timerID; - - static void STDMETHODCALLTYPE callbackFunction (UINT, UINT, DWORD_PTR userInfo, DWORD_PTR, DWORD_PTR) - { - if (Pimpl* const timer = reinterpret_cast (userInfo)) - if (timer->periodMs != 0) - timer->owner.hiResTimerCallback(); - } - - JUCE_DECLARE_NON_COPYABLE (Pimpl) -}; - } // namespace juce diff --git a/modules/juce_core/network/juce_Socket.cpp b/modules/juce_core/network/juce_Socket.cpp index 0823d429..c020720b 100644 --- a/modules/juce_core/network/juce_Socket.cpp +++ b/modules/juce_core/network/juce_Socket.cpp @@ -91,15 +91,16 @@ namespace SocketHelpers : setOption (handle, IPPROTO_TCP, TCP_NODELAY, (int) 1)); } - static void closeSocket (std::atomic& handle, CriticalSection& readLock, - bool isListener, int portNumber, std::atomic& connected) noexcept + static void closeSocket (std::atomic& handle, + [[maybe_unused]] CriticalSection& readLock, + [[maybe_unused]] bool isListener, + [[maybe_unused]] int portNumber, + std::atomic& connected) noexcept { const auto h = (SocketHandle) handle.load(); handle = -1; #if JUCE_WINDOWS - ignoreUnused (portNumber, isListener, readLock); - if (h != invalidSocket || connected) closesocket (h); @@ -771,11 +772,9 @@ bool DatagramSocket::setMulticastLoopbackEnabled (bool enable) return SocketHelpers::setOption ((SocketHandle) handle.load(), IPPROTO_IP, IP_MULTICAST_LOOP, enable); } -bool DatagramSocket::setEnablePortReuse (bool enabled) +bool DatagramSocket::setEnablePortReuse ([[maybe_unused]] bool enabled) { - #if JUCE_ANDROID - ignoreUnused (enabled); - #else + #if ! JUCE_ANDROID if (handle >= 0) return SocketHelpers::setOption ((SocketHandle) handle.load(), #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD diff --git a/modules/juce_core/network/juce_URL.cpp b/modules/juce_core/network/juce_URL.cpp index ce9c5030..dd10be08 100644 --- a/modules/juce_core/network/juce_URL.cpp +++ b/modules/juce_core/network/juce_URL.cpp @@ -178,7 +178,15 @@ URL::URL (File localFile) void URL::init() { - auto i = url.indexOfChar ('?'); + auto i = url.indexOfChar ('#'); + + if (i >= 0) + { + anchor = removeEscapeChars (url.substring (i + 1)); + url = url.upToFirstOccurrenceOf ("#", false, false); + } + + i = url.indexOfChar ('?'); if (i >= 0) { @@ -346,8 +354,21 @@ String URL::getSubPath (bool includeGetParameters) const String URL::getQueryString() const { + String result; + if (parameterNames.size() > 0) - return "?" + URLHelpers::getMangledParameters (*this); + result += "?" + URLHelpers::getMangledParameters (*this); + + if (anchor.isNotEmpty()) + result += getAnchorString(); + + return result; +} + +String URL::getAnchorString() const +{ + if (anchor.isNotEmpty()) + return "#" + URL::addEscapeChars (anchor, true); return {}; } @@ -609,8 +630,7 @@ public: } else { - auto desc = [error localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [error localizedDescription]; jassertfalse; } } @@ -643,8 +663,7 @@ private: return urlToUse.getLocalFile(); } - auto desc = [error localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [error localizedDescription]; jassertfalse; } @@ -861,6 +880,14 @@ URL URL::withParameters (const StringPairArray& parametersToAdd) const return u; } +URL URL::withAnchor (const String& anchorToAdd) const +{ + auto u = *this; + + u.anchor = anchorToAdd; + return u; +} + URL URL::withPOSTData (const String& newPostData) const { return withPOSTData (MemoryBlock (newPostData.toRawUTF8(), newPostData.getNumBytesAsUTF8())); diff --git a/modules/juce_core/network/juce_URL.h b/modules/juce_core/network/juce_URL.h index 09a048a7..6a399448 100644 --- a/modules/juce_core/network/juce_URL.h +++ b/modules/juce_core/network/juce_URL.h @@ -100,6 +100,11 @@ public: */ String getQueryString() const; + /** If any anchor is set, returns URL-encoded anchor, including the "#" + prefix. + */ + String getAnchorString() const; + /** Returns the scheme of the URL. e.g. for "http://www.xyz.com/foobar", this will return "http" (it won't @@ -144,7 +149,7 @@ public: @see withNewSubPath */ - JUCE_NODISCARD URL withNewDomainAndPath (const String& newFullPath) const; + [[nodiscard]] URL withNewDomainAndPath (const String& newFullPath) const; /** Returns a new version of this URL with a different sub-path. @@ -153,7 +158,7 @@ public: @see withNewDomainAndPath */ - JUCE_NODISCARD URL withNewSubPath (const String& newPath) const; + [[nodiscard]] URL withNewSubPath (const String& newPath) const; /** Attempts to return a URL which is the parent folder containing this URL. @@ -186,8 +191,8 @@ public: @see getParameterNames, getParameterValues */ - JUCE_NODISCARD URL withParameter (const String& parameterName, - const String& parameterValue) const; + [[nodiscard]] URL withParameter (const String& parameterName, + const String& parameterValue) const; /** Returns a copy of this URL, with a set of GET or POST parameters added. @@ -195,7 +200,11 @@ public: @see withParameter */ - JUCE_NODISCARD URL withParameters (const StringPairArray& parametersToAdd) const; + [[nodiscard]] URL withParameters (const StringPairArray& parametersToAdd) const; + + /** Returns a copy of this URL, with an anchor added to the end of the URL. + */ + [[nodiscard]] URL withAnchor (const String& anchor) const; /** Returns a copy of this URL, with a file-upload type parameter added to it. @@ -208,7 +217,7 @@ public: @see withDataToUpload */ - JUCE_NODISCARD URL withFileToUpload (const String& parameterName, + [[nodiscard]] URL withFileToUpload (const String& parameterName, const File& fileToUpload, const String& mimeType) const; @@ -222,7 +231,7 @@ public: @see withFileToUpload */ - JUCE_NODISCARD URL withDataToUpload (const String& parameterName, + [[nodiscard]] URL withDataToUpload (const String& parameterName, const String& filename, const MemoryBlock& fileContentToUpload, const String& mimeType) const; @@ -261,7 +270,7 @@ public: If no HTTP command is set when calling createInputStream() to read from this URL and some data has been set, it will do a POST request. */ - JUCE_NODISCARD URL withPOSTData (const String& postData) const; + [[nodiscard]] URL withPOSTData (const String& postData) const; /** Returns a copy of this URL, with a block of data to send as the POST data. @@ -271,7 +280,7 @@ public: If no HTTP command is set when calling createInputStream() to read from this URL and some data has been set, it will do a POST request. */ - JUCE_NODISCARD URL withPOSTData (const MemoryBlock& postData) const; + [[nodiscard]] URL withPOSTData (const MemoryBlock& postData) const; /** Returns the data that was set using withPOSTData(). */ String getPostData() const { return postData.toString(); } @@ -334,36 +343,36 @@ public: This can be useful for lengthy POST operations, so that you can provide user feedback. */ - JUCE_NODISCARD InputStreamOptions withProgressCallback (std::function progressCallback) const; + [[nodiscard]] InputStreamOptions withProgressCallback (std::function progressCallback) const; /** A string that will be appended onto the headers that are used for the request. It must be a valid set of HTML header directives, separated by newlines. */ - JUCE_NODISCARD InputStreamOptions withExtraHeaders (const String& extraHeaders) const; + [[nodiscard]] InputStreamOptions withExtraHeaders (const String& extraHeaders) const; /** Specifies a timeout for the request in milliseconds. If 0, this will use whatever default setting the OS chooses. If a negative number, it will be infinite. */ - JUCE_NODISCARD InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const; + [[nodiscard]] InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const; /** If this is non-null, all the (key, value) pairs received as headers in the response will be stored in this array. */ - JUCE_NODISCARD InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const; + [[nodiscard]] InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const; /** If this is non-null, it will get set to the http status code, if one is known, or 0 if a code isn't available. */ - JUCE_NODISCARD InputStreamOptions withStatusCode (int* statusCode) const; + [[nodiscard]] InputStreamOptions withStatusCode (int* statusCode) const; /** Specifies the number of redirects that will be followed before returning a response. N.B. This will be ignored on Android which follows up to 5 redirects. */ - JUCE_NODISCARD InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const; + [[nodiscard]] InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const; /** Specifies which HTTP request command to use. @@ -372,7 +381,7 @@ public: via withPOSTData(), withFileToUpload(), or withDataToUpload(). Otherwise it will be GET. */ - JUCE_NODISCARD InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const; + [[nodiscard]] InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const; //============================================================================== ParameterHandling getParameterHandling() const noexcept { return parameterHandling; } @@ -456,7 +465,7 @@ public: bool usePost = false; /** Specifies headers to add to the request. */ - JUCE_NODISCARD auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); } + [[nodiscard]] auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); } /** On iOS, specifies the container where the downloaded file will be stored. @@ -465,17 +474,17 @@ public: This is currently unused on other platforms. */ - JUCE_NODISCARD auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); } + [[nodiscard]] auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); } /** Specifies an observer for the download task. */ - JUCE_NODISCARD auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); } + [[nodiscard]] auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); } /** Specifies whether a post command should be used. */ - JUCE_NODISCARD auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); } + [[nodiscard]] auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); } private: template - JUCE_NODISCARD DownloadTaskOptions with (Member&& member, Value&& value) const + [[nodiscard]] DownloadTaskOptions with (Member&& member, Value&& value) const { auto copy = *this; copy.*member = std::forward (value); @@ -723,6 +732,7 @@ private: String url; MemoryBlock postData; StringArray parameterNames, parameterValues; + String anchor; ReferenceCountedArray filesToUpload; diff --git a/modules/juce_core/network/juce_WebInputStream.cpp b/modules/juce_core/network/juce_WebInputStream.cpp index daffbc44..1183c1bc 100644 --- a/modules/juce_core/network/juce_WebInputStream.cpp +++ b/modules/juce_core/network/juce_WebInputStream.cpp @@ -96,4 +96,11 @@ void WebInputStream::createHeadersAndPostData (const URL& aURL, aURL.createHeadersAndPostData (headers, data, addParametersToBody); } +bool WebInputStream::Listener::postDataSendProgress ([[maybe_unused]] WebInputStream& request, + [[maybe_unused]] int bytesSent, + [[maybe_unused]] int totalBytes) +{ + return true; +} + } // namespace juce diff --git a/modules/juce_core/network/juce_WebInputStream.h b/modules/juce_core/network/juce_WebInputStream.h index 88301212..308adfe4 100644 --- a/modules/juce_core/network/juce_WebInputStream.h +++ b/modules/juce_core/network/juce_WebInputStream.h @@ -107,11 +107,7 @@ class JUCE_API WebInputStream : public InputStream @returns true to continue or false to cancel the upload */ - virtual bool postDataSendProgress (WebInputStream& request, int bytesSent, int totalBytes) - { - ignoreUnused (request, bytesSent, totalBytes); - return true; - } + virtual bool postDataSendProgress (WebInputStream& request, int bytesSent, int totalBytes); }; /** Wait until the first byte is ready for reading. diff --git a/modules/juce_core/streams/juce_MemoryOutputStream.cpp b/modules/juce_core/streams/juce_MemoryOutputStream.cpp index e43b8465..d3be4a8b 100644 --- a/modules/juce_core/streams/juce_MemoryOutputStream.cpp +++ b/modules/juce_core/streams/juce_MemoryOutputStream.cpp @@ -172,15 +172,15 @@ bool MemoryOutputStream::setPosition (int64 newPosition) int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) { // before writing from an input, see if we can preallocate to make it more efficient.. - int64 availableData = source.getTotalLength() - source.getPosition(); + const auto availableData = source.getTotalLength() - source.getPosition(); if (availableData > 0) { - if (maxNumBytesToWrite > availableData || maxNumBytesToWrite < 0) + if (maxNumBytesToWrite < 0 || availableData < maxNumBytesToWrite) maxNumBytesToWrite = availableData; if (blockToUse != nullptr) - preallocate (blockToUse->getSize() + (size_t) maxNumBytesToWrite); + preallocate (position + (size_t) maxNumBytesToWrite); } return OutputStream::writeFromInputStream (source, maxNumBytesToWrite); diff --git a/modules/juce_core/system/juce_CompilerSupport.h b/modules/juce_core/system/juce_CompilerSupport.h index bbe21625..c1e173c5 100644 --- a/modules/juce_core/system/juce_CompilerSupport.h +++ b/modules/juce_core/system/juce_CompilerSupport.h @@ -30,8 +30,8 @@ // GCC #if JUCE_GCC - #if (__GNUC__ * 100 + __GNUC_MINOR__) < 500 - #error "JUCE requires GCC 5.0 or later" + #if (__GNUC__ * 100 + __GNUC_MINOR__) < 700 + #error "JUCE requires GCC 7.0 or later" #endif #ifndef JUCE_EXCEPTIONS_DISABLED @@ -49,8 +49,8 @@ // Clang #if JUCE_CLANG - #if (__clang_major__ < 3) || (__clang_major__ == 3 && __clang_minor__ < 4) - #error "JUCE requires Clang 3.4 or later" + #if (__clang_major__ < 6) + #error "JUCE requires Clang 6 or later" #endif #ifndef JUCE_COMPILER_SUPPORTS_ARC @@ -87,8 +87,8 @@ #endif //============================================================================== -#if ! JUCE_CXX14_IS_AVAILABLE - #error "JUCE requires C++14 or later" +#if ! JUCE_CXX17_IS_AVAILABLE + #error "JUCE requires C++17 or later" #endif //============================================================================== @@ -100,10 +100,5 @@ #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 #define JUCE_DELETED_FUNCTION = delete #define JUCE_CONSTEXPR constexpr -#endif - -#if JUCE_CXX17_IS_AVAILABLE #define JUCE_NODISCARD [[nodiscard]] -#else - #define JUCE_NODISCARD #endif diff --git a/modules/juce_core/system/juce_StandardHeader.h b/modules/juce_core/system/juce_StandardHeader.h index 71611f10..7a071434 100644 --- a/modules/juce_core/system/juce_StandardHeader.h +++ b/modules/juce_core/system/juce_StandardHeader.h @@ -29,7 +29,7 @@ */ #define JUCE_MAJOR_VERSION 7 #define JUCE_MINOR_VERSION 0 -#define JUCE_BUILDNUMBER 2 +#define JUCE_BUILDNUMBER 5 /** Current JUCE version number. @@ -43,8 +43,7 @@ #if ! DOXYGEN #define JUCE_VERSION_ID \ - volatile auto juceVersionId = "juce_version_" JUCE_STRINGIFY(JUCE_MAJOR_VERSION) "_" JUCE_STRINGIFY(JUCE_MINOR_VERSION) "_" JUCE_STRINGIFY(JUCE_BUILDNUMBER); \ - ignoreUnused (juceVersionId); + [[maybe_unused]] volatile auto juceVersionId = "juce_version_" JUCE_STRINGIFY(JUCE_MAJOR_VERSION) "_" JUCE_STRINGIFY(JUCE_MINOR_VERSION) "_" JUCE_STRINGIFY(JUCE_BUILDNUMBER); #endif //============================================================================== @@ -55,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -63,15 +63,16 @@ #include #include #include +#include #include #include #include +#include #include #include #include #include #include -#include //============================================================================== #include "juce_CompilerSupport.h" diff --git a/modules/juce_core/system/juce_SystemStats.cpp b/modules/juce_core/system/juce_SystemStats.cpp index 3fe9ac7f..8601bc08 100644 --- a/modules/juce_core/system/juce_SystemStats.cpp +++ b/modules/juce_core/system/juce_SystemStats.cpp @@ -253,4 +253,25 @@ bool SystemStats::isRunningInAppExtensionSandbox() noexcept #endif } +#if JUCE_UNIT_TESTS + +class UniqueHardwareIDTest : public UnitTest +{ +public: + //============================================================================== + UniqueHardwareIDTest() : UnitTest ("UniqueHardwareID", UnitTestCategories::analytics) {} + + void runTest() override + { + beginTest ("getUniqueDeviceID returns usable data."); + { + expect (SystemStats::getUniqueDeviceID().isNotEmpty()); + } + } +}; + +static UniqueHardwareIDTest uniqueHardwareIDTest; + +#endif + } // namespace juce diff --git a/modules/juce_core/system/juce_SystemStats.h b/modules/juce_core/system/juce_SystemStats.h index 37924f08..a80cc541 100644 --- a/modules/juce_core/system/juce_SystemStats.h +++ b/modules/juce_core/system/juce_SystemStats.h @@ -64,6 +64,7 @@ public: MacOSX_10_15 = MacOSX | 15, MacOS_11 = MacOSX | 16, MacOS_12 = MacOSX | 17, + MacOS_13 = MacOSX | 18, Win2000 = Windows | 1, WinXP = Windows | 2, @@ -145,8 +146,17 @@ public: The first choice for an ID is a filesystem ID for the user's home folder or windows directory. If that fails then this function returns the MAC addresses. */ + [[deprecated ("The identifiers produced by this function are not reliable. Use getUniqueDeviceID() instead.")]] static StringArray getDeviceIdentifiers(); + /** This method returns a machine unique ID unaffected by storage or peripheral + changes. + + This ID will be invalidated by changes to the motherboard and CPU on non-mobile + platforms, or resetting an Android device. + */ + static String getUniqueDeviceID(); + //============================================================================== // CPU and memory information.. @@ -233,7 +243,6 @@ public: */ static bool isRunningInAppExtensionSandbox() noexcept; - //============================================================================== #ifndef DOXYGEN [[deprecated ("This method was spelt wrong! Please change your code to use getCpuSpeedInMegahertz instead.")]] diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index aca2e656..a93c2796 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -109,7 +109,11 @@ /** If defined, this indicates that the processor is little-endian. */ #define JUCE_LITTLE_ENDIAN 1 - #define JUCE_INTEL 1 + #if defined (_M_ARM) || defined (_M_ARM64) || defined (__arm__) || defined (__aarch64__) + #define JUCE_ARM 1 + #else + #define JUCE_INTEL 1 + #endif #endif //============================================================================== @@ -145,9 +149,9 @@ #if JUCE_MAC #if ! defined (MAC_OS_X_VERSION_10_14) - #error "The 10.14 SDK (Xcode 10.1+) is required to build JUCE apps. You can create apps that run on macOS 10.7+ by changing the deployment target." - #elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 - #error "Building for OSX 10.6 is no longer supported!" + #error "The 10.14 SDK (Xcode 10.1+) is required to build JUCE apps. You can create apps that run on macOS 10.9+ by changing the deployment target." + #elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 + #error "Building for OSX 10.8 and earlier is no longer supported!" #endif #endif #endif diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h index 7ab9fb03..d53695eb 100644 --- a/modules/juce_core/text/juce_CharacterFunctions.h +++ b/modules/juce_core/text/juce_CharacterFunctions.h @@ -490,8 +490,8 @@ public: template struct HexParser { - static_assert (std::is_unsigned::value, "ResultType must be unsigned because " - "left-shifting a negative value is UB"); + static_assert (std::is_unsigned_v, "ResultType must be unsigned because " + "left-shifting a negative value is UB"); template static ResultType parse (CharPointerType t) noexcept diff --git a/modules/juce_core/text/juce_LocalisedStrings.h b/modules/juce_core/text/juce_LocalisedStrings.h index 32790de8..61198e65 100644 --- a/modules/juce_core/text/juce_LocalisedStrings.h +++ b/modules/juce_core/text/juce_LocalisedStrings.h @@ -50,14 +50,14 @@ namespace juce "goodbye" = "au revoir" @endcode - If the strings need to contain a quote character, they can use `\"` instead, and + If the strings need to contain a quote character, they can use \" instead, and if the first non-whitespace character on a line isn't a quote, then it's ignored, (you can use this to add comments). Note that this is a singleton class, so don't create or destroy the object directly. There's also a TRANS(text) macro defined to make it easy to use the this. - E.g. @code + @code printSomething (TRANS("hello")); @endcode diff --git a/modules/juce_core/threads/juce_CriticalSection.h b/modules/juce_core/threads/juce_CriticalSection.h index 9d5e12de..92362bce 100644 --- a/modules/juce_core/threads/juce_CriticalSection.h +++ b/modules/juce_core/threads/juce_CriticalSection.h @@ -106,9 +106,9 @@ private: // a block of memory here that's big enough to be used internally as a windows // CRITICAL_SECTION structure. #if JUCE_64BIT - std::aligned_storage<44, 8>::type lock; + std::aligned_storage_t<44, 8> lock; #else - std::aligned_storage<24, 8>::type lock; + std::aligned_storage_t<24, 8> lock; #endif #else mutable pthread_mutex_t lock; diff --git a/modules/juce_core/threads/juce_HighResolutionTimer.cpp b/modules/juce_core/threads/juce_HighResolutionTimer.cpp index de0f3a76..28ca899d 100644 --- a/modules/juce_core/threads/juce_HighResolutionTimer.cpp +++ b/modules/juce_core/threads/juce_HighResolutionTimer.cpp @@ -23,13 +23,98 @@ namespace juce { -HighResolutionTimer::HighResolutionTimer() : pimpl (new Pimpl (*this)) {} -HighResolutionTimer::~HighResolutionTimer() { stopTimer(); } +class HighResolutionTimer::Pimpl : public Thread +{ + using steady_clock = std::chrono::steady_clock; + using milliseconds = std::chrono::milliseconds; + +public: + explicit Pimpl (HighResolutionTimer& ownerRef) + : Thread ("HighResolutionTimerThread"), + owner (ownerRef) + { + } + + using Thread::isThreadRunning; + + void start (int periodMs) + { + { + const std::scoped_lock lk { mutex }; + periodMillis = periodMs; + nextTickTime = steady_clock::now() + milliseconds (periodMillis); + } + + waitEvent.notify_one(); + + if (! isThreadRunning()) + startThread (Thread::Priority::high); + } + + void stop() + { + { + const std::scoped_lock lk { mutex }; + periodMillis = 0; + } + + waitEvent.notify_one(); + + if (Thread::getCurrentThreadId() != getThreadId()) + stopThread (-1); + } + + int getPeriod() const + { + return periodMillis; + } + +private: + void run() override + { + for (;;) + { + { + std::unique_lock lk { mutex }; -void HighResolutionTimer::startTimer (int periodMs) { pimpl->start (jmax (1, periodMs)); } -void HighResolutionTimer::stopTimer() { pimpl->stop(); } + if (waitEvent.wait_until (lk, nextTickTime, [this] { return periodMillis == 0; })) + break; + + nextTickTime = steady_clock::now() + milliseconds (periodMillis); + } + + owner.hiResTimerCallback(); + } + } + + HighResolutionTimer& owner; + std::atomic periodMillis { 0 }; + steady_clock::time_point nextTickTime; + std::mutex mutex; + std::condition_variable waitEvent; +}; + +HighResolutionTimer::HighResolutionTimer() + : pimpl (new Pimpl (*this)) +{ +} + +HighResolutionTimer::~HighResolutionTimer() +{ + stopTimer(); +} + +void HighResolutionTimer::startTimer (int periodMs) +{ + pimpl->start (jmax (1, periodMs)); +} + +void HighResolutionTimer::stopTimer() +{ + pimpl->stop(); +} -bool HighResolutionTimer::isTimerRunning() const noexcept { return pimpl->periodMs != 0; } -int HighResolutionTimer::getTimerInterval() const noexcept { return pimpl->periodMs; } +bool HighResolutionTimer::isTimerRunning() const noexcept { return getTimerInterval() != 0; } +int HighResolutionTimer::getTimerInterval() const noexcept { return pimpl->getPeriod(); } } // namespace juce diff --git a/modules/juce_core/threads/juce_HighResolutionTimer.h b/modules/juce_core/threads/juce_HighResolutionTimer.h index 29ad4fd9..2ac6402a 100644 --- a/modules/juce_core/threads/juce_HighResolutionTimer.h +++ b/modules/juce_core/threads/juce_HighResolutionTimer.h @@ -93,7 +93,7 @@ public: int getTimerInterval() const noexcept; private: - struct Pimpl; + class Pimpl; std::unique_ptr pimpl; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HighResolutionTimer) diff --git a/modules/juce_core/threads/juce_Process.h b/modules/juce_core/threads/juce_Process.h index dfc0c3a2..61f2157b 100644 --- a/modules/juce_core/threads/juce_Process.h +++ b/modules/juce_core/threads/juce_Process.h @@ -50,7 +50,7 @@ public: @param priority the process priority, where 0=low, 1=normal, 2=high, 3=realtime */ - static void JUCE_CALLTYPE setPriority (const ProcessPriority priority); + static void JUCE_CALLTYPE setPriority (ProcessPriority priority); /** Kills the current process immediately. diff --git a/modules/juce_core/threads/juce_Thread.cpp b/modules/juce_core/threads/juce_Thread.cpp index 6c981e0a..5b870311 100644 --- a/modules/juce_core/threads/juce_Thread.cpp +++ b/modules/juce_core/threads/juce_Thread.cpp @@ -22,9 +22,9 @@ namespace juce { - -Thread::Thread (const String& name, size_t stackSize) - : threadName (name), threadStackSize (stackSize) +//============================================================================== +Thread::Thread (const String& name, size_t stackSize) : threadName (name), + threadStackSize (stackSize) { } @@ -84,9 +84,11 @@ void Thread::threadEntryPoint() if (threadName.isNotEmpty()) setCurrentThreadName (threadName); + // This 'startSuspensionEvent' protects 'threadId' which is initialised after the platform's native 'CreateThread' method. + // This ensures it has been initialised correctly before it reaches this point. if (startSuspensionEvent.wait (10000)) { - jassert (getCurrentThreadId() == threadId.get()); + jassert (getCurrentThreadId() == threadId); if (affinityMask != 0) setCurrentThreadAffinityMask (affinityMask); @@ -119,42 +121,65 @@ void JUCE_API juce_threadEntryPoint (void* userData) } //============================================================================== -void Thread::startThread() +bool Thread::startThreadInternal (Priority threadPriority) { - const ScopedLock sl (startStopLock); + shouldExit = false; - shouldExit = 0; + // 'priority' is essentially useless on Linux as only realtime + // has any options but we need to set this here to satisfy + // later queries, otherwise we get inconsistent results across + // platforms. + #if JUCE_ANDROID || JUCE_LINUX || JUCE_BSD + priority = threadPriority; + #endif - if (threadHandle.get() == nullptr) + if (createNativeThread (threadPriority)) { - launchThread(); - setThreadPriority (threadHandle.get(), threadPriority); startSuspensionEvent.signal(); + return true; } + + return false; } -void Thread::startThread (int priority) +bool Thread::startThread() +{ + return startThread (Priority::normal); +} + +bool Thread::startThread (Priority threadPriority) { const ScopedLock sl (startStopLock); - if (threadHandle.get() == nullptr) + if (threadHandle == nullptr) { - #if JUCE_ANDROID - isAndroidRealtimeThread = (priority == realtimeAudioPriority); - #endif - - threadPriority = getAdjustedPriority (priority); - startThread(); + realtimeOptions.reset(); + return startThreadInternal (threadPriority); } - else + + return false; +} + +bool Thread::startRealtimeThread (const RealtimeOptions& options) +{ + const ScopedLock sl (startStopLock); + + if (threadHandle == nullptr) { - setPriority (priority); + realtimeOptions = makeOptional (options); + + if (startThreadInternal (Priority::normal)) + return true; + + realtimeOptions.reset(); } + + return false; } bool Thread::isThreadRunning() const { - return threadHandle.get() != nullptr; + return threadHandle != nullptr; } Thread* JUCE_CALLTYPE Thread::getCurrentThread() @@ -164,19 +189,19 @@ Thread* JUCE_CALLTYPE Thread::getCurrentThread() Thread::ThreadID Thread::getThreadId() const noexcept { - return threadId.get(); + return threadId; } //============================================================================== void Thread::signalThreadShouldExit() { - shouldExit = 1; + shouldExit = true; listeners.call ([] (Listener& l) { l.exitSignalSent(); }); } bool Thread::threadShouldExit() const { - return shouldExit.get() != 0; + return shouldExit; } bool Thread::currentThreadShouldExit() @@ -249,40 +274,9 @@ void Thread::removeListener (Listener* listener) listeners.remove (listener); } -//============================================================================== -bool Thread::setPriority (int newPriority) -{ - newPriority = getAdjustedPriority (newPriority); - - // NB: deadlock possible if you try to set the thread prio from the thread itself, - // so using setCurrentThreadPriority instead in that case. - if (getCurrentThreadId() == getThreadId()) - return setCurrentThreadPriority (newPriority); - - const ScopedLock sl (startStopLock); - - #if JUCE_ANDROID - bool isRealtime = (newPriority == realtimeAudioPriority); - - // you cannot switch from or to an Android realtime thread once the - // thread is already running! - jassert (isThreadRunning() && (isRealtime == isAndroidRealtimeThread)); - - isAndroidRealtimeThread = isRealtime; - #endif - - if ((! isThreadRunning()) || setThreadPriority (threadHandle.get(), newPriority)) - { - threadPriority = newPriority; - return true; - } - - return false; -} - -bool Thread::setCurrentThreadPriority (const int newPriority) +bool Thread::isRealtime() const { - return setThreadPriority ({}, getAdjustedPriority (newPriority)); + return realtimeOptions.hasValue(); } void Thread::setAffinityMask (const uint32 newAffinityMask) @@ -290,11 +284,6 @@ void Thread::setAffinityMask (const uint32 newAffinityMask) affinityMask = newAffinityMask; } -int Thread::getAdjustedPriority (int newPriority) -{ - return jlimit (0, 10, newPriority == realtimeAudioPriority ? 9 : newPriority); -} - //============================================================================== bool Thread::wait (const int timeOutMilliseconds) const { @@ -309,7 +298,7 @@ void Thread::notify() const //============================================================================== struct LambdaThread : public Thread { - LambdaThread (std::function f) : Thread ("anonymous"), fn (f) {} + LambdaThread (std::function&& f) : Thread ("anonymous"), fn (std::move (f)) {} void run() override { @@ -322,11 +311,23 @@ struct LambdaThread : public Thread JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LambdaThread) }; -void Thread::launch (std::function functionToRun) +bool Thread::launch (std::function functionToRun) { - auto anon = new LambdaThread (functionToRun); + return launch (Priority::normal, std::move (functionToRun)); +} + +bool Thread::launch (Priority priority, std::function functionToRun) +{ + auto anon = std::make_unique (std::move (functionToRun)); anon->deleteOnThreadEnd = true; - anon->startThread(); + + if (anon->startThread (priority)) + { + anon.release(); + return true; + } + + return false; } //============================================================================== @@ -349,7 +350,6 @@ bool JUCE_CALLTYPE Process::isRunningUnderDebugger() noexcept return juce_isRunningUnderDebugger(); } - //============================================================================== //============================================================================== #if JUCE_UNIT_TESTS diff --git a/modules/juce_core/threads/juce_Thread.h b/modules/juce_core/threads/juce_Thread.h index 19634d67..97b66ff6 100644 --- a/modules/juce_core/threads/juce_Thread.h +++ b/modules/juce_core/threads/juce_Thread.h @@ -28,8 +28,8 @@ namespace juce Encapsulates a thread. Subclasses derive from Thread and implement the run() method, in which they - do their business. The thread can then be started with the startThread() method - and controlled with various other methods. + do their business. The thread can then be started with the startThread() or + startRealtimeThread() methods and controlled with various other methods. This class also contains some thread-related static methods, such as sleep(), yield(), getCurrentThreadId() etc. @@ -42,6 +42,46 @@ namespace juce class JUCE_API Thread { public: + //============================================================================== + /** The different runtime priorities of non-realtime threads. + + @see startThread + */ + enum class Priority + { + /** The highest possible priority that isn't a dedicated realtime thread. */ + highest = 2, + + /** Makes use of performance cores and higher clocks. */ + high = 1, + + /** The OS default. It will balance out across all cores. */ + normal = 0, + + /** Uses efficiency cores when possible. */ + low = -1, + + /** Restricted to efficiency cores on platforms that have them. */ + background = -2 + }; + + //============================================================================== + /** A selection of options available when creating realtime threads. + + @see startRealtimeThread + */ + struct RealtimeOptions + { + /** Linux only: A value with a range of 0-10, where 10 is the highest priority. */ + int priority = 5; + + /** iOS/macOS only: A millisecond value representing the estimated time between each + 'Thread::run' call. Your thread may be penalised if you frequently + overrun this. + */ + uint32_t workDurationMs = 0; + }; + //============================================================================== /** Creates a thread. @@ -78,23 +118,51 @@ public: virtual void run() = 0; //============================================================================== - /** Starts the thread running. + /** Attempts to start a new thread with default ('Priority::normal') priority. This will cause the thread's run() method to be called by a new thread. If this thread is already running, startThread() won't do anything. + If a thread cannot be created with the requested priority, this will return false + and Thread::run() will not be called. An exception to this is the Android platform, + which always starts a thread and attempts to upgrade the thread after creation. + + @returns true if the thread started successfully. false if it was unsuccesful. + @see stopThread */ - void startThread(); + bool startThread(); + + /** Attempts to start a new thread with a given priority. + + This will cause the thread's run() method to be called by a new thread. + If this thread is already running, startThread() won't do anything. - /** Starts the thread with a given priority. + If a thread cannot be created with the requested priority, this will return false + and Thread::run() will not be called. An exception to this is the Android platform, + which always starts a thread and attempts to upgrade the thread after creation. - Launches the thread with a given priority, where 0 = lowest, 10 = highest. - If the thread is already running, its priority will be changed. + @param newPriority Priority the thread should be assigned. This parameter is ignored + on Linux. - @see startThread, setPriority, realtimeAudioPriority + @returns true if the thread started successfully, false if it was unsuccesful. + + @see startThread, setPriority, startRealtimeThread */ - void startThread (int priority); + bool startThread (Priority newPriority); + + /** Starts the thread with realtime performance characteristics on platforms + that support it. + + You cannot change the options of a running realtime thread, nor switch + a non-realtime thread to a realtime thread. To make these changes you must + first stop the thread and then restart with different options. + + @param options Realtime options the thread should be created with. + + @see startThread, RealtimeOptions + */ + bool startRealtimeThread (const RealtimeOptions& options); /** Attempts to stop the thread running. @@ -119,7 +187,27 @@ public: bool stopThread (int timeOutMilliseconds); //============================================================================== - /** Invokes a lambda or function on its own thread. + /** Invokes a lambda or function on its own thread with the default priority. + + This will spin up a Thread object which calls the function and then exits. + Bear in mind that starting and stopping a thread can be a fairly heavyweight + operation, so you might prefer to use a ThreadPool if you're kicking off a lot + of short background tasks. + + Also note that using an anonymous thread makes it very difficult to interrupt + the function when you need to stop it, e.g. when your app quits. So it's up to + you to deal with situations where the function may fail to stop in time. + + @param functionToRun The lambda to be called from the new Thread. + + @returns true if the thread started successfully, or false if it failed. + + @see launch. + */ + static bool launch (std::function functionToRun); + + //============================================================================== + /** Invokes a lambda or function on its own thread with a custom priority. This will spin up a Thread object which calls the function and then exits. Bear in mind that starting and stopping a thread can be a fairly heavyweight @@ -129,8 +217,13 @@ public: Also note that using an anonymous thread makes it very difficult to interrupt the function when you need to stop it, e.g. when your app quits. So it's up to you to deal with situations where the function may fail to stop in time. + + @param priority The priority the thread is started with. + @param functionToRun The lambda to be called from the new Thread. + + @returns true if the thread started successfully, or false if it failed. */ - static void launch (std::function functionToRun); + static bool launch (Priority priority, std::function functionToRun); //============================================================================== /** Returns true if the thread is currently active */ @@ -198,50 +291,8 @@ public: /** Removes a listener added with addListener. */ void removeListener (Listener*); - //============================================================================== - /** Special realtime audio thread priority - - This priority will create a high-priority thread which is best suited - for realtime audio processing. - - Currently, this priority is identical to priority 9, except when building - for Android with OpenSL/Oboe support. - - In this case, JUCE will ask OpenSL/Oboe to construct a super high priority thread - specifically for realtime audio processing. - - Note that this priority can only be set **before** the thread has - started. Switching to this priority, or from this priority to a different - priority, is not supported under Android and will assert. - - For best performance this thread should yield at regular intervals - and not call any blocking APIs. - - @see startThread, setPriority, sleep, WaitableEvent - */ - enum - { - realtimeAudioPriority = -1 - }; - - /** Changes the thread's priority. - - May return false if for some reason the priority can't be changed. - - @param priority the new priority, in the range 0 (lowest) to 10 (highest). A priority - of 5 is normal. - @see realtimeAudioPriority - */ - bool setPriority (int priority); - - /** Changes the priority of the caller thread. - - Similar to setPriority(), but this static method acts on the caller thread. - May return false if for some reason the priority can't be changed. - - @see setPriority - */ - static bool setCurrentThreadPriority (int priority); + /** Returns true if this Thread represents a realtime thread. */ + bool isRealtime() const; //============================================================================== /** Sets the affinity mask for the thread. @@ -380,34 +431,58 @@ public: static void initialiseJUCE (void* jniEnv, void* jContext); #endif +protected: + //============================================================================== + /** Returns the current priority of this thread. + + This can only be called from the target thread. Doing so from another thread + will cause an assert. + + @see setPriority + */ + Priority getPriority() const; + + /** Attempts to set the priority for this thread. Returns true if the new priority + was set successfully, false if not. + + This can only be called from the target thread. Doing so from another thread + will cause an assert. + + @param newPriority The new priority to be applied to the thread. Note: This + has no effect on Linux platforms, subsequent calls to + 'getPriority' will return this value. + + @see Priority + */ + bool setPriority (Priority newPriority); + private: //============================================================================== const String threadName; - Atomic threadHandle { nullptr }; - Atomic threadId = {}; + std::atomic threadHandle { nullptr }; + std::atomic threadId { nullptr }; + Optional realtimeOptions = {}; CriticalSection startStopLock; WaitableEvent startSuspensionEvent, defaultEvent; - int threadPriority = 5; size_t threadStackSize; uint32 affinityMask = 0; bool deleteOnThreadEnd = false; - Atomic shouldExit { 0 }; + std::atomic shouldExit { false }; ListenerList> listeners; - #if JUCE_ANDROID - bool isAndroidRealtimeThread = false; + #if JUCE_ANDROID || JUCE_LINUX || JUCE_BSD + std::atomic priority; #endif #ifndef DOXYGEN friend void JUCE_API juce_threadEntryPoint (void*); #endif - void launchThread(); + bool startThreadInternal (Priority); + bool createNativeThread (Priority); void closeThreadHandle(); void killThread(); void threadEntryPoint(); - static bool setThreadPriority (void*, int); - static int getAdjustedPriority (int); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread) }; diff --git a/modules/juce_core/threads/juce_ThreadPool.cpp b/modules/juce_core/threads/juce_ThreadPool.cpp index 9b6c446f..8639481d 100644 --- a/modules/juce_core/threads/juce_ThreadPool.cpp +++ b/modules/juce_core/threads/juce_ThreadPool.cpp @@ -33,11 +33,14 @@ struct ThreadPool::ThreadPoolThread : public Thread void run() override { while (! threadShouldExit()) + { if (! pool.runNextJob (*this)) wait (500); + } } std::atomic currentJob { nullptr }; + ThreadPool& pool; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ThreadPoolThread) @@ -90,16 +93,19 @@ ThreadPoolJob* ThreadPoolJob::getCurrentThreadPoolJob() } //============================================================================== -ThreadPool::ThreadPool (int numThreads, size_t threadStackSize) +ThreadPool::ThreadPool (int numThreads, size_t threadStackSize, Thread::Priority priority) { jassert (numThreads > 0); // not much point having a pool without any threads! - createThreads (numThreads, threadStackSize); + for (int i = jmax (1, numThreads); --i >= 0;) + threads.add (new ThreadPoolThread (*this, threadStackSize)); + + for (auto* t : threads) + t->startThread (priority); } -ThreadPool::ThreadPool() +ThreadPool::ThreadPool() : ThreadPool (SystemStats::getNumCpus(), 0, Thread::Priority::normal) { - createThreads (SystemStats::getNumCpus()); } ThreadPool::~ThreadPool() @@ -108,15 +114,6 @@ ThreadPool::~ThreadPool() stopThreads(); } -void ThreadPool::createThreads (int numThreads, size_t threadStackSize) -{ - for (int i = jmax (1, numThreads); --i >= 0;) - threads.add (new ThreadPoolThread (*this, threadStackSize)); - - for (auto* t : threads) - t->startThread(); -} - void ThreadPool::stopThreads() { for (auto* t : threads) @@ -330,17 +327,6 @@ StringArray ThreadPool::getNamesOfAllJobs (bool onlyReturnActiveJobs) const return s; } -bool ThreadPool::setThreadPriorities (int newPriority) -{ - bool ok = true; - - for (auto* t : threads) - if (! t->setPriority (newPriority)) - ok = false; - - return ok; -} - ThreadPoolJob* ThreadPool::pickNextJobToRun() { OwnedArray deletionList; diff --git a/modules/juce_core/threads/juce_ThreadPool.h b/modules/juce_core/threads/juce_ThreadPool.h index 64394010..779b1d02 100644 --- a/modules/juce_core/threads/juce_ThreadPool.h +++ b/modules/juce_core/threads/juce_ThreadPool.h @@ -164,8 +164,9 @@ public: @param threadStackSize the size of the stack of each thread. If this value is zero then the default stack size of the OS will be used. + @param priority the desired priority of each thread in the pool. */ - ThreadPool (int numberOfThreads, size_t threadStackSize = 0); + ThreadPool (int numberOfThreads, size_t threadStackSize = 0, Thread::Priority priority = Thread::Priority::normal); /** Creates a thread pool with one thread per CPU core. Once you've created a pool, you can give it some jobs by calling addJob(). @@ -309,13 +310,6 @@ public: */ StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const; - /** Changes the priority of all the threads. - This will call Thread::setPriority() for each thread in the pool. - May return false if for some reason the priority can't be changed. - */ - bool setThreadPriorities (int newPriority); - - private: //============================================================================== Array jobs; @@ -330,7 +324,6 @@ private: bool runNextJob (ThreadPoolThread&); ThreadPoolJob* pickNextJobToRun(); void addToDeleteList (OwnedArray&, ThreadPoolJob*) const; - void createThreads (int numThreads, size_t threadStackSize = 0); void stopThreads(); // Note that this method has changed, and no longer has a parameter to indicate diff --git a/modules/juce_core/threads/juce_TimeSliceThread.cpp b/modules/juce_core/threads/juce_TimeSliceThread.cpp index 261fe859..67a773c2 100644 --- a/modules/juce_core/threads/juce_TimeSliceThread.cpp +++ b/modules/juce_core/threads/juce_TimeSliceThread.cpp @@ -89,6 +89,7 @@ void TimeSliceThread::moveToFrontOfQueue (TimeSliceClient* client) int TimeSliceThread::getNumClients() const { + const ScopedLock sl (listLock); return clients.size(); } @@ -98,6 +99,12 @@ TimeSliceClient* TimeSliceThread::getClient (const int i) const return clients[i]; } +bool TimeSliceThread::contains (const TimeSliceClient* c) const +{ + const ScopedLock sl (listLock); + return std::any_of (clients.begin(), clients.end(), [=] (auto* registered) { return registered == c; }); +} + //============================================================================== TimeSliceClient* TimeSliceThread::getNextClient (int index) const { diff --git a/modules/juce_core/threads/juce_TimeSliceThread.h b/modules/juce_core/threads/juce_TimeSliceThread.h index fc4009ad..e4986481 100644 --- a/modules/juce_core/threads/juce_TimeSliceThread.h +++ b/modules/juce_core/threads/juce_TimeSliceThread.h @@ -131,6 +131,9 @@ public: /** Returns one of the registered clients. */ TimeSliceClient* getClient (int index) const; + /** Returns true if the client is currently registered. */ + bool contains (const TimeSliceClient*) const; + //============================================================================== #ifndef DOXYGEN void run() override; diff --git a/modules/juce_core/time/juce_RelativeTime.cpp b/modules/juce_core/time/juce_RelativeTime.cpp index efa17b82..60b1a1e9 100644 --- a/modules/juce_core/time/juce_RelativeTime.cpp +++ b/modules/juce_core/time/juce_RelativeTime.cpp @@ -86,7 +86,7 @@ String RelativeTime::getApproximateDescription() const if (weeks > 8) return describeMonths ((weeks * 12) / 52); if (weeks > 1) return describeWeeks (weeks); - auto days = (int) inWeeks(); + auto days = (int) inDays(); if (days > 1) return describeDays (days); diff --git a/modules/juce_core/unit_tests/juce_UnitTestCategories.h b/modules/juce_core/unit_tests/juce_UnitTestCategories.h index 4846fb31..c4fa4b5d 100644 --- a/modules/juce_core/unit_tests/juce_UnitTestCategories.h +++ b/modules/juce_core/unit_tests/juce_UnitTestCategories.h @@ -35,7 +35,6 @@ namespace UnitTestCategories static const String cryptography { "Cryptography" }; static const String dsp { "DSP" }; static const String files { "Files" }; - static const String function { "Function" }; static const String graphics { "Graphics" }; static const String gui { "GUI" }; static const String json { "JSON" }; diff --git a/modules/juce_core/xml/juce_XmlElement.h b/modules/juce_core/xml/juce_XmlElement.h index 041539fb..c5ddd312 100644 --- a/modules/juce_core/xml/juce_XmlElement.h +++ b/modules/juce_core/xml/juce_XmlElement.h @@ -144,8 +144,8 @@ public: int lineWrapLength = 60; /**< A maximum line length before wrapping is done. (If newLineChars is nullptr, this is ignored) */ const char* newLineChars = "\r\n"; /**< Allows the newline characters to be set. If you set this to nullptr, then the whole XML document will be placed on a single line. */ - JUCE_NODISCARD TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */ - JUCE_NODISCARD TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */ + [[nodiscard]] TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */ + [[nodiscard]] TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */ }; /** Returns a text version of this XML element. diff --git a/modules/juce_cryptography/encryption/juce_BlowFish.cpp b/modules/juce_cryptography/encryption/juce_BlowFish.cpp index 150890e4..a47e4598 100644 --- a/modules/juce_cryptography/encryption/juce_BlowFish.cpp +++ b/modules/juce_cryptography/encryption/juce_BlowFish.cpp @@ -280,9 +280,8 @@ void BlowFish::encrypt (MemoryBlock& data) const auto size = data.getSize(); data.setSize (size + (8u - (size % 8u))); - auto success = encrypt (data.getData(), size, data.getSize()); + [[maybe_unused]] auto success = encrypt (data.getData(), size, data.getSize()); - ignoreUnused (success); jassert (success >= 0); } diff --git a/modules/juce_cryptography/juce_cryptography.h b/modules/juce_cryptography/juce_cryptography.h index 77fa22af..8373b146 100644 --- a/modules/juce_cryptography/juce_cryptography.h +++ b/modules/juce_cryptography/juce_cryptography.h @@ -35,12 +35,12 @@ ID: juce_cryptography vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE cryptography classes description: Classes for various basic cryptography functions, including RSA, Blowfish, MD5, SHA, etc. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_core diff --git a/modules/juce_data_structures/juce_data_structures.cpp b/modules/juce_data_structures/juce_data_structures.cpp index 4b482629..90d0d3d1 100644 --- a/modules/juce_data_structures/juce_data_structures.cpp +++ b/modules/juce_data_structures/juce_data_structures.cpp @@ -39,6 +39,7 @@ #include "values/juce_ValueTreeSynchroniser.cpp" #include "values/juce_CachedValue.cpp" #include "undomanager/juce_UndoManager.cpp" +#include "undomanager/juce_UndoableAction.cpp" #include "app_properties/juce_ApplicationProperties.cpp" #include "app_properties/juce_PropertiesFile.cpp" diff --git a/modules/juce_data_structures/juce_data_structures.h b/modules/juce_data_structures/juce_data_structures.h index 3ed772b8..4f9ebdf0 100644 --- a/modules/juce_data_structures/juce_data_structures.h +++ b/modules/juce_data_structures/juce_data_structures.h @@ -35,12 +35,12 @@ ID: juce_data_structures vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE data model helper classes description: Classes for undo/redo management, and smart data structures. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_events diff --git a/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp b/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp new file mode 100644 index 00000000..f9396269 --- /dev/null +++ b/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp @@ -0,0 +1,31 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +UndoableAction* UndoableAction::createCoalescedAction ([[maybe_unused]] UndoableAction* nextAction) { return nullptr; } + +} // namespace juce diff --git a/modules/juce_data_structures/undomanager/juce_UndoableAction.h b/modules/juce_data_structures/undomanager/juce_UndoableAction.h index 51e495ab..df868b06 100644 --- a/modules/juce_data_structures/undomanager/juce_UndoableAction.h +++ b/modules/juce_data_structures/undomanager/juce_UndoableAction.h @@ -94,7 +94,7 @@ public: If it's not possible to merge the two actions, the method should return a nullptr. */ - virtual UndoableAction* createCoalescedAction (UndoableAction* nextAction) { ignoreUnused (nextAction); return nullptr; } + virtual UndoableAction* createCoalescedAction (UndoableAction* nextAction); }; } // namespace juce diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 251d9f69..a3903d9f 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -46,7 +46,7 @@ public: SharedObject& operator= (const SharedObject&) = delete; - ~SharedObject() + ~SharedObject() override { jassert (parent == nullptr); // this should never happen unless something isn't obeying the ref-counting! @@ -873,7 +873,7 @@ ValueTree::Iterator::Iterator (const ValueTree& v, bool isEnd) ValueTree::Iterator& ValueTree::Iterator::operator++() { - internal = static_cast (internal) + 1; + ++internal; return *this; } @@ -882,7 +882,7 @@ bool ValueTree::Iterator::operator!= (const Iterator& other) const { return int ValueTree ValueTree::Iterator::operator*() const { - return ValueTree (SharedObject::Ptr (*static_cast (internal))); + return ValueTree (SharedObject::Ptr (*internal)); } ValueTree::Iterator ValueTree::begin() const noexcept { return Iterator (*this, false); } diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index d262e09c..8d147a55 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -70,6 +70,8 @@ namespace juce */ class JUCE_API ValueTree final { + JUCE_PUBLIC_IN_DLL_BUILD (class SharedObject) + public: //============================================================================== /** Creates an empty, invalid ValueTree. @@ -413,7 +415,7 @@ public: using iterator_category = std::forward_iterator_tag; private: - void* internal; + SharedObject** internal = nullptr; }; /** Returns a start iterator for the children in this tree. */ @@ -614,7 +616,6 @@ public: private: //============================================================================== - JUCE_PUBLIC_IN_DLL_BUILD (class SharedObject) friend class SharedObject; ReferenceCountedObjectPtr object; diff --git a/modules/juce_dsp/containers/juce_AudioBlock.h b/modules/juce_dsp/containers/juce_AudioBlock.h index 58e1a327..2ccf95db 100644 --- a/modules/juce_dsp/containers/juce_AudioBlock.h +++ b/modules/juce_dsp/containers/juce_AudioBlock.h @@ -31,7 +31,7 @@ namespace dsp #ifndef DOXYGEN namespace SampleTypeHelpers // Internal classes needed for handling sample type classes { - template ::value> + template > struct ElementType { using Type = T; @@ -71,10 +71,10 @@ class AudioBlock private: template using MayUseConvertingConstructor = - std::enable_if_t, - std::remove_const_t>::value - && std::is_const::value - && ! std::is_const::value, + std::enable_if_t, + std::remove_const_t> + && std::is_const_v + && ! std::is_const_v, int>; public: @@ -337,7 +337,7 @@ public: SIMDRegister then incrementing dstPos by one will increase the sample position in the AudioBuffer's units by a factor of SIMDRegister::SIMDNumElements. */ - void copyTo (AudioBuffer::type>& dst, size_t srcPos = 0, size_t dstPos = 0, + void copyTo (AudioBuffer>& dst, size_t srcPos = 0, size_t dstPos = 0, size_t numElements = std::numeric_limits::max()) const { auto dstlen = static_cast (dst.getNumSamples()) / sizeFactor; @@ -518,7 +518,7 @@ public: //============================================================================== /** Finds the minimum and maximum value of the buffer. */ - Range::type> findMinAndMax() const noexcept + Range> findMinAndMax() const noexcept { if (numChannels == 0) return {}; @@ -559,11 +559,11 @@ public: //============================================================================== // This class can only be used with floating point types - static_assert (std::is_same, float>::value - || std::is_same, double>::value + static_assert (std::is_same_v, float> + || std::is_same_v, double> #if JUCE_USE_SIMD - || std::is_same, SIMDRegister>::value - || std::is_same, SIMDRegister>::value + || std::is_same_v, SIMDRegister> + || std::is_same_v, SIMDRegister> #endif , "AudioBlock only supports single or double precision floating point types"); diff --git a/modules/juce_dsp/containers/juce_AudioBlock_test.cpp b/modules/juce_dsp/containers/juce_AudioBlock_test.cpp index df06583c..17ffad60 100644 --- a/modules/juce_dsp/containers/juce_AudioBlock_test.cpp +++ b/modules/juce_dsp/containers/juce_AudioBlock_test.cpp @@ -319,118 +319,110 @@ public: private: //============================================================================== - template - using ScalarVoid = typename std::enable_if_t < std::is_scalar ::value, void>; - - template - using SIMDVoid = typename std::enable_if_t ::value, void>; - - //============================================================================== - template - ScalarVoid copyingTests() + void copyingTests() { - auto unchangedElement1 = block.getSample (0, 4); - auto unchangedElement2 = block.getSample (1, 1); + if constexpr (std::is_scalar_v) + { + auto unchangedElement1 = block.getSample (0, 4); + auto unchangedElement2 = block.getSample (1, 1); - AudioBuffer otherBuffer (otherData.data(), (int) otherData.size(), numSamples); + AudioBuffer otherBuffer (otherData.data(), (int) otherData.size(), numSamples); - block.copyFrom (otherBuffer, 1, 2, 2); + block.copyFrom (otherBuffer, 1, 2, 2); - expectEquals (block.getSample (0, 4), unchangedElement1); - expectEquals (block.getSample (1, 1), unchangedElement2); - expectEquals (block.getSample (0, 2), otherBuffer.getSample (0, 1)); - expectEquals (block.getSample (1, 3), otherBuffer.getSample (1, 2)); + expectEquals (block.getSample (0, 4), unchangedElement1); + expectEquals (block.getSample (1, 1), unchangedElement2); + expectEquals (block.getSample (0, 2), otherBuffer.getSample (0, 1)); + expectEquals (block.getSample (1, 3), otherBuffer.getSample (1, 2)); - resetBlocks(); - - unchangedElement1 = otherBuffer.getSample (0, 4); - unchangedElement2 = otherBuffer.getSample (1, 3); + resetBlocks(); - block.copyTo (otherBuffer, 2, 1, 2); + unchangedElement1 = otherBuffer.getSample (0, 4); + unchangedElement2 = otherBuffer.getSample (1, 3); - expectEquals (otherBuffer.getSample (0, 4), unchangedElement1); - expectEquals (otherBuffer.getSample (1, 3), unchangedElement2); - expectEquals (otherBuffer.getSample (0, 1), block.getSample (0, 2)); - expectEquals (otherBuffer.getSample (1, 2), block.getSample (1, 3)); - } + block.copyTo (otherBuffer, 2, 1, 2); - #if JUCE_USE_SIMD - template - SIMDVoid copyingTests() - { - auto numSIMDElements = SIMDRegister::SIMDNumElements; - AudioBuffer numericData ((int) block.getNumChannels(), - (int) (block.getNumSamples() * numSIMDElements)); + expectEquals (otherBuffer.getSample (0, 4), unchangedElement1); + expectEquals (otherBuffer.getSample (1, 3), unchangedElement2); + expectEquals (otherBuffer.getSample (0, 1), block.getSample (0, 2)); + expectEquals (otherBuffer.getSample (1, 2), block.getSample (1, 3)); + } + #if JUCE_USE_SIMD + else + { + auto numSIMDElements = SIMDRegister::SIMDNumElements; + AudioBuffer numericData ((int) block.getNumChannels(), + (int) (block.getNumSamples() * numSIMDElements)); - for (int c = 0; c < numericData.getNumChannels(); ++c) - std::fill_n (numericData.getWritePointer (c), numericData.getNumSamples(), (NumericType) 1.0); + for (int c = 0; c < numericData.getNumChannels(); ++c) + std::fill_n (numericData.getWritePointer (c), numericData.getNumSamples(), (NumericType) 1.0); - numericData.applyGainRamp (0, numericData.getNumSamples(), (NumericType) 0.127, (NumericType) 17.3); + numericData.applyGainRamp (0, numericData.getNumSamples(), (NumericType) 0.127, (NumericType) 17.3); - auto lastUnchangedIndexBeforeCopiedRange = (int) ((numSIMDElements * 2) - 1); - auto firstUnchangedIndexAfterCopiedRange = (int) ((numSIMDElements * 4) + 1); - auto unchangedElement1 = numericData.getSample (0, lastUnchangedIndexBeforeCopiedRange); - auto unchangedElement2 = numericData.getSample (1, firstUnchangedIndexAfterCopiedRange); + auto lastUnchangedIndexBeforeCopiedRange = (int) ((numSIMDElements * 2) - 1); + auto firstUnchangedIndexAfterCopiedRange = (int) ((numSIMDElements * 4) + 1); + auto unchangedElement1 = numericData.getSample (0, lastUnchangedIndexBeforeCopiedRange); + auto unchangedElement2 = numericData.getSample (1, firstUnchangedIndexAfterCopiedRange); - block.copyTo (numericData, 1, 2, 2); + block.copyTo (numericData, 1, 2, 2); - expectEquals (numericData.getSample (0, lastUnchangedIndexBeforeCopiedRange), unchangedElement1); - expectEquals (numericData.getSample (1, firstUnchangedIndexAfterCopiedRange), unchangedElement2); - expect (SampleType (numericData.getSample (0, 2 * (int) numSIMDElements)) == block.getSample (0, 1)); - expect (SampleType (numericData.getSample (1, 3 * (int) numSIMDElements)) == block.getSample (1, 2)); + expectEquals (numericData.getSample (0, lastUnchangedIndexBeforeCopiedRange), unchangedElement1); + expectEquals (numericData.getSample (1, firstUnchangedIndexAfterCopiedRange), unchangedElement2); + expect (SampleType (numericData.getSample (0, 2 * (int) numSIMDElements)) == block.getSample (0, 1)); + expect (SampleType (numericData.getSample (1, 3 * (int) numSIMDElements)) == block.getSample (1, 2)); - numericData.applyGainRamp (0, numericData.getNumSamples(), (NumericType) 15.1, (NumericType) 0.7); + numericData.applyGainRamp (0, numericData.getNumSamples(), (NumericType) 15.1, (NumericType) 0.7); - auto unchangedSIMDElement1 = block.getSample (0, 1); - auto unchangedSIMDElement2 = block.getSample (1, 4); + auto unchangedSIMDElement1 = block.getSample (0, 1); + auto unchangedSIMDElement2 = block.getSample (1, 4); - block.copyFrom (numericData, 1, 2, 2); + block.copyFrom (numericData, 1, 2, 2); - expect (block.getSample (0, 1) == unchangedSIMDElement1); - expect (block.getSample (1, 4) == unchangedSIMDElement2); - expectEquals (block.getSample (0, 2).get (0), numericData.getSample (0, (int) numSIMDElements)); - expectEquals (block.getSample (1, 3).get (0), numericData.getSample (1, (int) (numSIMDElements * 2))); + expect (block.getSample (0, 1) == unchangedSIMDElement1); + expect (block.getSample (1, 4) == unchangedSIMDElement2); + expectEquals (block.getSample (0, 2).get (0), numericData.getSample (0, (int) numSIMDElements)); + expectEquals (block.getSample (1, 3).get (0), numericData.getSample (1, (int) (numSIMDElements * 2))); - if (numSIMDElements > 1) - { - expectEquals (block.getSample (0, 2).get (1), numericData.getSample (0, (int) (numSIMDElements + 1))); - expectEquals (block.getSample (1, 3).get (1), numericData.getSample (1, (int) ((numSIMDElements * 2) + 1))); + if (numSIMDElements > 1) + { + expectEquals (block.getSample (0, 2).get (1), numericData.getSample (0, (int) (numSIMDElements + 1))); + expectEquals (block.getSample (1, 3).get (1), numericData.getSample (1, (int) ((numSIMDElements * 2) + 1))); + } } + #endif } - #endif //============================================================================== - template - ScalarVoid smoothedValueTests() + void smoothedValueTests() { - block.fill ((SampleType) 1.0); - SmoothedValue sv { (SampleType) 1.0 }; - sv.reset (1, 4); - sv.setTargetValue ((SampleType) 0.0); - - block.multiplyBy (sv); - expect (block.getSample (0, 2) < (SampleType) 1.0); - expect (block.getSample (1, 2) < (SampleType) 1.0); - expect (block.getSample (0, 2) > (SampleType) 0.0); - expect (block.getSample (1, 2) > (SampleType) 0.0); - expectEquals (block.getSample (0, 5), (SampleType) 0.0); - expectEquals (block.getSample (1, 5), (SampleType) 0.0); - - sv.setCurrentAndTargetValue (-1.0f); - sv.setTargetValue (0.0f); - otherBlock.fill (-1.0f); - block.replaceWithProductOf (otherBlock, sv); - expect (block.getSample (0, 2) < (SampleType) 1.0); - expect (block.getSample (1, 2) < (SampleType) 1.0); - expect (block.getSample (0, 2) > (SampleType) 0.0); - expect (block.getSample (1, 2) > (SampleType) 0.0); - expectEquals (block.getSample (0, 5), (SampleType) 0.0); - expectEquals (block.getSample (1, 5), (SampleType) 0.0); + if constexpr (std::is_scalar_v) + { + block.fill ((SampleType) 1.0); + SmoothedValue sv { (SampleType) 1.0 }; + sv.reset (1, 4); + sv.setTargetValue ((SampleType) 0.0); + + block.multiplyBy (sv); + expect (block.getSample (0, 2) < (SampleType) 1.0); + expect (block.getSample (1, 2) < (SampleType) 1.0); + expect (block.getSample (0, 2) > (SampleType) 0.0); + expect (block.getSample (1, 2) > (SampleType) 0.0); + expectEquals (block.getSample (0, 5), (SampleType) 0.0); + expectEquals (block.getSample (1, 5), (SampleType) 0.0); + + sv.setCurrentAndTargetValue (-1.0f); + sv.setTargetValue (0.0f); + otherBlock.fill (-1.0f); + block.replaceWithProductOf (otherBlock, sv); + expect (block.getSample (0, 2) < (SampleType) 1.0); + expect (block.getSample (1, 2) < (SampleType) 1.0); + expect (block.getSample (0, 2) > (SampleType) 0.0); + expect (block.getSample (1, 2) > (SampleType) 0.0); + expectEquals (block.getSample (0, 5), (SampleType) 0.0); + expectEquals (block.getSample (1, 5), (SampleType) 0.0); + } } - template - SIMDVoid smoothedValueTests() {} - //============================================================================== void resetBlocks() { @@ -451,7 +443,7 @@ private: //============================================================================== static SampleType* allocateAlignedMemory (int numSamplesToAllocate) { - auto alignmentLowerBound = std::alignment_of::value; + auto alignmentLowerBound = std::alignment_of_v; #if ! JUCE_WINDOWS alignmentLowerBound = jmax (sizeof (void*), alignmentLowerBound); #endif diff --git a/modules/juce_dsp/containers/juce_FixedSizeFunction.h b/modules/juce_dsp/containers/juce_FixedSizeFunction.h index 565f8658..1051e853 100644 --- a/modules/juce_dsp/containers/juce_FixedSizeFunction.h +++ b/modules/juce_dsp/containers/juce_FixedSizeFunction.h @@ -56,13 +56,13 @@ namespace detail } template - typename std::enable_if::value, Ret>::type call (void* s, Args... args) + std::enable_if_t, Ret> call (void* s, Args... args) { (*reinterpret_cast (s)) (args...); } template - typename std::enable_if::value, Ret>::type call (void* s, Args... args) + std::enable_if_t, Ret> call (void* s, Args... args) { return (*reinterpret_cast (s)) (std::forward (args)...); } @@ -70,10 +70,9 @@ namespace detail template void clear (void* s) { - auto& fn = *reinterpret_cast (s); - fn.~Fn(); // I know this looks insane, for some reason MSVC 14 sometimes thinks fn is unreferenced - ignoreUnused (fn); + [[maybe_unused]] auto& fn = *reinterpret_cast (s); + fn.~Fn(); } template @@ -102,16 +101,16 @@ template class FixedSizeFunction { private: - using Storage = typename std::aligned_storage::type; + using Storage = std::aligned_storage_t; template - using Decay = typename std::decay::type; + using Decay = std::decay_t; template > - using IntIfValidConversion = typename std::enable_if::value, - int>::type; + using IntIfValidConversion = std::enable_if_t, + int>; public: /** Create an empty function. */ @@ -149,7 +148,7 @@ public: } /** Converting constructor from smaller FixedSizeFunctions. */ - template ::type = 0> + template = 0> FixedSizeFunction (FixedSizeFunction&& other) noexcept : vtable (other.vtable) { @@ -172,7 +171,7 @@ public: } /** Move assignment from smaller FixedSizeFunctions. */ - template ::type = 0> + template = 0> FixedSizeFunction& operator= (FixedSizeFunction&& other) noexcept { return *this = FixedSizeFunction (std::move (other)); diff --git a/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp b/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp index 6c4aa84a..e8122191 100644 --- a/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp +++ b/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp @@ -334,8 +334,8 @@ public: bool smallCalled = false; bool largeCalled = false; - SmallFn small = [&smallCalled, a = std::array{}] { smallCalled = true; juce::ignoreUnused (a); }; - LargeFn large = [&largeCalled, a = std::array{}] { largeCalled = true; juce::ignoreUnused (a); }; + SmallFn small = [&smallCalled, a = std::array{}] { smallCalled = true; ignoreUnused (a); }; + LargeFn large = [&largeCalled, a = std::array{}] { largeCalled = true; ignoreUnused (a); }; large = std::move (small); diff --git a/modules/juce_dsp/containers/juce_SIMDRegister.h b/modules/juce_dsp/containers/juce_SIMDRegister.h index 270193ab..04449a79 100644 --- a/modules/juce_dsp/containers/juce_SIMDRegister.h +++ b/modules/juce_dsp/containers/juce_SIMDRegister.h @@ -70,7 +70,7 @@ struct SIMDRegister /** The corresponding primitive integer type, for example, this will be int32_t if type is a float. */ - using MaskType = typename SIMDInternal::MaskTypeFor::type; + using MaskType = SIMDInternal::MaskType; //============================================================================== // Here are some types which are needed internally diff --git a/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp b/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp index f5ed7de8..a8881fcb 100644 --- a/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp +++ b/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp @@ -30,33 +30,32 @@ namespace dsp namespace SIMDRegister_test_internal { - template struct RandomPrimitive {}; - template - struct RandomPrimitive::value>::type> + struct RandomPrimitive { static type next (Random& random) { - return static_cast (std::is_signed::value ? (random.nextFloat() * 16.0) - 8.0 - : (random.nextFloat() * 8.0)); + if constexpr (std::is_floating_point_v) + { + return static_cast (std::is_signed_v ? (random.nextFloat() * 16.0) - 8.0 + : (random.nextFloat() * 8.0)); + } + else if constexpr (std::is_integral_v) + { + return static_cast (random.nextInt64()); + } } }; template - struct RandomPrimitive::value>::type> + struct RandomValue { static type next (Random& random) { - return static_cast (random.nextInt64()); + return RandomPrimitive::next (random); } }; - template - struct RandomValue - { - static type next (Random& random) { return RandomPrimitive::next (random); } - }; - template struct RandomValue> { @@ -756,11 +755,10 @@ public: template static void run (UnitTest& u, Random& random, Tag) { - bool is_signed = std::is_signed::value; type array [SIMDRegister::SIMDNumElements]; - auto value = is_signed ? static_cast ((random.nextFloat() * 16.0) - 8.0) - : static_cast (random.nextFloat() * 8.0); + auto value = std::is_signed_v ? static_cast ((random.nextFloat() * 16.0) - 8.0) + : static_cast (random.nextFloat() * 8.0); std::fill (array, array + SIMDRegister::SIMDNumElements, value); SIMDRegister a, b; diff --git a/modules/juce_dsp/frequency/juce_Convolution.h b/modules/juce_dsp/frequency/juce_Convolution.h index f9b18a04..19c44f57 100644 --- a/modules/juce_dsp/frequency/juce_Convolution.h +++ b/modules/juce_dsp/frequency/juce_Convolution.h @@ -184,7 +184,7 @@ public: stereo processing. */ template ::value, int> = 0> + std::enable_if_t, int> = 0> void process (const ProcessContext& context) noexcept { processSamples (context.getInputBlock(), context.getOutputBlock(), context.isBypassed); diff --git a/modules/juce_dsp/frequency/juce_Convolution_test.cpp b/modules/juce_dsp/frequency/juce_Convolution_test.cpp index 115c2c76..ab676f44 100644 --- a/modules/juce_dsp/frequency/juce_Convolution_test.cpp +++ b/modules/juce_dsp/frequency/juce_Convolution_test.cpp @@ -62,7 +62,7 @@ class ConvolutionTest : public UnitTest AudioBuffer result (2, length); result.clear(); - auto** channels = result.getArrayOfWritePointers(); + auto* const* channels = result.getArrayOfWritePointers(); std::for_each (channels, channels + result.getNumChannels(), [length] (auto* channel) { std::fill (channel, channel + length, 1.0f); diff --git a/modules/juce_dsp/juce_dsp.cpp b/modules/juce_dsp/juce_dsp.cpp index 40dd665f..e939a6a8 100644 --- a/modules/juce_dsp/juce_dsp.cpp +++ b/modules/juce_dsp/juce_dsp.cpp @@ -79,13 +79,13 @@ #include "widgets/juce_Chorus.cpp" #if JUCE_USE_SIMD - #if defined(__i386__) || defined(__amd64__) || defined(_M_X64) || defined(_X86_) || defined(_M_IX86) + #if JUCE_INTEL #ifdef __AVX2__ #include "native/juce_avx_SIMDNativeOps.cpp" #else #include "native/juce_sse_SIMDNativeOps.cpp" #endif - #elif defined(__arm__) || defined(_M_ARM) || defined (__arm64__) || defined (__aarch64__) + #elif JUCE_ARM #include "native/juce_neon_SIMDNativeOps.cpp" #else #error "SIMD register support not implemented for this platform" diff --git a/modules/juce_dsp/juce_dsp.h b/modules/juce_dsp/juce_dsp.h index 17ca0c08..a64e65ad 100644 --- a/modules/juce_dsp/juce_dsp.h +++ b/modules/juce_dsp/juce_dsp.h @@ -35,12 +35,12 @@ ID: juce_dsp vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE DSP classes description: Classes for audio buffer manipulation, digital audio processing, filtering, oversampling, fast math functions etc. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_audio_formats OSXFrameworks: Accelerate @@ -74,7 +74,9 @@ #include #endif -#elif defined (__ARM_NEON__) || defined (__ARM_NEON) || defined (__arm64__) || defined (__aarch64__) +// it's ok to check for _M_ARM below as this is only defined on Windows for Arm 32-bit +// which has a minimum requirement of armv7, which supports neon. +#elif defined (__ARM_NEON__) || defined (__ARM_NEON) || defined (__arm64__) || defined (__aarch64__) || defined (_M_ARM) || defined (_M_ARM64) #ifndef JUCE_USE_SIMD #define JUCE_USE_SIMD 1 @@ -206,10 +208,10 @@ namespace juce inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } #endif #else - inline void snapToZero (float& x) noexcept { ignoreUnused (x); } + inline void snapToZero ([[maybe_unused]] float& x) noexcept {} #ifndef DOXYGEN - inline void snapToZero (double& x) noexcept { ignoreUnused (x); } - inline void snapToZero (long double& x) noexcept { ignoreUnused (x); } + inline void snapToZero ([[maybe_unused]] double& x) noexcept {} + inline void snapToZero ([[maybe_unused]] long double& x) noexcept {} #endif #endif } @@ -227,7 +229,7 @@ namespace juce #else #include "native/juce_sse_SIMDNativeOps.h" #endif - #elif defined(__arm__) || defined(_M_ARM) || defined (__arm64__) || defined (__aarch64__) + #elif JUCE_ARM #include "native/juce_neon_SIMDNativeOps.h" #else #error "SIMD register support not implemented for this platform" diff --git a/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h b/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h index 2e0c72b9..595e02e0 100644 --- a/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_fallback_SIMDNativeOps.h @@ -42,8 +42,10 @@ namespace SIMDInternal template <> struct MaskTypeFor > { using type = uint32_t; }; template <> struct MaskTypeFor > { using type = uint64_t; }; - template struct PrimitiveType { using type = typename std::remove_cv::type; }; - template struct PrimitiveType> { using type = typename std::remove_cv::type; }; + template using MaskType = typename MaskTypeFor::type; + + template struct PrimitiveType { using type = std::remove_cv_t; }; + template struct PrimitiveType> { using type = std::remove_cv_t; }; template struct Log2Helper { enum { value = Log2Helper::value + 1 }; }; template <> struct Log2Helper<1> { enum { value = 0 }; }; @@ -63,7 +65,7 @@ struct SIMDFallbackOps static constexpr size_t bits = SIMDInternal::Log2Helper<(int) n>::value; // helper types - using MaskType = typename SIMDInternal::MaskTypeFor::type; + using MaskType = SIMDInternal::MaskType; union UnionType { vSIMDType v; ScalarType s[n]; }; union UnionMaskType { vSIMDType v; MaskType m[n]; }; diff --git a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.cpp b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.cpp index 1391e6ec..2cbd565d 100644 --- a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.cpp +++ b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.cpp @@ -31,6 +31,11 @@ namespace juce DEFINE_NEON_SIMD_CONST (int32_t, float, kEvenHighBit) = { static_cast(0x80000000), 0, static_cast(0x80000000), 0 }; DEFINE_NEON_SIMD_CONST (float, float, kOne) = { 1.0f, 1.0f, 1.0f, 1.0f }; + #if JUCE_64BIT + DEFINE_NEON_SIMD_CONST (int64_t, double, kAllBitsSet) = { -1, -1 }; + DEFINE_NEON_SIMD_CONST (double, double, kOne) = { 1.0, 1.0 }; + #endif + DEFINE_NEON_SIMD_CONST (int8_t, int8_t, kAllBitsSet) = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; DEFINE_NEON_SIMD_CONST (uint8_t, uint8_t, kAllBitsSet) = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; DEFINE_NEON_SIMD_CONST (int16_t, int16_t, kAllBitsSet) = { -1, -1, -1, -1, -1, -1, -1, -1 }; diff --git a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h index f9cca4d5..7f3c6660 100644 --- a/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_neon_SIMDNativeOps.h @@ -69,9 +69,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (uint32_t s) noexcept { return vdupq_n_u32 (s); } static forcedinline vSIMDType load (const uint32_t* a) noexcept { return vld1q_u32 (a); } - static forcedinline void store (vSIMDType value, uint32_t* a) noexcept { vst1q_u32 (a, value); } - static forcedinline uint32_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, uint32_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, uint32_t* a) noexcept { vst1q_u32 (a, value); } + static forcedinline uint32_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, uint32_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_u32 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_u32 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_u32 (a, b); } @@ -115,9 +115,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (int32_t s) noexcept { return vdupq_n_s32 (s); } static forcedinline vSIMDType load (const int32_t* a) noexcept { return vld1q_s32 (a); } - static forcedinline void store (vSIMDType value, int32_t* a) noexcept { vst1q_s32 (a, value); } - static forcedinline int32_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, int32_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, int32_t* a) noexcept { vst1q_s32 (a, value); } + static forcedinline int32_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, int32_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_s32 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_s32 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_s32 (a, b); } @@ -162,9 +162,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (int8_t s) noexcept { return vdupq_n_s8 (s); } static forcedinline vSIMDType load (const int8_t* a) noexcept { return vld1q_s8 (a); } - static forcedinline void store (vSIMDType value, int8_t* a) noexcept { vst1q_s8 (a, value); } - static forcedinline int8_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, int8_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, int8_t* a) noexcept { vst1q_s8 (a, value); } + static forcedinline int8_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, int8_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_s8 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_s8 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_s8 (a, b); } @@ -181,7 +181,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgeq_s8 (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return vmlaq_s8 (a, b, c); } - static forcedinline int8_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline int8_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -203,9 +203,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (uint8_t s) noexcept { return vdupq_n_u8 (s); } static forcedinline vSIMDType load (const uint8_t* a) noexcept { return vld1q_u8 (a); } - static forcedinline void store (vSIMDType value, uint8_t* a) noexcept { vst1q_u8 (a, value); } - static forcedinline uint8_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, uint8_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, uint8_t* a) noexcept { vst1q_u8 (a, value); } + static forcedinline uint8_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, uint8_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_u8 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_u8 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_u8 (a, b); } @@ -222,7 +222,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgeq_u8 (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return vmlaq_u8 (a, b, c); } - static forcedinline uint8_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline uint8_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -244,9 +244,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (int16_t s) noexcept { return vdupq_n_s16 (s); } static forcedinline vSIMDType load (const int16_t* a) noexcept { return vld1q_s16 (a); } - static forcedinline void store (vSIMDType value, int16_t* a) noexcept { vst1q_s16 (a, value); } - static forcedinline int16_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, int16_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, int16_t* a) noexcept { vst1q_s16 (a, value); } + static forcedinline int16_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, int16_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_s16 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_s16 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_s16 (a, b); } @@ -263,7 +263,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgeq_s16 (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return vmlaq_s16 (a, b, c); } - static forcedinline int16_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline int16_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -286,9 +286,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (uint16_t s) noexcept { return vdupq_n_u16 (s); } static forcedinline vSIMDType load (const uint16_t* a) noexcept { return vld1q_u16 (a); } - static forcedinline void store (vSIMDType value, uint16_t* a) noexcept { vst1q_u16 (a, value); } - static forcedinline uint16_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, uint16_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, uint16_t* a) noexcept { vst1q_u16 (a, value); } + static forcedinline uint16_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, uint16_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_u16 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_u16 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_u16 (a, b); } @@ -305,7 +305,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgeq_u16 (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return vmlaq_u16 (a, b, c); } - static forcedinline uint16_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline uint16_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -327,9 +327,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (int64_t s) noexcept { return vdupq_n_s64 (s); } static forcedinline vSIMDType load (const int64_t* a) noexcept { return vld1q_s64 (a); } - static forcedinline void store (vSIMDType value, int64_t* a) noexcept { vst1q_s64 (a, value); } - static forcedinline int64_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, int64_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, int64_t* a) noexcept { vst1q_s64 (a, value); } + static forcedinline int64_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, int64_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_s64 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_s64 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return fb::mul (a, b); } @@ -346,7 +346,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThanOrEqual (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return fb::multiplyAdd (a, b, c); } - static forcedinline int64_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline int64_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -369,9 +369,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (uint64_t s) noexcept { return vdupq_n_u64 (s); } static forcedinline vSIMDType load (const uint64_t* a) noexcept { return vld1q_u64 (a); } - static forcedinline void store (vSIMDType value, uint64_t* a) noexcept { vst1q_u64 (a, value); } - static forcedinline uint64_t get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, uint64_t s) noexcept { v[i] = s; return v; } + static forcedinline void store (vSIMDType value, uint64_t* a) noexcept { vst1q_u64 (a, value); } + static forcedinline uint64_t get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, uint64_t s) noexcept { return fb::set (v, i, s); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_u64 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_u64 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return fb::mul (a, b); } @@ -388,7 +388,7 @@ struct SIMDNativeOps static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return fb::greaterThanOrEqual (a, b); } static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return fb::multiplyAdd (a, b, c); } - static forcedinline uint64_t sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline uint64_t sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return a; } }; @@ -413,9 +413,9 @@ struct SIMDNativeOps //============================================================================== static forcedinline vSIMDType expand (float s) noexcept { return vdupq_n_f32 (s); } static forcedinline vSIMDType load (const float* a) noexcept { return vld1q_f32 (a); } - static forcedinline float get (vSIMDType v, size_t i) noexcept { return v[i]; } - static forcedinline vSIMDType set (vSIMDType v, size_t i, float s) noexcept { v[i] = s; return v; } - static forcedinline void store (vSIMDType value, float* a) noexcept { vst1q_f32 (a, value); } + static forcedinline float get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, float s) noexcept { return fb::set (v, i, s); } + static forcedinline void store (vSIMDType value, float* a) noexcept { vst1q_f32 (a, value); } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_f32 (a, b); } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_f32 (a, b); } static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_f32 (a, b); } @@ -459,6 +459,47 @@ struct SIMDNativeOps @tags{DSP} */ +#if JUCE_64BIT +template <> +struct SIMDNativeOps +{ + //============================================================================== + using vSIMDType = float64x2_t; + using vMaskType = uint64x2_t; + using fb = SIMDFallbackOps; + + //============================================================================== + DECLARE_NEON_SIMD_CONST (int64_t, kAllBitsSet); + DECLARE_NEON_SIMD_CONST (double, kOne); + + //============================================================================== + static forcedinline vSIMDType expand (double s) noexcept { return vdupq_n_f64 (s); } + static forcedinline vSIMDType load (const double* a) noexcept { return vld1q_f64 (a); } + static forcedinline double get (vSIMDType v, size_t i) noexcept { return fb::get (v, i); } + static forcedinline vSIMDType set (vSIMDType v, size_t i, double s) noexcept { return fb::set (v, i, s); } + static forcedinline void store (vSIMDType value, double* a) noexcept { vst1q_f64 (a, value); } + static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return vaddq_f64 (a, b); } + static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return vsubq_f64 (a, b); } + static forcedinline vSIMDType mul (vSIMDType a, vSIMDType b) noexcept { return vmulq_f64 (a, b); } + static forcedinline vSIMDType bit_and (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vandq_u64 ((vMaskType) a, (vMaskType) b); } + static forcedinline vSIMDType bit_or (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vorrq_u64 ((vMaskType) a, (vMaskType) b); } + static forcedinline vSIMDType bit_xor (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) veorq_u64 ((vMaskType) a, (vMaskType) b); } + static forcedinline vSIMDType bit_notand (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vbicq_u64 ((vMaskType) b, (vMaskType) a); } + static forcedinline vSIMDType bit_not (vSIMDType a) noexcept { return bit_notand (a, vld1q_f64 ((double*) kAllBitsSet)); } + static forcedinline vSIMDType min (vSIMDType a, vSIMDType b) noexcept { return vminq_f64 (a, b); } + static forcedinline vSIMDType max (vSIMDType a, vSIMDType b) noexcept { return vmaxq_f64 (a, b); } + static forcedinline vSIMDType equal (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vceqq_f64 (a, b); } + static forcedinline vSIMDType notEqual (vSIMDType a, vSIMDType b) noexcept { return bit_not (equal (a, b)); } + static forcedinline vSIMDType greaterThan (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgtq_f64 (a, b); } + static forcedinline vSIMDType greaterThanOrEqual (vSIMDType a, vSIMDType b) noexcept { return (vSIMDType) vcgeq_f64 (a, b); } + static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return (SIMDNativeOps::sum ((SIMDNativeOps::vSIMDType) notEqual (a, b)) == 0); } + static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return vmlaq_f64 (a, b, c); } + static forcedinline vSIMDType cmplxmul (vSIMDType a, vSIMDType b) noexcept { return fb::cmplxmul (a, b); } + static forcedinline double sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline vSIMDType oddevensum (vSIMDType a) noexcept { return a; } + static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return vcvtq_f64_s64 (vcvtq_s64_f64 (a)); } +}; +#else template <> struct SIMDNativeOps { @@ -468,8 +509,8 @@ struct SIMDNativeOps static forcedinline vSIMDType expand (double s) noexcept { return {{s, s}}; } static forcedinline vSIMDType load (const double* a) noexcept { return {{a[0], a[1]}}; } - static forcedinline void store (vSIMDType v, double* a) noexcept { a[0] = v.v[0]; a[1] = v.v[1]; } - static forcedinline double get (vSIMDType v, size_t i) noexcept { return v.v[i]; } + static forcedinline void store (vSIMDType v, double* a) noexcept { a[0] = v.v[0]; a[1] = v.v[1]; } + static forcedinline double get (vSIMDType v, size_t i) noexcept { return v.v[i]; } static forcedinline vSIMDType set (vSIMDType v, size_t i, double s) noexcept { v.v[i] = s; return v; } static forcedinline vSIMDType add (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] + b.v[0], a.v[1] + b.v[1]}}; } static forcedinline vSIMDType sub (vSIMDType a, vSIMDType b) noexcept { return {{a.v[0] - b.v[0], a.v[1] - b.v[1]}}; } @@ -488,12 +529,12 @@ struct SIMDNativeOps static forcedinline bool allEqual (vSIMDType a, vSIMDType b) noexcept { return fb::allEqual (a, b); } static forcedinline vSIMDType multiplyAdd (vSIMDType a, vSIMDType b, vSIMDType c) noexcept { return fb::multiplyAdd (a, b, c); } static forcedinline vSIMDType cmplxmul (vSIMDType a, vSIMDType b) noexcept { return fb::cmplxmul (a, b); } - static forcedinline double sum (vSIMDType a) noexcept { return fb::sum (a); } + static forcedinline double sum (vSIMDType a) noexcept { return fb::sum (a); } static forcedinline vSIMDType oddevensum (vSIMDType a) noexcept { return a; } static forcedinline vSIMDType truncate (vSIMDType a) noexcept { return fb::truncate (a); } }; - -#endif +#endif // JUCE_64BIT +#endif // #ifndef DOXYGEN JUCE_END_IGNORE_WARNINGS_GCC_LIKE diff --git a/modules/juce_dsp/processors/juce_DelayLine.h b/modules/juce_dsp/processors/juce_DelayLine.h index a32295f0..0d922376 100644 --- a/modules/juce_dsp/processors/juce_DelayLine.h +++ b/modules/juce_dsp/processors/juce_DelayLine.h @@ -201,126 +201,104 @@ public: private: //============================================================================== - template - typename std::enable_if ::value, SampleType>::type - interpolateSample (int channel) const + SampleType interpolateSample (int channel) { - auto index = (readPos[(size_t) channel] + delayInt) % totalSize; - return bufferData.getSample (channel, index); - } - - template - typename std::enable_if ::value, SampleType>::type - interpolateSample (int channel) const - { - auto index1 = readPos[(size_t) channel] + delayInt; - auto index2 = index1 + 1; - - if (index2 >= totalSize) + if constexpr (std::is_same_v) { - index1 %= totalSize; - index2 %= totalSize; + auto index = (readPos[(size_t) channel] + delayInt) % totalSize; + return bufferData.getSample (channel, index); } + else if constexpr (std::is_same_v) + { + auto index1 = readPos[(size_t) channel] + delayInt; + auto index2 = index1 + 1; - auto value1 = bufferData.getSample (channel, index1); - auto value2 = bufferData.getSample (channel, index2); - - return value1 + delayFrac * (value2 - value1); - } + if (index2 >= totalSize) + { + index1 %= totalSize; + index2 %= totalSize; + } - template - typename std::enable_if ::value, SampleType>::type - interpolateSample (int channel) const - { - auto index1 = readPos[(size_t) channel] + delayInt; - auto index2 = index1 + 1; - auto index3 = index2 + 1; - auto index4 = index3 + 1; + auto value1 = bufferData.getSample (channel, index1); + auto value2 = bufferData.getSample (channel, index2); - if (index4 >= totalSize) - { - index1 %= totalSize; - index2 %= totalSize; - index3 %= totalSize; - index4 %= totalSize; + return value1 + delayFrac * (value2 - value1); } + else if constexpr (std::is_same_v) + { + auto index1 = readPos[(size_t) channel] + delayInt; + auto index2 = index1 + 1; + auto index3 = index2 + 1; + auto index4 = index3 + 1; - auto* samples = bufferData.getReadPointer (channel); + if (index4 >= totalSize) + { + index1 %= totalSize; + index2 %= totalSize; + index3 %= totalSize; + index4 %= totalSize; + } - auto value1 = samples[index1]; - auto value2 = samples[index2]; - auto value3 = samples[index3]; - auto value4 = samples[index4]; + auto* samples = bufferData.getReadPointer (channel); - auto d1 = delayFrac - 1.f; - auto d2 = delayFrac - 2.f; - auto d3 = delayFrac - 3.f; + auto value1 = samples[index1]; + auto value2 = samples[index2]; + auto value3 = samples[index3]; + auto value4 = samples[index4]; - auto c1 = -d1 * d2 * d3 / 6.f; - auto c2 = d2 * d3 * 0.5f; - auto c3 = -d1 * d3 * 0.5f; - auto c4 = d1 * d2 / 6.f; + auto d1 = delayFrac - 1.f; + auto d2 = delayFrac - 2.f; + auto d3 = delayFrac - 3.f; - return value1 * c1 + delayFrac * (value2 * c2 + value3 * c3 + value4 * c4); - } + auto c1 = -d1 * d2 * d3 / 6.f; + auto c2 = d2 * d3 * 0.5f; + auto c3 = -d1 * d3 * 0.5f; + auto c4 = d1 * d2 / 6.f; - template - typename std::enable_if ::value, SampleType>::type - interpolateSample (int channel) - { - auto index1 = readPos[(size_t) channel] + delayInt; - auto index2 = index1 + 1; - - if (index2 >= totalSize) - { - index1 %= totalSize; - index2 %= totalSize; + return value1 * c1 + delayFrac * (value2 * c2 + value3 * c3 + value4 * c4); } + else if constexpr (std::is_same_v) + { + auto index1 = readPos[(size_t) channel] + delayInt; + auto index2 = index1 + 1; - auto value1 = bufferData.getSample (channel, index1); - auto value2 = bufferData.getSample (channel, index2); - - auto output = delayFrac == 0 ? value1 : value2 + alpha * (value1 - v[(size_t) channel]); - v[(size_t) channel] = output; - - return output; - } + if (index2 >= totalSize) + { + index1 %= totalSize; + index2 %= totalSize; + } - //============================================================================== - template - typename std::enable_if ::value, void>::type - updateInternalVariables() - { - } + auto value1 = bufferData.getSample (channel, index1); + auto value2 = bufferData.getSample (channel, index2); - template - typename std::enable_if ::value, void>::type - updateInternalVariables() - { - } + auto output = delayFrac == 0 ? value1 : value2 + alpha * (value1 - v[(size_t) channel]); + v[(size_t) channel] = output; - template - typename std::enable_if ::value, void>::type - updateInternalVariables() - { - if (delayInt >= 1) - { - delayFrac++; - delayInt--; + return output; } } - template - typename std::enable_if ::value, void>::type - updateInternalVariables() + //============================================================================== + void updateInternalVariables() { - if (delayFrac < (SampleType) 0.618 && delayInt >= 1) + if constexpr (std::is_same_v) { - delayFrac++; - delayInt--; + if (delayInt >= 1) + { + delayFrac++; + delayInt--; + } } + else if constexpr (std::is_same_v) + { + if (delayFrac < (SampleType) 0.618 && delayInt >= 1) + { + delayFrac++; + delayInt--; + } - alpha = (1 - delayFrac) / (1 + delayFrac); + alpha = (1 - delayFrac) / (1 + delayFrac); + } } //============================================================================== diff --git a/modules/juce_dsp/processors/juce_FIRFilter.h b/modules/juce_dsp/processors/juce_FIRFilter.h index 560fdc2c..203c1283 100644 --- a/modules/juce_dsp/processors/juce_FIRFilter.h +++ b/modules/juce_dsp/processors/juce_FIRFilter.h @@ -122,7 +122,7 @@ namespace FIR template void process (const ProcessContext& context) noexcept { - static_assert (std::is_same::value, + static_assert (std::is_same_v, "The sample-type of the FIR filter must match the sample-type supplied to this process callback"); check(); diff --git a/modules/juce_dsp/processors/juce_IIRFilter_Impl.h b/modules/juce_dsp/processors/juce_IIRFilter_Impl.h index 9644f4dc..150ab429 100644 --- a/modules/juce_dsp/processors/juce_IIRFilter_Impl.h +++ b/modules/juce_dsp/processors/juce_IIRFilter_Impl.h @@ -89,7 +89,7 @@ template template void Filter::processInternal (const ProcessContext& context) noexcept { - static_assert (std::is_same::value, + static_assert (std::is_same_v, "The sample-type of the IIR filter must match the sample-type supplied to this process callback"); check(); diff --git a/modules/juce_dsp/processors/juce_ProcessorChain.h b/modules/juce_dsp/processors/juce_ProcessorChain.h index 3b0cdfe4..9f821018 100644 --- a/modules/juce_dsp/processors/juce_ProcessorChain.h +++ b/modules/juce_dsp/processors/juce_ProcessorChain.h @@ -38,11 +38,11 @@ namespace detail template constexpr void forEachInTuple (Fn&& fn, Tuple&& tuple, std::index_sequence) { - (void) std::initializer_list { ((void) fn (std::get (tuple), std::integral_constant()), 0)... }; + (fn (std::get (tuple), std::integral_constant()), ...); } template - using TupleIndexSequence = std::make_index_sequence>>::value>; + using TupleIndexSequence = std::make_index_sequence>>>; template constexpr void forEachInTuple (Fn&& fn, Tuple&& tuple) @@ -50,12 +50,8 @@ namespace detail forEachInTuple (std::forward (fn), std::forward (tuple), TupleIndexSequence{}); } - // This could be a template variable, but that code causes an internal compiler error in MSVC 19.00.24215 template - struct UseContextDirectly - { - static constexpr auto value = ! Context::usesSeparateInputAndOutputBlocks() || Ix == 0; - }; + inline constexpr auto useContextDirectly = ! Context::usesSeparateInputAndOutputBlocks() || Ix == 0; } #endif @@ -103,23 +99,24 @@ public: } private: - template ::value, int> = 0> + template void processOne (const Context& context, Proc& proc, std::integral_constant) noexcept { - jassert (context.getOutputBlock().getNumChannels() == context.getInputBlock().getNumChannels()); - ProcessContextReplacing replacingContext (context.getOutputBlock()); - replacingContext.isBypassed = (bypassed[Ix] || context.isBypassed); - - proc.process (replacingContext); - } - - template ::value, int> = 0> - void processOne (const Context& context, Proc& proc, std::integral_constant) noexcept - { - auto contextCopy = context; - contextCopy.isBypassed = (bypassed[Ix] || context.isBypassed); - - proc.process (contextCopy); + if constexpr (detail::useContextDirectly) + { + auto contextCopy = context; + contextCopy.isBypassed = (bypassed[Ix] || context.isBypassed); + + proc.process (contextCopy); + } + else + { + jassert (context.getOutputBlock().getNumChannels() == context.getInputBlock().getNumChannels()); + ProcessContextReplacing replacingContext (context.getOutputBlock()); + replacingContext.isBypassed = (bypassed[Ix] || context.isBypassed); + + proc.process (replacingContext); + } } std::tuple processors; diff --git a/modules/juce_dsp/processors/juce_StateVariableFilter.h b/modules/juce_dsp/processors/juce_StateVariableFilter.h index 9a991608..6554b2bc 100644 --- a/modules/juce_dsp/processors/juce_StateVariableFilter.h +++ b/modules/juce_dsp/processors/juce_StateVariableFilter.h @@ -110,7 +110,7 @@ namespace StateVariableFilter template void process (const ProcessContext& context) noexcept { - static_assert (std::is_same::value, + static_assert (std::is_same_v, "The sample-type of the filter must match the sample-type supplied to this process callback"); if (context.isBypassed) diff --git a/modules/juce_dsp/widgets/juce_WaveShaper.h b/modules/juce_dsp/widgets/juce_WaveShaper.h index 30dfdb3b..995c20e7 100644 --- a/modules/juce_dsp/widgets/juce_WaveShaper.h +++ b/modules/juce_dsp/widgets/juce_WaveShaper.h @@ -71,7 +71,7 @@ struct WaveShaper }; //============================================================================== -#if JUCE_CXX17_IS_AVAILABLE && ! ((JUCE_MAC || JUCE_IOS) && JUCE_CLANG && __clang_major__ < 10) +#if ! ((JUCE_MAC || JUCE_IOS) && JUCE_CLANG && __clang_major__ < 10) template static WaveShaper, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } #else diff --git a/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp b/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp index d7e4b00a..dce744f3 100644 --- a/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp +++ b/modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp @@ -51,7 +51,7 @@ struct ChildProcessPingThread : public Thread, pingReceived(); } - void startPinging() { startThread (4); } + void startPinging() { startThread (Priority::low); } void pingReceived() noexcept { countdown = timeoutMs / 1000 + 1; } void triggerConnectionLostMessage() { triggerAsyncUpdate(); } diff --git a/modules/juce_events/interprocess/juce_NetworkServiceDiscovery.cpp b/modules/juce_events/interprocess/juce_NetworkServiceDiscovery.cpp index f1b006d6..add5e521 100644 --- a/modules/juce_events/interprocess/juce_NetworkServiceDiscovery.cpp +++ b/modules/juce_events/interprocess/juce_NetworkServiceDiscovery.cpp @@ -41,7 +41,7 @@ NetworkServiceDiscovery::Advertiser::Advertiser (const String& serviceTypeUID, message.setAttribute ("address", String()); message.setAttribute ("port", connectionPort); - startThread (2); + startThread (Priority::background); } NetworkServiceDiscovery::Advertiser::~Advertiser() @@ -92,7 +92,7 @@ NetworkServiceDiscovery::AvailableServiceList::AvailableServiceList (const Strin #endif socket.bindToPort (broadcastPort); - startThread (2); + startThread (Priority::background); } NetworkServiceDiscovery::AvailableServiceList::~AvailableServiceList() diff --git a/modules/juce_events/juce_events.h b/modules/juce_events/juce_events.h index 6f7e5060..b3d60e38 100644 --- a/modules/juce_events/juce_events.h +++ b/modules/juce_events/juce_events.h @@ -32,12 +32,12 @@ ID: juce_events vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE message and event handling classes description: Classes for running an application's main event loop and sending/receiving messages, timers, etc. website: http://www.juce.com/juce license: ISC - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_core diff --git a/modules/juce_events/messages/juce_ApplicationBase.cpp b/modules/juce_events/messages/juce_ApplicationBase.cpp index 604a649e..04f534be 100644 --- a/modules/juce_events/messages/juce_ApplicationBase.cpp +++ b/modules/juce_events/messages/juce_ApplicationBase.cpp @@ -199,14 +199,12 @@ String JUCEApplicationBase::getCommandLineParameters() { String argString; - for (int i = 1; i < juce_argc; ++i) + for (const auto& arg : getCommandLineParameterArray()) { - String arg { CharPointer_UTF8 (juce_argv[i]) }; - - if (arg.containsChar (' ') && ! arg.isQuotedString()) - arg = arg.quoted ('"'); - - argString << arg << ' '; + const auto withQuotes = arg.containsChar (' ') && ! arg.isQuotedString() + ? arg.quoted ('"') + : arg; + argString << withQuotes << ' '; } return argString.trim(); @@ -214,7 +212,12 @@ String JUCEApplicationBase::getCommandLineParameters() StringArray JUCEApplicationBase::getCommandLineParameterArray() { - return StringArray (juce_argv + 1, juce_argc - 1); + StringArray result; + + for (int i = 1; i < juce_argc; ++i) + result.add (CharPointer_UTF8 (juce_argv[i])); + + return result; } int JUCEApplicationBase::main (int argc, const char* argv[]) diff --git a/modules/juce_events/native/juce_linux_Messaging.cpp b/modules/juce_events/native/juce_linux_Messaging.cpp index dcf58334..69fa2394 100644 --- a/modules/juce_events/native/juce_linux_Messaging.cpp +++ b/modules/juce_events/native/juce_linux_Messaging.cpp @@ -68,8 +68,7 @@ public: ScopedUnlock ul (lock); unsigned char x = 0xff; - auto numBytes = write (getWriteHandle(), &x, 1); - ignoreUnused (numBytes); + [[maybe_unused]] auto numBytes = write (getWriteHandle(), &x, 1); } } @@ -97,8 +96,7 @@ private: ScopedUnlock ul (lock); unsigned char x; - auto numBytes = read (fd, &x, 1); - ignoreUnused (numBytes); + [[maybe_unused]] auto numBytes = read (fd, &x, 1); } return queue.removeAndReturn (0); diff --git a/modules/juce_events/native/juce_win32_Messaging.cpp b/modules/juce_events/native/juce_win32_Messaging.cpp index 3266f7a3..0e91c215 100644 --- a/modules/juce_events/native/juce_win32_Messaging.cpp +++ b/modules/juce_events/native/juce_win32_Messaging.cpp @@ -288,7 +288,7 @@ void MessageManager::broadcastMessage (const String& value) //============================================================================== void MessageManager::doPlatformSpecificInitialisation() { - ignoreUnused (OleInitialize (nullptr)); + [[maybe_unused]] const auto result = OleInitialize (nullptr); InternalMessageQueue::getInstance(); } diff --git a/modules/juce_events/native/juce_win32_WinRTWrapper.cpp b/modules/juce_events/native/juce_win32_WinRTWrapper.cpp index af4a7937..fca7cc30 100644 --- a/modules/juce_events/native/juce_win32_WinRTWrapper.cpp +++ b/modules/juce_events/native/juce_win32_WinRTWrapper.cpp @@ -42,7 +42,7 @@ WinRTWrapper::WinRTWrapper() return; HRESULT status = roInitialize (1); - initialised = ! (status != S_OK && status != S_FALSE && status != 0x80010106L); + initialised = ! (status != S_OK && status != S_FALSE && status != (HRESULT) 0x80010106L); } WinRTWrapper::~WinRTWrapper() diff --git a/modules/juce_events/native/juce_win32_WinRTWrapper.h b/modules/juce_events/native/juce_win32_WinRTWrapper.h index af0e1b96..12c67f2f 100644 --- a/modules/juce_events/native/juce_win32_WinRTWrapper.h +++ b/modules/juce_events/native/juce_win32_WinRTWrapper.h @@ -30,7 +30,7 @@ public: ~WinRTWrapper(); bool isInitialised() const noexcept { return initialised; } - JUCE_DECLARE_SINGLETON (WinRTWrapper, true) + JUCE_DECLARE_SINGLETON (WinRTWrapper, false) //============================================================================== template diff --git a/modules/juce_events/timers/juce_Timer.cpp b/modules/juce_events/timers/juce_Timer.cpp index 3da0766d..2dde51bc 100644 --- a/modules/juce_events/timers/juce_Timer.cpp +++ b/modules/juce_events/timers/juce_Timer.cpp @@ -303,7 +303,7 @@ private: void handleAsyncUpdate() override { - startThread (7); + startThread (Priority::high); } JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TimerThread) diff --git a/modules/juce_graphics/colour/juce_Colour.h b/modules/juce_graphics/colour/juce_Colour.h index b8e10580..3077addd 100644 --- a/modules/juce_graphics/colour/juce_Colour.h +++ b/modules/juce_graphics/colour/juce_Colour.h @@ -299,35 +299,35 @@ public: //============================================================================== /** Returns a copy of this colour with a different hue. */ - JUCE_NODISCARD Colour withHue (float newHue) const noexcept; + [[nodiscard]] Colour withHue (float newHue) const noexcept; /** Returns a copy of this colour with a different saturation. */ - JUCE_NODISCARD Colour withSaturation (float newSaturation) const noexcept; + [[nodiscard]] Colour withSaturation (float newSaturation) const noexcept; /** Returns a copy of this colour with a different saturation in the HSL colour space. */ - JUCE_NODISCARD Colour withSaturationHSL (float newSaturation) const noexcept; + [[nodiscard]] Colour withSaturationHSL (float newSaturation) const noexcept; /** Returns a copy of this colour with a different brightness. @see brighter, darker, withMultipliedBrightness */ - JUCE_NODISCARD Colour withBrightness (float newBrightness) const noexcept; + [[nodiscard]] Colour withBrightness (float newBrightness) const noexcept; /** Returns a copy of this colour with a different lightness. @see lighter, darker, withMultipliedLightness */ - JUCE_NODISCARD Colour withLightness (float newLightness) const noexcept; + [[nodiscard]] Colour withLightness (float newLightness) const noexcept; /** Returns a copy of this colour with its hue rotated. The new colour's hue is ((this->getHue() + amountToRotate) % 1.0) @see brighter, darker, withMultipliedBrightness */ - JUCE_NODISCARD Colour withRotatedHue (float amountToRotate) const noexcept; + [[nodiscard]] Colour withRotatedHue (float amountToRotate) const noexcept; /** Returns a copy of this colour with its saturation multiplied by the given value. The new colour's saturation is (this->getSaturation() * multiplier) (the result is clipped to legal limits). */ - JUCE_NODISCARD Colour withMultipliedSaturation (float multiplier) const noexcept; + [[nodiscard]] Colour withMultipliedSaturation (float multiplier) const noexcept; /** Returns a copy of this colour with its saturation multiplied by the given value. The new colour's saturation is (this->getSaturation() * multiplier) @@ -335,19 +335,19 @@ public: This will be in the HSL colour space. */ - JUCE_NODISCARD Colour withMultipliedSaturationHSL (float multiplier) const noexcept; + [[nodiscard]] Colour withMultipliedSaturationHSL (float multiplier) const noexcept; /** Returns a copy of this colour with its brightness multiplied by the given value. The new colour's brightness is (this->getBrightness() * multiplier) (the result is clipped to legal limits). */ - JUCE_NODISCARD Colour withMultipliedBrightness (float amount) const noexcept; + [[nodiscard]] Colour withMultipliedBrightness (float amount) const noexcept; /** Returns a copy of this colour with its lightness multiplied by the given value. The new colour's lightness is (this->lightness() * multiplier) (the result is clipped to legal limits). */ - JUCE_NODISCARD Colour withMultipliedLightness (float amount) const noexcept; + [[nodiscard]] Colour withMultipliedLightness (float amount) const noexcept; //============================================================================== /** Returns a brighter version of this colour. @@ -355,14 +355,14 @@ public: where 0 is unchanged, and higher values make it brighter @see withMultipliedBrightness */ - JUCE_NODISCARD Colour brighter (float amountBrighter = 0.4f) const noexcept; + [[nodiscard]] Colour brighter (float amountBrighter = 0.4f) const noexcept; /** Returns a darker version of this colour. @param amountDarker how much darker to make it - a value greater than or equal to 0, where 0 is unchanged, and higher values make it darker @see withMultipliedBrightness */ - JUCE_NODISCARD Colour darker (float amountDarker = 0.4f) const noexcept; + [[nodiscard]] Colour darker (float amountDarker = 0.4f) const noexcept; //============================================================================== /** Returns a colour that will be clearly visible against this colour. @@ -372,7 +372,7 @@ public: that's just a little bit lighter; Colours::black.contrasting (1.0f) will return white; Colours::white.contrasting (1.0f) will return black, etc. */ - JUCE_NODISCARD Colour contrasting (float amount = 1.0f) const noexcept; + [[nodiscard]] Colour contrasting (float amount = 1.0f) const noexcept; /** Returns a colour that is as close as possible to a target colour whilst still being in contrast to this one. @@ -381,20 +381,20 @@ public: nudged up or down so that it differs from the luminosity of this colour by at least the amount specified by minLuminosityDiff. */ - JUCE_NODISCARD Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept; + [[nodiscard]] Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept; /** Returns a colour that contrasts against two colours. Looks for a colour that contrasts with both of the colours passed-in. Handy for things like choosing a highlight colour in text editors, etc. */ - JUCE_NODISCARD static Colour contrasting (Colour colour1, + [[nodiscard]] static Colour contrasting (Colour colour1, Colour colour2) noexcept; //============================================================================== /** Returns an opaque shade of grey. @param brightness the level of grey to return - 0 is black, 1.0 is white */ - JUCE_NODISCARD static Colour greyLevel (float brightness) noexcept; + [[nodiscard]] static Colour greyLevel (float brightness) noexcept; //============================================================================== /** Returns a stringified version of this colour. @@ -403,7 +403,7 @@ public: String toString() const; /** Reads the colour from a string that was created with toString(). */ - JUCE_NODISCARD static Colour fromString (StringRef encodedColourString); + [[nodiscard]] static Colour fromString (StringRef encodedColourString); /** Returns the colour as a hex string in the form RRGGBB or AARRGGBB. */ String toDisplayString (bool includeAlphaValue) const; diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index 4cf70077..640ac3b5 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -540,18 +540,16 @@ void Graphics::fillRectList (const RectangleList& rects) const void Graphics::fillAll() const { - fillRect (context.getClipBounds()); + context.fillAll(); } void Graphics::fillAll (Colour colourToUse) const { if (! colourToUse.isTransparent()) { - auto clip = context.getClipBounds(); - context.saveState(); context.setFill (colourToUse); - context.fillRect (clip, false); + context.fillAll(); context.restoreState(); } } diff --git a/modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h b/modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h index e34a42fe..29070743 100644 --- a/modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h +++ b/modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h @@ -86,6 +86,7 @@ public: virtual void setInterpolationQuality (Graphics::ResamplingQuality) = 0; //============================================================================== + virtual void fillAll() { fillRect (getClipBounds(), false); } virtual void fillRect (const Rectangle&, bool replaceExistingContents) = 0; virtual void fillRect (const Rectangle&) = 0; virtual void fillRectList (const RectangleList&) = 0; diff --git a/modules/juce_graphics/fonts/juce_Font.h b/modules/juce_graphics/fonts/juce_Font.h index 8b4e9601..dbcf8d18 100644 --- a/modules/juce_graphics/fonts/juce_Font.h +++ b/modules/juce_graphics/fonts/juce_Font.h @@ -154,7 +154,7 @@ public: /** Returns a copy of this font with a new typeface style. @see getAvailableStyles() */ - JUCE_NODISCARD Font withTypefaceStyle (const String& newStyle) const; + [[nodiscard]] Font withTypefaceStyle (const String& newStyle) const; /** Returns a list of the styles that this font can use. */ StringArray getAvailableStyles() const; @@ -204,10 +204,10 @@ public: //============================================================================== /** Returns a copy of this font with a new height. */ - JUCE_NODISCARD Font withHeight (float height) const; + [[nodiscard]] Font withHeight (float height) const; /** Returns a copy of this font with a new height, specified in points. */ - JUCE_NODISCARD Font withPointHeight (float heightInPoints) const; + [[nodiscard]] Font withPointHeight (float heightInPoints) const; /** Changes the font's height. @see getHeight, withHeight, setHeightWithoutChangingWidth @@ -271,7 +271,7 @@ public: @param styleFlags a bitwise-or'ed combination of values from the FontStyleFlags enum. @see FontStyleFlags, getStyleFlags */ - JUCE_NODISCARD Font withStyle (int styleFlags) const; + [[nodiscard]] Font withStyle (int styleFlags) const; /** Changes the font's style. @param newFlags a bitwise-or'ed combination of values from the FontStyleFlags enum. @@ -286,7 +286,7 @@ public: /** Returns a copy of this font with the bold attribute set. If the font does not have a bold version, this will return the default font. */ - JUCE_NODISCARD Font boldened() const; + [[nodiscard]] Font boldened() const; /** Returns true if the font is bold. */ bool isBold() const noexcept; @@ -294,7 +294,7 @@ public: /** Makes the font italic or non-italic. */ void setItalic (bool shouldBeItalic); /** Returns a copy of this font with the italic attribute set. */ - JUCE_NODISCARD Font italicised() const; + [[nodiscard]] Font italicised() const; /** Returns true if the font is italic. */ bool isItalic() const noexcept; @@ -317,7 +317,7 @@ public: narrower, greater than 1.0 will be stretched out. @see getHorizontalScale */ - JUCE_NODISCARD Font withHorizontalScale (float scaleFactor) const; + [[nodiscard]] Font withHorizontalScale (float scaleFactor) const; /** Changes the font's horizontal scale factor. @param scaleFactor a value of 1.0 is the normal scale, less than this will be @@ -353,7 +353,7 @@ public: normal spacing, positive values spread the letters out, negative values make them closer together. */ - JUCE_NODISCARD Font withExtraKerningFactor (float extraKerning) const; + [[nodiscard]] Font withExtraKerningFactor (float extraKerning) const; /** Changes the font's kerning. @param extraKerning a multiple of the font's height that will be added diff --git a/modules/juce_graphics/fonts/juce_TextLayout.h b/modules/juce_graphics/fonts/juce_TextLayout.h index 7e7e9823..7bd2a0b8 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.h +++ b/modules/juce_graphics/fonts/juce_TextLayout.h @@ -44,7 +44,7 @@ private: class DereferencingIterator { public: - using value_type = typename std::remove_reference())>::type; + using value_type = std::remove_reference_t())>; using difference_type = typename std::iterator_traits::difference_type; using pointer = value_type*; using reference = value_type&; diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index da183d1e..55253288 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -123,7 +123,7 @@ public: template constexpr Point operator* (OtherType multiplier) const noexcept { - using CommonType = typename std::common_type::type; + using CommonType = std::common_type_t; return Point ((ValueType) ((CommonType) x * (CommonType) multiplier), (ValueType) ((CommonType) y * (CommonType) multiplier)); } @@ -132,7 +132,7 @@ public: template constexpr Point operator/ (OtherType divisor) const noexcept { - using CommonType = typename std::common_type::type; + using CommonType = std::common_type_t; return Point ((ValueType) ((CommonType) x / (CommonType) divisor), (ValueType) ((CommonType) y / (CommonType) divisor)); } @@ -150,7 +150,7 @@ public: //============================================================================== /** This type will be double if the Point's type is double, otherwise it will be float. */ - using FloatType = typename TypeHelpers::SmallestFloatType::type; + using FloatType = TypeHelpers::SmallestFloatType; //============================================================================== /** Returns the straight-line distance between this point and the origin. */ diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index db7b479d..9789f7ee 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -217,41 +217,41 @@ public: void setVerticalRange (Range range) noexcept { pos.y = range.getStart(); h = range.getLength(); } /** Returns a rectangle which has the same size and y-position as this one, but with a different x-position. */ - JUCE_NODISCARD Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; } + [[nodiscard]] Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; } /** Returns a rectangle which has the same size and x-position as this one, but with a different y-position. */ - JUCE_NODISCARD Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; } + [[nodiscard]] Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; } /** Returns a rectangle which has the same size and y-position as this one, but whose right-hand edge has the given position. */ - JUCE_NODISCARD Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; } + [[nodiscard]] Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; } /** Returns a rectangle which has the same size and x-position as this one, but whose bottom edge has the given position. */ - JUCE_NODISCARD Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; } + [[nodiscard]] Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; } /** Returns a rectangle with the same size as this one, but a new position. */ - JUCE_NODISCARD Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; } + [[nodiscard]] Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; } /** Returns a rectangle with the same size as this one, but a new position. */ - JUCE_NODISCARD Rectangle withPosition (Point newPos) const noexcept { return { newPos.x, newPos.y, w, h }; } + [[nodiscard]] Rectangle withPosition (Point newPos) const noexcept { return { newPos.x, newPos.y, w, h }; } /** Returns a rectangle whose size is the same as this one, but whose top-left position is (0, 0). */ - JUCE_NODISCARD Rectangle withZeroOrigin() const noexcept { return { w, h }; } + [[nodiscard]] Rectangle withZeroOrigin() const noexcept { return { w, h }; } /** Returns a rectangle with the same size as this one, but a new centre position. */ - JUCE_NODISCARD Rectangle withCentre (Point newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2, + [[nodiscard]] Rectangle withCentre (Point newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2, newCentre.y - h / (ValueType) 2, w, h }; } /** Returns a rectangle which has the same position and height as this one, but with a different width. */ - JUCE_NODISCARD Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; } + [[nodiscard]] Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; } /** Returns a rectangle which has the same position and width as this one, but with a different height. */ - JUCE_NODISCARD Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; } + [[nodiscard]] Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; } /** Returns a rectangle with the same top-left position as this one, but a new size. */ - JUCE_NODISCARD Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; } + [[nodiscard]] Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; } /** Returns a rectangle with the same centre position as this one, but a new size. */ - JUCE_NODISCARD Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2, + [[nodiscard]] Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2, pos.y + (h - newHeight) / (ValueType) 2, newWidth, newHeight }; } /** Moves the x position, adjusting the width so that the right-hand edge remains in the same place. @@ -264,7 +264,7 @@ public: If the new x is beyond the right of the current right-hand edge, the width will be set to zero. @see setLeft */ - JUCE_NODISCARD Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; } + [[nodiscard]] Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; } /** Moves the y position, adjusting the height so that the bottom edge remains in the same place. If the y is moved to be below the current bottom edge, the height will be set to zero. @@ -276,7 +276,7 @@ public: If the new y is beyond the bottom of the current rectangle, the height will be set to zero. @see setTop */ - JUCE_NODISCARD Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; } + [[nodiscard]] Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; } /** Adjusts the width so that the right-hand edge of the rectangle has this new value. If the new right is below the current X value, the X will be pushed down to match it. @@ -288,7 +288,7 @@ public: If the new right edge is below the current left-hand edge, the width will be set to zero. @see setRight */ - JUCE_NODISCARD Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; } + [[nodiscard]] Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; } /** Adjusts the height so that the bottom edge of the rectangle has this new value. If the new bottom is lower than the current Y value, the Y will be pushed down to match it. @@ -300,19 +300,19 @@ public: If the new y is beyond the bottom of the current rectangle, the height will be set to zero. @see setBottom */ - JUCE_NODISCARD Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; } + [[nodiscard]] Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; } /** Returns a version of this rectangle with the given amount removed from its left-hand edge. */ - JUCE_NODISCARD Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); } + [[nodiscard]] Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); } /** Returns a version of this rectangle with the given amount removed from its right-hand edge. */ - JUCE_NODISCARD Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); } + [[nodiscard]] Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); } /** Returns a version of this rectangle with the given amount removed from its top edge. */ - JUCE_NODISCARD Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); } + [[nodiscard]] Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); } /** Returns a version of this rectangle with the given amount removed from its bottom edge. */ - JUCE_NODISCARD Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); } + [[nodiscard]] Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); } //============================================================================== /** Moves the rectangle's position by adding amount to its x and y coordinates. */ @@ -813,7 +813,7 @@ public: */ Rectangle transformedBy (const AffineTransform& transform) const noexcept { - using FloatType = typename TypeHelpers::SmallestFloatType::type; + using FloatType = TypeHelpers::SmallestFloatType; auto x1 = static_cast (pos.x), y1 = static_cast (pos.y); auto x2 = static_cast (pos.x + w), y2 = static_cast (pos.y); diff --git a/modules/juce_graphics/geometry/juce_RectangleList.h b/modules/juce_graphics/geometry/juce_RectangleList.h index 8e106cd4..c05a6984 100644 --- a/modules/juce_graphics/geometry/juce_RectangleList.h +++ b/modules/juce_graphics/geometry/juce_RectangleList.h @@ -201,76 +201,108 @@ public: Any rectangles in the list which overlap this will be clipped and subdivided if necessary. */ - void subtract (RectangleType rect) + void subtract (const RectangleType rect) { if (auto numRects = rects.size()) { - auto x1 = rect.getX(); - auto y1 = rect.getY(); - auto x2 = x1 + rect.getWidth(); - auto y2 = y1 + rect.getHeight(); + const auto x1 = rect.getX(); + const auto y1 = rect.getY(); + const auto x2 = x1 + rect.getWidth(); + const auto y2 = y1 + rect.getHeight(); for (int i = numRects; --i >= 0;) { auto& r = rects.getReference (i); - auto rx1 = r.getX(); - auto ry1 = r.getY(); - auto rx2 = rx1 + r.getWidth(); - auto ry2 = ry1 + r.getHeight(); + const auto rx1 = r.getX(); + const auto ry1 = r.getY(); + const auto rx2 = rx1 + r.getWidth(); + const auto ry2 = ry1 + r.getHeight(); - if (! (x2 <= rx1 || x1 >= rx2 || y2 <= ry1 || y1 >= ry2)) + const auto isNotEqual = [&] (const RectangleType newRect) { - if (x1 > rx1 && x1 < rx2) + // When subtracting tiny slices from relatively large rectangles, the + // subtraction may have no effect (due to limited-precision floating point + // maths) and the original rectangle may remain unchanged. + // We check that any 'new' rectangle has different dimensions to the rectangle + // being tested before adding it to the rects array. + // Integer arithmetic is not susceptible to this problem, so there's no need + // for this additional equality check when working with integral rectangles. + if constexpr (std::is_floating_point_v) { - if (y1 <= ry1 && y2 >= ry2 && x2 >= rx2) + return newRect != r; + } + else + { + ignoreUnused (newRect); + return true; + } + }; + + if (rx1 < x2 && x1 < rx2 && ry1 < y2 && y1 < ry2) + { + if (rx1 < x1 && x1 < rx2) + { + if (y1 <= ry1 && ry2 <= y2 && rx2 <= x2) { r.setWidth (x1 - rx1); } else { - r.setX (x1); - r.setWidth (rx2 - x1); - - rects.insert (++i, RectangleType (rx1, ry1, x1 - rx1, ry2 - ry1)); - ++i; + if (const RectangleType newRect (rx1, ry1, x1 - rx1, ry2 - ry1); isNotEqual (newRect)) + { + r.setX (x1); + r.setWidth (rx2 - x1); + + rects.insert (++i, newRect); + ++i; + } } } - else if (x2 > rx1 && x2 < rx2) + else if (rx1 < x2 && x2 < rx2) { r.setX (x2); r.setWidth (rx2 - x2); - if (y1 > ry1 || y2 < ry2 || x1 > rx1) + if (ry1 < y1 || y2 < ry2 || rx1 < x1) { - rects.insert (++i, RectangleType (rx1, ry1, x2 - rx1, ry2 - ry1)); - ++i; + if (const RectangleType newRect (rx1, ry1, x2 - rx1, ry2 - ry1); isNotEqual (newRect)) + { + rects.insert (++i, newRect); + ++i; + } } } - else if (y1 > ry1 && y1 < ry2) + else if (ry1 < y1 && y1 < ry2) { - if (x1 <= rx1 && x2 >= rx2 && y2 >= ry2) + if (x1 <= rx1 && rx2 <= x2 && ry2 <= y2) { r.setHeight (y1 - ry1); } else { - r.setY (y1); - r.setHeight (ry2 - y1); - - rects.insert (++i, RectangleType (rx1, ry1, rx2 - rx1, y1 - ry1)); - ++i; + if (const RectangleType newRect (rx1, ry1, rx2 - rx1, y1 - ry1); isNotEqual (newRect)) + { + r.setY (y1); + r.setHeight (ry2 - y1); + + rects.insert (++i, newRect); + ++i; + } } } - else if (y2 > ry1 && y2 < ry2) + else if (ry1 < y2 && y2 < ry2) { r.setY (y2); r.setHeight (ry2 - y2); - if (x1 > rx1 || x2 < rx2 || y1 > ry1) + if (rx1 < x1 || x2 < rx2 || ry1 < y1) { - rects.insert (++i, RectangleType (rx1, ry1, rx2 - rx1, y2 - ry1)); - ++i; + if (const RectangleType newRect (rx1, ry1, rx2 - rx1, y2 - ry1); isNotEqual (newRect)) + { + rects.insert (++i, newRect); + ++i; + } } } else diff --git a/modules/juce_graphics/juce_graphics.h b/modules/juce_graphics/juce_graphics.h index d10c3cee..cb86476d 100644 --- a/modules/juce_graphics/juce_graphics.h +++ b/modules/juce_graphics/juce_graphics.h @@ -35,12 +35,12 @@ ID: juce_graphics vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE graphics classes description: Classes for 2D vector graphics, image loading/saving, font handling, etc. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_events OSXFrameworks: Cocoa QuartzCore diff --git a/modules/juce_graphics/native/juce_freetype_Fonts.cpp b/modules/juce_graphics/native/juce_freetype_Fonts.cpp index 2c34fa9e..9c4a3cc2 100644 --- a/modules/juce_graphics/native/juce_freetype_Fonts.cpp +++ b/modules/juce_graphics/native/juce_freetype_Fonts.cpp @@ -154,26 +154,17 @@ public: //============================================================================== StringArray findAllFamilyNames() const { - StringArray s; + std::set set; for (auto* face : faces) - s.addIfNotAlreadyThere (face->family); - - return s; - } - - static int indexOfRegularStyle (const StringArray& styles) - { - int i = styles.indexOf ("Regular", true); + set.insert (face->family); - if (i >= 0) - return i; + StringArray s; - for (i = 0; i < styles.size(); ++i) - if (! (styles[i].containsIgnoreCase ("Bold") || styles[i].containsIgnoreCase ("Italic"))) - return i; + for (const auto& family : set) + s.add (family); - return -1; + return s; } StringArray findAllTypefaceStyles (const String& family) const @@ -184,12 +175,7 @@ public: if (face->family == family) s.addIfNotAlreadyThere (face->style); - // try to get a regular style to be first in the list - auto regular = indexOfRegularStyle (s); - - if (regular > 0) - s.strings.swap (0, regular); - + // scanFontPaths ensures that regular styles are ordered before other styles return s; } @@ -198,9 +184,48 @@ public: for (auto& path : paths) { for (const auto& iter : RangedDirectoryIterator (File::getCurrentWorkingDirectory().getChildFile (path), true)) + { if (iter.getFile().hasFileExtension ("ttf;pfb;pcf;otf")) scanFont (iter.getFile()); + } } + + std::sort (faces.begin(), faces.end(), [] (const auto* a, const auto* b) + { + const auto tie = [] (const KnownTypeface& t) + { + // Used to order styles like "Regular", "Roman" etc. before "Bold", "Italic", etc. + const auto computeStyleNormalcy = [] (const String& style) + { + if (style == "Regular") + return 0; + + if (style == "Roman") + return 1; + + if (style == "Book") + return 2; + + if (style.containsIgnoreCase ("Bold")) + return 3; + + if (style.containsIgnoreCase ("Italic")) + return 4; + + return 5; + }; + + return std::make_tuple (t.family, + computeStyleNormalcy (t.style), + t.style, + t.isSansSerif, + t.isMonospaced, + t.faceIndex, + t.file); + }; + + return tie (*a) < tie (*b); + }); } void getMonospacedNames (StringArray& monoSpaced) const diff --git a/modules/juce_graphics/native/juce_linux_Fonts.cpp b/modules/juce_graphics/native/juce_linux_Fonts.cpp index d5e9cc13..474b136f 100644 --- a/modules/juce_graphics/native/juce_linux_Fonts.cpp +++ b/modules/juce_graphics/native/juce_linux_Fonts.cpp @@ -113,99 +113,85 @@ bool TextLayout::createNativeLayout (const AttributedString&) //============================================================================== struct DefaultFontInfo { - struct Characteristics - { - explicit Characteristics (String nameIn) : name (nameIn) {} - - Characteristics withStyle (String styleIn) const - { - auto copy = *this; - copy.style = std::move (styleIn); - return copy; - } - - String name, style; - }; - DefaultFontInfo() - : defaultSans (getDefaultSansSerifFontCharacteristics()), - defaultSerif (getDefaultSerifFontCharacteristics()), - defaultFixed (getDefaultMonospacedFontCharacteristics()) + : defaultSans (getDefaultSansSerifFontName()), + defaultSerif (getDefaultSerifFontName()), + defaultFixed (getDefaultMonospacedFontName()) { } - Characteristics getRealFontCharacteristics (const String& faceName) const + String getRealFontName (const String& faceName) const { if (faceName == Font::getDefaultSansSerifFontName()) return defaultSans; if (faceName == Font::getDefaultSerifFontName()) return defaultSerif; if (faceName == Font::getDefaultMonospacedFontName()) return defaultFixed; - return Characteristics { faceName }; + return faceName; } - Characteristics defaultSans, defaultSerif, defaultFixed; + String defaultSans, defaultSerif, defaultFixed; private: template - static Characteristics pickBestFont (const StringArray& names, Range&& choicesArray) + static String pickBestFont (const StringArray& names, Range&& choicesArray) { for (auto& choice : choicesArray) - if (names.contains (choice.name, true)) + if (names.contains (choice, true)) return choice; for (auto& choice : choicesArray) for (auto& name : names) - if (name.startsWithIgnoreCase (choice.name)) - return Characteristics { name }.withStyle (choice.style); + if (name.startsWithIgnoreCase (choice)) + return name; for (auto& choice : choicesArray) for (auto& name : names) - if (name.containsIgnoreCase (choice.name)) - return Characteristics { name }.withStyle (choice.style); + if (name.containsIgnoreCase (choice)) + return name; - return Characteristics { names[0] }; + return names[0]; } - static Characteristics getDefaultSansSerifFontCharacteristics() + static String getDefaultSansSerifFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getSansSerifNames (allFonts); - static const Characteristics targets[] { Characteristics { "Verdana" }, - Characteristics { "Bitstream Vera Sans" }.withStyle ("Roman"), - Characteristics { "Luxi Sans" }, - Characteristics { "Liberation Sans" }, - Characteristics { "DejaVu Sans" }, - Characteristics { "Sans" } }; + static constexpr const char* targets[] { "Verdana", + "Bitstream Vera Sans", + "Luxi Sans", + "Liberation Sans", + "DejaVu Sans", + "Sans" }; return pickBestFont (allFonts, targets); } - static Characteristics getDefaultSerifFontCharacteristics() + static String getDefaultSerifFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getSerifNames (allFonts); - static const Characteristics targets[] { Characteristics { "Bitstream Vera Serif" }.withStyle ("Roman"), - Characteristics { "Times" }, - Characteristics { "Nimbus Roman" }, - Characteristics { "Liberation Serif" }, - Characteristics { "DejaVu Serif" }, - Characteristics { "Serif" } }; + static constexpr const char* targets[] { "Bitstream Vera Serif", + "Times", + "Nimbus Roman", + "Liberation Serif", + "DejaVu Serif", + "Serif" }; return pickBestFont (allFonts, targets); } - static Characteristics getDefaultMonospacedFontCharacteristics() + static String getDefaultMonospacedFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getMonospacedNames (allFonts); - static const Characteristics targets[] { Characteristics { "DejaVu Sans Mono" }, - Characteristics { "Bitstream Vera Sans Mono" }.withStyle ("Roman"), - Characteristics { "Sans Mono" }, - Characteristics { "Liberation Mono" }, - Characteristics { "Courier" }, - Characteristics { "DejaVu Mono" }, - Characteristics { "Mono" } }; + static constexpr const char* targets[] { "DejaVu Sans Mono", + "Bitstream Vera Sans Mono", + "Sans Mono", + "Liberation Mono", + "Courier", + "DejaVu Mono", + "Mono" }; return pickBestFont (allFonts, targets); } @@ -219,13 +205,13 @@ Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font) Font f (font); const auto name = font.getTypefaceName(); - const auto characteristics = defaultInfo.getRealFontCharacteristics (name); - f.setTypefaceName (characteristics.name); + const auto realName = defaultInfo.getRealFontName (name); + f.setTypefaceName (realName); - const auto styles = findAllTypefaceStyles (name); + const auto styles = findAllTypefaceStyles (realName); if (! styles.contains (font.getTypefaceStyle())) - f.setTypefaceStyle (characteristics.style); + f.setTypefaceStyle (styles[0]); return Typeface::createSystemTypefaceFor (f); } diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.h b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.h index aa323fa6..6230c99c 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.h +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.h @@ -53,12 +53,18 @@ namespace detail void operator() (CGGradientRef ptr) const noexcept { CGGradientRelease (ptr); } }; + struct ColorDelete + { + void operator() (CGColorRef ptr) const noexcept { CGColorRelease (ptr); } + }; + //============================================================================== using ColorSpacePtr = std::unique_ptr; using ContextPtr = std::unique_ptr; using DataProviderPtr = std::unique_ptr; using ImagePtr = std::unique_ptr; using GradientPtr = std::unique_ptr; + using ColorPtr = std::unique_ptr; } //============================================================================== @@ -95,6 +101,7 @@ public: void setInterpolationQuality (Graphics::ResamplingQuality) override; //============================================================================== + void fillAll() override; void fillRect (const Rectangle&, bool replaceExistingContents) override; void fillRect (const Rectangle&) override; void fillRectList (const RectangleList&) override; diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index 7e78c804..417d16c7 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -404,8 +404,13 @@ void CoreGraphicsContext::setFill (const FillType& fillType) if (fillType.isColour()) { - CGContextSetRGBFillColor (context.get(), fillType.colour.getFloatRed(), fillType.colour.getFloatGreen(), - fillType.colour.getFloatBlue(), fillType.colour.getFloatAlpha()); + const CGFloat components[] { fillType.colour.getFloatRed(), + fillType.colour.getFloatGreen(), + fillType.colour.getFloatBlue(), + fillType.colour.getFloatAlpha() }; + + const detail::ColorPtr color { CGColorCreate (rgbColourSpace.get(), components) }; + CGContextSetFillColorWithColor (context.get(), color.get()); CGContextSetAlpha (context.get(), 1.0f); } } @@ -428,6 +433,26 @@ void CoreGraphicsContext::setInterpolationQuality (Graphics::ResamplingQuality q } //============================================================================== +void CoreGraphicsContext::fillAll() +{ + // The clip rectangle is expanded in order to avoid having alpha blended pixels at the edges. + // The clipping mechanism will take care of cutting off pixels beyond the clip bounds. This is + // a hard cutoff and will ensure that no semi-transparent pixels will remain inside the filled + // area. + const auto clipBounds = getClipBounds(); + + const auto clipBoundsOnDevice = CGContextConvertSizeToDeviceSpace (context.get(), + CGSize { (CGFloat) clipBounds.getWidth(), + (CGFloat) clipBounds.getHeight() }); + + const auto inverseScale = clipBoundsOnDevice.width > (CGFloat) 0.0 + ? (int) (clipBounds.getWidth() / clipBoundsOnDevice.width) + : 0; + const auto expansion = jmax (1, inverseScale); + + fillRect (clipBounds.expanded (expansion), false); +} + void CoreGraphicsContext::fillRect (const Rectangle& r, bool replaceExistingContents) { fillCGRect (CGRectMake (r.getX(), flipHeight - r.getBottom(), r.getWidth(), r.getHeight()), replaceExistingContents); diff --git a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp index b5e3340f..d848addf 100644 --- a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp +++ b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp @@ -528,8 +528,8 @@ Direct2DLowLevelGraphicsContext::Direct2DLowLevelGraphicsContext (HWND hwnd_) if (pimpl->factories->d2dFactory != nullptr) { - auto hr = pimpl->factories->d2dFactory->CreateHwndRenderTarget ({}, { hwnd, size }, pimpl->renderingTarget.resetAndGetPointerAddress()); - jassert (SUCCEEDED (hr)); ignoreUnused (hr); + [[maybe_unused]] auto hr = pimpl->factories->d2dFactory->CreateHwndRenderTarget ({}, { hwnd, size }, pimpl->renderingTarget.resetAndGetPointerAddress()); + jassert (SUCCEEDED (hr)); hr = pimpl->renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), pimpl->colourBrush.resetAndGetPointerAddress()); } } diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp index b82b4c53..f565a583 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp @@ -200,8 +200,7 @@ namespace DirectWriteTypeLayout } ComSmartPtr dwFont; - auto hr = fontCollection.GetFontFromFontFace (glyphRun.fontFace, dwFont.resetAndGetPointerAddress()); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection.GetFontFromFontFace (glyphRun.fontFace, dwFont.resetAndGetPointerAddress()); jassert (dwFont != nullptr); ComSmartPtr dwFontFamily; @@ -299,8 +298,7 @@ namespace DirectWriteTypeLayout fontIndex = 0; ComSmartPtr fontFamily; - auto hr = fontCollection.GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress()); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection.GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress()); ComSmartPtr dwFont; uint32 fontFacesCount = 0; @@ -420,8 +418,7 @@ namespace DirectWriteTypeLayout return; UINT32 actualLineCount = 0; - auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount); - ignoreUnused (hr); + [[maybe_unused]] auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount); layout.ensureStorageAllocated ((int) actualLineCount); @@ -486,7 +483,7 @@ static bool canAllTypefacesAndFontsBeUsedInLayout (const AttributedString& text) #endif -bool TextLayout::createNativeLayout (const AttributedString& text) +bool TextLayout::createNativeLayout ([[maybe_unused]] const AttributedString& text) { #if JUCE_USE_DIRECTWRITE if (! canAllTypefacesAndFontsBeUsedInLayout (text)) @@ -506,8 +503,6 @@ bool TextLayout::createNativeLayout (const AttributedString& text) return true; } - #else - ignoreUnused (text); #endif return false; diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp index da59341e..5da13351 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp @@ -35,8 +35,7 @@ namespace uint32 index = 0; BOOL exists = false; - auto hr = names->FindLocaleName (L"en-us", &index, &exists); - ignoreUnused (hr); + [[maybe_unused]] auto hr = names->FindLocaleName (L"en-us", &index, &exists); if (! exists) index = 0; @@ -152,8 +151,7 @@ public: jassert (fontCollection != nullptr); uint32 fontIndex = 0; - auto hr = fontCollection->FindFamilyName (font.getTypefaceName().toWideCharPointer(), &fontIndex, &fontFound); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection->FindFamilyName (font.getTypefaceName().toWideCharPointer(), &fontIndex, &fontFound); if (! fontFound) fontIndex = 0; diff --git a/modules/juce_graphics/native/juce_win32_Fonts.cpp b/modules/juce_graphics/native/juce_win32_Fonts.cpp index b7d4afe2..005061ef 100644 --- a/modules/juce_graphics/native/juce_win32_Fonts.cpp +++ b/modules/juce_graphics/native/juce_win32_Fonts.cpp @@ -234,8 +234,7 @@ StringArray Font::findAllTypefaceStyles (const String& family) { BOOL fontFound = false; uint32 fontIndex = 0; - auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound); - ignoreUnused (hr); + [[maybe_unused]] auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound); if (! fontFound) fontIndex = 0; diff --git a/modules/juce_gui_basics/accessibility/juce_AccessibilityState.h b/modules/juce_gui_basics/accessibility/juce_AccessibilityState.h index 247a6c83..75c1e1dd 100644 --- a/modules/juce_gui_basics/accessibility/juce_AccessibilityState.h +++ b/modules/juce_gui_basics/accessibility/juce_AccessibilityState.h @@ -50,73 +50,73 @@ public: @see isCheckable */ - JUCE_NODISCARD AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); } + [[nodiscard]] AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); } /** Sets the checked flag and returns the new state. @see isChecked */ - JUCE_NODISCARD AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); } + [[nodiscard]] AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); } /** Sets the collapsed flag and returns the new state. @see isCollapsed */ - JUCE_NODISCARD AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); } + [[nodiscard]] AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); } /** Sets the expandable flag and returns the new state. @see isExpandable */ - JUCE_NODISCARD AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); } + [[nodiscard]] AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); } /** Sets the expanded flag and returns the new state. @see isExpanded */ - JUCE_NODISCARD AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); } + [[nodiscard]] AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); } /** Sets the focusable flag and returns the new state. @see isFocusable */ - JUCE_NODISCARD AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); } + [[nodiscard]] AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); } /** Sets the focused flag and returns the new state. @see isFocused */ - JUCE_NODISCARD AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); } + [[nodiscard]] AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); } /** Sets the ignored flag and returns the new state. @see isIgnored */ - JUCE_NODISCARD AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); } + [[nodiscard]] AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); } /** Sets the selectable flag and returns the new state. @see isSelectable */ - JUCE_NODISCARD AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); } + [[nodiscard]] AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); } /** Sets the multiSelectable flag and returns the new state. @see isMultiSelectable */ - JUCE_NODISCARD AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); } + [[nodiscard]] AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); } /** Sets the selected flag and returns the new state. @see isSelected */ - JUCE_NODISCARD AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); } + [[nodiscard]] AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); } /** Sets the accessible offscreen flag and returns the new state. @see isSelected */ - JUCE_NODISCARD AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); } + [[nodiscard]] AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); } //============================================================================== /** Returns true if the UI element is checkable. @@ -208,7 +208,7 @@ private: accessibleOffscreen = (1 << 11) }; - JUCE_NODISCARD AccessibleState withFlag (int flag) const noexcept + [[nodiscard]] AccessibleState withFlag (int flag) const noexcept { auto copy = *this; copy.flags |= flag; diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index cc7577c5..9f8d9d74 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -39,6 +39,51 @@ static Component* findFirstEnabledAncestor (Component* in) Component* Component::currentlyFocusedComponent = nullptr; +//============================================================================== +class HierarchyChecker +{ +public: + HierarchyChecker (Component* comp, const MouseEvent& originalEvent) + : me (originalEvent) + { + for (; comp != nullptr; comp = comp->getParentComponent()) + hierarchy.emplace_back (comp); + } + + Component* nearestNonNullParent() const + { + for (auto& comp : hierarchy) + if (comp != nullptr) + return comp; + + return nullptr; + } + + bool shouldBailOut() const + { + return nearestNonNullParent() == nullptr; + } + + MouseEvent eventWithNearestParent() const + { + auto* comp = nearestNonNullParent(); + return { me.source, + me.position.toFloat(), + me.mods, + me.pressure, me.orientation, me.rotation, + me.tiltX, me.tiltY, + comp, comp, + me.eventTime, + me.mouseDownPosition.toFloat(), + me.mouseDownTime, + me.getNumberOfClicks(), + me.mouseWasDraggedSinceMouseDown() }; + } + +private: + std::vector> hierarchy; + const MouseEvent me; +}; //============================================================================== class Component::MouseListenerList @@ -75,104 +120,41 @@ public: } } - // g++ 4.8 cannot deduce the parameter pack inside the function pointer when it has more than one element - #if defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__) - template - static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker, - void (MouseListener::*eventMethod) (const MouseEvent&), - Params... params) - { - sendMouseEvent (comp, checker, eventMethod, params...); - } - - template - static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker, - void (MouseListener::*eventMethod) (const MouseEvent&, const MouseWheelDetails&), - Params... params) - { - sendMouseEvent (comp, checker, eventMethod, params...); - } - - template - static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker, - void (MouseListener::*eventMethod) (const MouseEvent&, float), - Params... params) - { - sendMouseEvent (comp, checker, eventMethod, params...); - } - template - static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker, - EventMethod eventMethod, - Params... params) - #else - template - static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker, - void (MouseListener::*eventMethod) (Params...), - Params... params) - #endif + static void sendMouseEvent (HierarchyChecker& checker, EventMethod&& eventMethod, Params&&... params) { - if (checker.shouldBailOut()) - return; - - if (auto* list = comp.mouseListeners.get()) + const auto callListeners = [&] (auto& parentComp, const auto findNumListeners) { - for (int i = list->listeners.size(); --i >= 0;) + if (auto* list = parentComp.mouseListeners.get()) { - (list->listeners.getUnchecked(i)->*eventMethod) (params...); + const WeakReference safePointer { &parentComp }; - if (checker.shouldBailOut()) - return; + for (int i = findNumListeners (*list); --i >= 0; i = jmin (i, findNumListeners (*list))) + { + (list->listeners.getUnchecked (i)->*eventMethod) (checker.eventWithNearestParent(), params...); - i = jmin (i, list->listeners.size()); + if (checker.shouldBailOut() || safePointer == nullptr) + return false; + } } - } - for (Component* p = comp.parentComponent; p != nullptr; p = p->parentComponent) - { - if (auto* list = p->mouseListeners.get()) - { - if (list->numDeepMouseListeners > 0) - { - BailOutChecker2 checker2 (checker, p); - - for (int i = list->numDeepMouseListeners; --i >= 0;) - { - (list->listeners.getUnchecked(i)->*eventMethod) (params...); + return true; + }; - if (checker2.shouldBailOut()) - return; + if (auto* parent = checker.nearestNonNullParent()) + if (! callListeners (*parent, [] (auto& list) { return list.listeners.size(); })) + return; - i = jmin (i, list->numDeepMouseListeners); - } - } - } - } + if (auto* parent = checker.nearestNonNullParent()) + for (Component* p = parent->parentComponent; p != nullptr; p = p->parentComponent) + if (! callListeners (*p, [] (auto& list) { return list.numDeepMouseListeners; })) + return; } private: Array listeners; int numDeepMouseListeners = 0; - struct BailOutChecker2 - { - BailOutChecker2 (Component::BailOutChecker& boc, Component* comp) - : checker (boc), safePointer (comp) - { - } - - bool shouldBailOut() const noexcept - { - return checker.shouldBailOut() || safePointer == nullptr; - } - - private: - Component::BailOutChecker& checker; - const WeakReference safePointer; - - JUCE_DECLARE_NON_COPYABLE (BailOutChecker2) - }; - JUCE_DECLARE_NON_COPYABLE (MouseListenerList) }; @@ -1769,6 +1751,8 @@ void Component::enterModalState (bool shouldTakeKeyboardFocus, // thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe. JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED + SafePointer safeReference { this }; + if (! isCurrentlyModal (false)) { // While this component is in modal state it may block other components from receiving @@ -1776,6 +1760,13 @@ void Component::enterModalState (bool shouldTakeKeyboardFocus, // we must manually force the mouse to "leave" blocked components. ComponentHelpers::sendMouseEventToComponentsThatAreBlockedByModal (*this, &Component::internalMouseExit); + if (safeReference == nullptr) + { + // If you hit this assertion, the mouse-exit event above has caused the modal component to be deleted. + jassertfalse; + return; + } + auto& mcm = *ModalComponentManager::getInstance(); mcm.startModal (this, deleteWhenDismissed); mcm.attachCallback (this, callback); @@ -2413,8 +2404,6 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati if (flags.repaintOnMouseActivityFlag) repaint(); - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), source.getCurrentModifiers(), @@ -2425,6 +2414,8 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati time, 0, false); + + HierarchyChecker checker (this, me); mouseEnter (me); flags.cachedMouseInsideComponent = true; @@ -2433,8 +2424,7 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati return; Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseEnter (me); }); - - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseEnter); } void Component::internalMouseExit (MouseInputSource source, Point relativePos, Time time) @@ -2451,8 +2441,6 @@ void Component::internalMouseExit (MouseInputSource source, Point relativ flags.cachedMouseInsideComponent = false; - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), source.getCurrentModifiers(), @@ -2464,20 +2452,32 @@ void Component::internalMouseExit (MouseInputSource source, Point relativ 0, false); + HierarchyChecker checker (this, me); mouseExit (me); if (checker.shouldBailOut()) return; Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseExit (me); }); - - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseExit, me); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseExit); } void Component::internalMouseDown (MouseInputSource source, const PointerState& relativePointerState, Time time) { auto& desktop = Desktop::getInstance(); - BailOutChecker checker (this); + + const auto me = makeMouseEvent (source, + relativePointerState, + source.getCurrentModifiers(), + this, + this, + time, + relativePointerState.position, + time, + source.getNumberOfMultipleClicks(), + false); + + HierarchyChecker checker (this, me); if (isCurrentlyBlockedByAnotherModalComponent()) { @@ -2492,18 +2492,7 @@ void Component::internalMouseDown (MouseInputSource source, const PointerState& if (isCurrentlyBlockedByAnotherModalComponent()) { // allow blocked mouse-events to go to global listeners.. - const auto me = makeMouseEvent (source, - relativePointerState, - source.getCurrentModifiers(), - this, - this, - time, - relativePointerState.position, - time, - source.getNumberOfMultipleClicks(), - false); - - desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (me); }); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (checker.eventWithNearestParent()); }); return; } } @@ -2532,24 +2521,14 @@ void Component::internalMouseDown (MouseInputSource source, const PointerState& if (flags.repaintOnMouseActivityFlag) repaint(); - const auto me = makeMouseEvent (source, - relativePointerState, - source.getCurrentModifiers(), - this, - this, - time, - relativePointerState.position, - time, - source.getNumberOfMultipleClicks(), - false); mouseDown (me); if (checker.shouldBailOut()) return; - desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (me); }); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (checker.eventWithNearestParent()); }); - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseDown, me); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseDown); } void Component::internalMouseUp (MouseInputSource source, const PointerState& relativePointerState, Time time, const ModifierKeys oldModifiers) @@ -2557,11 +2536,6 @@ void Component::internalMouseUp (MouseInputSource source, const PointerState& re if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent()) return; - BailOutChecker checker (this); - - if (flags.repaintOnMouseActivityFlag) - repaint(); - const auto me = makeMouseEvent (source, relativePointerState, oldModifiers, @@ -2572,15 +2546,21 @@ void Component::internalMouseUp (MouseInputSource source, const PointerState& re source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.isLongPressOrDrag()); + + HierarchyChecker checker (this, me); + + if (flags.repaintOnMouseActivityFlag) + repaint(); + mouseUp (me); if (checker.shouldBailOut()) return; auto& desktop = Desktop::getInstance(); - desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseUp (me); }); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseUp (checker.eventWithNearestParent()); }); - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseUp, me); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseUp); if (checker.shouldBailOut()) return; @@ -2588,13 +2568,14 @@ void Component::internalMouseUp (MouseInputSource source, const PointerState& re // check for double-click if (me.getNumberOfClicks() >= 2) { - mouseDoubleClick (me); + if (checker.nearestNonNullParent() == this) + mouseDoubleClick (checker.eventWithNearestParent()); if (checker.shouldBailOut()) return; - desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseDoubleClick (me); }); - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseDoubleClick (checker.eventWithNearestParent()); }); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseDoubleClick); } } @@ -2602,8 +2583,6 @@ void Component::internalMouseDrag (MouseInputSource source, const PointerState& { if (! isCurrentlyBlockedByAnotherModalComponent()) { - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, relativePointerState, source.getCurrentModifiers(), @@ -2614,14 +2593,16 @@ void Component::internalMouseDrag (MouseInputSource source, const PointerState& source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.isLongPressOrDrag()); + + HierarchyChecker checker (this, me); + mouseDrag (me); if (checker.shouldBailOut()) return; - Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDrag (me); }); - - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me); + Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDrag (checker.eventWithNearestParent()); }); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseDrag); } } @@ -2636,8 +2617,6 @@ void Component::internalMouseMove (MouseInputSource source, Point relativ } else { - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), source.getCurrentModifiers(), @@ -2648,14 +2627,16 @@ void Component::internalMouseMove (MouseInputSource source, Point relativ time, 0, false); + + HierarchyChecker checker (this, me); + mouseMove (me); if (checker.shouldBailOut()) return; - desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseMove (me); }); - - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseMove, me); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseMove (checker.eventWithNearestParent()); }); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseMove); } } @@ -2663,7 +2644,6 @@ void Component::internalMouseWheel (MouseInputSource source, Point relati Time time, const MouseWheelDetails& wheel) { auto& desktop = Desktop::getInstance(); - BailOutChecker checker (this); const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), @@ -2676,6 +2656,8 @@ void Component::internalMouseWheel (MouseInputSource source, Point relati 0, false); + HierarchyChecker checker (this, me); + if (isCurrentlyBlockedByAnotherModalComponent()) { // allow blocked mouse-events to go to global listeners.. @@ -2688,10 +2670,10 @@ void Component::internalMouseWheel (MouseInputSource source, Point relati if (checker.shouldBailOut()) return; - desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseWheelMove (me, wheel); }); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseWheelMove (checker.eventWithNearestParent(), wheel); }); if (! checker.shouldBailOut()) - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseWheelMove, me, wheel); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseWheelMove, wheel); } } @@ -2699,7 +2681,6 @@ void Component::internalMagnifyGesture (MouseInputSource source, Point re Time time, float amount) { auto& desktop = Desktop::getInstance(); - BailOutChecker checker (this); const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), @@ -2712,6 +2693,8 @@ void Component::internalMagnifyGesture (MouseInputSource source, Point re 0, false); + HierarchyChecker checker (this, me); + if (isCurrentlyBlockedByAnotherModalComponent()) { // allow blocked mouse-events to go to global listeners.. @@ -2724,10 +2707,10 @@ void Component::internalMagnifyGesture (MouseInputSource source, Point re if (checker.shouldBailOut()) return; - desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseMagnify (me, amount); }); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseMagnify (checker.eventWithNearestParent(), amount); }); if (! checker.shouldBailOut()) - MouseListenerList::template sendMouseEvent (*this, checker, &MouseListener::mouseMagnify, me, amount); + MouseListenerList::sendMouseEvent (checker, &MouseListener::mouseMagnify, amount); } } diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index 24529bf5..9f730496 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -2132,7 +2132,7 @@ public: @see runModalLoop, enterModalState, isCurrentlyModal */ - void exitModalState (int returnValue); + void exitModalState (int returnValue = 0); /** Returns true if this component is the modal one. diff --git a/modules/juce_gui_basics/desktop/juce_Displays.h b/modules/juce_gui_basics/desktop/juce_Displays.h index 9108d5a9..75bba0db 100644 --- a/modules/juce_gui_basics/desktop/juce_Displays.h +++ b/modules/juce_gui_basics/desktop/juce_Displays.h @@ -93,6 +93,12 @@ public: pixels per inch, divide this by the Display::scale value. */ double dpi; + + /** The vertical refresh rate of the display if applicable. + + Currently this is only used on Linux for display rate repainting. + */ + std::optional verticalFrequencyHz; }; //============================================================================== diff --git a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp index 9887b1c3..eb1c7514 100644 --- a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp @@ -150,15 +150,13 @@ JUCE_IMPLEMENT_SINGLETON (ContentSharer) ContentSharer::ContentSharer() {} ContentSharer::~ContentSharer() { clearSingletonInstance(); } -void ContentSharer::shareFiles (const Array& files, +void ContentSharer::shareFiles ([[maybe_unused]] const Array& files, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); pimpl->shareFiles (files); #else - ignoreUnused (files); - // Content sharing is not available on this platform! jassertfalse; @@ -188,15 +186,13 @@ void ContentSharer::startNewShare (std::function cal } #endif -void ContentSharer::shareText (const String& text, +void ContentSharer::shareText ([[maybe_unused]] const String& text, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); pimpl->shareText (text); #else - ignoreUnused (text); - // Content sharing is not available on this platform! jassertfalse; @@ -205,16 +201,14 @@ void ContentSharer::shareText (const String& text, #endif } -void ContentSharer::shareImages (const Array& images, +void ContentSharer::shareImages ([[maybe_unused]] const Array& images, std::function callbackToUse, - ImageFileFormat* imageFileFormatToUse) + [[maybe_unused]] ImageFileFormat* imageFileFormatToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); prepareImagesThread.reset (new PrepareImagesThread (*this, images, imageFileFormatToUse)); #else - ignoreUnused (images, imageFileFormatToUse); - // Content sharing is not available on this platform! jassertfalse; @@ -238,15 +232,13 @@ void ContentSharer::filesToSharePrepared() } #endif -void ContentSharer::shareData (const MemoryBlock& mb, +void ContentSharer::shareData ([[maybe_unused]] const MemoryBlock& mb, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); prepareDataThread.reset (new PrepareDataThread (*this, mb)); #else - ignoreUnused (mb); - if (callbackToUse) callbackToUse (false, "Content sharing not available on this platform!"); #endif diff --git a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp index 134e4511..75a9f1dd 100644 --- a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp @@ -27,7 +27,7 @@ namespace juce { DirectoryContentsList::DirectoryContentsList (const FileFilter* f, TimeSliceThread& t) - : fileFilter (f), thread (t) + : fileFilter (f), thread (t) { } @@ -202,33 +202,27 @@ int DirectoryContentsList::useTimeSlice() bool DirectoryContentsList::checkNextFile (bool& hasChanged) { - if (fileFindHandle != nullptr) - { - if (*fileFindHandle != RangedDirectoryIterator()) - { - const auto entry = *(*fileFindHandle)++; - - if (addFile (entry.getFile(), - entry.isDirectory(), - entry.getFileSize(), - entry.getModificationTime(), - entry.getCreationTime(), - entry.isReadOnly())) - { - hasChanged = true; - } - - return true; - } + if (fileFindHandle == nullptr) + return false; + if (*fileFindHandle == RangedDirectoryIterator()) + { fileFindHandle = nullptr; isSearching = false; - - if (! wasEmpty && files.isEmpty()) - hasChanged = true; + hasChanged = true; + return false; } - return false; + const auto entry = *(*fileFindHandle)++; + + hasChanged |= addFile (entry.getFile(), + entry.isDirectory(), + entry.getFileSize(), + entry.getModificationTime(), + entry.getCreationTime(), + entry.isReadOnly()); + + return true; } bool DirectoryContentsList::addFile (const File& file, const bool isDir, diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp index 39f337f4..13e4f9d7 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp @@ -63,6 +63,9 @@ FileBrowserComponent::FileBrowserComponent (int flags_, filename = initialFileOrDirectory.getFileName(); } + // The thread must be started before the DirectoryContentsList attempts to scan any file + thread.startThread (Thread::Priority::low); + fileList.reset (new DirectoryContentsList (this, thread)); fileList->setDirectory (currentRoot, true, true); @@ -122,8 +125,6 @@ FileBrowserComponent::FileBrowserComponent (int flags_, if (filename.isNotEmpty()) setFileName (filename); - thread.startThread (4); - startTimer (2000); } @@ -439,7 +440,7 @@ void FileBrowserComponent::fileDoubleClicked (const File& f) void FileBrowserComponent::browserRootChanged (const File&) {} -bool FileBrowserComponent::keyPressed (const KeyPress& key) +bool FileBrowserComponent::keyPressed ([[maybe_unused]] const KeyPress& key) { #if JUCE_LINUX || JUCE_BSD || JUCE_WINDOWS if (key.getModifiers().isCommandDown() @@ -451,7 +452,6 @@ bool FileBrowserComponent::keyPressed (const KeyPress& key) } #endif - ignoreUnused (key); return false; } diff --git a/modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp b/modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp index 10224c49..a85f57ee 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp @@ -270,6 +270,13 @@ void FileChooser::finished (const Array& asyncResults) callback (*this); } +#if ! JUCE_ANDROID +void FileChooser::registerCustomMimeTypeForFileExtension ([[maybe_unused]] const String& mimeType, + [[maybe_unused]] const String& fileExtension) +{ +} +#endif + //============================================================================== FilePreviewComponent::FilePreviewComponent() {} FilePreviewComponent::~FilePreviewComponent() {} diff --git a/modules/juce_gui_basics/filebrowser/juce_FileChooser.h b/modules/juce_gui_basics/filebrowser/juce_FileChooser.h index b9242e9c..c19b9bfb 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileChooser.h +++ b/modules/juce_gui_basics/filebrowser/juce_FileChooser.h @@ -293,6 +293,19 @@ public: */ static bool isPlatformDialogAvailable(); + /** Associate a particular file-extension to a mime-type + + On Android, JUCE needs to convert common file extensions to mime-types when using + wildcard filters in native file chooser dialog boxes. JUCE has an extensive conversion + table to convert between the most common file-types and mime-types transparently, but + some more obscure file-types may be missing. Use this method to register your own + mime-type to file extension conversions. Please contact the JUCE team if you think + that a common mime-type/file-extension entry is missing in JUCE's internal tables. + Does nothing on other platforms. + */ + static void registerCustomMimeTypeForFileExtension (const String& mimeType, + const String& fileExtension); + //============================================================================== #ifndef DOXYGEN class Native; diff --git a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.h b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.h index 904dac3c..bf1e147d 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.h +++ b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.h @@ -60,7 +60,7 @@ namespace juce dialogBox->centreWithDefaultSize (nullptr); dialogBox->enterModalState (true, ModalCallbackFunction::create (onFileSelected), - true); + false); } @endcode diff --git a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp index 8e83749c..073feb9e 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp @@ -31,12 +31,11 @@ Image juce_createIconForFile (const File& file); //============================================================================== FileListComponent::FileListComponent (DirectoryContentsList& listToShow) - : ListBox ({}, nullptr), + : ListBox ({}, this), DirectoryContentsDisplayComponent (listToShow), lastDirectory (listToShow.getDirectory()) { setTitle ("Files"); - setModel (this); directoryContentsList.addChangeListener (this); } @@ -67,14 +66,18 @@ void FileListComponent::scrollToTop() void FileListComponent::setSelectedFile (const File& f) { - for (int i = directoryContentsList.getNumFiles(); --i >= 0;) + if (! directoryContentsList.isStillLoading()) { - if (directoryContentsList.getFile (i) == f) + for (int i = directoryContentsList.getNumFiles(); --i >= 0;) { - fileWaitingToBeSelected = File(); + if (directoryContentsList.getFile (i) == f) + { + fileWaitingToBeSelected = File(); - selectRow (i); - return; + updateContent(); + selectRow (i); + return; + } } } diff --git a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.h b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.h index b5bfe529..3d99e92c 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.h +++ b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.h @@ -40,9 +40,9 @@ namespace juce @tags{GUI} */ -class JUCE_API FileListComponent : public ListBox, +class JUCE_API FileListComponent : private ListBoxModel, + public ListBox, public DirectoryContentsDisplayComponent, - private ListBoxModel, private ChangeListener { public: diff --git a/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp index f5f1e643..916193cf 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp @@ -117,39 +117,30 @@ public: newList->addChangeListener (this); } - bool selectFile (const File& target) + void selectFile (const File& target) { if (file == target) { setSelected (true, true); - return true; + return; } - if (target.isAChildOf (file)) + if (subContentsList != nullptr && subContentsList->isStillLoading()) { - setOpen (true); + pendingFileSelection.emplace (*this, target); + return; + } - for (int maxRetries = 500; --maxRetries > 0;) - { - for (int i = 0; i < getNumSubItems(); ++i) - if (auto* f = dynamic_cast (getSubItem (i))) - if (f->selectFile (target)) - return true; + pendingFileSelection.reset(); - // if we've just opened and the contents are still loading, wait for it.. - if (subContentsList != nullptr && subContentsList->isStillLoading()) - { - Thread::sleep (10); - rebuildItemsFromContentList(); - } - else - { - break; - } - } - } + if (! target.isAChildOf (file)) + return; - return false; + setOpen (true); + + for (int i = 0; i < getNumSubItems(); ++i) + if (auto* f = dynamic_cast (getSubItem (i))) + f->selectFile (target); } void changeListenerCallback (ChangeBroadcaster*) override @@ -224,6 +215,33 @@ public: const File file; private: + class PendingFileSelection : private Timer + { + public: + PendingFileSelection (FileListTreeItem& item, const File& f) + : owner (item), fileToSelect (f) + { + startTimer (10); + } + + ~PendingFileSelection() override + { + stopTimer(); + } + + private: + void timerCallback() override + { + // Take a copy of the file here, in case this PendingFileSelection + // object is destroyed during the call to selectFile. + owner.selectFile (File { fileToSelect }); + } + + FileListTreeItem& owner; + File fileToSelect; + }; + + Optional pendingFileSelection; FileTreeComponent& owner; DirectoryContentsList* parentContentsList; int indexInContentsList; @@ -316,8 +334,7 @@ void FileTreeComponent::setDragAndDropDescription (const String& description) void FileTreeComponent::setSelectedFile (const File& target) { if (auto* t = dynamic_cast (getRootItem())) - if (! t->selectFile (target)) - clearSelectedItems(); + t->selectFile (target); } void FileTreeComponent::setItemHeight (int newHeight) diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp index 50553e40..daa71127 100644 --- a/modules/juce_gui_basics/juce_gui_basics.cpp +++ b/modules/juce_gui_basics/juce_gui_basics.cpp @@ -67,9 +67,19 @@ #include #include #include - #include #include - #include + #include + + #if JUCE_MINGW + // Some MinGW headers use 'new' as a parameter name + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wkeyword-macro") + #define new new_ + JUCE_END_IGNORE_WARNINGS_GCC_LIKE + #endif + + #include + + #undef new #if JUCE_WEB_BROWSER #include @@ -253,6 +263,7 @@ namespace juce #include "windows/juce_ThreadWithProgressWindow.cpp" #include "windows/juce_TooltipWindow.cpp" #include "windows/juce_TopLevelWindow.cpp" +#include "windows/juce_VBlankAttachement.cpp" #include "commands/juce_ApplicationCommandInfo.cpp" #include "commands/juce_ApplicationCommandManager.cpp" #include "commands/juce_ApplicationCommandTarget.cpp" @@ -290,6 +301,7 @@ namespace juce #else #include "native/accessibility/juce_mac_Accessibility.mm" + #include "native/juce_mac_PerScreenDisplayLinks.h" #include "native/juce_mac_NSViewComponentPeer.mm" #include "native/juce_mac_Windowing.mm" #include "native/juce_mac_MainMenu.mm" @@ -316,6 +328,7 @@ namespace juce JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant") + #include "native/x11/juce_linux_ScopedWindowAssociation.h" #include "native/juce_linux_Windowing.cpp" #include "native/x11/juce_linux_XWindowSystem.cpp" @@ -324,6 +337,28 @@ namespace juce #include "native/juce_linux_FileChooser.cpp" #elif JUCE_ANDROID + +namespace juce +{ +static jobject makeAndroidRect (Rectangle r) +{ + return getEnv()->NewObject (AndroidRect, + AndroidRect.constructor, + r.getX(), + r.getY(), + r.getRight(), + r.getBottom()); +} + +static jobject makeAndroidPoint (Point p) +{ + return getEnv()->NewObject (AndroidPoint, + AndroidPoint.create, + p.getX(), + p.getY()); +} +} // namespace juce + #include "juce_core/files/juce_common_MimeTypes.h" #include "native/accessibility/juce_android_Accessibility.cpp" #include "native/juce_android_Windowing.cpp" diff --git a/modules/juce_gui_basics/juce_gui_basics.h b/modules/juce_gui_basics/juce_gui_basics.h index ff32e26f..bd29a182 100644 --- a/modules/juce_gui_basics/juce_gui_basics.h +++ b/modules/juce_gui_basics/juce_gui_basics.h @@ -35,12 +35,12 @@ ID: juce_gui_basics vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE GUI core classes description: Basic user-interface components and related classes. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_graphics juce_data_structures OSXFrameworks: Cocoa QuartzCore @@ -278,6 +278,7 @@ namespace juce #include "windows/juce_NativeMessageBox.h" #include "windows/juce_ThreadWithProgressWindow.h" #include "windows/juce_TooltipWindow.h" +#include "windows/juce_VBlankAttachement.h" #include "layout/juce_MultiDocumentPanel.h" #include "layout/juce_SidePanel.h" #include "filebrowser/juce_FileBrowserListener.h" diff --git a/modules/juce_gui_basics/keyboard/juce_KeyListener.h b/modules/juce_gui_basics/keyboard/juce_KeyListener.h index da33a7ea..40fea0a1 100644 --- a/modules/juce_gui_basics/keyboard/juce_KeyListener.h +++ b/modules/juce_gui_basics/keyboard/juce_KeyListener.h @@ -31,7 +31,7 @@ namespace juce Receives callbacks when keys are pressed. You can add a key listener to a component to be informed when that component - gets key events. See the Component::addListener method for more details. + gets key events. See the Component::addKeyListener method for more details. @see KeyPress, Component::addKeyListener, KeyPressMappingSet diff --git a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h index 5270459e..dcf999e9 100644 --- a/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h +++ b/modules/juce_gui_basics/keyboard/juce_ModifierKeys.h @@ -163,10 +163,10 @@ public: //============================================================================== /** Returns a copy of only the mouse-button flags */ - JUCE_NODISCARD ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); } + [[nodiscard]] ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); } /** Returns a copy of only the non-mouse flags */ - JUCE_NODISCARD ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); } + [[nodiscard]] ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); } bool operator== (const ModifierKeys other) const noexcept { return flags == other.flags; } bool operator!= (const ModifierKeys other) const noexcept { return flags != other.flags; } @@ -175,8 +175,8 @@ public: /** Returns the raw flags for direct testing. */ inline int getRawFlags() const noexcept { return flags; } - JUCE_NODISCARD ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); } - JUCE_NODISCARD ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); } + [[nodiscard]] ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); } + [[nodiscard]] ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); } /** Tests a combination of flags and returns true if any of them are set. */ bool testFlags (int flagsToTest) const noexcept { return (flags & flagsToTest) != 0; } diff --git a/modules/juce_gui_basics/keyboard/juce_TextInputTarget.h b/modules/juce_gui_basics/keyboard/juce_TextInputTarget.h index b255a2a0..fe5ac1a3 100644 --- a/modules/juce_gui_basics/keyboard/juce_TextInputTarget.h +++ b/modules/juce_gui_basics/keyboard/juce_TextInputTarget.h @@ -26,7 +26,6 @@ namespace juce { -//============================================================================== /** An abstract base class which can be implemented by components that function as text editors. @@ -108,7 +107,8 @@ public: decimalKeyboard, urlKeyboard, emailAddressKeyboard, - phoneNumberKeyboard + phoneNumberKeyboard, + passwordKeyboard }; /** Returns the target's preference for the type of keyboard that would be most appropriate. diff --git a/modules/juce_gui_basics/layout/juce_Grid.cpp b/modules/juce_gui_basics/layout/juce_Grid.cpp index aa143a35..b012520d 100644 --- a/modules/juce_gui_basics/layout/juce_Grid.cpp +++ b/modules/juce_gui_basics/layout/juce_Grid.cpp @@ -1047,7 +1047,7 @@ void Grid::performLayout (Rectangle targetArea) + targetArea.toFloat().getPosition(); if (auto* c = item->associatedComponent) - c->setBounds (item->currentBounds.toNearestIntEdges()); + c->setBounds (item->currentBounds.getSmallestIntegerContainer()); } } diff --git a/modules/juce_gui_basics/layout/juce_SidePanel.cpp b/modules/juce_gui_basics/layout/juce_SidePanel.cpp index 758b5d96..dfd36a45 100644 --- a/modules/juce_gui_basics/layout/juce_SidePanel.cpp +++ b/modules/juce_gui_basics/layout/juce_SidePanel.cpp @@ -159,7 +159,8 @@ void SidePanel::paint (Graphics& g) : shadowArea.getTopLeft()).toFloat(), false)); g.fillRect (shadowArea); - g.excludeClipRegion (shadowArea); + g.reduceClipRegion (getLocalBounds().withTrimmedRight (shadowArea.getWidth()) + .withX (isOnLeft ? 0 : shadowArea.getWidth())); g.fillAll (bgColour); } @@ -242,10 +243,8 @@ void SidePanel::lookAndFeelChanged() titleLabel.setJustificationType (lf.getSidePanelTitleJustification (*this)); } -void SidePanel::componentMovedOrResized (Component& component, bool wasMoved, bool wasResized) +void SidePanel::componentMovedOrResized (Component& component, [[maybe_unused]] bool wasMoved, bool wasResized) { - ignoreUnused (wasMoved); - if (wasResized && (&component == parent)) setBounds (calculateBoundsInParent (component)); } diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp index 0ec5d7d2..3c6a6e66 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp @@ -464,10 +464,9 @@ void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g, int x, int y, int g.strokePath (indent, PathStrokeType (0.5f)); } -void LookAndFeel_V3::drawPopupMenuBackground (Graphics& g, int width, int height) +void LookAndFeel_V3::drawPopupMenuBackground (Graphics& g, [[maybe_unused]] int width, [[maybe_unused]] int height) { g.fillAll (findColour (PopupMenu::backgroundColourId)); - ignoreUnused (width, height); #if ! JUCE_MAC g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f)); diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp index bd87b26a..d400073a 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp @@ -353,12 +353,10 @@ void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button, void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component, float x, float y, float w, float h, const bool ticked, - const bool isEnabled, - const bool shouldDrawButtonAsHighlighted, - const bool shouldDrawButtonAsDown) + [[maybe_unused]] const bool isEnabled, + [[maybe_unused]] const bool shouldDrawButtonAsHighlighted, + [[maybe_unused]] const bool shouldDrawButtonAsDown) { - ignoreUnused (isEnabled, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown); - Rectangle tickBounds (x, y, w, h); g.setColour (component.findColour (ToggleButton::tickDisabledColourId)); @@ -619,10 +617,8 @@ int LookAndFeel_V4::getDefaultScrollbarWidth() } void LookAndFeel_V4::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height, - bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) + bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, [[maybe_unused]] bool isMouseDown) { - ignoreUnused (isMouseDown); - Rectangle thumbBounds; if (isScrollbarVertical) @@ -1253,10 +1249,8 @@ void LookAndFeel_V4::drawPropertyComponentBackground (Graphics& g, int width, in g.fillRect (0, 0, width, height - 1); } -void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component) +void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, [[maybe_unused]] int width, int height, PropertyComponent& component) { - ignoreUnused (width); - auto indent = getPropertyComponentIndent (component); g.setColour (component.findColour (PropertyComponent::labelTextColourId) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index ef413750..8dd13573 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -324,12 +324,16 @@ private: //============================================================================== struct MenuWindow : public Component { - MenuWindow (const PopupMenu& menu, MenuWindow* parentWindow, - Options opts, bool alignToRectangle, bool shouldDismissOnMouseUp, - ApplicationCommandManager** manager, float parentScaleFactor = 1.0f) + MenuWindow (const PopupMenu& menu, + MenuWindow* parentWindow, + Options opts, + bool alignToRectangle, + bool shouldDismissOnMouseUp, + ApplicationCommandManager** manager, + float parentScaleFactor = 1.0f) : Component ("menu"), parent (parentWindow), - options (opts.withParentComponent (getLookAndFeel().getParentComponentForMenuOptions (opts))), + options (opts.withParentComponent (findLookAndFeel (menu, parentWindow)->getParentComponentForMenuOptions (opts))), managerOfChosenCommand (manager), componentAttachedTo (options.getTargetComponent()), dismissOnMouseUp (shouldDismissOnMouseUp), @@ -343,8 +347,7 @@ struct MenuWindow : public Component setAlwaysOnTop (true); setFocusContainerType (FocusContainerType::focusContainer); - setLookAndFeel (parent != nullptr ? &(parent->getLookAndFeel()) - : menu.lookAndFeel.get()); + setLookAndFeel (findLookAndFeel (menu, parentWindow)); auto& lf = getLookAndFeel(); @@ -1291,6 +1294,17 @@ struct MenuWindow : public Component })); } + LookAndFeel* findLookAndFeel (const PopupMenu& menu, MenuWindow* parentWindow) const + { + if (parentWindow != nullptr) + return &(parentWindow->getLookAndFeel()); + + if (auto* lnf = menu.lookAndFeel.get()) + return lnf; + + return &getLookAndFeel(); + } + //============================================================================== MenuWindow* parent; const Options options; @@ -2098,7 +2112,7 @@ struct PopupMenuCompletionCallback : public ModalComponentManager::Callback int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentManager::Callback* userCallback, - bool canBeModal) + [[maybe_unused]] bool canBeModal) { std::unique_ptr userCallbackDeleter (userCallback); std::unique_ptr callback (new PopupMenuCompletionCallback()); @@ -2120,7 +2134,6 @@ int PopupMenu::showWithOptionalCallback (const Options& options, if (userCallback == nullptr && canBeModal) return window->runModalLoop(); #else - ignoreUnused (canBeModal); jassert (! (userCallback == nullptr && canBeModal)); #endif } diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.h b/modules/juce_gui_basics/menus/juce_PopupMenu.h index be05c9af..6ca8c721 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.h +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.h @@ -483,8 +483,8 @@ public: @see withTargetComponent, withTargetScreenArea */ - JUCE_NODISCARD Options withTargetComponent (Component* targetComponent) const; - JUCE_NODISCARD Options withTargetComponent (Component& targetComponent) const; + [[nodiscard]] Options withTargetComponent (Component* targetComponent) const; + [[nodiscard]] Options withTargetComponent (Component& targetComponent) const; /** Sets the region of the screen next to which the menu should be displayed. @@ -500,7 +500,7 @@ public: @see withMousePosition */ - JUCE_NODISCARD Options withTargetScreenArea (Rectangle targetArea) const; + [[nodiscard]] Options withTargetScreenArea (Rectangle targetArea) const; /** Sets the target screen area to match the current mouse position. @@ -508,7 +508,7 @@ public: @see withTargetScreenArea */ - JUCE_NODISCARD Options withMousePosition() const; + [[nodiscard]] Options withMousePosition() const; /** If the passed component has been deleted when the popup menu exits, the selected item's action will not be called. @@ -517,26 +517,26 @@ public: callback, in the case that the callback needs to access a component that may be deleted. */ - JUCE_NODISCARD Options withDeletionCheck (Component& componentToWatchForDeletion) const; + [[nodiscard]] Options withDeletionCheck (Component& componentToWatchForDeletion) const; /** Sets the minimum width of the popup window. */ - JUCE_NODISCARD Options withMinimumWidth (int minWidth) const; + [[nodiscard]] Options withMinimumWidth (int minWidth) const; /** Sets the minimum number of columns in the popup window. */ - JUCE_NODISCARD Options withMinimumNumColumns (int minNumColumns) const; + [[nodiscard]] Options withMinimumNumColumns (int minNumColumns) const; /** Sets the maximum number of columns in the popup window. */ - JUCE_NODISCARD Options withMaximumNumColumns (int maxNumColumns) const; + [[nodiscard]] Options withMaximumNumColumns (int maxNumColumns) const; /** Sets the default height of each item in the popup menu. */ - JUCE_NODISCARD Options withStandardItemHeight (int standardHeight) const; + [[nodiscard]] Options withStandardItemHeight (int standardHeight) const; /** Sets an item which must be visible when the menu is initially drawn. This is useful to ensure that a particular item is shown when the menu contains too many items to display on a single screen. */ - JUCE_NODISCARD Options withItemThatMustBeVisible (int idOfItemToBeVisible) const; + [[nodiscard]] Options withItemThatMustBeVisible (int idOfItemToBeVisible) const; /** Sets a component that the popup menu will be drawn into. @@ -547,10 +547,10 @@ public: avoid this unwanted behaviour, but with the downside that the menu size will be constrained by the size of the parent component. */ - JUCE_NODISCARD Options withParentComponent (Component* parentComponent) const; + [[nodiscard]] Options withParentComponent (Component* parentComponent) const; /** Sets the direction of the popup menu relative to the target screen area. */ - JUCE_NODISCARD Options withPreferredPopupDirection (PopupDirection direction) const; + [[nodiscard]] Options withPreferredPopupDirection (PopupDirection direction) const; /** Sets an item to select in the menu. @@ -560,7 +560,7 @@ public: than needing to move the highlighted row down from the top of the menu each time it is opened. */ - JUCE_NODISCARD Options withInitiallySelectedItem (int idOfItemToBeSelected) const; + [[nodiscard]] Options withInitiallySelectedItem (int idOfItemToBeSelected) const; //============================================================================== /** Gets the parent component. This may be nullptr if the Component has been deleted. diff --git a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp index c36306d2..9b60308b 100644 --- a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp +++ b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp @@ -62,10 +62,8 @@ static Rectangle getLogoArea (Rectangle parentRect) } //============================================================================== -JUCESplashScreen::JUCESplashScreen (Component& parent) +JUCESplashScreen::JUCESplashScreen ([[maybe_unused]] Component& parent) { - ignoreUnused (parent); - #if JUCE_DISPLAY_SPLASH_SCREEN if (splashDisplayTime == 0 || Time::getMillisecondCounter() < splashDisplayTime + (uint32) millisecondsToDisplaySplash) diff --git a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp index 24d0e63a..646cdd19 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp @@ -57,18 +57,18 @@ public: return lastPeer; } - Component* findComponentAt (Point screenPos) + static Component* findComponentAt (Point screenPos, ComponentPeer* peer) { - if (auto* peer = getPeer()) - { - auto relativePos = ScalingHelpers::unscaledScreenPosToScaled (peer->getComponent(), - peer->globalToLocal (screenPos)); - auto& comp = peer->getComponent(); + if (! ComponentPeer::isValidPeer (peer)) + return nullptr; - // (the contains() call is needed to test for overlapping desktop windows) - if (comp.contains (relativePos)) - return comp.getComponentAt (relativePos); - } + auto relativePos = ScalingHelpers::unscaledScreenPosToScaled (peer->getComponent(), + peer->globalToLocal (screenPos)); + auto& comp = peer->getComponent(); + + // (the contains() call is needed to test for overlapping desktop windows) + if (comp.contains (relativePos)) + return comp.getComponentAt (relativePos); return nullptr; } @@ -244,11 +244,12 @@ public: void setPeer (ComponentPeer& newPeer, const PointerState& pointerState, Time time) { - if (&newPeer != lastPeer) + if (&newPeer != lastPeer && ( findComponentAt (pointerState.position, &newPeer) != nullptr + || findComponentAt (pointerState.position, lastPeer) == nullptr)) { setComponentUnderMouse (nullptr, pointerState, time); lastPeer = &newPeer; - setComponentUnderMouse (findComponentAt (pointerState.position), pointerState, time); + setComponentUnderMouse (findComponentAt (pointerState.position, getPeer()), pointerState, time); } } @@ -257,7 +258,7 @@ public: const auto& newScreenPos = newPointerState.position; if (! isDragging()) - setComponentUnderMouse (findComponentAt (newScreenPos), newPointerState, time); + setComponentUnderMouse (findComponentAt (newScreenPos, getPeer()), newPointerState, time); if ((newPointerState != lastPointerState) || forceUpdate) { diff --git a/modules/juce_gui_basics/mouse/juce_PointerState.h b/modules/juce_gui_basics/mouse/juce_PointerState.h index 2b516792..97fd53bc 100644 --- a/modules/juce_gui_basics/mouse/juce_PointerState.h +++ b/modules/juce_gui_basics/mouse/juce_PointerState.h @@ -41,13 +41,13 @@ public: bool operator== (const PointerState& other) const noexcept { return tie() == other.tie(); } bool operator!= (const PointerState& other) const noexcept { return tie() != other.tie(); } - JUCE_NODISCARD PointerState withPositionOffset (Point x) const noexcept { return with (&PointerState::position, position + x); } - JUCE_NODISCARD PointerState withPosition (Point x) const noexcept { return with (&PointerState::position, x); } - JUCE_NODISCARD PointerState withPressure (float x) const noexcept { return with (&PointerState::pressure, x); } - JUCE_NODISCARD PointerState withOrientation (float x) const noexcept { return with (&PointerState::orientation, x); } - JUCE_NODISCARD PointerState withRotation (float x) const noexcept { return with (&PointerState::rotation, x); } - JUCE_NODISCARD PointerState withTiltX (float x) const noexcept { return with (&PointerState::tiltX, x); } - JUCE_NODISCARD PointerState withTiltY (float x) const noexcept { return with (&PointerState::tiltY, x); } + [[nodiscard]] PointerState withPositionOffset (Point x) const noexcept { return with (&PointerState::position, position + x); } + [[nodiscard]] PointerState withPosition (Point x) const noexcept { return with (&PointerState::position, x); } + [[nodiscard]] PointerState withPressure (float x) const noexcept { return with (&PointerState::pressure, x); } + [[nodiscard]] PointerState withOrientation (float x) const noexcept { return with (&PointerState::orientation, x); } + [[nodiscard]] PointerState withRotation (float x) const noexcept { return with (&PointerState::rotation, x); } + [[nodiscard]] PointerState withTiltX (float x) const noexcept { return with (&PointerState::tiltX, x); } + [[nodiscard]] PointerState withTiltY (float x) const noexcept { return with (&PointerState::tiltY, x); } Point position; float pressure = MouseInputSource::defaultPressure; diff --git a/modules/juce_gui_basics/mouse/juce_TooltipClient.h b/modules/juce_gui_basics/mouse/juce_TooltipClient.h index a0976b45..0eba1c63 100644 --- a/modules/juce_gui_basics/mouse/juce_TooltipClient.h +++ b/modules/juce_gui_basics/mouse/juce_TooltipClient.h @@ -58,6 +58,7 @@ public: as a base class and calling setTooltip(). Many of the JUCE widgets already use this as a base class to implement their + tooltips. See the TooltipWindow docs for more information about implementing tooltips. @see TooltipClient, TooltipWindow diff --git a/modules/juce_gui_basics/native/accessibility/juce_android_Accessibility.cpp b/modules/juce_gui_basics/native/accessibility/juce_android_Accessibility.cpp index 1ac5ed67..b6b2dee7 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_android_Accessibility.cpp +++ b/modules/juce_gui_basics/native/accessibility/juce_android_Accessibility.cpp @@ -297,21 +297,13 @@ public: { const auto scale = Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale; - const auto screenBounds = accessibilityHandler.getComponent().getScreenBounds() * scale; + LocalRef screenBounds (makeAndroidRect (accessibilityHandler.getComponent().getScreenBounds() * scale)); - LocalRef rect (env->NewObject (AndroidRect, AndroidRect.constructor, - screenBounds.getX(), screenBounds.getY(), - screenBounds.getRight(), screenBounds.getBottom())); + env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setBoundsInScreen, screenBounds.get()); - env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setBoundsInScreen, rect.get()); + LocalRef boundsInParent (makeAndroidRect (accessibilityHandler.getComponent().getBoundsInParent() * scale)); - const auto boundsInParent = accessibilityHandler.getComponent().getBoundsInParent() * scale; - - rect = LocalRef (env->NewObject (AndroidRect, AndroidRect.constructor, - boundsInParent.getX(), boundsInParent.getY(), - boundsInParent.getRight(), boundsInParent.getBottom())); - - env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setBoundsInParent, rect.get()); + env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setBoundsInParent, boundsInParent.get()); } const auto state = accessibilityHandler.getCurrentState(); diff --git a/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm b/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm index 5874ad3e..e7f8516c 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm +++ b/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm @@ -217,7 +217,7 @@ private: template static constexpr void forEach (Func&& func, Items&&... items) { - (void) std::initializer_list { ((void) func (std::forward (items)), 0)... }; + (func (std::forward (items)), ...); } public: diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_Accessibility.cpp b/modules/juce_gui_basics/native/accessibility/juce_win32_Accessibility.cpp index 9be3ac5e..01d383c0 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_Accessibility.cpp +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_Accessibility.cpp @@ -155,11 +155,13 @@ void sendAccessibilityPropertyChangedEvent (const AccessibilityHandler& handler, void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, InternalAccessibilityEvent eventType) { + using namespace ComTypes::Constants; + if (eventType == InternalAccessibilityEvent::elementCreated || eventType == InternalAccessibilityEvent::elementDestroyed) { if (auto* parent = handler.getParent()) - sendAccessibilityAutomationEvent (*parent, ComTypes::UIA_LayoutInvalidatedEventId); + sendAccessibilityAutomationEvent (*parent, UIA_LayoutInvalidatedEventId); return; } @@ -176,9 +178,9 @@ void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, Inte { switch (eventType) { - case InternalAccessibilityEvent::focusChanged: return ComTypes::UIA_AutomationFocusChangedEventId; - case InternalAccessibilityEvent::windowOpened: return ComTypes::UIA_Window_WindowOpenedEventId; - case InternalAccessibilityEvent::windowClosed: return ComTypes::UIA_Window_WindowClosedEventId; + case InternalAccessibilityEvent::focusChanged: return UIA_AutomationFocusChangedEventId; + case InternalAccessibilityEvent::windowOpened: return UIA_Window_WindowOpenedEventId; + case InternalAccessibilityEvent::windowClosed: return UIA_Window_WindowClosedEventId; case InternalAccessibilityEvent::elementCreated: case InternalAccessibilityEvent::elementDestroyed: case InternalAccessibilityEvent::elementMovedOrResized: break; @@ -221,12 +223,14 @@ void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent eventTyp auto event = [eventType]() -> EVENTID { + using namespace ComTypes::Constants; + switch (eventType) { - case AccessibilityEvent::textSelectionChanged: return ComTypes::UIA_Text_TextSelectionChangedEventId; - case AccessibilityEvent::textChanged: return ComTypes::UIA_Text_TextChangedEventId; - case AccessibilityEvent::structureChanged: return ComTypes::UIA_StructureChangedEventId; - case AccessibilityEvent::rowSelectionChanged: return ComTypes::UIA_SelectionItem_ElementSelectedEventId; + case AccessibilityEvent::textSelectionChanged: return UIA_Text_TextSelectionChangedEventId; + case AccessibilityEvent::textChanged: return UIA_Text_TextChangedEventId; + case AccessibilityEvent::structureChanged: return UIA_StructureChangedEventId; + case AccessibilityEvent::rowSelectionChanged: return UIA_SelectionItem_ElementSelectedEventId; case AccessibilityEvent::titleChanged: case AccessibilityEvent::valueChanged: break; } diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.cpp b/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.cpp index d7712203..8b13c317 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.cpp +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.cpp @@ -96,46 +96,48 @@ static String getAutomationId (const AccessibilityHandler& handler) static auto roleToControlTypeId (AccessibilityRole roleType) { + using namespace ComTypes::Constants; + switch (roleType) { case AccessibilityRole::popupMenu: case AccessibilityRole::dialogWindow: case AccessibilityRole::splashScreen: - case AccessibilityRole::window: return ComTypes::UIA_WindowControlTypeId; + case AccessibilityRole::window: return UIA_WindowControlTypeId; case AccessibilityRole::label: - case AccessibilityRole::staticText: return ComTypes::UIA_TextControlTypeId; + case AccessibilityRole::staticText: return UIA_TextControlTypeId; case AccessibilityRole::column: - case AccessibilityRole::row: return ComTypes::UIA_ListItemControlTypeId; - - case AccessibilityRole::button: return ComTypes::UIA_ButtonControlTypeId; - case AccessibilityRole::toggleButton: return ComTypes::UIA_CheckBoxControlTypeId; - case AccessibilityRole::radioButton: return ComTypes::UIA_RadioButtonControlTypeId; - case AccessibilityRole::comboBox: return ComTypes::UIA_ComboBoxControlTypeId; - case AccessibilityRole::image: return ComTypes::UIA_ImageControlTypeId; - case AccessibilityRole::slider: return ComTypes::UIA_SliderControlTypeId; - case AccessibilityRole::editableText: return ComTypes::UIA_EditControlTypeId; - case AccessibilityRole::menuItem: return ComTypes::UIA_MenuItemControlTypeId; - case AccessibilityRole::menuBar: return ComTypes::UIA_MenuBarControlTypeId; - case AccessibilityRole::table: return ComTypes::UIA_TableControlTypeId; - case AccessibilityRole::tableHeader: return ComTypes::UIA_HeaderControlTypeId; - case AccessibilityRole::cell: return ComTypes::UIA_DataItemControlTypeId; - case AccessibilityRole::hyperlink: return ComTypes::UIA_HyperlinkControlTypeId; - case AccessibilityRole::list: return ComTypes::UIA_ListControlTypeId; - case AccessibilityRole::listItem: return ComTypes::UIA_ListItemControlTypeId; - case AccessibilityRole::tree: return ComTypes::UIA_TreeControlTypeId; - case AccessibilityRole::treeItem: return ComTypes::UIA_TreeItemControlTypeId; - case AccessibilityRole::progressBar: return ComTypes::UIA_ProgressBarControlTypeId; - case AccessibilityRole::group: return ComTypes::UIA_GroupControlTypeId; - case AccessibilityRole::scrollBar: return ComTypes::UIA_ScrollBarControlTypeId; - case AccessibilityRole::tooltip: return ComTypes::UIA_ToolTipControlTypeId; + case AccessibilityRole::row: return UIA_ListItemControlTypeId; + + case AccessibilityRole::button: return UIA_ButtonControlTypeId; + case AccessibilityRole::toggleButton: return UIA_CheckBoxControlTypeId; + case AccessibilityRole::radioButton: return UIA_RadioButtonControlTypeId; + case AccessibilityRole::comboBox: return UIA_ComboBoxControlTypeId; + case AccessibilityRole::image: return UIA_ImageControlTypeId; + case AccessibilityRole::slider: return UIA_SliderControlTypeId; + case AccessibilityRole::editableText: return UIA_EditControlTypeId; + case AccessibilityRole::menuItem: return UIA_MenuItemControlTypeId; + case AccessibilityRole::menuBar: return UIA_MenuBarControlTypeId; + case AccessibilityRole::table: return UIA_TableControlTypeId; + case AccessibilityRole::tableHeader: return UIA_HeaderControlTypeId; + case AccessibilityRole::cell: return UIA_DataItemControlTypeId; + case AccessibilityRole::hyperlink: return UIA_HyperlinkControlTypeId; + case AccessibilityRole::list: return UIA_ListControlTypeId; + case AccessibilityRole::listItem: return UIA_ListItemControlTypeId; + case AccessibilityRole::tree: return UIA_TreeControlTypeId; + case AccessibilityRole::treeItem: return UIA_TreeItemControlTypeId; + case AccessibilityRole::progressBar: return UIA_ProgressBarControlTypeId; + case AccessibilityRole::group: return UIA_GroupControlTypeId; + case AccessibilityRole::scrollBar: return UIA_ScrollBarControlTypeId; + case AccessibilityRole::tooltip: return UIA_ToolTipControlTypeId; case AccessibilityRole::ignored: case AccessibilityRole::unspecified: break; }; - return ComTypes::UIA_CustomControlTypeId; + return UIA_CustomControlTypeId; } //============================================================================== @@ -206,38 +208,40 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn return false; }; + using namespace ComTypes::Constants; + switch (pId) { - case ComTypes::UIA_WindowPatternId: + case UIA_WindowPatternId: { if (fragmentRoot) return new UIAWindowProvider (this); break; } - case ComTypes::UIA_TransformPatternId: + case UIA_TransformPatternId: { if (fragmentRoot) return new UIATransformProvider (this); break; } - case ComTypes::UIA_TextPatternId: - case ComTypes::UIA_TextPattern2Id: + case UIA_TextPatternId: + case UIA_TextPattern2Id: { if (accessibilityHandler.getTextInterface() != nullptr) return new UIATextProvider (this); break; } - case ComTypes::UIA_ValuePatternId: + case UIA_ValuePatternId: { if (accessibilityHandler.getValueInterface() != nullptr) return new UIAValueProvider (this); break; } - case ComTypes::UIA_RangeValuePatternId: + case UIA_RangeValuePatternId: { if (accessibilityHandler.getValueInterface() != nullptr && accessibilityHandler.getValueInterface()->getRange().isValid()) @@ -247,7 +251,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn break; } - case ComTypes::UIA_TogglePatternId: + case UIA_TogglePatternId: { if (accessibilityHandler.getCurrentState().isCheckable() && (accessibilityHandler.getActions().contains (AccessibilityActionType::toggle) @@ -258,7 +262,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn break; } - case ComTypes::UIA_SelectionPatternId: + case UIA_SelectionPatternId: { if (role == AccessibilityRole::list || role == AccessibilityRole::popupMenu @@ -269,7 +273,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn break; } - case ComTypes::UIA_SelectionItemPatternId: + case UIA_SelectionItemPatternId: { auto state = accessibilityHandler.getCurrentState(); @@ -280,31 +284,31 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn break; } - case ComTypes::UIA_TablePatternId: - case ComTypes::UIA_GridPatternId: + case UIA_TablePatternId: + case UIA_GridPatternId: { if (accessibilityHandler.getTableInterface() != nullptr - && (pId == ComTypes::UIA_GridPatternId || accessibilityHandler.getRole() == AccessibilityRole::table)) + && (pId == UIA_GridPatternId || accessibilityHandler.getRole() == AccessibilityRole::table)) return static_cast (new UIAGridProvider (this)); break; } - case ComTypes::UIA_TableItemPatternId: - case ComTypes::UIA_GridItemPatternId: + case UIA_TableItemPatternId: + case UIA_GridItemPatternId: { if (isListOrTableCell (accessibilityHandler)) return static_cast (new UIAGridItemProvider (this)); break; } - case ComTypes::UIA_InvokePatternId: + case UIA_InvokePatternId: { if (accessibilityHandler.getActions().contains (AccessibilityActionType::press)) return new UIAInvokeProvider (this); break; } - case ComTypes::UIA_ExpandCollapsePatternId: + case UIA_ExpandCollapsePatternId: { if (accessibilityHandler.getActions().contains (AccessibilityActionType::showMenu) && accessibilityHandler.getCurrentState().isExpandable()) @@ -312,14 +316,14 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn break; } - case ComTypes::UIA_ScrollPatternId: + case UIA_ScrollPatternId: { if (accessibilityHandler.getTableInterface() != nullptr) return new UIAScrollProvider (this); break; } - case ComTypes::UIA_ScrollItemPatternId: + case UIA_ScrollItemPatternId: { if (isListOrTableCell (accessibilityHandler)) return new UIAScrollItemProvider (this); @@ -345,6 +349,8 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI const auto state = accessibilityHandler.getCurrentState(); const auto ignored = accessibilityHandler.isIgnored(); + using namespace ComTypes::Constants; + switch (propertyId) { case UIA_AutomationIdPropertyId: @@ -389,7 +395,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI VariantHelpers::setBool (textInterface->isDisplayingProtectedText(), pRetVal); break; - case ComTypes::UIA_IsPeripheralPropertyId: + case UIA_IsPeripheralPropertyId: VariantHelpers::setBool (role == AccessibilityRole::tooltip || role == AccessibilityRole::popupMenu || role == AccessibilityRole::splashScreen, diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.h b/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.h index a00e6bad..0109d9d1 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.h @@ -26,9 +26,6 @@ namespace juce { -#define UIA_FullDescriptionPropertyId 30159 -#define UIA_IsDialogPropertyId 30174 - class AccessibilityNativeHandle : public ComBaseClassHelper diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_ComInterfaces.h b/modules/juce_gui_basics/native/accessibility/juce_win32_ComInterfaces.h index cb07817b..0f6a08f5 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_ComInterfaces.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_ComInterfaces.h @@ -136,6 +136,68 @@ enum ScrollAmount ScrollAmount_SmallIncrement = 4 }; +namespace Constants +{ + +#undef UIA_InvokePatternId +#undef UIA_SelectionPatternId +#undef UIA_ValuePatternId +#undef UIA_RangeValuePatternId +#undef UIA_ScrollPatternId +#undef UIA_ExpandCollapsePatternId +#undef UIA_GridPatternId +#undef UIA_GridItemPatternId +#undef UIA_WindowPatternId +#undef UIA_SelectionItemPatternId +#undef UIA_TablePatternId +#undef UIA_TableItemPatternId +#undef UIA_TextPatternId +#undef UIA_TogglePatternId +#undef UIA_TransformPatternId +#undef UIA_ScrollItemPatternId +#undef UIA_TextPattern2Id +#undef UIA_StructureChangedEventId +#undef UIA_MenuOpenedEventId +#undef UIA_AutomationFocusChangedEventId +#undef UIA_MenuClosedEventId +#undef UIA_LayoutInvalidatedEventId +#undef UIA_Invoke_InvokedEventId +#undef UIA_SelectionItem_ElementSelectedEventId +#undef UIA_Text_TextSelectionChangedEventId +#undef UIA_Text_TextChangedEventId +#undef UIA_Window_WindowOpenedEventId +#undef UIA_Window_WindowClosedEventId +#undef UIA_IsPeripheralPropertyId +#undef UIA_FullDescriptionPropertyId +#undef UIA_IsDialogPropertyId +#undef UIA_IsReadOnlyAttributeId +#undef UIA_CaretPositionAttributeId +#undef UIA_ButtonControlTypeId +#undef UIA_CheckBoxControlTypeId +#undef UIA_ComboBoxControlTypeId +#undef UIA_EditControlTypeId +#undef UIA_HyperlinkControlTypeId +#undef UIA_ImageControlTypeId +#undef UIA_ListItemControlTypeId +#undef UIA_ListControlTypeId +#undef UIA_MenuBarControlTypeId +#undef UIA_MenuItemControlTypeId +#undef UIA_ProgressBarControlTypeId +#undef UIA_RadioButtonControlTypeId +#undef UIA_ScrollBarControlTypeId +#undef UIA_SliderControlTypeId +#undef UIA_TextControlTypeId +#undef UIA_ToolTipControlTypeId +#undef UIA_TreeControlTypeId +#undef UIA_TreeItemControlTypeId +#undef UIA_CustomControlTypeId +#undef UIA_GroupControlTypeId +#undef UIA_DataItemControlTypeId +#undef UIA_WindowControlTypeId +#undef UIA_HeaderControlTypeId +#undef UIA_HeaderItemControlTypeId +#undef UIA_TableControlTypeId + const long UIA_InvokePatternId = 10000; const long UIA_SelectionPatternId = 10001; const long UIA_ValuePatternId = 10002; @@ -165,6 +227,8 @@ const long UIA_Text_TextChangedEventId = 20015; const long UIA_Window_WindowOpenedEventId = 20016; const long UIA_Window_WindowClosedEventId = 20017; const long UIA_IsPeripheralPropertyId = 30150; +const long UIA_FullDescriptionPropertyId = 30159; +const long UIA_IsDialogPropertyId = 30174; const long UIA_IsReadOnlyAttributeId = 40015; const long UIA_CaretPositionAttributeId = 40038; const long UIA_ButtonControlTypeId = 50000; @@ -193,6 +257,8 @@ const long UIA_HeaderControlTypeId = 50034; const long UIA_HeaderItemControlTypeId = 50035; const long UIA_TableControlTypeId = 50036; +} // namespace Constants + interface IRawElementProviderFragmentRoot; interface IRawElementProviderFragment; diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_UIAExpandCollapseProvider.h b/modules/juce_gui_basics/native/accessibility/juce_win32_UIAExpandCollapseProvider.h index de1772f0..ca6fb8af 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_UIAExpandCollapseProvider.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_UIAExpandCollapseProvider.h @@ -66,9 +66,11 @@ private: if (handler.getActions().invoke (AccessibilityActionType::showMenu)) { + using namespace ComTypes::Constants; + sendAccessibilityAutomationEvent (handler, handler.getCurrentState().isExpanded() - ? ComTypes::UIA_MenuOpenedEventId - : ComTypes::UIA_MenuClosedEventId); + ? UIA_MenuOpenedEventId + : UIA_MenuClosedEventId); return S_OK; } diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_UIAInvokeProvider.h b/modules/juce_gui_basics/native/accessibility/juce_win32_UIAInvokeProvider.h index e991abb6..ff8a4239 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_UIAInvokeProvider.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_UIAInvokeProvider.h @@ -43,8 +43,10 @@ public: if (handler.getActions().invoke (AccessibilityActionType::press)) { + using namespace ComTypes::Constants; + if (isElementValid()) - sendAccessibilityAutomationEvent (handler, ComTypes::UIA_Invoke_InvokedEventId); + sendAccessibilityAutomationEvent (handler, UIA_Invoke_InvokedEventId); return S_OK; } diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_UIASelectionProvider.h b/modules/juce_gui_basics/native/accessibility/juce_win32_UIASelectionProvider.h index dc0427a8..874cb3b3 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_UIASelectionProvider.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_UIASelectionProvider.h @@ -49,8 +49,10 @@ public: if (isRadioButton) { + using namespace ComTypes::Constants; + handler.getActions().invoke (AccessibilityActionType::press); - sendAccessibilityAutomationEvent (handler, ComTypes::UIA_SelectionItem_ElementSelectedEventId); + sendAccessibilityAutomationEvent (handler, UIA_SelectionItem_ElementSelectedEventId); return S_OK; } diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_UIATextProvider.h b/modules/juce_gui_basics/native/accessibility/juce_win32_UIATextProvider.h index 7a6224c8..6b9b0ff4 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_UIATextProvider.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_UIATextProvider.h @@ -303,15 +303,17 @@ private: { VariantHelpers::clear (pRetVal); + using namespace ComTypes::Constants; + switch (attributeId) { - case ComTypes::UIA_IsReadOnlyAttributeId: + case UIA_IsReadOnlyAttributeId: { VariantHelpers::setBool (textInterface.isReadOnly(), pRetVal); break; } - case ComTypes::UIA_CaretPositionAttributeId: + case UIA_CaretPositionAttributeId: { auto cursorPos = textInterface.getTextInsertionOffset(); diff --git a/modules/juce_gui_basics/native/java/app/com/rmsl/juce/ComponentPeerView.java b/modules/juce_gui_basics/native/java/app/com/rmsl/juce/ComponentPeerView.java index fc0371a9..9a82e2c1 100644 --- a/modules/juce_gui_basics/native/java/app/com/rmsl/juce/ComponentPeerView.java +++ b/modules/juce_gui_basics/native/java/app/com/rmsl/juce/ComponentPeerView.java @@ -32,9 +32,20 @@ import android.graphics.Canvas; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Paint; +import android.graphics.Point; import android.graphics.Rect; +import android.os.Build; +import android.text.Selection; +import android.text.SpanWatcher; +import android.text.Spannable; +import android.text.Spanned; +import android.text.TextWatcher; +import android.util.Pair; import android.os.Bundle; +import android.text.Editable; import android.text.InputType; +import android.text.SpannableStringBuilder; +import android.view.Choreographer; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@ -50,10 +61,11 @@ import android.view.inputmethod.InputMethodManager; import java.lang.reflect.Method; import java.util.ArrayList; + import java.util.List; public final class ComponentPeerView extends ViewGroup - implements View.OnFocusChangeListener, Application.ActivityLifecycleCallbacks + implements View.OnFocusChangeListener, Application.ActivityLifecycleCallbacks, Choreographer.FrameCallback { public ComponentPeerView (Context context, boolean opaque_, long host) { @@ -62,9 +74,10 @@ public final class ComponentPeerView extends ViewGroup if (Application.class.isInstance (context)) { ((Application) context).registerActivityLifecycleCallbacks (this); - } else + } + else { - ((Application) context.getApplicationContext ()).registerActivityLifecycleCallbacks (this); + ((Application) context.getApplicationContext()).registerActivityLifecycleCallbacks (this); } this.host = host; @@ -76,7 +89,7 @@ public final class ComponentPeerView extends ViewGroup setOnFocusChangeListener (this); // swap red and blue colours to match internal opengl texture format - ColorMatrix colorMatrix = new ColorMatrix (); + ColorMatrix colorMatrix = new ColorMatrix(); float[] colorTransform = {0, 0, 1.0f, 0, 0, 0, 1.0f, 0, 0, 0, @@ -90,10 +103,12 @@ public final class ComponentPeerView extends ViewGroup try { - method = getClass ().getMethod ("setLayerType", int.class, Paint.class); - } catch (SecurityException e) + method = getClass().getMethod ("setLayerType", int.class, Paint.class); + } + catch (SecurityException e) { - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { } @@ -103,17 +118,22 @@ public final class ComponentPeerView extends ViewGroup { int layerTypeNone = 0; method.invoke (this, layerTypeNone, null); - } catch (java.lang.IllegalArgumentException e) + } + catch (java.lang.IllegalArgumentException e) { - } catch (java.lang.IllegalAccessException e) + } + catch (java.lang.IllegalAccessException e) { - } catch (java.lang.reflect.InvocationTargetException e) + } + catch (java.lang.reflect.InvocationTargetException e) { } } + + Choreographer.getInstance().postFrameCallback (this); } - public void clear () + public void clear() { host = 0; } @@ -130,15 +150,28 @@ public final class ComponentPeerView extends ViewGroup handlePaint (host, canvas, paint); } + private native void handleDoFrame (long host, long frameTimeNanos); + @Override - public boolean isOpaque () + public void doFrame (long frameTimeNanos) + { + if (host == 0) + return; + + handleDoFrame (host, frameTimeNanos); + + Choreographer.getInstance().postFrameCallback (this); + } + + @Override + public boolean isOpaque() { return opaque; } private final boolean opaque; private long host; - private final Paint paint = new Paint (); + private final Paint paint = new Paint(); //============================================================================== private native void handleMouseDown (long host, int index, float x, float y, long time); @@ -152,25 +185,25 @@ public final class ComponentPeerView extends ViewGroup if (host == 0) return false; - int action = event.getAction (); - long time = event.getEventTime (); + int action = event.getAction(); + long time = event.getEventTime(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: - handleMouseDown (host, event.getPointerId (0), event.getRawX (), event.getRawY (), time); + handleMouseDown (host, event.getPointerId (0), event.getRawX(), event.getRawY(), time); return true; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: - handleMouseUp (host, event.getPointerId (0), event.getRawX (), event.getRawY (), time); + handleMouseUp (host, event.getPointerId (0), event.getRawX(), event.getRawY(), time); return true; case MotionEvent.ACTION_MOVE: { - handleMouseDrag (host, event.getPointerId (0), event.getRawX (), event.getRawY (), time); + handleMouseDrag (host, event.getPointerId (0), event.getRawX(), event.getRawY(), time); - int n = event.getPointerCount (); + int n = event.getPointerCount(); if (n > 1) { @@ -190,8 +223,9 @@ public final class ComponentPeerView extends ViewGroup if (i == 0) { - handleMouseUp (host, event.getPointerId (0), event.getRawX (), event.getRawY (), time); - } else + handleMouseUp (host, event.getPointerId (0), event.getRawX(), event.getRawY(), time); + } + else { int point[] = new int[2]; getLocationOnScreen (point); @@ -207,8 +241,9 @@ public final class ComponentPeerView extends ViewGroup if (i == 0) { - handleMouseDown (host, event.getPointerId (0), event.getRawX (), event.getRawY (), time); - } else + handleMouseDown (host, event.getPointerId (0), event.getRawX(), event.getRawY(), time); + } + else { int point[] = new int[2]; getLocationOnScreen (point); @@ -237,32 +272,132 @@ public final class ComponentPeerView extends ViewGroup return false; } + //============================================================================== + public static class TextInputTarget + { + public TextInputTarget (long owner) { host = owner; } + + public boolean isTextInputActive() { return ComponentPeerView.textInputTargetIsTextInputActive (host); } + public int getHighlightedRegionBegin() { return ComponentPeerView.textInputTargetGetHighlightedRegionBegin (host); } + public int getHighlightedRegionEnd() { return ComponentPeerView.textInputTargetGetHighlightedRegionEnd (host); } + public void setHighlightedRegion (int b, int e) { ComponentPeerView.textInputTargetSetHighlightedRegion (host, b, e); } + public String getTextInRange (int b, int e) { return ComponentPeerView.textInputTargetGetTextInRange (host, b, e); } + public void insertTextAtCaret (String text) { ComponentPeerView.textInputTargetInsertTextAtCaret (host, text); } + public int getCaretPosition() { return ComponentPeerView.textInputTargetGetCaretPosition (host); } + public int getTotalNumChars() { return ComponentPeerView.textInputTargetGetTotalNumChars (host); } + public int getCharIndexForPoint (Point point) { return ComponentPeerView.textInputTargetGetCharIndexForPoint (host, point); } + public int getKeyboardType() { return ComponentPeerView.textInputTargetGetKeyboardType (host); } + public void setTemporaryUnderlining (List> list) { ComponentPeerView.textInputTargetSetTemporaryUnderlining (host, list); } + + //============================================================================== + private final long host; + } + + private native static boolean textInputTargetIsTextInputActive (long host); + private native static int textInputTargetGetHighlightedRegionBegin (long host); + private native static int textInputTargetGetHighlightedRegionEnd (long host); + private native static void textInputTargetSetHighlightedRegion (long host, int begin, int end); + private native static String textInputTargetGetTextInRange (long host, int begin, int end); + private native static void textInputTargetInsertTextAtCaret (long host, String text); + private native static int textInputTargetGetCaretPosition (long host); + private native static int textInputTargetGetTotalNumChars (long host); + private native static int textInputTargetGetCharIndexForPoint (long host, Point point); + private native static int textInputTargetGetKeyboardType (long host); + private native static void textInputTargetSetTemporaryUnderlining (long host, List> list); + + private native long getFocusedTextInputTargetPointer (long host); + + private TextInputTarget getFocusedTextInputTarget (long host) + { + final long ptr = getFocusedTextInputTargetPointer (host); + return ptr != 0 ? new TextInputTarget (ptr) : null; + } + //============================================================================== private native void handleKeyDown (long host, int keycode, int textchar, int kbFlags); private native void handleKeyUp (long host, int keycode, int textchar); private native void handleBackButton (long host); private native void handleKeyboardHidden (long host); - public void showKeyboard (String type) + private static int getInputTypeForJuceVirtualKeyboardType (int type) { - InputMethodManager imm = (InputMethodManager) getContext ().getSystemService (Context.INPUT_METHOD_SERVICE); - - if (imm != null) + switch (type) { - if (type.length () > 0) - { - imm.showSoftInput (this, android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT); - imm.setInputMethod (getWindowToken (), type); - keyboardDismissListener.startListening (); - } else - { - imm.hideSoftInputFromWindow (getWindowToken (), 0); - keyboardDismissListener.stopListening (); - } + case 0: // textKeyboard + return InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_NORMAL + | InputType.TYPE_TEXT_FLAG_MULTI_LINE + | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; + case 1: // numericKeyboard + return InputType.TYPE_CLASS_NUMBER + | InputType.TYPE_NUMBER_VARIATION_NORMAL; + case 2: // decimalKeyboard + return InputType.TYPE_CLASS_NUMBER + | InputType.TYPE_NUMBER_VARIATION_NORMAL + | InputType.TYPE_NUMBER_FLAG_DECIMAL; + case 3: // urlKeyboard + return InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_URI + | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; + case 4: // emailAddressKeyboard + return InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS + | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; + case 5: // phoneNumberKeyboard + return InputType.TYPE_CLASS_PHONE; + case 6: // passwordKeyboard + return InputType.TYPE_CLASS_TEXT + | InputType.TYPE_TEXT_VARIATION_PASSWORD + | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; } + + return 0; + } + + InputMethodManager getInputMethodManager() + { + return (InputMethodManager) getContext().getSystemService (Context.INPUT_METHOD_SERVICE); } - public void backButtonPressed () + public void closeInputMethodContext() + { + InputMethodManager imm = getInputMethodManager(); + + if (imm == null) + return; + + if (cachedConnection != null) + cachedConnection.closeConnection(); + + imm.restartInput (this); + } + + public void showKeyboard (int virtualKeyboardType, int selectionStart, int selectionEnd) + { + InputMethodManager imm = getInputMethodManager(); + + if (imm == null) + return; + + // restartingInput causes a call back to onCreateInputConnection, where we'll pick + // up the correct keyboard characteristics to use for the focused TextInputTarget. + imm.restartInput (this); + imm.showSoftInput (this, 0); + keyboardDismissListener.startListening(); + } + + public void hideKeyboard() + { + InputMethodManager imm = getInputMethodManager(); + + if (imm == null) + return; + + imm.hideSoftInputFromWindow (getWindowToken(), 0); + keyboardDismissListener.stopListening(); + } + + public void backButtonPressed() { if (host == 0) return; @@ -276,6 +411,11 @@ public final class ComponentPeerView extends ViewGroup if (host == 0) return false; + // The key event may move the cursor, or in some cases it might enter characters (e.g. + // digits). In this case, we need to reset the IME so that it's aware of the new contents + // of the TextInputTarget. + closeInputMethodContext(); + switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: @@ -283,7 +423,7 @@ public final class ComponentPeerView extends ViewGroup return super.onKeyDown (keyCode, event); case KeyEvent.KEYCODE_BACK: { - backButtonPressed (); + backButtonPressed(); return true; } @@ -293,8 +433,9 @@ public final class ComponentPeerView extends ViewGroup handleKeyDown (host, keyCode, - event.getUnicodeChar (), - event.getMetaState ()); + event.getUnicodeChar(), + event.getMetaState()); + return true; } @@ -304,7 +445,7 @@ public final class ComponentPeerView extends ViewGroup if (host == 0) return false; - handleKeyUp (host, keyCode, event.getUnicodeChar ()); + handleKeyUp (host, keyCode, event.getUnicodeChar()); return true; } @@ -314,17 +455,17 @@ public final class ComponentPeerView extends ViewGroup if (host == 0) return false; - if (keyCode != KeyEvent.KEYCODE_UNKNOWN || event.getAction () != KeyEvent.ACTION_MULTIPLE) + if (keyCode != KeyEvent.KEYCODE_UNKNOWN || (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && event.getAction() != KeyEvent.ACTION_MULTIPLE)) return super.onKeyMultiple (keyCode, count, event); - if (event.getCharacters () != null) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && event.getCharacters() != null) { - int utf8Char = event.getCharacters ().codePointAt (0); + int utf8Char = event.getCharacters().codePointAt (0); handleKeyDown (host, keyCode, utf8Char, - event.getMetaState ()); + event.getMetaState()); return true; } @@ -339,39 +480,40 @@ public final class ComponentPeerView extends ViewGroup view = viewToUse; } - private void startListening () + private void startListening() { - view.getViewTreeObserver ().addOnGlobalLayoutListener (viewTreeObserver); + view.getViewTreeObserver().addOnGlobalLayoutListener (viewTreeObserver); } - private void stopListening () + private void stopListening() { - view.getViewTreeObserver ().removeGlobalOnLayoutListener (viewTreeObserver); + view.getViewTreeObserver().removeOnGlobalLayoutListener (viewTreeObserver); } private class TreeObserver implements ViewTreeObserver.OnGlobalLayoutListener { - TreeObserver () + TreeObserver() { keyboardShown = false; } @Override - public void onGlobalLayout () + public void onGlobalLayout() { - Rect r = new Rect (); + Rect r = new Rect(); - View parentView = getRootView (); + View parentView = getRootView(); int diff; if (parentView == null) { getWindowVisibleDisplayFrame (r); - diff = getHeight () - (r.bottom - r.top); - } else + diff = getHeight() - (r.bottom - r.top); + } + else { parentView.getWindowVisibleDisplayFrame (r); - diff = parentView.getHeight () - (r.bottom - r.top); + diff = parentView.getHeight() - (r.bottom - r.top); } // Arbitrary threshold, surely keyboard would take more than 20 pix. @@ -381,7 +523,7 @@ public final class ComponentPeerView extends ViewGroup handleKeyboardHidden (view.host); } - if (!keyboardShown && diff > 20) + if (! keyboardShown && diff > 20) keyboardShown = true; } @@ -389,26 +531,219 @@ public final class ComponentPeerView extends ViewGroup } private final ComponentPeerView view; - private final TreeObserver viewTreeObserver = new TreeObserver (); + private final TreeObserver viewTreeObserver = new TreeObserver(); } private final KeyboardDismissListener keyboardDismissListener = new KeyboardDismissListener (this); - // this is here to make keyboard entry work on a Galaxy Tab2 10.1 + //============================================================================== + // This implementation is quite similar to the ChangeListener in Android's built-in TextView. + private static final class ChangeWatcher implements SpanWatcher, TextWatcher + { + public ChangeWatcher (ComponentPeerView viewIn, Editable editableIn, TextInputTarget targetIn) + { + view = viewIn; + editable = editableIn; + target = targetIn; + + updateEditableSelectionFromTarget (editable, target); + } + + @Override + public void onSpanAdded (Spannable text, Object what, int start, int end) + { + updateTargetRangesFromEditable (editable, target); + } + + @Override + public void onSpanRemoved (Spannable text, Object what, int start, int end) + { + updateTargetRangesFromEditable (editable, target); + } + + @Override + public void onSpanChanged (Spannable text, Object what, int ostart, int oend, int nstart, int nend) + { + updateTargetRangesFromEditable (editable, target); + } + + @Override + public void afterTextChanged (Editable s) + { + } + + @Override + public void beforeTextChanged (CharSequence s, int start, int count, int after) + { + contentsBeforeChange = s.toString(); + } + + @Override + public void onTextChanged (CharSequence s, int start, int before, int count) + { + if (editable != s || contentsBeforeChange == null) + return; + + final String newText = s.subSequence (start, start + count).toString(); + + int code = 0; + + if (newText.endsWith ("\n") || newText.endsWith ("\r")) + code = KeyEvent.KEYCODE_ENTER; + + if (newText.endsWith ("\t")) + code = KeyEvent.KEYCODE_TAB; + + target.setHighlightedRegion (contentsBeforeChange.codePointCount (0, start), + contentsBeforeChange.codePointCount (0, start + before)); + target.insertTextAtCaret (code != 0 ? newText.substring (0, newText.length() - 1) + : newText); + + // Treating return/tab as individual keypresses rather than part of the composition + // sequence allows TextEditor onReturn and onTab to work as expected. + if (code != 0) + view.onKeyDown (code, new KeyEvent (KeyEvent.ACTION_DOWN, code)); + + updateTargetRangesFromEditable (editable, target); + contentsBeforeChange = null; + } + + private static void updateEditableSelectionFromTarget (Editable editable, TextInputTarget text) + { + final int start = text.getHighlightedRegionBegin(); + final int end = text.getHighlightedRegionEnd(); + + if (start < 0 || end < 0) + return; + + final String string = editable.toString(); + Selection.setSelection (editable, + string.offsetByCodePoints (0, start), + string.offsetByCodePoints (0, end)); + } + + private static void updateTargetSelectionFromEditable (Editable editable, TextInputTarget target) + { + final int start = Selection.getSelectionStart (editable); + final int end = Selection.getSelectionEnd (editable); + + if (start < 0 || end < 0) + return; + + final String string = editable.toString(); + target.setHighlightedRegion (string.codePointCount (0, start), + string.codePointCount (0, end)); + } + + private static List> getUnderlinedRanges (Editable editable) + { + final int start = BaseInputConnection.getComposingSpanStart (editable); + final int end = BaseInputConnection.getComposingSpanEnd (editable); + + if (start < 0 || end < 0) + return null; + + final String string = editable.toString(); + + final ArrayList> pairs = new ArrayList<>(); + pairs.add (new Pair<> (string.codePointCount (0, start), string.codePointCount (0, end))); + return pairs; + } + + private static void updateTargetCompositionRangesFromEditable (Editable editable, TextInputTarget target) + { + target.setTemporaryUnderlining (getUnderlinedRanges (editable)); + } + + private static void updateTargetRangesFromEditable (Editable editable, TextInputTarget target) + { + updateTargetSelectionFromEditable (editable, target); + updateTargetCompositionRangesFromEditable (editable, target); + } + + private final ComponentPeerView view; + private final TextInputTarget target; + private final Editable editable; + private String contentsBeforeChange; + } + + private static final class Connection extends BaseInputConnection + { + Connection (ComponentPeerView viewIn, boolean fullEditor, TextInputTarget targetIn) + { + super (viewIn, fullEditor); + view = viewIn; + target = targetIn; + } + + @Override + public Editable getEditable() + { + if (cached != null) + return cached; + + if (target == null) + return cached = super.getEditable(); + + int length = target.getTotalNumChars(); + String initialText = target.getTextInRange (0, length); + cached = new SpannableStringBuilder (initialText); + // Span the entire range of text, so that we pick up changes at any location. + // Use cached.length rather than target.getTotalNumChars here, because this + // range is in UTF-16 code units, rather than code points. + changeWatcher = new ChangeWatcher (view, cached, target); + cached.setSpan (changeWatcher, 0, cached.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); + return cached; + } + + /** Call this to stop listening for selection/composition updates. + + We do this before closing the current input method context (e.g. when the user + taps on a text view to move the cursor), because otherwise the input system + might send another round of notifications *during* the restartInput call, after we've + requested that the input session should end. + */ + @Override + public void closeConnection() + { + if (cached != null && changeWatcher != null) + cached.removeSpan (changeWatcher); + + cached = null; + target = null; + + super.closeConnection(); + } + + private ComponentPeerView view; + private TextInputTarget target; + private Editable cached; + private ChangeWatcher changeWatcher; + } + @Override public InputConnection onCreateInputConnection (EditorInfo outAttrs) { + TextInputTarget focused = getFocusedTextInputTarget (host); + outAttrs.actionLabel = ""; outAttrs.hintText = ""; outAttrs.initialCapsMode = 0; - outAttrs.initialSelEnd = outAttrs.initialSelStart = -1; + outAttrs.initialSelStart = focused != null ? focused.getHighlightedRegionBegin() : -1; + outAttrs.initialSelEnd = focused != null ? focused.getHighlightedRegionEnd() : -1; outAttrs.label = ""; - outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI; - outAttrs.inputType = InputType.TYPE_NULL; - - return new BaseInputConnection (this, false); + outAttrs.imeOptions = EditorInfo.IME_ACTION_UNSPECIFIED + | EditorInfo.IME_FLAG_NO_EXTRACT_UI + | EditorInfo.IME_FLAG_NO_ENTER_ACTION; + outAttrs.inputType = focused != null ? getInputTypeForJuceVirtualKeyboardType (focused.getKeyboardType()) + : 0; + + cachedConnection = new Connection (this, true, focused); + return cachedConnection; } + private Connection cachedConnection; + //============================================================================== @Override protected void onSizeChanged (int w, int h, int oldw, int oldh) @@ -447,11 +782,13 @@ public final class ComponentPeerView extends ViewGroup Method systemUIVisibilityMethod = null; try { - systemUIVisibilityMethod = this.getClass ().getMethod ("setSystemUiVisibility", int.class); - } catch (SecurityException e) + systemUIVisibilityMethod = this.getClass().getMethod ("setSystemUiVisibility", int.class); + } + catch (SecurityException e) { return; - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { return; } @@ -460,18 +797,21 @@ public final class ComponentPeerView extends ViewGroup try { systemUIVisibilityMethod.invoke (this, visibility); - } catch (java.lang.IllegalArgumentException e) + } + catch (java.lang.IllegalArgumentException e) { - } catch (java.lang.IllegalAccessException e) + } + catch (java.lang.IllegalAccessException e) { - } catch (java.lang.reflect.InvocationTargetException e) + } + catch (java.lang.reflect.InvocationTargetException e) { } } - public boolean isVisible () + public boolean isVisible() { - return getVisibility () == VISIBLE; + return getVisibility() == VISIBLE; } public void setVisible (boolean b) @@ -556,11 +896,22 @@ public final class ComponentPeerView extends ViewGroup if (host == 0) return null; - final AccessibilityNodeInfo nodeInfo = AccessibilityNodeInfo.obtain (view, virtualViewId); + final AccessibilityNodeInfo nodeInfo; + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) + { + nodeInfo = new AccessibilityNodeInfo (view, virtualViewId); + } + else + { + nodeInfo = AccessibilityNodeInfo.obtain (view, virtualViewId); + } if (! populateAccessibilityNodeInfo (host, virtualViewId, nodeInfo)) { - nodeInfo.recycle(); + if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.R) + nodeInfo.recycle(); + return null; } @@ -601,10 +952,10 @@ public final class ComponentPeerView extends ViewGroup } private final JuceAccessibilityNodeProvider nodeProvider = new JuceAccessibilityNodeProvider (this); - private final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext ().getSystemService (Context.ACCESSIBILITY_SERVICE); + private final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService (Context.ACCESSIBILITY_SERVICE); @Override - public AccessibilityNodeProvider getAccessibilityNodeProvider () + public AccessibilityNodeProvider getAccessibilityNodeProvider() { return nodeProvider; } diff --git a/modules/juce_gui_basics/native/java/app/com/rmsl/juce/JuceContentProviderFileObserver.java b/modules/juce_gui_basics/native/java/app/com/rmsl/juce/JuceContentProviderFileObserver.java index a89dc646..61f9a070 100644 --- a/modules/juce_gui_basics/native/java/app/com/rmsl/juce/JuceContentProviderFileObserver.java +++ b/modules/juce_gui_basics/native/java/app/com/rmsl/juce/JuceContentProviderFileObserver.java @@ -34,7 +34,6 @@ public final class JuceContentProviderFileObserver extends FileObserver public JuceContentProviderFileObserver (long hostToUse, String path, int mask) { super (path, mask); - host = hostToUse; } diff --git a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp index ba3f3376..9330d28d 100644 --- a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp @@ -101,7 +101,7 @@ public: class Owner { public: - virtual ~Owner() {} + virtual ~Owner() = default; virtual void cursorClosed (const AndroidContentSharerCursor&) = 0; }; @@ -121,9 +121,9 @@ public: jobject getNativeCursor() { return cursor.get(); } - void cursorClosed() + static void cursorClosed (JNIEnv*, AndroidContentSharerCursor& t) { - MessageManager::callAsync ([this] { owner.cursorClosed (*this); }); + MessageManager::callAsync ([&t] { t.owner.cursorClosed (t); }); } void addRow (LocalRef& values) @@ -141,20 +141,12 @@ private: #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (addRow, "addRow", "([Ljava/lang/Object;)V") \ METHOD (constructor, "", "(J[Ljava/lang/String;)V") \ - CALLBACK (contentSharerCursorClosed, "contentSharerCursorClosed", "(J)V") \ + CALLBACK (generatedCallback<&AndroidContentSharerCursor::cursorClosed>, "contentSharerCursorClosed", "(J)V") \ - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceContentProviderCursor, "com/rmsl/juce/JuceContentProviderCursor", 16, javaJuceContentProviderCursor, sizeof (javaJuceContentProviderCursor)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceContentProviderCursor, "com/rmsl/juce/JuceContentProviderCursor", 16, javaJuceContentProviderCursor) #undef JNI_CLASS_MEMBERS - - static void JNICALL contentSharerCursorClosed (JNIEnv*, jobject, jlong host) - { - if (auto* myself = reinterpret_cast (host)) - myself->cursorClosed(); - } }; -AndroidContentSharerCursor::JuceContentProviderCursor_Class AndroidContentSharerCursor::JuceContentProviderCursor; - //============================================================================== class AndroidContentSharerFileObserver { @@ -184,10 +176,8 @@ public: env->CallVoidMethod (fileObserver, JuceContentProviderFileObserver.startWatching); } - void onFileEvent (int event, const LocalRef& path) + void onFileEvent (int event, [[maybe_unused]] const LocalRef& path) { - ignoreUnused (path); - if (event == open) { ++numOpenedHandles; @@ -230,20 +220,17 @@ private: METHOD (constructor, "", "(JLjava/lang/String;I)V") \ METHOD (startWatching, "startWatching", "()V") \ METHOD (stopWatching, "stopWatching", "()V") \ - CALLBACK (contentSharerFileObserverEvent, "contentSharerFileObserverEvent", "(JILjava/lang/String;)V") \ + CALLBACK (generatedCallback<&AndroidContentSharerFileObserver::onFileEventCallback>, "contentSharerFileObserverEvent", "(JILjava/lang/String;)V") \ - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceContentProviderFileObserver, "com/rmsl/juce/JuceContentProviderFileObserver", 16, javaJuceContentProviderFileObserver, sizeof (javaJuceContentProviderFileObserver)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceContentProviderFileObserver, "com/rmsl/juce/JuceContentProviderFileObserver", 16, javaJuceContentProviderFileObserver) #undef JNI_CLASS_MEMBERS - static void JNICALL contentSharerFileObserverEvent (JNIEnv*, jobject /*fileObserver*/, jlong host, int event, jstring path) + static void onFileEventCallback (JNIEnv*, AndroidContentSharerFileObserver& t, jint event, jstring path) { - if (auto* myself = reinterpret_cast (host)) - myself->onFileEvent (event, LocalRef (path)); + t.onFileEvent (event, LocalRef (path)); } }; -AndroidContentSharerFileObserver::JuceContentProviderFileObserver_Class AndroidContentSharerFileObserver::JuceContentProviderFileObserver; - //============================================================================== class AndroidContentSharerPrepareFilesThread : private Thread { @@ -513,10 +500,8 @@ public: //============================================================================== jobject openFile (const LocalRef& contentProvider, - const LocalRef& uri, const LocalRef& mode) + const LocalRef& uri, [[maybe_unused]] const LocalRef& mode) { - ignoreUnused (mode); - WeakReference weakRef (this); if (weakRef == nullptr) @@ -895,6 +880,4 @@ ContentSharer::Pimpl* ContentSharer::createPimpl() return new ContentSharerNativeImpl (*this); } -ContentSharer::ContentSharerNativeImpl::JuceSharingContentProvider_Class ContentSharer::ContentSharerNativeImpl::JuceSharingContentProvider; - } // namespace juce diff --git a/modules/juce_gui_basics/native/juce_android_FileChooser.cpp b/modules/juce_gui_basics/native/juce_android_FileChooser.cpp index 53c2456e..b28166e0 100644 --- a/modules/juce_gui_basics/native/juce_android_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_android_FileChooser.cpp @@ -277,4 +277,10 @@ bool FileChooser::isPlatformDialogAvailable() #endif } +void FileChooser::registerCustomMimeTypeForFileExtension (const String& mimeType, + const String& fileExtension) +{ + MimeTypeTable::registerCustomMimeTypeForFileExtension (mimeType, fileExtension); +} + } // namespace juce diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index a6b8a974..1fadc42a 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -25,104 +25,768 @@ namespace juce { + // This byte-code is generated from native/java/com/rmsl/juce/ComponentPeerView.java with min sdk version 16 // See juce_core/native/java/README.txt on how to generate this byte-code. -static const uint8 javaComponentPeerView[] = -{ 31,139,8,8,217,126,216,97,0,3,74,97,118,97,68,101,120,66,121,116,101,67,111,100,101,46,100,101,120,0,165,155,11,124,212,213,149,199,207,189,255,255,204,36,147,215,100,18,146,64,18,50,9,175,16,72,102,8,111,19,148,183,6,18,64,18,16,18,171,76,146,127,146, - 129,201,127,134,153,73,72,124,21,149,143,96,173,21,45,82,21,109,177,165,182,110,109,215,90,219,181,22,181,93,93,215,173,186,85,107,87,180,90,31,69,197,150,90,180,86,105,117,117,127,247,49,147,9,143,210,118,195,231,59,231,252,207,125,223,123,238,185,247, - 63,33,221,214,144,59,48,115,54,125,253,172,186,247,86,249,42,166,141,253,112,218,236,231,195,83,47,91,120,183,99,205,99,123,255,208,184,125,22,81,148,136,134,214,207,242,146,254,57,56,147,168,146,41,251,60,240,129,73,180,4,242,121,7,81,9,228,241,12,162, - 203,33,31,200,36,66,18,237,207,33,218,52,153,200,151,75,212,94,78,116,33,184,24,116,130,205,192,6,215,128,107,193,245,96,55,216,3,110,1,251,192,215,192,195,224,5,240,18,248,13,120,3,188,5,126,15,142,129,63,131,156,241,232,7,184,8,12,131,61,224,126,240, - 60,248,12,140,173,32,170,7,231,130,207,129,65,112,19,120,8,60,7,142,130,137,62,162,101,96,8,220,3,14,131,194,74,162,6,208,11,246,130,23,64,69,21,198,2,46,7,119,130,159,129,195,192,152,64,84,14,2,160,13,92,2,110,0,247,129,199,193,155,224,47,160,122,34, - 209,82,208,1,194,224,10,176,3,220,4,110,6,183,130,253,224,0,184,7,220,7,126,12,30,1,143,129,39,192,211,224,57,240,2,120,5,188,14,222,1,71,193,123,224,35,240,9,48,38,17,101,130,28,224,5,227,64,37,152,4,166,130,5,96,45,184,8,108,6,131,224,42,240,37,112, - 27,184,11,220,7,30,6,79,130,151,192,49,112,28,56,176,174,121,160,6,204,6,243,192,74,208,10,58,64,23,8,131,56,216,14,174,7,119,128,123,192,15,193,65,240,34,120,21,188,1,222,1,89,83,136,138,64,57,152,6,230,129,117,32,14,174,0,55,128,187,192,15,193,35,224, - 73,240,34,56,12,254,2,114,171,137,202,192,20,48,15,44,7,171,193,6,96,129,109,96,39,184,29,124,7,252,4,188,8,94,5,111,130,35,128,79,37,42,0,147,192,92,176,28,180,130,16,184,4,92,7,110,3,223,2,7,193,227,224,85,240,14,248,35,120,31,124,10,140,26,248,15, - 152,0,102,129,115,64,11,184,0,92,12,182,128,1,176,27,236,3,7,192,67,224,41,240,75,240,6,56,2,142,129,227,224,99,192,166,17,185,65,33,168,2,53,32,0,230,128,38,112,17,136,130,171,193,126,240,3,240,56,120,21,188,13,62,4,206,233,40,15,42,64,29,152,11,22, - 129,53,224,34,208,3,34,96,24,108,7,95,4,251,192,215,193,207,192,99,224,105,240,30,200,171,197,122,129,82,48,13,204,7,107,65,39,136,130,47,128,59,193,195,224,73,240,18,120,11,124,8,204,58,204,51,152,0,234,65,51,88,11,54,128,77,160,15,216,32,14,134,193, - 213,224,26,112,61,216,11,110,7,223,5,15,128,159,131,23,193,155,224,8,248,61,248,35,248,19,248,8,124,12,62,3,78,196,36,132,40,202,2,69,160,152,84,220,26,11,198,129,82,80,6,16,82,8,97,131,16,22,8,97,128,176,237,9,91,156,176,125,9,219,138,224,254,4,119, - 37,184,28,193,101,8,203,77,88,30,194,244,18,166,133,48,60,66,115,228,7,1,48,3,212,3,132,79,66,88,165,217,96,14,152,171,227,232,124,112,22,104,0,141,96,1,56,27,156,3,22,130,69,96,49,169,88,187,12,156,7,54,128,78,208,5,186,129,69,106,124,201,31,151,150, - 247,151,170,49,51,253,236,214,186,176,139,121,224,218,158,173,245,131,176,231,165,213,229,213,115,246,152,182,231,106,123,158,78,75,234,99,180,238,209,243,42,234,47,208,250,83,186,108,73,90,157,98,174,159,47,85,186,152,227,151,117,158,201,105,245,76, - 213,245,228,107,253,48,244,66,173,31,45,85,109,138,57,255,64,215,35,244,79,116,61,181,186,158,49,122,29,204,50,213,31,177,22,217,101,106,14,235,117,158,38,173,139,182,86,104,189,16,121,86,106,93,180,219,172,117,31,236,45,90,15,64,95,165,245,70,232,171, - 181,126,30,244,53,90,111,131,126,190,214,47,132,222,170,245,238,52,123,56,77,79,64,95,167,245,203,210,236,187,210,244,221,105,250,45,105,117,238,79,179,127,27,122,155,214,239,77,179,31,40,29,209,197,156,175,213,186,152,207,100,61,15,164,229,23,243,185, - 94,235,63,133,253,2,173,63,145,150,231,80,154,254,90,153,242,205,153,122,110,55,106,253,8,236,237,90,63,150,166,127,2,189,67,235,25,226,142,160,117,15,244,207,105,189,76,220,27,180,94,13,253,34,173,7,210,236,194,199,54,105,125,30,236,65,173,159,151,150, - 191,173,92,248,57,163,97,82,50,135,137,125,63,137,226,164,228,191,73,201,232,65,45,15,106,249,144,150,15,107,249,136,206,255,115,18,177,194,71,110,166,100,1,19,113,99,38,253,23,9,89,65,89,76,196,16,149,94,161,211,43,144,82,196,132,207,23,209,86,225,79, - 216,117,15,72,89,65,79,72,89,78,191,148,114,38,189,35,101,22,29,149,62,63,153,150,67,58,16,129,254,68,98,127,58,233,70,41,199,208,126,200,76,68,49,67,202,89,244,33,137,125,94,45,159,179,180,61,11,17,225,35,57,110,245,156,135,118,111,144,178,136,110,210, - 207,183,106,121,167,152,127,157,46,228,110,41,77,186,89,63,239,147,210,160,219,73,237,211,59,180,252,170,148,140,238,210,242,91,36,246,37,167,189,82,78,165,111,146,216,131,147,100,251,5,136,120,191,149,114,62,29,150,178,148,222,38,177,95,107,105,64,203, - 15,72,196,233,57,244,31,36,226,72,54,61,47,229,88,122,159,68,44,81,227,24,139,136,43,100,25,162,230,143,164,172,161,191,74,121,14,153,114,93,2,50,189,28,51,176,67,202,18,218,165,159,175,149,114,30,189,43,215,171,78,230,27,143,26,95,39,177,78,170,92,5, - 236,61,90,246,74,153,71,125,82,142,37,7,83,210,41,215,115,178,204,239,195,10,133,164,244,211,102,41,23,209,22,41,11,40,172,101,191,148,11,201,150,114,44,13,105,121,185,148,115,233,74,41,43,233,58,41,189,116,189,148,57,244,37,41,157,180,71,251,205,94, - 157,254,21,41,103,211,45,82,102,210,215,164,116,211,215,117,190,111,72,153,65,7,164,84,235,32,252,236,110,41,203,232,95,180,252,142,150,247,104,127,252,174,148,227,233,123,218,254,175,186,220,189,90,126,95,203,251,164,244,209,15,164,108,160,251,165,156, - 67,143,105,249,184,148,19,232,5,41,171,232,144,150,47,106,249,146,78,255,181,126,126,89,203,87,164,204,165,223,72,57,133,94,149,114,58,189,38,229,217,244,134,148,202,143,124,218,143,196,243,155,122,255,188,37,165,242,43,145,255,136,148,141,116,76,202, - 122,58,174,229,95,164,156,70,159,72,57,142,62,149,114,6,125,166,159,137,169,124,76,75,206,84,186,193,212,188,20,50,113,110,21,211,109,36,228,98,122,84,238,87,78,63,147,50,159,188,76,156,77,202,95,167,97,103,124,153,196,249,100,208,21,82,114,122,154,196, - 25,85,72,255,78,226,190,48,86,251,171,218,83,201,51,19,175,88,116,33,98,220,21,250,208,26,175,237,226,204,19,49,93,164,39,32,239,208,233,21,186,252,180,180,242,59,144,126,175,78,247,145,58,87,197,153,120,143,46,191,7,242,144,78,23,119,129,169,208,3,245, - 234,190,112,86,189,178,173,134,92,15,12,157,190,9,108,214,121,226,210,110,72,157,251,213,189,161,131,185,41,234,17,55,168,14,158,133,181,204,64,45,162,173,28,191,186,59,121,89,91,167,155,182,122,102,193,158,197,139,240,218,56,131,115,115,62,55,201,229, - 201,167,182,206,44,218,234,171,160,24,118,191,200,215,214,165,242,26,148,101,110,93,51,135,22,15,184,249,124,254,135,207,108,143,24,143,203,83,253,182,169,219,159,224,87,119,152,42,204,104,212,115,153,28,173,104,91,244,187,214,175,238,96,167,107,219, - 160,124,230,245,206,156,50,246,228,54,3,115,105,177,35,27,49,227,24,218,20,113,202,205,108,223,20,68,169,108,86,253,214,201,185,231,201,220,213,239,136,248,107,202,254,44,241,171,181,107,139,170,124,34,165,136,203,123,9,159,143,60,94,196,151,182,173, - 238,244,116,206,118,176,155,93,119,109,115,206,199,200,16,215,143,25,232,175,24,227,106,191,136,247,152,89,111,14,198,184,13,54,47,93,232,201,150,119,180,12,60,137,177,110,240,171,179,182,192,89,72,85,60,27,249,196,44,180,197,115,168,109,102,46,217,158, - 165,200,149,205,230,179,198,17,155,239,60,236,197,145,28,139,144,195,109,172,157,40,222,21,25,125,191,237,70,50,204,217,155,198,209,186,56,230,193,40,34,175,113,33,180,100,254,182,68,14,250,29,192,72,178,77,209,127,83,206,195,108,90,226,16,249,231,27, - 46,154,187,201,65,222,2,81,70,180,85,140,56,103,123,138,196,200,78,104,163,250,191,197,90,10,159,187,218,175,238,116,29,222,92,61,206,42,204,97,212,39,246,82,135,7,20,228,201,49,51,249,143,232,203,126,245,253,67,212,35,110,123,185,41,251,190,148,189, - 94,218,185,190,21,127,195,175,252,185,205,147,39,247,132,240,32,209,238,119,252,234,94,220,230,203,67,31,197,205,27,227,172,244,160,215,101,104,57,55,149,239,190,211,230,43,151,249,114,225,241,98,36,63,70,190,167,132,223,185,188,69,81,95,9,226,111,149, - 153,133,222,56,209,171,142,61,69,120,170,160,104,160,150,246,100,118,236,41,192,83,57,158,38,203,167,66,212,187,16,107,157,109,142,115,68,81,47,86,16,122,133,89,132,114,249,84,102,58,96,75,32,190,187,205,121,230,231,168,194,45,158,241,158,74,237,183, - 123,161,69,113,227,185,112,223,24,104,33,156,77,182,111,179,252,220,130,243,190,10,117,70,61,242,60,54,11,105,194,162,89,52,153,137,27,161,237,51,209,243,54,209,39,7,246,175,207,65,162,70,23,90,245,26,182,103,72,247,228,99,242,78,158,208,51,7,227,233, - 204,40,166,150,12,167,203,91,92,150,145,37,53,59,16,167,54,103,182,49,207,40,36,47,247,78,156,176,116,46,121,29,91,61,131,152,135,108,103,139,211,116,120,199,120,165,180,3,151,210,151,77,225,105,194,187,197,168,84,239,247,80,245,157,57,102,245,7,224, - 125,112,12,188,4,196,225,97,152,242,61,96,228,103,251,57,244,15,61,159,248,163,210,197,93,178,8,251,241,18,82,247,23,110,84,223,202,166,124,133,213,221,204,248,244,59,88,205,62,70,58,186,224,221,47,160,124,166,213,231,149,113,214,148,145,15,239,125,1, - 237,99,129,213,84,105,228,98,207,59,100,188,155,27,80,49,54,186,174,143,42,151,184,165,63,39,203,44,77,166,5,22,163,76,182,244,193,100,90,75,42,237,236,84,154,75,222,254,16,135,117,218,160,179,77,70,6,81,167,67,239,123,43,160,246,76,235,66,111,90,124, - 49,224,139,194,18,13,52,227,118,84,253,215,145,241,244,235,186,196,123,113,59,198,148,171,251,32,126,226,1,21,251,189,158,188,212,158,185,60,144,220,51,133,178,79,73,251,213,218,190,206,51,70,182,207,245,222,187,54,160,222,61,109,207,114,217,87,25,235, - 80,159,151,170,63,53,116,59,55,4,212,57,146,43,203,169,55,211,175,164,217,156,58,126,127,245,12,99,91,161,199,150,204,255,173,51,228,95,153,154,11,213,143,123,79,209,143,7,78,97,123,36,205,102,234,182,30,15,168,239,11,188,76,124,163,208,17,224,164,164, - 65,27,103,32,238,29,219,24,112,209,198,128,83,91,51,225,199,88,73,207,198,128,137,244,12,236,199,177,232,79,21,249,88,190,30,175,88,147,95,5,212,89,125,234,254,183,45,46,162,232,218,86,50,207,175,62,46,124,195,144,254,247,202,105,203,204,92,246,217,103, - 114,220,11,23,144,25,20,101,220,104,71,156,213,191,11,168,239,57,218,182,231,99,157,196,41,229,198,73,55,142,90,175,68,20,241,228,98,215,187,177,251,189,66,154,182,167,64,72,135,141,53,204,164,44,167,107,251,96,70,147,246,17,177,166,110,180,37,124,244, - 163,128,250,174,195,235,105,141,161,39,226,140,101,56,99,153,58,233,166,139,87,62,18,41,54,206,45,85,95,150,144,78,215,86,182,99,208,217,130,249,173,254,67,36,48,150,118,102,226,228,59,98,123,206,194,8,171,197,69,143,171,113,38,191,191,17,178,64,147, - 173,207,218,49,51,212,123,159,151,90,175,66,219,78,217,182,115,62,51,208,242,252,204,76,180,137,158,227,4,247,86,213,87,186,40,178,112,28,221,242,32,90,121,223,246,184,97,207,102,243,152,184,89,40,221,246,13,11,191,117,136,154,68,31,179,68,31,175,100, - 123,84,31,189,158,234,23,212,220,139,245,154,57,67,125,239,48,122,238,213,136,133,77,140,213,73,110,30,93,187,10,171,134,178,127,38,189,163,137,22,205,24,241,169,76,29,59,86,207,80,107,25,217,80,74,109,131,233,181,206,67,155,202,135,99,240,97,81,38,79, - 175,229,38,36,151,161,162,214,103,145,219,16,35,103,134,156,117,150,199,108,79,14,234,119,103,138,181,203,165,44,215,175,110,252,140,166,177,15,165,215,86,191,215,250,156,23,210,246,229,227,140,21,235,44,98,129,88,151,2,33,157,174,103,7,51,214,136,17, - 231,87,191,124,230,156,107,85,206,255,60,115,206,243,145,211,246,136,211,210,157,229,205,159,91,90,67,222,202,9,101,179,113,18,44,193,253,216,59,110,246,131,149,36,106,17,117,124,79,212,225,43,20,146,121,29,75,29,217,142,171,214,61,62,198,246,141,81, - 150,162,165,206,108,231,85,61,143,23,37,235,61,228,118,179,234,215,208,143,171,113,83,199,165,254,135,55,190,238,102,25,243,221,37,244,247,142,96,42,245,124,150,222,159,127,166,39,162,166,234,95,255,227,61,88,163,123,48,233,255,221,131,53,178,7,88,102, - 166,190,29,20,190,37,226,144,95,75,17,191,196,187,91,92,250,30,151,119,150,23,102,168,239,50,209,71,156,251,46,202,230,227,140,255,37,111,225,132,165,56,247,29,157,78,156,251,242,12,143,83,189,41,238,145,46,244,59,7,251,31,124,226,245,78,168,194,169, - 111,136,83,63,3,39,123,139,201,13,113,218,111,229,213,239,230,240,234,163,224,119,224,136,240,247,124,244,173,84,238,93,68,61,62,189,168,166,196,168,174,158,50,189,174,38,45,222,26,245,35,123,195,208,214,172,122,117,7,158,199,93,36,102,196,70,142,92, - 242,46,172,254,88,140,79,197,228,194,122,21,7,196,29,74,220,118,199,241,159,202,59,84,37,90,171,192,251,219,60,68,15,219,115,9,118,168,155,45,96,5,152,109,59,48,137,2,24,241,185,50,191,29,152,72,30,179,109,70,1,110,182,117,178,254,100,138,151,219,129, - 9,228,225,42,205,47,230,247,125,146,191,239,18,63,201,239,92,197,123,206,116,216,102,37,191,60,213,63,11,79,120,94,115,194,179,40,95,72,234,236,205,71,239,152,182,9,124,90,102,232,116,175,62,103,199,105,123,133,150,92,227,211,243,53,141,230,74,123,173, - 182,215,34,58,43,201,100,60,101,250,159,131,70,206,116,174,125,35,121,150,155,41,157,105,187,43,245,93,50,199,76,179,84,126,33,115,82,101,132,116,234,52,39,242,113,109,115,105,153,169,101,242,187,232,92,217,43,210,247,11,49,198,153,122,44,62,105,159, - 169,125,120,102,170,215,170,252,44,45,103,235,114,201,126,10,153,163,219,23,122,94,42,61,47,109,76,57,169,177,22,167,250,161,234,246,232,246,124,169,156,106,92,62,157,155,145,122,223,102,213,132,247,41,103,99,200,14,37,206,38,126,118,3,21,45,137,244, - 71,35,182,101,39,214,88,86,108,125,200,218,86,183,57,56,24,36,182,156,248,242,38,98,77,196,155,166,2,168,43,136,175,104,166,242,21,3,93,214,162,174,46,43,30,15,117,134,194,161,196,240,170,72,183,181,38,22,25,12,117,91,49,42,94,105,13,119,70,130,177,238, - 165,161,120,127,40,30,111,14,197,19,150,141,4,214,76,188,25,181,53,163,154,230,102,50,154,241,128,143,21,226,163,153,138,154,131,118,119,44,18,234,246,7,163,81,255,162,174,68,104,16,53,55,208,172,209,246,104,52,28,234,10,38,66,17,123,98,50,79,115,168, - 199,234,26,238,10,91,75,130,225,112,103,176,107,75,188,129,198,158,174,84,122,82,87,196,70,207,18,254,37,66,14,37,210,147,122,99,193,104,95,168,43,238,95,18,180,7,131,168,112,252,41,146,34,225,72,108,121,40,156,176,98,167,79,111,9,38,98,161,161,6,154, - 250,55,211,71,85,85,114,114,214,53,193,144,141,254,21,159,156,178,214,234,66,66,65,42,33,18,247,47,30,176,187,195,86,3,21,166,27,155,22,135,236,110,81,251,72,29,131,88,106,63,22,107,217,160,37,42,31,55,58,161,37,34,166,75,167,77,29,157,38,156,100,226, - 106,123,121,164,107,32,190,164,47,104,247,90,201,69,78,239,74,42,107,250,144,82,198,115,99,145,129,104,3,205,57,57,165,45,102,89,171,59,227,86,108,208,138,161,149,115,195,145,206,96,184,57,56,28,25,72,140,52,83,241,183,203,53,208,140,209,25,130,233,254, - 234,31,229,189,45,65,59,216,43,138,212,255,221,69,132,195,55,217,61,145,147,250,127,134,50,201,77,210,64,117,163,203,133,236,232,64,162,223,74,244,69,186,253,139,131,113,84,142,103,248,165,141,229,149,94,59,233,244,249,151,117,135,18,145,152,234,78,205, - 233,179,157,84,101,237,25,242,182,72,61,53,59,231,52,119,69,250,253,177,254,120,216,191,25,1,192,127,82,216,152,248,55,227,66,3,45,63,99,5,167,137,28,19,71,175,236,252,127,182,158,6,170,60,83,209,6,170,106,238,14,134,7,67,91,252,65,219,142,36,100,204, - 240,47,179,187,194,145,120,200,238,93,18,14,198,101,48,56,57,79,19,38,54,166,211,43,79,145,222,98,245,119,234,12,22,178,148,159,34,75,107,168,215,14,38,6,98,150,216,48,34,6,251,195,216,91,126,236,176,88,171,181,117,192,178,187,144,146,159,158,162,154, - 171,74,51,53,133,195,86,111,48,172,150,97,217,80,151,21,85,139,61,241,20,121,98,189,3,253,24,123,90,174,130,244,92,8,138,189,106,210,70,140,171,34,173,3,93,125,202,51,210,202,121,211,178,172,238,220,44,99,82,121,154,173,213,234,26,136,193,33,78,83,164, - 21,49,208,238,21,30,57,98,139,89,61,97,212,131,110,12,70,84,232,110,11,198,122,173,244,222,142,59,69,118,213,181,6,26,163,210,6,18,161,176,127,81,44,22,28,22,78,208,64,121,105,102,97,33,207,9,134,6,50,219,54,174,89,70,217,233,62,71,108,61,241,245,77, - 228,88,223,132,31,168,43,200,185,126,69,211,242,229,120,155,135,20,9,43,68,2,30,196,193,182,126,69,59,242,8,69,28,110,235,165,169,185,29,169,205,237,56,250,214,183,163,112,187,172,136,181,147,209,46,202,225,163,89,168,205,228,104,95,33,116,19,2,199,101, - 187,176,226,152,116,182,55,75,179,67,72,216,59,112,54,119,52,145,183,227,100,103,40,232,56,197,90,184,85,92,154,24,8,4,82,250,140,52,189,62,77,159,153,166,207,74,211,103,167,233,115,210,244,185,105,250,60,232,89,74,95,30,14,246,198,41,103,84,64,164,194, - 224,41,2,47,57,131,50,34,137,146,66,54,7,59,173,48,101,4,245,241,78,99,131,221,221,167,62,6,40,51,168,125,56,78,172,147,242,197,225,191,120,32,145,136,216,107,98,104,198,234,38,103,103,4,143,253,144,242,80,36,103,151,60,207,201,213,37,143,173,110,114, - 224,222,16,140,81,86,151,8,85,17,156,178,139,18,226,33,117,50,83,174,124,104,139,5,237,120,79,36,214,79,57,226,214,128,227,56,46,115,163,34,117,121,64,69,145,1,60,151,118,197,172,96,226,228,48,40,194,51,153,221,161,158,30,98,22,57,44,113,174,146,175, - 7,135,242,41,179,198,23,15,183,137,90,51,69,14,121,206,146,163,71,138,236,158,145,83,183,155,178,228,147,136,92,77,221,84,138,237,49,170,182,229,105,137,101,39,38,142,186,180,101,202,84,185,10,121,41,181,37,24,223,130,54,198,8,195,200,13,74,223,150,40, - 7,102,17,154,176,78,86,44,78,25,226,81,184,32,185,133,166,51,101,139,29,43,198,218,22,234,183,100,43,231,89,161,222,190,4,21,64,149,167,76,122,31,133,177,89,239,246,213,118,43,166,210,178,101,21,216,213,193,86,68,73,85,133,218,227,178,163,114,17,16,86, - 229,220,103,143,24,80,153,11,79,107,131,219,54,36,149,141,148,37,148,72,36,33,90,35,15,30,90,135,225,71,253,173,216,227,161,46,139,114,97,89,103,135,132,39,136,113,201,222,156,120,175,144,163,94,31,74,57,180,40,115,1,150,40,178,173,45,178,5,157,45,75, - 61,203,76,97,11,71,80,52,28,28,94,30,11,98,252,38,82,55,200,207,141,196,250,168,4,139,8,167,28,181,42,231,69,68,43,121,58,37,26,93,19,28,16,126,236,73,25,214,90,113,120,124,202,178,56,229,242,148,163,44,56,252,150,70,182,97,55,165,30,215,69,169,48,245, - 32,15,198,243,66,221,221,232,173,110,166,37,130,54,100,153,81,134,88,176,55,89,167,52,160,26,93,167,188,142,82,129,126,176,98,98,99,104,239,201,232,11,198,149,191,22,247,193,179,90,35,61,122,153,99,145,126,53,49,200,130,210,210,187,205,190,8,66,48,11, - 145,27,222,177,90,70,245,56,25,161,254,126,202,19,239,39,161,96,120,73,48,26,111,193,130,80,142,54,180,90,225,101,118,119,42,29,143,240,139,24,54,138,188,190,180,13,71,45,202,150,234,197,234,42,67,25,104,108,125,48,60,128,189,31,194,81,178,197,66,99, - 241,38,59,158,8,226,56,69,106,124,117,52,136,179,149,198,134,226,109,17,156,109,203,134,162,216,239,210,5,151,217,65,172,96,55,234,142,235,213,36,215,22,107,120,137,232,79,241,150,211,188,229,228,36,19,90,251,196,140,58,194,50,154,229,192,7,172,152,232, - 222,42,220,55,200,12,91,61,9,114,134,45,187,55,209,71,78,221,85,102,147,105,11,63,113,217,214,182,85,66,201,176,147,161,35,219,78,223,174,206,72,167,136,65,100,70,194,221,125,242,115,27,229,71,236,228,27,209,18,25,131,176,159,70,76,75,173,120,34,22,25, - 22,142,51,98,212,206,149,86,50,233,93,165,35,166,214,224,160,149,156,47,181,7,211,242,203,201,31,93,69,107,34,18,141,194,84,140,80,33,251,113,194,197,19,157,183,225,91,219,40,39,146,254,6,65,185,145,81,49,158,178,35,182,220,12,50,124,80,102,196,78,58, - 118,142,84,91,6,194,137,80,84,44,137,124,132,115,102,136,163,67,22,69,142,214,208,37,86,50,72,162,38,181,180,178,38,103,68,45,184,75,201,139,81,110,0,81,63,129,24,230,136,74,199,118,71,131,49,228,148,97,34,39,58,202,189,29,81,25,245,203,163,145,232,64, - 248,180,113,158,197,200,21,83,239,164,84,21,179,122,133,111,196,78,255,186,74,101,49,171,31,67,85,195,95,109,159,112,200,57,98,50,98,26,113,43,65,185,113,17,91,83,47,139,148,141,103,57,137,194,83,169,56,253,169,73,13,90,238,30,81,44,237,78,47,139,53, - 39,61,146,74,240,116,202,183,57,26,19,79,6,201,117,161,180,168,87,122,74,179,184,76,7,113,122,198,85,216,148,14,156,19,31,21,46,221,201,199,176,234,211,5,161,112,120,85,36,33,221,33,59,142,13,147,12,80,40,136,167,84,244,64,102,225,104,170,95,184,42,34, - 25,94,54,242,88,18,87,189,105,26,105,75,143,212,148,199,144,153,232,11,197,201,41,62,39,6,180,156,1,171,56,148,12,212,4,85,76,68,198,64,162,103,158,140,253,108,144,28,131,50,106,184,164,88,221,67,166,120,75,162,60,241,153,238,92,153,194,208,22,89,23, - 183,200,51,120,210,105,49,24,138,37,6,130,97,125,190,185,7,71,166,130,109,35,54,68,124,40,0,102,128,122,48,19,204,34,54,76,223,52,57,237,229,174,220,246,90,186,199,100,183,112,87,57,207,122,150,15,149,111,54,232,151,172,228,141,149,244,144,201,175,229, - 176,231,210,163,38,187,142,185,202,159,228,151,148,191,111,208,245,172,166,246,38,7,209,115,166,113,11,143,111,115,229,62,90,65,191,229,140,80,85,35,253,142,147,107,122,135,193,223,103,57,215,26,236,93,86,80,55,244,145,65,215,48,190,185,145,229,231,135, - 26,121,188,220,65,141,44,203,137,242,92,117,128,207,217,200,87,110,171,165,95,112,118,187,104,237,68,121,8,85,230,222,79,175,40,209,104,92,205,126,207,126,204,92,211,249,179,212,192,63,101,219,248,51,108,219,16,127,227,210,215,118,49,238,112,47,170,109, - 172,107,108,60,187,195,160,237,204,125,153,193,174,100,179,27,239,170,52,140,95,176,0,43,30,19,24,111,240,167,24,103,249,197,14,206,207,71,87,28,204,97,56,221,124,218,1,135,219,73,78,230,228,78,163,166,134,15,78,119,240,26,30,159,78,115,85,23,230,242, - 219,249,29,82,49,133,242,85,254,181,209,214,148,226,72,38,239,23,143,215,137,46,127,161,140,6,33,86,210,97,131,239,227,119,10,251,235,38,12,180,75,76,25,189,100,136,207,47,152,124,224,82,200,29,38,27,128,120,215,16,2,37,111,150,207,215,149,209,167,134, - 202,176,91,101,56,46,51,208,141,6,59,138,133,89,185,178,182,125,101,123,29,125,158,93,38,75,221,107,240,27,249,143,24,10,150,214,210,219,140,237,130,186,139,21,229,249,104,15,231,79,136,199,242,157,124,76,57,239,47,231,121,13,117,43,45,62,176,226,66, - 62,188,130,30,228,198,19,108,135,76,231,249,215,240,88,249,222,142,205,187,12,199,110,206,253,214,57,116,175,46,155,187,211,87,182,151,238,54,28,151,63,205,190,196,63,100,151,160,35,251,13,243,54,126,55,123,129,253,15,210,23,236,108,167,91,84,171,59, - 249,19,84,206,31,252,124,249,74,35,51,206,155,13,215,245,220,224,143,210,70,190,112,58,43,200,11,40,60,205,70,214,51,140,47,104,52,178,143,177,57,11,24,51,220,15,50,94,203,202,114,206,113,184,29,217,51,28,89,155,157,238,58,86,80,196,47,109,104,116,102, - 47,96,229,99,132,125,180,145,47,103,229,185,244,136,193,110,197,12,251,12,182,139,7,152,183,136,103,79,199,40,43,12,218,201,106,199,59,72,42,211,38,56,232,245,64,13,253,196,96,207,161,139,244,170,193,134,92,185,161,50,58,206,216,13,40,252,152,65,7,89, - 121,221,230,149,67,155,198,238,36,94,201,110,228,37,62,94,197,35,166,247,25,86,156,195,39,194,80,230,42,102,197,11,139,51,139,151,22,243,226,154,98,83,229,170,144,185,224,143,197,231,166,242,231,242,9,34,63,43,25,175,20,94,82,94,82,65,156,153,238,221, - 62,230,157,124,229,118,243,80,217,20,118,188,140,177,67,229,140,125,0,142,141,71,50,203,230,108,183,111,218,246,237,230,193,138,233,236,181,10,50,156,148,43,74,48,111,45,202,28,168,100,187,124,207,139,143,163,226,99,71,21,227,183,131,199,170,200,89,82, - 154,239,133,135,123,213,191,153,200,124,180,10,89,30,152,140,143,103,196,199,17,241,177,99,10,62,246,139,143,131,83,204,171,56,49,32,164,75,235,127,47,133,192,13,206,98,135,166,96,201,171,25,59,80,109,176,7,170,139,216,51,208,143,128,47,78,101,108,63, - 184,31,28,6,123,106,24,251,54,56,8,158,1,7,166,97,232,224,139,211,25,123,13,188,92,203,216,243,117,204,220,237,103,230,1,63,210,252,14,182,127,22,99,247,204,230,236,167,224,240,108,79,218,239,7,146,50,249,119,57,226,251,234,228,223,230,136,239,177,147, - 127,159,147,252,93,169,248,27,29,241,29,118,242,239,116,156,52,242,183,58,134,71,127,191,157,139,58,125,234,247,66,27,160,59,125,42,143,248,255,103,204,163,236,226,255,156,113,159,106,87,252,109,143,161,243,139,255,247,101,250,212,239,37,166,214,171, - 95,84,136,178,242,255,173,121,84,95,197,223,17,253,31,67,245,215,66,128,52,0,0,0,0 }; +static const uint8 javaComponentPeerView[] +{ + 0x1f, 0x8b, 0x08, 0x08, 0x16, 0x5e, 0x87, 0x63, 0x00, 0x03, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x78, 0x00, 0xad, 0x7c, + 0x0b, 0x7c, 0x94, 0xd5, 0xb5, 0xef, 0xda, 0xdf, 0x3c, 0x33, 0x79, 0xcd, + 0x4c, 0x02, 0xe1, 0xcd, 0x24, 0xa0, 0xe4, 0x9d, 0x21, 0xbc, 0x12, 0x12, + 0x20, 0x21, 0x04, 0x4c, 0x08, 0x10, 0xc8, 0x10, 0x24, 0xa1, 0xca, 0x90, + 0x0c, 0x64, 0x64, 0x98, 0x19, 0x66, 0x26, 0x01, 0x7c, 0x15, 0x29, 0x0a, + 0xf5, 0x51, 0xb1, 0xda, 0x4a, 0xd5, 0xf6, 0x58, 0xaf, 0x2f, 0x3c, 0xea, + 0x41, 0xc5, 0xfa, 0xa8, 0xb6, 0xd6, 0xaa, 0xd5, 0xa3, 0xa7, 0xea, 0x39, + 0xf6, 0x96, 0xdb, 0x63, 0xab, 0x1e, 0xb5, 0xad, 0xad, 0x57, 0xed, 0xa9, + 0xad, 0x7a, 0x8f, 0x3d, 0xde, 0xff, 0xda, 0x7b, 0xcf, 0xe4, 0x1b, 0x12, + 0xd4, 0xde, 0xdf, 0x4d, 0xf8, 0x7f, 0x6b, 0xed, 0xb5, 0xd6, 0x7e, 0xaf, + 0xbd, 0xf6, 0xde, 0xdf, 0x84, 0x19, 0x0c, 0xed, 0x75, 0xf9, 0xe7, 0x2d, + 0xa0, 0xee, 0xef, 0xbf, 0xfb, 0xe4, 0x77, 0xef, 0x38, 0xfe, 0xef, 0xe7, + 0xdc, 0x31, 0xe9, 0xf1, 0x87, 0x7e, 0x3c, 0xf2, 0xe2, 0x88, 0x38, 0x74, + 0xe6, 0xbc, 0x07, 0xde, 0xff, 0xaa, 0xbf, 0x8b, 0x28, 0x4e, 0x44, 0x7b, + 0x7b, 0xe7, 0x7b, 0x49, 0xff, 0x44, 0x56, 0x13, 0x85, 0x84, 0x92, 0xaf, + 0x04, 0xac, 0x76, 0xa2, 0x21, 0xd0, 0x69, 0x0e, 0xa2, 0x59, 0xa0, 0x9f, + 0xe6, 0x12, 0xfd, 0x1c, 0xb4, 0x38, 0x9f, 0x08, 0x22, 0x3a, 0x58, 0x44, + 0xf4, 0xc2, 0x22, 0xa2, 0xc1, 0x62, 0x22, 0x5f, 0x2d, 0x51, 0x19, 0x70, + 0x06, 0x50, 0x0e, 0x54, 0x01, 0xb5, 0x40, 0x3d, 0xb0, 0x00, 0x58, 0x02, + 0xb4, 0x02, 0xab, 0x80, 0x75, 0xc0, 0x39, 0xc0, 0x08, 0x70, 0x00, 0xb8, + 0x14, 0xf8, 0x3a, 0x70, 0x25, 0x70, 0x04, 0xb8, 0x0e, 0xf8, 0x0e, 0xf0, + 0x5d, 0xe0, 0x16, 0xe0, 0x76, 0xe0, 0x18, 0x70, 0x0f, 0x70, 0x1f, 0xf0, + 0x12, 0xf0, 0x0e, 0xf0, 0x2e, 0xf0, 0x01, 0xf0, 0x17, 0xe0, 0x13, 0xe0, + 0x33, 0xc0, 0x52, 0x47, 0xe4, 0x04, 0xf2, 0x01, 0x2f, 0x50, 0x09, 0x6c, + 0x05, 0x2e, 0x00, 0xbe, 0x0d, 0xdc, 0x07, 0xbc, 0x0c, 0xfc, 0x09, 0x98, + 0xe6, 0x27, 0x5a, 0x08, 0x74, 0x03, 0x61, 0xe0, 0x52, 0xe0, 0x06, 0xe0, + 0x38, 0xf0, 0x1c, 0xf0, 0x26, 0xf0, 0x19, 0x30, 0x79, 0x2e, 0x51, 0x0b, + 0xb0, 0x05, 0xd8, 0x0d, 0x5c, 0x06, 0xdc, 0x0f, 0xbc, 0x04, 0xbc, 0x03, + 0xd8, 0xea, 0x89, 0xfc, 0x40, 0x3b, 0x70, 0x2e, 0x70, 0x3d, 0xf0, 0x30, + 0xf0, 0x47, 0x60, 0xe6, 0x3c, 0xa2, 0x4d, 0xc0, 0x21, 0xe0, 0x5e, 0xe0, + 0x57, 0x40, 0xce, 0x7c, 0xa2, 0xc5, 0xc0, 0x10, 0x70, 0x0c, 0xf8, 0x13, + 0x50, 0xbd, 0x00, 0x79, 0x81, 0x03, 0xc0, 0xed, 0xc0, 0x33, 0xc0, 0x3b, + 0x80, 0x73, 0x21, 0xc6, 0x15, 0x58, 0x00, 0x6c, 0x06, 0xbe, 0x0a, 0x5c, + 0x07, 0x3c, 0x04, 0x3c, 0x0f, 0xfc, 0x01, 0xf8, 0x6f, 0xa0, 0x06, 0xf3, + 0xd0, 0x01, 0x6c, 0x05, 0x12, 0xc0, 0x41, 0xe0, 0x2a, 0xe0, 0x5a, 0xe0, + 0x56, 0xe0, 0x7e, 0xe0, 0x41, 0xe0, 0x11, 0xe0, 0x47, 0xc0, 0x53, 0xc0, + 0xf3, 0xc0, 0x8b, 0xc0, 0x2f, 0x81, 0x5f, 0x03, 0x6f, 0x01, 0xef, 0x00, + 0xef, 0x01, 0x1f, 0x02, 0x9f, 0x00, 0x7f, 0x03, 0x8c, 0x06, 0xb4, 0x03, + 0x28, 0x04, 0x8a, 0x81, 0xc9, 0x80, 0x0f, 0xa8, 0x00, 0xea, 0x80, 0xf9, + 0xc0, 0x62, 0xa0, 0x05, 0x58, 0x01, 0x74, 0x01, 0xeb, 0x80, 0x00, 0xd0, + 0x07, 0x9c, 0x0b, 0x0c, 0x00, 0xe7, 0x01, 0x71, 0x20, 0x05, 0xec, 0x03, + 0x2e, 0x01, 0x0e, 0x03, 0x57, 0x02, 0x47, 0x80, 0x5b, 0x81, 0x47, 0x80, + 0xa7, 0x81, 0x97, 0x81, 0xdf, 0x00, 0x7f, 0x04, 0x3e, 0x06, 0x6c, 0x8d, + 0x98, 0x4f, 0x60, 0x26, 0x50, 0x0d, 0x34, 0x02, 0x2b, 0x81, 0x1e, 0xe0, + 0x5c, 0x60, 0x27, 0xb0, 0x07, 0xf8, 0x1a, 0x70, 0x35, 0x70, 0x23, 0x70, + 0x07, 0xf0, 0x00, 0xf0, 0x04, 0xf0, 0x22, 0xf0, 0x36, 0xf0, 0x9f, 0xc0, + 0x47, 0x5c, 0xd6, 0x62, 0xa2, 0xd9, 0xc0, 0x22, 0xa0, 0x13, 0xd8, 0x00, + 0xf4, 0x01, 0x11, 0xe0, 0x02, 0xe0, 0x00, 0x70, 0x2d, 0x70, 0x37, 0xf0, + 0x08, 0xf0, 0x1c, 0x70, 0x12, 0x78, 0x0f, 0xc8, 0x6d, 0xc2, 0x38, 0x00, + 0x33, 0x80, 0x72, 0xa0, 0x13, 0xd8, 0x08, 0x0c, 0x00, 0xfb, 0x81, 0xef, + 0x01, 0xc7, 0x80, 0x47, 0x81, 0x97, 0x81, 0x37, 0x81, 0x4f, 0x00, 0x67, + 0x33, 0xea, 0x05, 0xe6, 0x00, 0x4b, 0x81, 0x4e, 0x60, 0x13, 0x10, 0x02, + 0xf6, 0x03, 0xb7, 0x00, 0xf7, 0x00, 0xcf, 0x02, 0x6f, 0x00, 0x7f, 0x05, + 0xf2, 0x97, 0x60, 0xee, 0x81, 0xe5, 0x40, 0x0f, 0x30, 0x04, 0x8c, 0x00, + 0x97, 0x00, 0xdf, 0x04, 0x6e, 0x06, 0x8e, 0x01, 0xf7, 0x03, 0x3f, 0x06, + 0x5e, 0x02, 0xde, 0x04, 0xfe, 0x02, 0xd8, 0x96, 0x12, 0x95, 0x00, 0xd5, + 0x40, 0x33, 0xb0, 0x1e, 0xd8, 0x0a, 0xc4, 0x81, 0x6f, 0x00, 0xd7, 0x01, + 0x37, 0x00, 0x27, 0x80, 0xa7, 0x81, 0x5f, 0x02, 0xef, 0x00, 0x1f, 0x03, + 0x8e, 0x65, 0xe8, 0x23, 0x50, 0x09, 0x34, 0x01, 0x5d, 0x40, 0x3f, 0x30, + 0x04, 0x5c, 0x04, 0x5c, 0x01, 0xdc, 0x0a, 0xdc, 0x0b, 0x9c, 0x00, 0x9e, + 0x00, 0x5e, 0x06, 0x5e, 0x07, 0xfe, 0x04, 0x7c, 0x0a, 0xb8, 0x5a, 0x88, + 0xa6, 0x03, 0x73, 0x80, 0x3a, 0xa0, 0x09, 0x68, 0x07, 0xce, 0x06, 0x92, + 0xc0, 0xc5, 0xc0, 0xf5, 0xc0, 0xed, 0xc0, 0x3d, 0xc0, 0x83, 0xc0, 0x0f, + 0x81, 0xe7, 0x80, 0x97, 0x81, 0xb7, 0x81, 0x8f, 0x81, 0xfc, 0x56, 0xcc, + 0x3b, 0x50, 0x0f, 0xac, 0x03, 0xb6, 0x01, 0xc3, 0xc0, 0x37, 0x80, 0x6f, + 0x03, 0xb7, 0x01, 0x0f, 0x02, 0x3f, 0x05, 0x7e, 0x0e, 0xfc, 0x1a, 0xf8, + 0x2d, 0xf0, 0x01, 0xf0, 0x19, 0x90, 0xb7, 0x9c, 0x68, 0x2a, 0x50, 0x09, + 0x34, 0x02, 0xab, 0x80, 0x75, 0x40, 0x2f, 0x10, 0x02, 0x0e, 0x02, 0xd7, + 0x03, 0x37, 0x03, 0x4f, 0x01, 0xff, 0x01, 0xbc, 0x07, 0x7c, 0x0a, 0x88, + 0x36, 0x22, 0x0f, 0x30, 0x13, 0x68, 0x00, 0xd6, 0x02, 0x5b, 0x80, 0x11, + 0xe0, 0x20, 0x70, 0x15, 0x70, 0x2b, 0xf0, 0x13, 0xe0, 0x57, 0xc0, 0xef, + 0x80, 0xbf, 0x02, 0xc6, 0x0a, 0xcc, 0x35, 0xe0, 0x03, 0xea, 0x80, 0x65, + 0xc0, 0x5a, 0xa0, 0x1f, 0xd8, 0x0e, 0x44, 0x81, 0xab, 0x81, 0x13, 0xc0, + 0x6f, 0x00, 0x7b, 0x3b, 0xd1, 0x99, 0x40, 0x3b, 0xb0, 0x1d, 0x38, 0x0c, + 0xdc, 0x05, 0xbc, 0x08, 0x7c, 0x04, 0x7c, 0x06, 0x38, 0x10, 0x94, 0x3d, + 0xc0, 0x44, 0xa0, 0x11, 0x18, 0x04, 0x0e, 0x02, 0x77, 0x00, 0xf7, 0x02, + 0x0f, 0x01, 0x8f, 0x03, 0x3f, 0x07, 0x5e, 0x07, 0x0a, 0x10, 0xa3, 0xdd, + 0x40, 0x09, 0x70, 0x06, 0x70, 0x26, 0x30, 0x07, 0x28, 0x07, 0x2a, 0x80, + 0x4a, 0xa0, 0x0a, 0xa8, 0x06, 0x6a, 0x00, 0x84, 0x4f, 0x42, 0x58, 0x24, + 0x84, 0x3c, 0x42, 0x58, 0x23, 0x84, 0x2f, 0x42, 0xb8, 0x22, 0x84, 0x27, + 0x42, 0x28, 0x22, 0x84, 0x19, 0x42, 0x38, 0x20, 0x2c, 0x47, 0xc2, 0x12, + 0x22, 0xb8, 0x34, 0xc1, 0x45, 0x09, 0xae, 0x46, 0x70, 0x19, 0xc2, 0x94, + 0x13, 0xa6, 0x8b, 0x30, 0xe4, 0x84, 0xa1, 0x23, 0x0c, 0x03, 0xa1, 0x6b, + 0xd4, 0xae, 0xf7, 0x93, 0x55, 0xc0, 0x59, 0x40, 0x07, 0xd0, 0x09, 0x60, + 0xbb, 0x21, 0x6c, 0x43, 0xb4, 0x06, 0x58, 0x0b, 0xac, 0x03, 0xba, 0x81, + 0xf5, 0xc0, 0x06, 0xa0, 0x07, 0x08, 0x00, 0x1b, 0x81, 0x5e, 0x60, 0x13, + 0x70, 0x36, 0xb0, 0x19, 0xe8, 0x03, 0xfa, 0x81, 0x2d, 0xc0, 0x57, 0x80, + 0x73, 0x80, 0x73, 0x81, 0xad, 0x40, 0x10, 0xd8, 0x46, 0x6a, 0xef, 0xfa, + 0x1a, 0xf0, 0x0d, 0xe0, 0x6a, 0xe0, 0x08, 0x70, 0x0d, 0xa9, 0x71, 0x49, + 0xff, 0x14, 0x6a, 0x7a, 0xa2, 0x4a, 0x8d, 0x95, 0xd0, 0x69, 0xaf, 0xe6, + 0x59, 0x5e, 0xa4, 0xf9, 0xc7, 0xc0, 0x17, 0x6b, 0xfe, 0x29, 0xf0, 0x13, + 0x34, 0xff, 0x02, 0xf8, 0x89, 0x9a, 0x7f, 0xc5, 0xc4, 0xbf, 0x6a, 0xe2, + 0xdf, 0xaa, 0x52, 0xf3, 0x60, 0xe8, 0xf2, 0x27, 0x69, 0x9e, 0xcb, 0x99, + 0xac, 0xf9, 0x77, 0xc1, 0x4f, 0x03, 0xb5, 0x6b, 0x9b, 0x52, 0xc0, 0x09, + 0x7c, 0xa8, 0xe5, 0x6e, 0x2d, 0x67, 0xde, 0x63, 0xe2, 0x27, 0x9b, 0xf8, + 0xe9, 0x26, 0xde, 0xa7, 0x79, 0x96, 0x95, 0xe9, 0xbe, 0x94, 0x69, 0xfe, + 0x53, 0x5d, 0xe6, 0x2c, 0x53, 0x5d, 0xec, 0x1f, 0xd6, 0x6a, 0x25, 0x9f, + 0xa3, 0xe5, 0x33, 0x49, 0xf9, 0x06, 0xb7, 0x93, 0x6d, 0xd8, 0x47, 0xf2, + 0x60, 0x33, 0x83, 0x94, 0x6f, 0x3c, 0xa6, 0xcb, 0x99, 0x6f, 0xaa, 0x6b, + 0x91, 0xae, 0x6b, 0xa6, 0xe6, 0x39, 0xef, 0x2c, 0xcd, 0x17, 0x23, 0xef, + 0x6c, 0x52, 0xfe, 0x33, 0xad, 0x5a, 0x95, 0xc9, 0xfc, 0x6c, 0x5d, 0x6f, + 0x93, 0x2e, 0x67, 0x86, 0xe6, 0xb9, 0x7c, 0x9f, 0xe6, 0xab, 0x75, 0x5e, + 0xf6, 0xb7, 0x06, 0x9d, 0x57, 0xfa, 0x5c, 0xb5, 0xea, 0x13, 0xf3, 0x67, + 0x55, 0xab, 0x79, 0x6f, 0xd1, 0xe5, 0x84, 0x35, 0xcf, 0xed, 0x39, 0x4f, + 0xf3, 0x5c, 0xe6, 0x4e, 0xcd, 0x77, 0xc3, 0x3e, 0xa2, 0xf9, 0x2d, 0xe0, + 0x77, 0x69, 0x9e, 0xdb, 0x1c, 0xd5, 0xfc, 0x10, 0xe4, 0x31, 0xcd, 0x73, + 0x1b, 0xe2, 0x9a, 0xdf, 0x0b, 0x7e, 0xb7, 0xe6, 0x0f, 0x82, 0x4f, 0x6a, + 0xfe, 0x4a, 0xf0, 0x09, 0xcd, 0x1f, 0x35, 0xf1, 0x37, 0x83, 0x4f, 0x69, + 0xfe, 0x4e, 0xf0, 0xc3, 0x9a, 0x3f, 0x0e, 0xfe, 0x7c, 0xcd, 0x3f, 0x6c, + 0x92, 0x3f, 0x61, 0xe2, 0x9f, 0x05, 0xff, 0x55, 0xcd, 0xbf, 0x64, 0x92, + 0xbf, 0x6a, 0xe2, 0xdf, 0x32, 0xf1, 0xef, 0x9a, 0xf8, 0x16, 0x53, 0xf9, + 0x1f, 0x82, 0xdf, 0xa3, 0xf9, 0x4f, 0xc1, 0x5f, 0xa0, 0x79, 0x27, 0x26, + 0xf9, 0x42, 0xcd, 0x17, 0xd7, 0x8c, 0xe6, 0x9d, 0x6d, 0xe2, 0xab, 0x4d, + 0xfc, 0x7c, 0xf0, 0x23, 0xe9, 0x72, 0x30, 0x56, 0x17, 0x6b, 0xbe, 0xd9, + 0x64, 0x73, 0x73, 0xd5, 0x28, 0xcf, 0x3e, 0xb3, 0x2f, 0x5d, 0x3e, 0xf8, + 0x8b, 0x34, 0xbf, 0xa2, 0x66, 0xb4, 0x6d, 0xdd, 0xe0, 0xf7, 0x6b, 0xfe, + 0x6c, 0x53, 0x39, 0xbc, 0x76, 0xf6, 0x6a, 0x7e, 0xd0, 0x24, 0x8f, 0xd7, + 0x8c, 0xca, 0xf7, 0x9a, 0xca, 0x39, 0x68, 0x6e, 0xbf, 0x69, 0x1c, 0xae, + 0x84, 0xfc, 0x12, 0xcd, 0x5f, 0x07, 0xfe, 0x80, 0xe6, 0x6f, 0x32, 0xd9, + 0xdf, 0x6d, 0xe2, 0x4f, 0xd4, 0xa8, 0xf8, 0xc1, 0xf1, 0x8c, 0x7f, 0x0e, + 0x6a, 0x9e, 0xfd, 0xe7, 0xd2, 0x34, 0x5f, 0x33, 0xca, 0x3f, 0x0b, 0xfe, + 0x32, 0xcd, 0xbf, 0x02, 0xfe, 0x90, 0xe6, 0xd9, 0x97, 0x0e, 0x6b, 0xfe, + 0x55, 0xc8, 0xbf, 0xae, 0xf9, 0xdf, 0x83, 0xbf, 0x42, 0xf3, 0x1f, 0x82, + 0xbf, 0x5c, 0xf3, 0x9f, 0x9a, 0xe4, 0x3c, 0xb6, 0x57, 0x6a, 0xde, 0x8a, + 0xc5, 0x77, 0x95, 0xe6, 0x8b, 0x6b, 0x47, 0xed, 0xe3, 0xa6, 0xbc, 0xdc, + 0xdf, 0x7c, 0x44, 0x9c, 0x7f, 0x22, 0x45, 0xfb, 0x04, 0xc7, 0x3b, 0x41, + 0x83, 0xc4, 0x7b, 0xc0, 0x3c, 0x3a, 0xa6, 0xe9, 0xdf, 0x24, 0x15, 0xf4, + 0x99, 0xa6, 0xfc, 0x8f, 0xa9, 0xd0, 0xd4, 0xd0, 0xd4, 0x22, 0x94, 0x7d, + 0xa1, 0xe0, 0x7d, 0xa3, 0x89, 0x1e, 0x21, 0xa6, 0x1e, 0x7a, 0x4c, 0xd2, + 0x1a, 0x5a, 0x2d, 0xe5, 0xb5, 0x14, 0x14, 0xbc, 0xa7, 0x78, 0xe8, 0x38, + 0x31, 0x2d, 0xa7, 0xfb, 0x25, 0x55, 0xfa, 0x0a, 0xad, 0xaf, 0x04, 0xdd, + 0xa4, 0x29, 0xa7, 0xab, 0xd0, 0xe2, 0x02, 0x49, 0xab, 0xe9, 0x6c, 0xc1, + 0xfb, 0x90, 0xd2, 0x57, 0x6b, 0x7d, 0x35, 0x34, 0x03, 0x82, 0xe3, 0x8f, + 0x41, 0xff, 0x4d, 0x1c, 0x7b, 0x4a, 0xe9, 0x4e, 0x49, 0x2b, 0xe8, 0x3e, + 0x49, 0xd3, 0xf2, 0x6a, 0xca, 0x17, 0x4c, 0x2b, 0xc9, 0x2b, 0x69, 0x2b, + 0x55, 0x49, 0x9a, 0x4b, 0xd5, 0x82, 0xe3, 0xce, 0x7c, 0x0a, 0xc1, 0xce, + 0x86, 0x9d, 0x6b, 0xae, 0xe0, 0xf8, 0x9a, 0x4f, 0x4f, 0x13, 0xd3, 0x52, + 0x7a, 0x13, 0x34, 0x07, 0xed, 0x75, 0x48, 0xba, 0x89, 0x16, 0x40, 0xef, + 0xc2, 0xae, 0xc6, 0xe9, 0x5c, 0x2d, 0xcf, 0xc5, 0x08, 0x2e, 0x14, 0x3c, + 0x9e, 0x2a, 0xed, 0x41, 0xbd, 0x6e, 0xc1, 0xb4, 0x9b, 0xe6, 0x49, 0xba, + 0x9e, 0x96, 0x08, 0xde, 0x33, 0x72, 0xe8, 0x0d, 0x52, 0xf4, 0x3f, 0x24, + 0x6d, 0xa1, 0x66, 0xc1, 0xfb, 0xc4, 0x5a, 0x99, 0xaf, 0x04, 0xbb, 0x1a, + 0xd3, 0xc9, 0xc8, 0xf1, 0x4b, 0x49, 0xdb, 0xa8, 0x0e, 0xfa, 0x29, 0x68, + 0x37, 0xcb, 0xa7, 0xa0, 0xdc, 0x9f, 0x4a, 0x5a, 0x46, 0xcf, 0xea, 0xf4, + 0xaf, 0x34, 0xfd, 0x1d, 0xe8, 0x54, 0xad, 0x67, 0xfa, 0x94, 0xa4, 0x2e, + 0x79, 0x1f, 0xe3, 0xf4, 0xab, 0x92, 0x5a, 0xe8, 0xd7, 0x92, 0xe2, 0x4c, + 0xa1, 0xe9, 0x6b, 0x92, 0x0a, 0x7a, 0x57, 0xd3, 0xff, 0x4d, 0x1c, 0xa3, + 0x0d, 0x7a, 0x59, 0xd2, 0x25, 0xf4, 0x47, 0xe2, 0x58, 0xdb, 0x28, 0xeb, + 0x9f, 0x81, 0x9d, 0xb4, 0x54, 0x30, 0xdd, 0x42, 0x65, 0x92, 0x56, 0xd3, + 0x19, 0x82, 0xe3, 0xef, 0x59, 0xf4, 0x8f, 0xa4, 0x68, 0xbd, 0xe0, 0xb8, + 0xbb, 0x99, 0x72, 0x05, 0xc7, 0xdc, 0x95, 0x32, 0x5f, 0x19, 0x7a, 0x58, + 0x24, 0xd3, 0xe5, 0xe4, 0x17, 0x1c, 0xeb, 0xd5, 0x38, 0xcd, 0xc6, 0x8e, + 0xaf, 0x68, 0x39, 0x9d, 0x90, 0xd4, 0x49, 0xff, 0xac, 0xe9, 0xf3, 0x92, + 0xba, 0xe9, 0x5f, 0x88, 0xf7, 0x9a, 0x20, 0x7d, 0x2a, 0x69, 0x3b, 0xcd, + 0x17, 0x4c, 0x07, 0x68, 0xa5, 0xf4, 0xab, 0xd5, 0x32, 0x7f, 0x39, 0x4e, + 0x17, 0x77, 0x4b, 0xba, 0x8e, 0xee, 0x95, 0xf4, 0x4c, 0xfa, 0xad, 0xa4, + 0xad, 0x74, 0xa6, 0xb4, 0x5b, 0x4e, 0x73, 0x84, 0x4a, 0x97, 0x0b, 0x65, + 0x57, 0x21, 0xe9, 0x32, 0xea, 0xd7, 0x74, 0x8b, 0xa6, 0x5f, 0xd1, 0xf4, + 0x1c, 0xe9, 0x97, 0x6b, 0x64, 0xf9, 0x15, 0xba, 0x7d, 0x15, 0xba, 0x3d, + 0x95, 0x38, 0x95, 0x38, 0x24, 0x2d, 0xa6, 0x47, 0x25, 0x9d, 0x43, 0x3f, + 0xd2, 0xe9, 0x1f, 0x4b, 0xda, 0x4f, 0x35, 0xd2, 0x6f, 0x3b, 0xa4, 0x5d, + 0x15, 0xf2, 0xcf, 0x94, 0xfe, 0xaa, 0xf2, 0x55, 0x43, 0xfe, 0x2d, 0x4d, + 0xbf, 0x2d, 0xe9, 0x14, 0xba, 0x5e, 0xd2, 0x72, 0x5a, 0x25, 0x14, 0x3d, + 0x4b, 0xfa, 0x75, 0x8d, 0xb4, 0x67, 0xff, 0x7e, 0x46, 0x52, 0x07, 0xfd, + 0x4c, 0xa7, 0xff, 0x55, 0xd3, 0x7f, 0xd3, 0xf4, 0xa4, 0xa4, 0xb3, 0xe8, + 0x2d, 0x9d, 0x7e, 0x5b, 0xd2, 0x1e, 0xb2, 0xc9, 0x72, 0x36, 0x93, 0x4b, + 0xd2, 0x4a, 0x6a, 0x94, 0x34, 0x40, 0x2d, 0xd2, 0xff, 0x17, 0xcb, 0xf2, + 0x6b, 0x71, 0x3a, 0xfa, 0xa6, 0xa4, 0x36, 0xba, 0x56, 0xd2, 0xf9, 0x74, + 0x9d, 0xa4, 0x79, 0x74, 0x54, 0xd2, 0x4e, 0xfa, 0x8e, 0xa4, 0x21, 0xba, + 0x41, 0xd2, 0x99, 0x74, 0xa3, 0xa6, 0x37, 0x49, 0x3a, 0x48, 0xdf, 0xd5, + 0xf9, 0xbf, 0x27, 0x69, 0x1d, 0xfd, 0x83, 0xa4, 0xb3, 0xe9, 0x66, 0x49, + 0xe7, 0xd1, 0xf7, 0xb5, 0xfe, 0x16, 0x4d, 0xff, 0x87, 0xa4, 0x76, 0xba, + 0x55, 0xa7, 0x6f, 0x93, 0xb4, 0x9c, 0xee, 0xd1, 0xf4, 0x01, 0x4d, 0x1f, + 0x94, 0xb4, 0x8f, 0x1e, 0x96, 0xb4, 0x86, 0x7e, 0x28, 0xe9, 0x02, 0x7a, + 0x42, 0xd2, 0x19, 0xf4, 0x13, 0x49, 0x27, 0xd2, 0x93, 0x92, 0xe6, 0xd3, + 0x0b, 0x92, 0x4e, 0xa6, 0x17, 0x49, 0xad, 0xef, 0x97, 0x74, 0x1c, 0x78, + 0x59, 0xdb, 0xbf, 0x22, 0xe9, 0x24, 0xfa, 0x85, 0xa4, 0x16, 0xfa, 0x9f, + 0x92, 0x9e, 0x4d, 0xff, 0x4b, 0x52, 0x2f, 0xbd, 0x2e, 0x69, 0x11, 0xfd, + 0x5e, 0xe7, 0x7b, 0x47, 0xd2, 0x42, 0xfa, 0x83, 0xa4, 0x6a, 0x3d, 0xd4, + 0xe2, 0xf7, 0x3d, 0xdd, 0x9e, 0xf7, 0x35, 0xfd, 0x40, 0xd3, 0x3f, 0x49, + 0x3a, 0x97, 0xfe, 0x53, 0x52, 0x3f, 0xfd, 0x59, 0x8f, 0xc7, 0x87, 0x5a, + 0xff, 0x17, 0x9d, 0xff, 0xaf, 0x9a, 0x7e, 0xa4, 0xe9, 0xc7, 0x92, 0xd6, + 0xd3, 0x27, 0x92, 0x9e, 0x4b, 0xff, 0x47, 0xf7, 0xff, 0xbf, 0x24, 0xdd, + 0x4c, 0x39, 0x42, 0xd1, 0x3c, 0x49, 0x17, 0xd1, 0x04, 0x49, 0x17, 0xd2, + 0x44, 0x4d, 0x4b, 0x34, 0x9d, 0xa4, 0xf5, 0x93, 0x75, 0x7a, 0x8a, 0xa6, + 0x53, 0x25, 0x2d, 0xa1, 0x69, 0x92, 0x36, 0xd1, 0x74, 0x49, 0x57, 0xd1, + 0x0c, 0x49, 0xb7, 0x91, 0x4f, 0x52, 0xb5, 0xbe, 0x6b, 0xf5, 0xfa, 0xe6, + 0xf4, 0x2c, 0x49, 0x7b, 0x69, 0xb6, 0x50, 0x71, 0xf4, 0x0c, 0x6d, 0x5f, + 0x29, 0xe9, 0x56, 0xaa, 0x95, 0x74, 0x23, 0x2d, 0xd2, 0xb4, 0x41, 0xd2, + 0x15, 0xd4, 0x24, 0x54, 0x1c, 0x5e, 0x26, 0x69, 0x0f, 0xb5, 0xea, 0xf4, + 0x72, 0x6d, 0xd7, 0xa6, 0xe9, 0x0a, 0x49, 0xab, 0xa8, 0x5d, 0x28, 0x3f, + 0xe8, 0x12, 0xca, 0x2f, 0xd6, 0xe8, 0xf4, 0x5a, 0x4d, 0xd7, 0x69, 0xda, + 0x2d, 0x94, 0x5f, 0xad, 0xd7, 0xe9, 0x0d, 0x42, 0xf9, 0x57, 0x8f, 0x50, + 0x7e, 0x1c, 0x10, 0x6a, 0xbc, 0x37, 0x0a, 0xe5, 0xc7, 0xbd, 0x42, 0x8d, + 0xfb, 0x36, 0xc1, 0xe7, 0xd1, 0xa9, 0xd4, 0x21, 0x69, 0x19, 0x6d, 0x16, + 0x7c, 0x26, 0x3d, 0x83, 0xfe, 0x9d, 0x98, 0x6e, 0x27, 0xa7, 0xdc, 0x07, + 0x0c, 0xb2, 0x4b, 0x3a, 0x9d, 0xb6, 0x0a, 0x3e, 0x77, 0xaa, 0x38, 0xd5, + 0x88, 0x93, 0xe7, 0x73, 0x92, 0xaa, 0x7c, 0x4d, 0xf0, 0x9b, 0x1f, 0x10, + 0x53, 0x2b, 0x3d, 0x24, 0xe9, 0x0e, 0x7a, 0x5c, 0x52, 0x15, 0xf7, 0x59, + 0x5e, 0x2c, 0xe9, 0x2c, 0xea, 0x14, 0x7c, 0x1e, 0xf5, 0x91, 0x43, 0xf0, + 0x1d, 0x48, 0x95, 0xb7, 0x14, 0xf5, 0xdd, 0x45, 0xea, 0x9e, 0xe5, 0x26, + 0x75, 0xbe, 0x3d, 0x8a, 0x7d, 0x3c, 0x0f, 0xf4, 0x55, 0x5c, 0x7c, 0x0a, + 0xf8, 0x12, 0x44, 0xea, 0x0e, 0xe6, 0x26, 0x75, 0xa6, 0xe5, 0x1f, 0xd6, + 0x7f, 0x08, 0x7d, 0x97, 0xd6, 0x57, 0x6a, 0xfd, 0x2c, 0x93, 0xde, 0x8a, + 0x4b, 0xd3, 0x76, 0xad, 0xaf, 0xd2, 0x72, 0x2e, 0xff, 0x66, 0x5d, 0xfe, + 0x34, 0xe8, 0x2f, 0xd5, 0xfa, 0x6a, 0x53, 0xfd, 0xe9, 0xfc, 0xd5, 0xd0, + 0x1f, 0xd5, 0x7a, 0x3e, 0xd7, 0x8b, 0x53, 0xf4, 0xcd, 0xd0, 0x3f, 0xa1, + 0xf5, 0x7c, 0xd6, 0xe7, 0x7b, 0x06, 0x9f, 0xc5, 0xef, 0xd4, 0xe5, 0x07, + 0xa0, 0xff, 0x58, 0xeb, 0xed, 0x7c, 0x3e, 0x00, 0x2d, 0xae, 0x50, 0x77, + 0xc5, 0xdd, 0xee, 0xb9, 0x98, 0x31, 0x17, 0xa8, 0x9f, 0xa9, 0x58, 0xcc, + 0x27, 0x06, 0x61, 0xa1, 0xf2, 0xd9, 0x51, 0xf7, 0x53, 0x90, 0xe4, 0xd9, + 0xca, 0x8c, 0xa5, 0x14, 0x77, 0xbf, 0x80, 0x71, 0x2c, 0xb3, 0x94, 0x90, + 0xd7, 0x1a, 0xf5, 0x3f, 0x83, 0x98, 0xcf, 0x39, 0x7e, 0x22, 0xeb, 0x97, + 0x69, 0xe1, 0xb2, 0x71, 0x9a, 0xed, 0xe3, 0x7e, 0x37, 0x59, 0x6c, 0x51, + 0xdf, 0xbf, 0xa0, 0x7c, 0x8f, 0xe1, 0xb5, 0x79, 0x6c, 0x56, 0x8c, 0x3d, + 0xdf, 0x95, 0x66, 0x54, 0xf0, 0x7e, 0x8c, 0xb3, 0x8f, 0x9b, 0x23, 0x43, + 0xbf, 0x28, 0xa0, 0x7e, 0x23, 0x8f, 0xfa, 0x2d, 0xf9, 0xb4, 0xdb, 0xb7, + 0x14, 0xd6, 0x7c, 0xc7, 0x33, 0x32, 0xb7, 0x2d, 0xd5, 0x4f, 0x96, 0xd9, + 0xf0, 0xcb, 0x7c, 0x65, 0x85, 0x7a, 0x87, 0x99, 0x70, 0x3f, 0x8e, 0x74, + 0x9e, 0xe8, 0x17, 0xb9, 0x19, 0x3d, 0xe7, 0x9a, 0x57, 0xa1, 0xee, 0x5e, + 0x01, 0x91, 0x47, 0x01, 0x83, 0x4b, 0x6d, 0xc1, 0xbe, 0x57, 0x80, 0x3c, + 0x0e, 0xa9, 0x6f, 0x3e, 0x8d, 0x3e, 0x9d, 0x7f, 0xd5, 0x69, 0xf4, 0x39, + 0xd0, 0xf3, 0x98, 0x75, 0x57, 0xa8, 0x7b, 0x47, 0xa0, 0x25, 0x8f, 0xe6, + 0x75, 0x87, 0x41, 0x73, 0x31, 0x0f, 0x18, 0xab, 0x81, 0xe3, 0x43, 0x09, + 0xff, 0x63, 0x14, 0x72, 0xe6, 0xd9, 0xb8, 0x6d, 0x3c, 0x0a, 0x53, 0x9c, + 0x06, 0x45, 0x7d, 0x3f, 0xc3, 0x39, 0xd3, 0xe5, 0xf4, 0x52, 0xa3, 0x33, + 0x9f, 0xa6, 0x38, 0x2d, 0x19, 0x49, 0x03, 0xf8, 0x72, 0x8b, 0xd7, 0x59, + 0x6e, 0x29, 0x72, 0x2e, 0x47, 0x3c, 0x10, 0x52, 0x33, 0x01, 0xe3, 0xdf, + 0x20, 0xac, 0x54, 0xe4, 0x5c, 0x42, 0x81, 0xd6, 0x7c, 0x0a, 0x2c, 0xcf, + 0x95, 0xa3, 0x6b, 0xd8, 0x5d, 0x46, 0xa0, 0x2d, 0x97, 0x8e, 0x8f, 0x70, + 0xca, 0x62, 0x77, 0xd9, 0xa3, 0xfe, 0x2d, 0x54, 0x6a, 0x0f, 0xac, 0xcc, + 0xa7, 0x06, 0x27, 0x66, 0xc0, 0xfd, 0x2c, 0xcf, 0x9d, 0xe3, 0xa4, 0xc3, + 0xf1, 0x59, 0xd4, 0xff, 0xcf, 0x64, 0x73, 0xe4, 0x61, 0xfc, 0xfb, 0x10, + 0x21, 0x58, 0x1b, 0x68, 0x2f, 0xa0, 0x32, 0xfb, 0x14, 0x8a, 0xfb, 0x8b, + 0xc8, 0xee, 0x8c, 0xfa, 0x6f, 0xa6, 0x4b, 0xed, 0x81, 0x76, 0xc8, 0x57, + 0xaa, 0x1e, 0x86, 0xc8, 0x6b, 0xeb, 0x6f, 0xcf, 0x95, 0xe3, 0x60, 0xc8, + 0x7e, 0xee, 0xa8, 0x50, 0xfe, 0x13, 0x75, 0x6f, 0xc4, 0xcc, 0xb9, 0x40, + 0x7b, 0x99, 0x5a, 0x17, 0xa3, 0x85, 0x4d, 0x56, 0xb4, 0xdc, 0xc3, 0xbe, + 0x61, 0xc1, 0x0c, 0x78, 0x8d, 0xa8, 0xff, 0x39, 0x8c, 0x11, 0x6c, 0x98, + 0x5a, 0x5d, 0xd6, 0xdd, 0xfe, 0x02, 0xb2, 0x58, 0x0b, 0xe4, 0x3c, 0xf2, + 0x98, 0x26, 0xf5, 0x98, 0xee, 0x76, 0x37, 0x2a, 0x6f, 0xf1, 0x7d, 0x05, + 0x73, 0x37, 0xaa, 0x3f, 0x5f, 0xcf, 0xe9, 0x6e, 0x5f, 0x2b, 0xfc, 0x7e, + 0xb7, 0x6f, 0x19, 0x9e, 0x6a, 0x4e, 0x55, 0x5b, 0x0e, 0xe8, 0xb6, 0xec, + 0x76, 0xe7, 0x23, 0xcd, 0x5e, 0x97, 0xc7, 0x54, 0xc8, 0xb6, 0x08, 0x53, + 0x5b, 0x2c, 0xdc, 0x96, 0x67, 0xb0, 0xee, 0x5c, 0x72, 0xcc, 0x66, 0x09, + 0x97, 0x85, 0x47, 0xc9, 0x6a, 0x29, 0x90, 0x3e, 0x6f, 0x43, 0x19, 0xdf, + 0xa8, 0x50, 0x77, 0xd2, 0x40, 0x77, 0x21, 0x4e, 0x95, 0x16, 0xac, 0x93, + 0x40, 0xb7, 0x07, 0x33, 0x98, 0x43, 0x31, 0x77, 0x3d, 0xcf, 0x1a, 0xf5, + 0x43, 0xe3, 0x41, 0x7f, 0xf9, 0x6d, 0x85, 0x8b, 0x02, 0xeb, 0x3d, 0xc4, + 0xa5, 0x9e, 0x8d, 0x1e, 0xe6, 0x21, 0xfa, 0x4e, 0xa0, 0xb8, 0xaf, 0x10, + 0x65, 0xf5, 0xaf, 0x2f, 0x94, 0xe7, 0xa6, 0x40, 0x8f, 0x97, 0x02, 0x01, + 0x0f, 0xc5, 0x5b, 0x16, 0x92, 0xbf, 0xb5, 0xbf, 0xdb, 0x8d, 0x1c, 0x85, + 0xf0, 0xce, 0x1c, 0xd8, 0xb8, 0x2c, 0x45, 0x56, 0x2f, 0x25, 0x02, 0xb9, + 0x24, 0xea, 0x03, 0xb2, 0x54, 0xc4, 0x01, 0xfc, 0x72, 0x9f, 0x6e, 0xd4, + 0x63, 0x12, 0xf7, 0xd7, 0x92, 0xdb, 0xe8, 0x17, 0x5e, 0xac, 0x01, 0x0f, + 0x7a, 0x6d, 0xe1, 0x33, 0x3c, 0xe4, 0xb7, 0x55, 0xa8, 0x77, 0x16, 0x01, + 0x1f, 0xb7, 0x33, 0x87, 0x02, 0xa5, 0x6e, 0xc4, 0x70, 0x1b, 0x25, 0x7c, + 0x2e, 0x8c, 0x0e, 0xac, 0x21, 0xef, 0xf7, 0x79, 0xd0, 0xea, 0x3a, 0xd8, + 0x17, 0xa0, 0x2c, 0x43, 0xf6, 0xef, 0xde, 0x0a, 0x75, 0x5f, 0x0f, 0x6c, + 0x2d, 0xc2, 0x38, 0xf1, 0xdb, 0x94, 0x5c, 0xb4, 0x7f, 0x22, 0xaa, 0x9c, + 0x0b, 0x07, 0x6e, 0xb4, 0xa1, 0xc7, 0xc6, 0x56, 0xd8, 0x16, 0x89, 0x19, + 0x34, 0xdf, 0xed, 0x42, 0x1f, 0xca, 0x28, 0x30, 0x50, 0x8c, 0x76, 0x54, + 0x92, 0xdf, 0x51, 0xee, 0x08, 0x6c, 0x2d, 0xc6, 0x0c, 0x54, 0xe1, 0xae, + 0x0c, 0xef, 0x18, 0x50, 0x65, 0x58, 0x28, 0xd7, 0xba, 0xbb, 0x7b, 0x90, + 0xda, 0x86, 0x5d, 0x8e, 0x46, 0x87, 0x8b, 0xb6, 0x3a, 0x0c, 0x5a, 0x50, + 0x62, 0xc3, 0x18, 0x71, 0xa4, 0xf2, 0x18, 0xdc, 0x2f, 0xa7, 0x9e, 0xab, + 0x47, 0x75, 0x4c, 0xf9, 0xbc, 0xfa, 0xbd, 0xee, 0x79, 0x0e, 0x78, 0xf6, + 0x0e, 0x65, 0xe1, 0x80, 0xc5, 0x6e, 0x7f, 0x08, 0x91, 0x38, 0xcf, 0x51, + 0x9e, 0x9b, 0x2d, 0xdd, 0x2e, 0xa5, 0x0d, 0x0e, 0xac, 0x01, 0xf7, 0x13, + 0x90, 0xb9, 0x1c, 0x51, 0xdf, 0x4a, 0xdc, 0x5f, 0xf3, 0x1c, 0x1e, 0x87, + 0xc7, 0x70, 0x61, 0x2c, 0xf9, 0x9d, 0xcb, 0xd3, 0x15, 0xea, 0x1d, 0x84, + 0xb9, 0xce, 0x89, 0x18, 0xc4, 0xb9, 0x08, 0x39, 0x8d, 0x56, 0x2b, 0x79, + 0x1d, 0x85, 0x0e, 0x93, 0x4e, 0x88, 0xa4, 0x38, 0xe8, 0xf8, 0xd6, 0x1e, + 0xfb, 0x0e, 0x9e, 0x61, 0xe8, 0x2c, 0x72, 0xd4, 0x89, 0x7e, 0x5e, 0xa1, + 0xde, 0xe1, 0x94, 0x09, 0x15, 0xed, 0x04, 0x79, 0x44, 0x5a, 0xf7, 0x0b, + 0x3d, 0x5f, 0xfd, 0xa2, 0x08, 0x3a, 0x8e, 0xc0, 0xfd, 0x46, 0xb1, 0xf6, + 0x61, 0xd6, 0xff, 0xba, 0x82, 0xef, 0x21, 0xac, 0x9f, 0xa8, 0x63, 0x9b, + 0x57, 0x6c, 0x81, 0xb7, 0x14, 0x98, 0xe2, 0xed, 0x5b, 0x15, 0xea, 0x7d, + 0x58, 0x19, 0x22, 0x60, 0xdc, 0x2d, 0xa3, 0xcc, 0xfa, 0x89, 0x14, 0xf0, + 0x94, 0xa0, 0x77, 0xfb, 0x65, 0x34, 0x6b, 0x44, 0xee, 0x8c, 0xcc, 0x77, + 0x10, 0xb2, 0x51, 0x8b, 0x0b, 0xd8, 0xa3, 0xc4, 0x06, 0x83, 0xdf, 0xb1, + 0x09, 0x2a, 0xcf, 0x8b, 0xfa, 0xca, 0x40, 0xa3, 0xee, 0xd2, 0x2c, 0xf9, + 0x7d, 0xc6, 0x7d, 0xa5, 0x45, 0xf0, 0x9c, 0x05, 0x62, 0x0a, 0x6d, 0xdc, + 0x30, 0x81, 0x1a, 0x8c, 0x89, 0x18, 0xff, 0x2d, 0xe0, 0x02, 0x1b, 0x50, + 0x52, 0x59, 0x09, 0x3c, 0x76, 0x22, 0x46, 0x62, 0x9d, 0x5c, 0x2f, 0x7a, + 0x76, 0x2d, 0xbb, 0xfd, 0x03, 0x54, 0x6f, 0x65, 0xfb, 0x46, 0xc3, 0x81, + 0x33, 0x83, 0x8d, 0xbc, 0xee, 0x2d, 0xdd, 0x13, 0xe4, 0x0d, 0x54, 0xc8, + 0x38, 0xfc, 0x17, 0xb4, 0x9d, 0xfb, 0x10, 0xc0, 0x19, 0x8d, 0xe7, 0x9b, + 0xc7, 0x85, 0xfd, 0xf4, 0xbf, 0x2a, 0xd4, 0xbb, 0xb8, 0x7e, 0x51, 0xa2, + 0xfb, 0x5d, 0x26, 0xe0, 0x3d, 0xbe, 0x4e, 0x5e, 0x23, 0x62, 0x32, 0x46, + 0x69, 0x92, 0x1c, 0x03, 0xa1, 0x4b, 0xe2, 0x72, 0xac, 0x32, 0xfe, 0x77, + 0x13, 0xe9, 0xf2, 0xb3, 0xe5, 0xeb, 0xa5, 0x3c, 0xbd, 0x0e, 0x9c, 0x95, + 0x7a, 0xff, 0xf2, 0x4d, 0x42, 0x5f, 0x2f, 0x91, 0xf1, 0x23, 0x50, 0x3a, + 0x19, 0xa3, 0x33, 0x47, 0x46, 0x89, 0xb4, 0x5d, 0xfe, 0x69, 0xed, 0xca, + 0xb3, 0xec, 0xbc, 0x95, 0x2a, 0xd6, 0xf4, 0xf8, 0xa6, 0xc0, 0xcf, 0xcf, + 0x85, 0xce, 0x25, 0xdb, 0x9f, 0xd6, 0x97, 0x64, 0xe9, 0x23, 0x19, 0xbd, + 0x55, 0xfb, 0xf7, 0x34, 0xb3, 0xde, 0x1f, 0x25, 0xb7, 0xc5, 0x65, 0x29, + 0xb4, 0x8c, 0xe6, 0x2f, 0xcb, 0xca, 0xbf, 0x75, 0x4c, 0xf9, 0x73, 0xb2, + 0xf4, 0x43, 0x63, 0xf4, 0xd5, 0x59, 0xfa, 0xd8, 0x18, 0xfd, 0xdc, 0x2c, + 0xfd, 0xae, 0x8c, 0x9e, 0x77, 0x27, 0x1e, 0xbf, 0x85, 0x66, 0x7d, 0xcb, + 0x79, 0xe4, 0x6e, 0xcb, 0xb3, 0x78, 0x2c, 0x6a, 0xbe, 0x78, 0x9c, 0x97, + 0x54, 0x2a, 0x1f, 0x57, 0x73, 0xd5, 0x07, 0x2f, 0x29, 0xc8, 0xf4, 0xad, + 0x4d, 0xeb, 0x54, 0xdf, 0x76, 0xa2, 0x6f, 0x05, 0x99, 0x72, 0x3b, 0xcc, + 0xba, 0x96, 0x30, 0xca, 0x1d, 0xcd, 0xd7, 0x9d, 0x95, 0x2f, 0x28, 0xf3, + 0x19, 0xda, 0x6f, 0x7a, 0x2b, 0xb5, 0xdf, 0xb8, 0x67, 0x4a, 0xbf, 0xe1, + 0x5d, 0x98, 0xcb, 0xeb, 0xaf, 0x54, 0xef, 0x03, 0x7b, 0xba, 0xa7, 0x23, + 0xf6, 0xec, 0xc3, 0x7d, 0x28, 0x4f, 0x9e, 0x89, 0xfb, 0x83, 0x16, 0x00, + 0x6b, 0xd6, 0xd8, 0xbc, 0xcd, 0x4e, 0xde, 0x3f, 0x37, 0x20, 0x07, 0xef, + 0x41, 0x58, 0xa9, 0xd6, 0x72, 0xc3, 0xfb, 0xe1, 0xe6, 0x41, 0x27, 0xe2, + 0xa1, 0x5d, 0xee, 0x47, 0x90, 0x59, 0x36, 0x0f, 0x38, 0x60, 0xef, 0xe2, + 0x73, 0x77, 0xf7, 0xe6, 0x20, 0xbf, 0x29, 0xe0, 0xbd, 0x8a, 0xdf, 0x38, + 0xbb, 0xc4, 0x6e, 0xf7, 0xc5, 0xbc, 0x36, 0x50, 0x52, 0x0e, 0x76, 0xbf, + 0x0a, 0xf2, 0x7a, 0xe2, 0x2d, 0xcb, 0x71, 0xf2, 0xec, 0xef, 0x9d, 0x46, + 0x1e, 0xfb, 0xe8, 0x98, 0xee, 0xac, 0x54, 0x67, 0x92, 0xa8, 0x7b, 0x2f, + 0xd2, 0xdc, 0x0e, 0xab, 0x88, 0xfa, 0x70, 0x66, 0x04, 0x3f, 0x13, 0x77, + 0x48, 0x8f, 0x3e, 0x93, 0xb0, 0x6d, 0xbc, 0x92, 0x64, 0x9c, 0xdd, 0xed, + 0x7b, 0xd8, 0x34, 0xf6, 0x36, 0x29, 0x1b, 0xd6, 0xba, 0x78, 0xe0, 0x76, + 0x72, 0xd7, 0x2b, 0x9d, 0x5d, 0xfe, 0x12, 0x5d, 0xa4, 0x75, 0x23, 0xf6, + 0x6b, 0xe4, 0xbe, 0x52, 0xa8, 0xd7, 0x50, 0xfa, 0x47, 0xfa, 0xa6, 0xa7, + 0x50, 0xa4, 0xc7, 0xed, 0x32, 0x3d, 0x6e, 0x1b, 0xdd, 0x3e, 0x69, 0x6b, + 0xe8, 0x75, 0x72, 0x45, 0x25, 0xe7, 0xe6, 0xb6, 0x1e, 0xe0, 0xbe, 0x61, + 0xe7, 0xc2, 0x58, 0xb9, 0x31, 0x32, 0xb0, 0xca, 0x85, 0x15, 0x47, 0x95, + 0x23, 0x95, 0xea, 0xbd, 0x6a, 0xe0, 0xc8, 0x54, 0xd8, 0x55, 0xc8, 0xfa, + 0x1a, 0x70, 0x97, 0xed, 0xf9, 0xe6, 0x74, 0xa4, 0x27, 0x23, 0xe5, 0xb2, + 0x46, 0xdd, 0xd3, 0x99, 0xda, 0xa2, 0xee, 0x19, 0x4c, 0xed, 0x51, 0xf7, + 0x14, 0xd0, 0x5c, 0x87, 0xe3, 0x9a, 0x11, 0xe7, 0xa5, 0x28, 0xd9, 0x3b, + 0xa5, 0xd0, 0xe5, 0x75, 0x15, 0xba, 0x72, 0xd1, 0x0a, 0x6e, 0xff, 0xf5, + 0x95, 0x2a, 0xae, 0xf7, 0xec, 0x9f, 0x9e, 0x1d, 0x5b, 0x73, 0x0a, 0x73, + 0xa2, 0xee, 0x04, 0xea, 0xf5, 0xb6, 0x78, 0x3d, 0xf5, 0x39, 0x33, 0x71, + 0x47, 0x9b, 0x44, 0xf5, 0x39, 0x13, 0x41, 0x27, 0x83, 0x7a, 0xa9, 0xe7, + 0x6b, 0x5c, 0x6b, 0x89, 0xae, 0x65, 0x22, 0x53, 0x87, 0xe3, 0x80, 0xf8, + 0xd6, 0x88, 0xfd, 0x72, 0xb4, 0xb7, 0x50, 0xc4, 0xfc, 0xb3, 0xe9, 0xa8, + 0xcb, 0x25, 0xcb, 0x89, 0xa3, 0x9c, 0x42, 0x91, 0xaf, 0xe3, 0xfa, 0xb1, + 0x4a, 0xf5, 0x6e, 0xb8, 0xe7, 0xc8, 0xf4, 0x53, 0xf6, 0x90, 0x42, 0xa3, + 0xd1, 0xe5, 0x27, 0xb5, 0x8f, 0x4d, 0xa7, 0x05, 0x6e, 0x9e, 0xf3, 0x62, + 0xcc, 0x96, 0x8b, 0xbc, 0xb3, 0xea, 0xfd, 0x38, 0x11, 0x94, 0x6e, 0xcd, + 0xc5, 0x1e, 0x35, 0x95, 0x6b, 0x9e, 0x00, 0x79, 0x5e, 0x6e, 0x43, 0x6e, + 0x49, 0x86, 0x8f, 0xfa, 0x9e, 0xc6, 0x19, 0xdc, 0xe5, 0xe8, 0xb9, 0x8e, + 0xf5, 0x13, 0x39, 0x9f, 0xd3, 0x71, 0xad, 0xb8, 0x9d, 0x5b, 0x64, 0x91, + 0x3d, 0x2f, 0x34, 0x62, 0x2d, 0x67, 0xd0, 0xb1, 0xe7, 0x5d, 0x18, 0x01, + 0x8e, 0xfb, 0x16, 0x39, 0x77, 0x8f, 0x56, 0xaa, 0xcf, 0x14, 0xd8, 0x67, + 0xb3, 0xc6, 0xc0, 0x5e, 0x68, 0xe7, 0x1e, 0xf2, 0xfe, 0x14, 0xdf, 0x74, + 0x05, 0xd9, 0x82, 0xde, 0x89, 0x85, 0x76, 0xb6, 0x55, 0xf3, 0xf1, 0x24, + 0xf2, 0xf1, 0xbd, 0xce, 0xe9, 0xf4, 0x90, 0x93, 0x47, 0x04, 0x63, 0xe8, + 0x75, 0x8d, 0x96, 0x80, 0xfe, 0xb8, 0x52, 0x62, 0x12, 0x76, 0x75, 0x17, + 0xa5, 0xb0, 0x22, 0xbd, 0x94, 0x9b, 0xfb, 0x0b, 0xf1, 0x19, 0x79, 0xa7, + 0x37, 0x88, 0xf7, 0xa9, 0xfe, 0xe5, 0x93, 0xe4, 0xad, 0xad, 0x7f, 0xe3, + 0x1a, 0xf2, 0xd6, 0xd7, 0x97, 0xfe, 0x2b, 0x79, 0x37, 0x14, 0x5b, 0xf8, + 0xf5, 0x5f, 0x7d, 0xe9, 0x2a, 0xf2, 0x6e, 0xab, 0x2f, 0xe5, 0xdc, 0x0f, + 0xfa, 0xdf, 0x40, 0xf1, 0x8d, 0xb8, 0x47, 0xf6, 0x5c, 0x82, 0x3e, 0xf9, + 0xa6, 0xd1, 0x31, 0xac, 0x8d, 0x14, 0xc6, 0x06, 0x65, 0x5a, 0x53, 0xd8, + 0xeb, 0x41, 0x6d, 0x4e, 0x78, 0xb2, 0xf5, 0x07, 0x23, 0x4e, 0xfe, 0x4c, + 0xa5, 0x7c, 0xce, 0xac, 0x37, 0xda, 0x60, 0xf9, 0x55, 0xcc, 0x56, 0xcf, + 0x01, 0x95, 0x27, 0x87, 0xfd, 0xc2, 0x37, 0x93, 0xa9, 0x6d, 0x85, 0x5d, + 0xb8, 0x0e, 0x6c, 0x7f, 0x26, 0x14, 0xf5, 0xf9, 0x38, 0x8d, 0xfb, 0xa0, + 0xc8, 0x3f, 0xe0, 0xb9, 0x1d, 0x5b, 0x99, 0x2c, 0xa5, 0x54, 0xb4, 0x89, + 0x80, 0x08, 0xa5, 0x4b, 0x2b, 0xcc, 0xff, 0xfb, 0x5a, 0x70, 0xd5, 0xff, + 0xd7, 0x16, 0x5c, 0x25, 0x5b, 0xf0, 0x65, 0xea, 0xe5, 0x4f, 0x94, 0x52, + 0x62, 0x2a, 0xcb, 0x0a, 0x17, 0xbd, 0x56, 0x45, 0xb3, 0xde, 0x53, 0x2d, + 0xf8, 0x3d, 0x79, 0x27, 0x2e, 0xf8, 0xeb, 0xac, 0x4c, 0xdb, 0xc3, 0x28, + 0x83, 0xdb, 0x11, 0xe6, 0x7a, 0xad, 0x05, 0xae, 0x03, 0x2b, 0x9e, 0xb1, + 0x72, 0x3b, 0x64, 0xda, 0x56, 0x90, 0x7f, 0x60, 0xe3, 0x33, 0xb2, 0x4c, + 0xc3, 0x6d, 0xcf, 0x94, 0x7b, 0xd2, 0xee, 0x16, 0xe5, 0xbf, 0xf9, 0x72, + 0xed, 0xb8, 0xfa, 0x4b, 0xb7, 0x58, 0xf5, 0x8d, 0xe3, 0x88, 0x8a, 0x16, + 0x1f, 0x54, 0xaa, 0xcf, 0xb8, 0xe2, 0xfe, 0xf3, 0xa9, 0xcd, 0x96, 0x6b, + 0xe5, 0xcf, 0xa9, 0xe6, 0x1a, 0x56, 0xec, 0xf3, 0x4e, 0xac, 0xf9, 0x1a, + 0xc8, 0x37, 0x50, 0x8b, 0x8d, 0xe3, 0x81, 0x67, 0x9c, 0x98, 0x75, 0x7f, + 0x26, 0x66, 0x8d, 0xd5, 0x3d, 0xf0, 0x39, 0xba, 0xe3, 0x9f, 0xa3, 0xfb, + 0x81, 0x69, 0x8f, 0x52, 0x6d, 0xfc, 0x28, 0xad, 0xf3, 0xdf, 0x87, 0xb3, + 0xed, 0xe9, 0xf2, 0x9d, 0xc8, 0xe4, 0x4b, 0x9f, 0x31, 0xf8, 0x87, 0xef, + 0xae, 0x55, 0xf2, 0x34, 0xc7, 0x11, 0xad, 0x98, 0x2e, 0xe1, 0x88, 0x40, + 0x5e, 0x3f, 0xf3, 0xa5, 0x92, 0x2f, 0x46, 0xcf, 0x98, 0x62, 0x75, 0xe1, + 0x0c, 0xec, 0xf5, 0xb1, 0x44, 0xa8, 0x92, 0x84, 0x43, 0x96, 0xc1, 0x9f, + 0xd1, 0xf1, 0xb8, 0xf0, 0x5a, 0xe5, 0xf2, 0x73, 0x49, 0x9d, 0xcd, 0x6c, + 0xe3, 0xb4, 0x31, 0xee, 0xbf, 0x10, 0x6d, 0xcc, 0xcb, 0x9c, 0x69, 0xb2, + 0x75, 0x23, 0x19, 0x9d, 0x55, 0xfe, 0x12, 0xfd, 0x2d, 0xdd, 0xfe, 0x96, + 0x07, 0x11, 0xe3, 0xd3, 0xf9, 0x54, 0xfb, 0xe3, 0x3a, 0x66, 0xf7, 0xf8, + 0xa6, 0xcb, 0xfb, 0xbb, 0xba, 0x33, 0x62, 0xbf, 0xc3, 0x1d, 0x9c, 0x77, + 0xdb, 0xb8, 0x6f, 0x16, 0xce, 0x4f, 0x65, 0x68, 0x4f, 0xdc, 0xcd, 0xf1, + 0xad, 0xbf, 0xa5, 0x14, 0xa7, 0xa5, 0x6a, 0xd4, 0xd3, 0x45, 0xad, 0xd6, + 0xfe, 0xd6, 0x19, 0x48, 0x55, 0x22, 0xd5, 0x2e, 0x53, 0x33, 0xe5, 0x7e, + 0x64, 0xc5, 0xa9, 0x70, 0x8a, 0x71, 0x07, 0xf1, 0x7e, 0x84, 0x1b, 0x88, + 0x98, 0x29, 0x4a, 0xa9, 0xbf, 0x75, 0x2a, 0x4d, 0xc3, 0x19, 0x2d, 0xea, + 0xfb, 0x31, 0xad, 0x97, 0xf7, 0x45, 0x27, 0xcd, 0xb4, 0x71, 0x9a, 0x3f, + 0xb3, 0x2d, 0x77, 0x45, 0xdd, 0x42, 0xde, 0x3f, 0x47, 0x65, 0x7d, 0xab, + 0xe0, 0x5d, 0xb8, 0x0f, 0xde, 0x8b, 0xfa, 0xb7, 0xac, 0xf4, 0xc1, 0xdb, + 0xa3, 0xbe, 0x3b, 0x68, 0x10, 0xda, 0x3b, 0xe5, 0xf3, 0x18, 0xad, 0xa0, + 0x32, 0x47, 0x0e, 0xda, 0x65, 0x41, 0x14, 0x2b, 0x72, 0x16, 0xd3, 0xac, + 0xc3, 0xcb, 0xe9, 0x4c, 0x27, 0x7f, 0x3a, 0x1c, 0xf5, 0x59, 0xe9, 0x10, + 0x95, 0x39, 0x5d, 0x68, 0xbf, 0x8d, 0xf6, 0x22, 0xed, 0xa0, 0xfd, 0xe4, + 0x9d, 0xe3, 0x75, 0x46, 0xdd, 0x3f, 0xe5, 0xf6, 0x61, 0xbf, 0x5c, 0x2c, + 0x66, 0x25, 0x56, 0xd0, 0x36, 0x4b, 0x19, 0xad, 0xb1, 0x18, 0xb6, 0x69, + 0x96, 0x5c, 0xa6, 0xb8, 0xa1, 0xfe, 0x48, 0x8e, 0x5f, 0xb9, 0xe1, 0xd8, + 0xdf, 0x80, 0x99, 0x98, 0xb5, 0xa7, 0x9d, 0xf4, 0x1b, 0x02, 0xb1, 0x46, + 0x38, 0x6c, 0x6b, 0x9c, 0x0e, 0xd8, 0x3c, 0x4f, 0x2d, 0x8e, 0xdd, 0x72, + 0x1c, 0xf9, 0xc6, 0xea, 0x45, 0x6b, 0xe5, 0xe7, 0xbc, 0x16, 0xab, 0xbc, + 0xff, 0x8c, 0xfe, 0xec, 0x5f, 0x46, 0x7f, 0x57, 0xfa, 0xd4, 0x1f, 0xa5, + 0xe7, 0xcf, 0x18, 0xd9, 0x5f, 0xf6, 0x13, 0xef, 0xf9, 0x76, 0x32, 0x8c, + 0xc5, 0x17, 0x35, 0x5c, 0x64, 0x59, 0x78, 0x95, 0x58, 0x70, 0x95, 0x68, + 0xbe, 0x4a, 0x98, 0x7d, 0xc0, 0x2a, 0x7d, 0xf8, 0x51, 0xf4, 0xa1, 0x80, + 0x4e, 0x95, 0xc7, 0xfd, 0x57, 0x4a, 0xb9, 0xd9, 0x2f, 0xa4, 0x7d, 0xcb, + 0x23, 0xf0, 0x8b, 0xb1, 0xf6, 0xbb, 0xfd, 0x0f, 0x49, 0xfb, 0xf4, 0x5d, + 0x60, 0x6e, 0x95, 0x3a, 0x73, 0x64, 0xef, 0x25, 0x16, 0xf4, 0x3d, 0xee, + 0x3f, 0x8c, 0xd3, 0x50, 0x81, 0xc9, 0xaf, 0x16, 0x55, 0x29, 0x9f, 0x63, + 0x9f, 0xee, 0x83, 0x6f, 0xa5, 0x75, 0xf2, 0x7d, 0x46, 0x95, 0x8a, 0x07, + 0x51, 0xf7, 0x45, 0xf2, 0xec, 0xc2, 0xef, 0x22, 0x0a, 0x70, 0xf2, 0x9d, + 0x26, 0x6f, 0x8b, 0x51, 0x77, 0x1b, 0xdf, 0x11, 0x7c, 0xf3, 0xc9, 0x27, + 0xef, 0x88, 0x6a, 0x1f, 0x5b, 0xa1, 0x3f, 0x0f, 0x1f, 0xa7, 0xee, 0x4d, + 0x5f, 0xc7, 0xee, 0xa5, 0x67, 0xc3, 0xce, 0xb3, 0xd1, 0x2b, 0xcf, 0x87, + 0xaa, 0xcd, 0x5d, 0xfa, 0xb3, 0x73, 0xae, 0xcb, 0x92, 0xa9, 0x2b, 0xea, + 0xfe, 0x5a, 0xe6, 0x3d, 0xc0, 0x3c, 0xf4, 0x31, 0xe0, 0x9f, 0x81, 0x59, + 0xe6, 0xbf, 0x0b, 0x28, 0xa0, 0xec, 0x33, 0x4e, 0xfa, 0x5d, 0xce, 0x78, + 0xef, 0x77, 0xec, 0xfa, 0x2c, 0xd9, 0x93, 0x1e, 0x97, 0x16, 0xdd, 0x36, + 0x1b, 0xda, 0x66, 0x53, 0xe3, 0x72, 0x19, 0x59, 0x85, 0xd9, 0xb6, 0xef, + 0x73, 0x6c, 0x0f, 0x69, 0xdb, 0x2f, 0x5b, 0xff, 0x78, 0x32, 0x87, 0xbe, + 0x53, 0x07, 0xab, 0x54, 0x1c, 0x19, 0x3b, 0x5e, 0x81, 0x0d, 0xa5, 0x14, + 0xdf, 0x70, 0x04, 0x63, 0xc6, 0xf6, 0x4e, 0x7d, 0x56, 0x1e, 0x3a, 0xad, + 0xfd, 0xbc, 0x5e, 0x1b, 0xc5, 0x5b, 0x86, 0xc9, 0xb6, 0x5b, 0xf5, 0xc3, + 0x3e, 0xa6, 0x4e, 0xbb, 0x3e, 0x4b, 0xc6, 0x75, 0x19, 0xb1, 0x8d, 0x67, + 0x52, 0x69, 0x5b, 0x8f, 0x17, 0x25, 0x59, 0xf9, 0xaf, 0x3b, 0x0c, 0x6b, + 0x03, 0xf4, 0x71, 0xff, 0x0f, 0xa9, 0xd4, 0xa2, 0xea, 0x34, 0x64, 0x8c, + 0xb9, 0x40, 0x7f, 0xce, 0xcf, 0x6b, 0xd2, 0x2e, 0xd7, 0xe4, 0x52, 0xe1, + 0xf5, 0xce, 0x9a, 0x85, 0x55, 0x69, 0x2d, 0xc3, 0xda, 0x5f, 0x63, 0xb5, + 0xd8, 0xe4, 0x7a, 0xb4, 0xa4, 0xe7, 0x6d, 0x56, 0xa9, 0x5a, 0x8d, 0x0e, + 0xdc, 0xa6, 0xd7, 0x38, 0x84, 0x8d, 0x57, 0xe2, 0x56, 0x91, 0xfe, 0x1b, + 0x0b, 0x2f, 0x5a, 0xc4, 0x73, 0x9d, 0xab, 0xd6, 0x88, 0xaf, 0xc1, 0x67, + 0x59, 0xe8, 0x5b, 0xe0, 0x6b, 0xf6, 0x7d, 0xce, 0xf8, 0xb1, 0xf4, 0xb2, + 0x2a, 0x15, 0x6b, 0xf9, 0x1d, 0x96, 0x57, 0x60, 0x1f, 0x6a, 0x8d, 0xfa, + 0xee, 0xd6, 0xef, 0x73, 0xd2, 0xef, 0x3e, 0xae, 0xd4, 0xfe, 0xc7, 0x7e, + 0x44, 0xf2, 0xd6, 0x2b, 0xfd, 0x08, 0x5e, 0x2a, 0xe4, 0xbb, 0x96, 0x05, + 0x24, 0x8c, 0x80, 0x60, 0x2f, 0x5a, 0x23, 0xdf, 0x13, 0xed, 0xb7, 0xe1, + 0xb9, 0xfa, 0x86, 0xae, 0x3e, 0xba, 0xd9, 0xca, 0xf9, 0x0b, 0x9a, 0x6b, + 0x6a, 0x6a, 0xe9, 0x49, 0x2b, 0x8f, 0x35, 0xd4, 0xff, 0x98, 0x66, 0x1e, + 0xb2, 0xea, 0xf1, 0x2c, 0xa0, 0xfb, 0xd2, 0xb2, 0x67, 0x35, 0x73, 0xc7, + 0x9d, 0x62, 0xa2, 0xe7, 0xeb, 0x27, 0x3a, 0x96, 0x88, 0xa2, 0xe2, 0xdb, + 0x0f, 0xd1, 0xdb, 0x56, 0x34, 0x16, 0x65, 0xf6, 0xaf, 0x3e, 0x8b, 0xae, + 0xb6, 0x31, 0x4f, 0xd7, 0x49, 0xd2, 0x4c, 0x7f, 0xd6, 0xaa, 0xbe, 0xd5, + 0x1d, 0x74, 0x97, 0x8d, 0x0a, 0xb6, 0xac, 0xde, 0xb7, 0x7a, 0xef, 0x05, + 0x27, 0x4e, 0xd0, 0x2d, 0x36, 0x5d, 0x39, 0x3d, 0x0d, 0xf1, 0xa1, 0x2e, + 0xb4, 0x61, 0xbf, 0x03, 0x2d, 0x7b, 0xfb, 0xbc, 0xcb, 0x77, 0x3e, 0xb5, + 0x9a, 0x6e, 0x61, 0x5e, 0x78, 0x3c, 0x27, 0x9e, 0xa6, 0xfb, 0x1c, 0xd2, + 0xf2, 0x4d, 0xba, 0xc9, 0x21, 0x8b, 0xfe, 0xc4, 0xce, 0xa4, 0x8f, 0x3e, + 0xb0, 0xc0, 0x24, 0x4c, 0x1f, 0xa1, 0xbb, 0xfd, 0xc7, 0xf6, 0xfe, 0xa2, + 0xf9, 0xad, 0xfe, 0x1a, 0x64, 0xd8, 0x4b, 0xaf, 0xb2, 0x9c, 0x5e, 0xb3, + 0xb0, 0x95, 0xb1, 0x68, 0xb3, 0xd1, 0xb9, 0x87, 0xde, 0xe6, 0x21, 0xf9, + 0x03, 0x3f, 0x8e, 0xf2, 0xeb, 0x9d, 0xef, 0xf1, 0xe3, 0x66, 0x83, 0xcd, + 0xbe, 0xc3, 0xec, 0x0d, 0xfc, 0xf8, 0x3e, 0x3f, 0xfe, 0x81, 0x1f, 0x37, + 0x19, 0xb2, 0x9e, 0x6f, 0x4b, 0x83, 0xef, 0xca, 0xe7, 0x8d, 0x4a, 0x74, + 0x8b, 0x4c, 0x3c, 0xe1, 0xc0, 0xe3, 0x97, 0x3c, 0x8c, 0x87, 0x6b, 0x9a, + 0xfb, 0x6e, 0x0b, 0xaf, 0x5e, 0x73, 0xa8, 0x96, 0x7e, 0xc7, 0x39, 0xdb, + 0x58, 0xdd, 0xa6, 0x07, 0xab, 0xcd, 0xa6, 0x87, 0xef, 0x18, 0x4b, 0xef, + 0xb5, 0xe3, 0x71, 0x39, 0xe7, 0x3f, 0x4c, 0x37, 0xca, 0xb6, 0xdd, 0x65, + 0x78, 0xde, 0xaf, 0x5d, 0x1d, 0x32, 0x86, 0x3b, 0xb7, 0xd0, 0xcf, 0x2c, + 0xb2, 0x8f, 0x4f, 0xbf, 0x79, 0xfb, 0xe1, 0xba, 0x90, 0x71, 0xfe, 0x10, + 0x3d, 0x2e, 0x4d, 0xee, 0xa0, 0x47, 0x84, 0xa0, 0xce, 0x3b, 0x56, 0x1b, + 0x67, 0x08, 0x5f, 0x81, 0x28, 0x29, 0x5a, 0x62, 0xe4, 0x8a, 0x39, 0x8a, + 0x59, 0x2f, 0xca, 0x0a, 0x44, 0xb1, 0xfb, 0x8a, 0x9d, 0xc6, 0x6e, 0x70, + 0xc6, 0x05, 0x62, 0x42, 0x01, 0x3d, 0xcc, 0xe5, 0xdf, 0x46, 0x6d, 0xb2, + 0xb1, 0x6d, 0xb2, 0x48, 0x3a, 0x4b, 0x12, 0xe3, 0xb7, 0xd4, 0x64, 0xfc, + 0xd1, 0xd8, 0x63, 0x7c, 0xdf, 0xb2, 0x67, 0xaf, 0x71, 0xf5, 0xbe, 0xd7, + 0x0f, 0x47, 0x8e, 0x36, 0x37, 0x2f, 0x69, 0x6e, 0x5e, 0x7a, 0x7d, 0x4b, + 0xf3, 0x5d, 0x46, 0x81, 0x98, 0x52, 0x60, 0xe4, 0x3f, 0x40, 0xdf, 0xc4, + 0x18, 0x1d, 0xa5, 0xcb, 0x05, 0x55, 0xd3, 0xbb, 0xe8, 0xd0, 0x85, 0xab, + 0x97, 0xd0, 0xf7, 0xd0, 0x82, 0x82, 0xa3, 0x4b, 0xe8, 0x10, 0x54, 0x17, + 0x1e, 0xa2, 0x27, 0xed, 0x9c, 0xa4, 0x77, 0x98, 0x7c, 0x87, 0xae, 0x95, + 0x4a, 0xfa, 0x4c, 0xce, 0xf6, 0x43, 0xf4, 0xbe, 0x4d, 0xf5, 0x7d, 0xc9, + 0x21, 0xba, 0x86, 0x0d, 0x50, 0x6e, 0x49, 0x01, 0x3d, 0x00, 0x76, 0x33, + 0x7d, 0x62, 0xc8, 0x86, 0x5c, 0xbc, 0xba, 0x59, 0xdd, 0xcf, 0x8a, 0x10, + 0x81, 0xd9, 0xdf, 0x67, 0x92, 0xda, 0xe7, 0xa7, 0xc1, 0x9f, 0x27, 0xe9, + 0x35, 0x20, 0x48, 0xd9, 0xa4, 0xdf, 0x67, 0x18, 0x19, 0xe4, 0xc9, 0x74, + 0x9e, 0xb6, 0x49, 0xff, 0x1d, 0xd2, 0x3c, 0x4d, 0x6b, 0x35, 0x75, 0x6a, + 0xfb, 0xe9, 0x3a, 0xff, 0x19, 0x5a, 0x5e, 0xad, 0xe5, 0xb5, 0x7a, 0x7d, + 0x35, 0x62, 0x7f, 0x64, 0x79, 0x93, 0x6e, 0x83, 0x61, 0xaa, 0xaf, 0x09, + 0xbb, 0x38, 0xf3, 0x9e, 0x4c, 0x5a, 0xc5, 0xed, 0x74, 0x9b, 0xac, 0x19, + 0x5e, 0xbd, 0x0b, 0x4d, 0xdf, 0x35, 0x0d, 0xad, 0x33, 0xb4, 0xce, 0xd0, + 0xeb, 0x59, 0x95, 0xef, 0x90, 0xe7, 0x27, 0x25, 0x6b, 0xd2, 0x74, 0x99, + 0xa6, 0xad, 0xb2, 0x04, 0x8b, 0xd6, 0xe3, 0x26, 0x62, 0xaa, 0x47, 0xbd, + 0x13, 0xb0, 0x48, 0xda, 0xaa, 0xc7, 0x46, 0xbd, 0x9b, 0x60, 0x9a, 0xa3, + 0x69, 0xbe, 0xce, 0xeb, 0xc1, 0xd9, 0x55, 0x7e, 0x26, 0x61, 0x6a, 0x6b, + 0x31, 0x7a, 0xcb, 0x29, 0xbb, 0x89, 0x4f, 0xf7, 0x25, 0x3d, 0xee, 0xd3, + 0x34, 0x9d, 0x9e, 0x19, 0xbf, 0x56, 0x59, 0x4e, 0xad, 0x2c, 0x31, 0x3d, + 0x76, 0xb5, 0x5a, 0xd6, 0x2a, 0x65, 0x56, 0x39, 0xfe, 0xa3, 0x65, 0x35, + 0x6a, 0x59, 0xa3, 0xa9, 0xff, 0x8d, 0x32, 0xa5, 0xee, 0x9f, 0x4c, 0x5b, + 0x49, 0xed, 0xc1, 0xad, 0xa6, 0x7c, 0x8c, 0xe5, 0x9a, 0xb6, 0xe9, 0xbe, + 0xb2, 0xa6, 0xd0, 0xc4, 0x4f, 0xc9, 0xf8, 0xc5, 0x14, 0xd3, 0x18, 0x17, + 0x66, 0xe6, 0xae, 0x4c, 0xeb, 0xdd, 0xba, 0xcc, 0xa9, 0xba, 0x9e, 0xda, + 0x8c, 0xa5, 0x6a, 0x5b, 0x6d, 0xc6, 0x5a, 0xe4, 0x90, 0x70, 0x11, 0x2e, + 0xc9, 0xa2, 0x9c, 0x8c, 0xf2, 0x4e, 0x12, 0x15, 0x64, 0x6f, 0x0e, 0x47, + 0xc3, 0xa9, 0xa5, 0x64, 0x2c, 0x6d, 0x22, 0xeb, 0xd2, 0x26, 0x3c, 0xed, + 0xfc, 0xac, 0xe8, 0xa5, 0xfc, 0xb6, 0xa1, 0x60, 0x74, 0x47, 0x68, 0x53, + 0x30, 0x35, 0x30, 0x14, 0x4a, 0xd0, 0xc4, 0xb6, 0xd8, 0xae, 0x78, 0x2c, + 0x1a, 0x8a, 0xa6, 0xba, 0x43, 0xa1, 0x44, 0x6f, 0x38, 0xb4, 0xa7, 0xf6, + 0xbc, 0xe0, 0x48, 0x90, 0x5c, 0x6d, 0xb1, 0x68, 0x34, 0x34, 0x90, 0x0a, + 0xc7, 0xa2, 0x24, 0x56, 0x92, 0xb1, 0xb2, 0x83, 0x44, 0x07, 0x19, 0x1d, + 0x15, 0x40, 0x07, 0x59, 0x3a, 0x3a, 0x38, 0xd1, 0x09, 0xa6, 0xb3, 0x0b, + 0x4c, 0x17, 0x89, 0x4e, 0x32, 0x3a, 0x19, 0x5d, 0x34, 0xbd, 0x73, 0x78, + 0x20, 0xd4, 0x3a, 0x30, 0x10, 0x4a, 0x26, 0xc3, 0xdb, 0xc2, 0x91, 0x70, + 0x6a, 0xdf, 0xda, 0xd8, 0x60, 0xa8, 0x3b, 0x11, 0x1b, 0x09, 0x0f, 0xa2, + 0xc6, 0x92, 0xd5, 0xa1, 0x7d, 0xdb, 0x62, 0xc1, 0xc4, 0xe0, 0x8a, 0x70, + 0x72, 0x57, 0x38, 0x99, 0xec, 0x0a, 0x27, 0x53, 0xa1, 0x28, 0x14, 0x02, + 0x25, 0x75, 0xa1, 0xec, 0x2e, 0x2e, 0xbb, 0xab, 0x93, 0xac, 0x5d, 0x9d, + 0x92, 0xeb, 0x82, 0x48, 0xca, 0x21, 0xc3, 0xa3, 0x8b, 0x26, 0x76, 0x05, + 0xa3, 0x83, 0x89, 0x58, 0x78, 0xb0, 0x2e, 0x18, 0x8f, 0xd7, 0xb5, 0xa2, + 0x91, 0x23, 0xa8, 0xa4, 0x89, 0xe6, 0x67, 0xcb, 0xe3, 0xf1, 0x48, 0x78, + 0x20, 0xc8, 0x3d, 0x98, 0x9d, 0xb6, 0xe9, 0x0a, 0x6f, 0x0f, 0x0d, 0xec, + 0x1b, 0x88, 0x84, 0xda, 0x82, 0x91, 0xc8, 0xb6, 0xe0, 0xc0, 0xce, 0x64, + 0x13, 0x4d, 0x3e, 0x5d, 0x2e, 0xb3, 0x6a, 0x20, 0x16, 0x45, 0x23, 0x53, + 0x75, 0x6d, 0x4c, 0xf7, 0xa6, 0xcc, 0xaa, 0x1d, 0x89, 0x60, 0x7c, 0x28, + 0x3c, 0x90, 0xac, 0x6b, 0x0b, 0x46, 0x47, 0x82, 0x28, 0x70, 0xc6, 0x38, + 0xaa, 0x58, 0x24, 0x96, 0x58, 0x19, 0x8e, 0xa4, 0x42, 0x89, 0xd3, 0xeb, + 0xd7, 0x04, 0x53, 0x89, 0xf0, 0xde, 0x26, 0xaa, 0xf8, 0x5c, 0x7d, 0x56, + 0x51, 0x93, 0xc6, 0x9a, 0x76, 0x07, 0xc3, 0xd1, 0xd4, 0xf8, 0x9a, 0x98, + 0xd4, 0x94, 0x8c, 0xd5, 0x6c, 0xc0, 0x44, 0x37, 0xd1, 0x94, 0x8c, 0x22, + 0x96, 0xac, 0x5b, 0x3e, 0x1c, 0x8e, 0x0c, 0xce, 0xee, 0x6d, 0xdf, 0xd0, + 0xd3, 0xb1, 0x6e, 0x6d, 0x13, 0x15, 0x65, 0xeb, 0xa2, 0x83, 0x91, 0x50, + 0x13, 0x15, 0x9b, 0x85, 0x1d, 0xcb, 0xc3, 0xd1, 0x41, 0x6e, 0xd3, 0x68, + 0xf9, 0x3c, 0x52, 0x75, 0xed, 0x83, 0xe1, 0x54, 0x70, 0x1b, 0x9b, 0x4f, + 0xca, 0x56, 0xf4, 0x84, 0x22, 0xca, 0xbf, 0xcc, 0x35, 0x2b, 0x4d, 0x3c, + 0x18, 0xd5, 0xfe, 0x39, 0x36, 0x17, 0x74, 0x51, 0x55, 0xde, 0x19, 0xa7, + 0xd1, 0xf4, 0x60, 0x98, 0xa2, 0x3b, 0x64, 0x07, 0xb8, 0x80, 0x53, 0x0a, + 0x0f, 0xe0, 0x91, 0x29, 0x7c, 0xb4, 0x5b, 0xc3, 0xa9, 0x70, 0x84, 0xc7, + 0x6e, 0x7c, 0x61, 0x33, 0x55, 0x66, 0x84, 0x23, 0x58, 0x23, 0x75, 0x6d, + 0x43, 0xb1, 0x44, 0x28, 0x26, 0x07, 0x30, 0x94, 0x98, 0xbd, 0x32, 0x11, + 0xdc, 0x95, 0x71, 0xa9, 0x26, 0x9a, 0xf6, 0x39, 0xb6, 0xe6, 0xf1, 0x91, + 0x5a, 0xac, 0x86, 0xf6, 0x91, 0x50, 0x34, 0x6b, 0xfc, 0xa5, 0x62, 0x4d, + 0x8c, 0x07, 0x47, 0xeb, 0x2a, 0xb2, 0x75, 0xbc, 0x4e, 0x67, 0xaf, 0x8b, + 0xae, 0x8c, 0x0d, 0x0c, 0x27, 0xd5, 0x7a, 0x4e, 0xaf, 0x22, 0x73, 0xf3, + 0x33, 0xa6, 0xe6, 0x51, 0xcc, 0x08, 0x57, 0x25, 0x62, 0xc3, 0xf1, 0x26, + 0x5a, 0x38, 0x56, 0x13, 0x48, 0x84, 0x42, 0xeb, 0xb6, 0x25, 0x43, 0x89, + 0x11, 0xf4, 0x6d, 0x5d, 0x74, 0x55, 0x24, 0xb6, 0x2d, 0x18, 0xe9, 0x0a, + 0xee, 0x8b, 0x0d, 0xa7, 0x46, 0xab, 0x99, 0xf9, 0xf9, 0xf9, 0x9a, 0x68, + 0x6e, 0xb6, 0x41, 0xd0, 0x1c, 0x10, 0xea, 0xb2, 0xc2, 0xc3, 0x9a, 0x60, + 0x34, 0xb8, 0x83, 0xb3, 0xd4, 0x7f, 0xe9, 0x2c, 0x1c, 0x51, 0x3a, 0xa2, + 0xdb, 0x63, 0x63, 0xda, 0xff, 0x05, 0x79, 0xd2, 0x51, 0xa8, 0x89, 0x6a, + 0xb3, 0xf3, 0x85, 0xa3, 0xf1, 0xe1, 0xd4, 0xae, 0x50, 0x6a, 0x28, 0x36, + 0x58, 0xb7, 0x3c, 0x98, 0x44, 0xe1, 0x48, 0x8f, 0xc6, 0x40, 0xb3, 0xb7, + 0x8d, 0xb1, 0x67, 0x17, 0x8f, 0x25, 0x54, 0x73, 0x2a, 0x4f, 0x6f, 0x36, + 0xa6, 0xc8, 0x9a, 0x2f, 0xb0, 0x5d, 0x23, 0xf9, 0xcc, 0xe8, 0xd4, 0x75, + 0x0d, 0xc4, 0x76, 0xd5, 0x25, 0x76, 0x25, 0x23, 0x75, 0xe7, 0x21, 0xc2, + 0xd6, 0x8d, 0x89, 0xdc, 0xb3, 0xb3, 0x42, 0x7b, 0x13, 0x55, 0x7f, 0x71, + 0x06, 0x53, 0x6b, 0x96, 0x7d, 0xa1, 0xf5, 0xe7, 0xc6, 0xf5, 0x26, 0x5a, + 0xf9, 0x85, 0x05, 0x9c, 0x26, 0xf2, 0xcf, 0xce, 0x76, 0x9c, 0xc6, 0xff, + 0xd7, 0x72, 0xd8, 0xe7, 0xbe, 0x28, 0x2b, 0x2f, 0x7f, 0x39, 0xb8, 0x81, + 0x60, 0x62, 0x47, 0x08, 0x2b, 0xab, 0xf4, 0x8b, 0xb2, 0x34, 0x51, 0x59, + 0xd7, 0x60, 0x30, 0x32, 0x12, 0xde, 0x59, 0x87, 0x00, 0x13, 0x4b, 0xc9, + 0xbd, 0xa1, 0xae, 0x3d, 0x3a, 0x10, 0x89, 0x25, 0x11, 0x67, 0xda, 0x22, + 0xc1, 0xa4, 0x0c, 0xfa, 0x63, 0x6d, 0x3a, 0x30, 0xb8, 0x09, 0xad, 0x2f, + 0x1d, 0x47, 0xbf, 0x26, 0xb4, 0x6b, 0x9b, 0x36, 0x08, 0xc1, 0x64, 0xfa, + 0x38, 0x26, 0x3d, 0xe1, 0x1d, 0xd1, 0x60, 0x6a, 0x38, 0x21, 0xc3, 0x27, + 0x6f, 0xcc, 0x75, 0x11, 0x4c, 0x31, 0x42, 0x4a, 0x30, 0xd1, 0x13, 0xda, + 0x3d, 0x1c, 0x8a, 0x0e, 0x40, 0xe3, 0x31, 0x6b, 0x54, 0x75, 0x65, 0x26, + 0x51, 0x47, 0x24, 0x12, 0xda, 0x11, 0x8c, 0xa8, 0x99, 0x6b, 0xdf, 0x3b, + 0x10, 0x8a, 0xab, 0x09, 0x9f, 0x3d, 0x8e, 0x4d, 0x62, 0xc7, 0xf0, 0x2e, + 0xf4, 0xdd, 0x64, 0x55, 0x64, 0xb6, 0xc2, 0xe6, 0x27, 0x5d, 0xb1, 0xd4, + 0x24, 0x5c, 0x1b, 0xeb, 0x19, 0x1e, 0x18, 0x52, 0xbe, 0x6a, 0xca, 0xe7, + 0x35, 0x99, 0xac, 0xdb, 0x76, 0x9e, 0xdc, 0x61, 0xa6, 0x9b, 0x64, 0x3d, + 0xa1, 0x81, 0xe1, 0x04, 0x7c, 0xe8, 0x34, 0x59, 0x54, 0x10, 0xe7, 0x35, + 0x32, 0x2a, 0x4b, 0x84, 0xb6, 0xf3, 0x96, 0x81, 0x66, 0x8c, 0xc4, 0xd4, + 0x16, 0xad, 0x26, 0xd1, 0x54, 0xc4, 0x94, 0x71, 0xcc, 0x55, 0xd3, 0x9a, + 0x68, 0x82, 0xd2, 0xc9, 0xa0, 0xde, 0x9a, 0x48, 0x04, 0xf7, 0xb1, 0xdf, + 0x34, 0x91, 0xdb, 0x24, 0x1e, 0x5f, 0xd2, 0x4c, 0x8e, 0x9e, 0x15, 0xab, + 0xcf, 0xed, 0x58, 0x1b, 0x20, 0x6b, 0x60, 0x73, 0x77, 0x3b, 0x15, 0x9e, + 0xe2, 0x45, 0x94, 0x67, 0xf6, 0x60, 0x12, 0xbd, 0x64, 0xf4, 0xe2, 0xc0, + 0xd2, 0x8b, 0xe3, 0x8b, 0xb5, 0x97, 0x8f, 0x4a, 0x36, 0x7e, 0xe2, 0x2c, + 0xd3, 0xdb, 0x49, 0xf6, 0xde, 0xce, 0x8e, 0x95, 0x2b, 0x71, 0xba, 0xe9, + 0xed, 0x94, 0x8a, 0x4e, 0x56, 0x58, 0x7a, 0x71, 0x76, 0xc2, 0xa3, 0x8b, + 0xc5, 0x7c, 0xe0, 0xe9, 0xed, 0xec, 0x83, 0x35, 0x33, 0x5d, 0x5c, 0x46, + 0x97, 0x34, 0xed, 0x52, 0xa6, 0x7c, 0x0c, 0xea, 0x85, 0x11, 0x04, 0x2c, + 0x77, 0x48, 0x22, 0xab, 0xea, 0x92, 0x59, 0x71, 0x2b, 0x06, 0xdb, 0xd7, + 0x29, 0x9f, 0x38, 0x53, 0xf5, 0xf6, 0xa1, 0xd2, 0x3e, 0x69, 0x22, 0xfa, + 0xc8, 0xd2, 0xc7, 0xa6, 0x78, 0x74, 0x31, 0x0b, 0x35, 0x0c, 0x6d, 0x7d, + 0x9d, 0x9c, 0xb6, 0x82, 0xb0, 0x80, 0x35, 0xa8, 0xd6, 0xde, 0xd7, 0x25, + 0xc5, 0x36, 0xa6, 0x90, 0xf7, 0xe3, 0x18, 0xd8, 0xdf, 0x41, 0xde, 0xfe, + 0xb1, 0xee, 0x56, 0xd4, 0x3f, 0xce, 0x6c, 0xbb, 0x54, 0x2c, 0x9e, 0xed, + 0xf7, 0xfb, 0x33, 0xfc, 0x5c, 0xf0, 0xb9, 0xa3, 0xbc, 0x29, 0x91, 0xa5, + 0xa9, 0x37, 0x27, 0xe6, 0x99, 0x13, 0xf3, 0xcd, 0x89, 0x05, 0xe6, 0xc4, + 0x42, 0x73, 0x62, 0x91, 0x39, 0xd1, 0x60, 0x4e, 0x34, 0x9a, 0x5a, 0x53, + 0x6f, 0xe2, 0xe7, 0x99, 0xf8, 0xf9, 0x26, 0x7e, 0x81, 0x89, 0x5f, 0x68, + 0xe2, 0x17, 0x99, 0xf8, 0x06, 0x13, 0xdf, 0x38, 0x5a, 0xd9, 0xca, 0x48, + 0x70, 0x47, 0x92, 0xf2, 0xb3, 0xb6, 0x24, 0x2a, 0x0e, 0x8e, 0xb3, 0xf5, + 0x71, 0x0e, 0x76, 0xe0, 0xae, 0xe0, 0xb6, 0x50, 0x84, 0x2c, 0xc1, 0xc1, + 0x41, 0x9a, 0x8c, 0xc7, 0xf8, 0x7b, 0x2f, 0xb9, 0x83, 0xdb, 0x71, 0xfa, + 0x63, 0x1f, 0x54, 0x01, 0x7f, 0x90, 0x3c, 0x7c, 0xf0, 0x58, 0x3e, 0x9c, + 0x4a, 0xc5, 0xa2, 0xdd, 0x09, 0x94, 0x2e, 0x45, 0xa1, 0xed, 0x38, 0x77, + 0x98, 0xad, 0xec, 0xdb, 0x62, 0xb0, 0xd8, 0x45, 0xf6, 0x81, 0x20, 0x36, + 0x88, 0x41, 0x72, 0x2b, 0x6a, 0x3a, 0xe9, 0xe7, 0x0f, 0x64, 0x5d, 0x0e, + 0x6c, 0x38, 0x29, 0x07, 0x13, 0x54, 0xc8, 0xa1, 0x2e, 0x64, 0x32, 0x2b, + 0x91, 0x02, 0xd3, 0x1e, 0xa5, 0x8f, 0xc5, 0x94, 0x3b, 0xc0, 0x3b, 0x02, + 0x9f, 0x33, 0x5b, 0x53, 0x54, 0x90, 0x49, 0xb4, 0xc5, 0x86, 0xa3, 0x29, + 0x14, 0x0e, 0x2b, 0x9c, 0x4e, 0x93, 0x52, 0x46, 0xc5, 0xfa, 0x4c, 0x9d, + 0x5c, 0x2e, 0x1b, 0xaa, 0x1a, 0x49, 0x53, 0x07, 0x12, 0xa1, 0x60, 0x6a, + 0xec, 0x36, 0xc3, 0xbb, 0x2b, 0x39, 0x06, 0x63, 0xf2, 0xa8, 0x45, 0xce, + 0x90, 0x3e, 0x55, 0x82, 0x8b, 0x0e, 0x26, 0x37, 0x85, 0x53, 0x43, 0xe4, + 0xdb, 0x8e, 0x03, 0xe8, 0xb8, 0xf9, 0x92, 0xcb, 0xf7, 0xf1, 0x30, 0x50, + 0x0e, 0x5b, 0xc8, 0x33, 0x13, 0xe5, 0x6d, 0x1f, 0x3d, 0x3a, 0x0d, 0xd2, + 0x54, 0xac, 0xe1, 0xac, 0x9c, 0xd2, 0x88, 0x83, 0x7f, 0xc7, 0x20, 0x4d, + 0x3b, 0x55, 0x99, 0x75, 0x9b, 0xc9, 0x91, 0x5a, 0x39, 0x2a, 0x85, 0x19, + 0x76, 0x4d, 0x30, 0xb9, 0x13, 0xc5, 0x4e, 0x60, 0xc1, 0xe8, 0x7d, 0x22, + 0x3d, 0x48, 0x6e, 0x88, 0xdb, 0x82, 0x89, 0x50, 0xaa, 0x1b, 0x1b, 0x88, + 0xcc, 0x59, 0xcc, 0x12, 0x84, 0xf4, 0x0e, 0x9c, 0xa0, 0xf7, 0xae, 0x8c, + 0x25, 0xd4, 0x00, 0xe5, 0x6b, 0x29, 0x5c, 0x23, 0x94, 0x48, 0x92, 0x93, + 0x93, 0xbc, 0xdc, 0xa8, 0x88, 0x39, 0xde, 0xa6, 0x78, 0xff, 0xe1, 0x63, + 0x6f, 0x7b, 0x54, 0x55, 0x96, 0x25, 0xec, 0x49, 0x05, 0x13, 0x29, 0x72, + 0x49, 0xb1, 0x9e, 0x1d, 0x8e, 0x95, 0xe9, 0x81, 0xcb, 0xe3, 0x04, 0x1f, + 0x2e, 0x03, 0x61, 0x0c, 0xe8, 0x64, 0xa4, 0x64, 0xa7, 0x43, 0x83, 0xa7, + 0xc6, 0x36, 0xdf, 0x69, 0x55, 0xb2, 0x99, 0x7a, 0x0c, 0xce, 0x0a, 0x85, + 0x77, 0x0c, 0xa5, 0x64, 0x39, 0x67, 0x81, 0x8b, 0x70, 0x2a, 0x34, 0xb8, + 0x21, 0xb4, 0x03, 0xfd, 0x5b, 0x8e, 0x27, 0x9c, 0x66, 0x3c, 0x15, 0xb7, + 0x9c, 0xbb, 0x23, 0x4b, 0x35, 0x8f, 0xfa, 0x84, 0xb4, 0x30, 0xeb, 0x10, + 0x44, 0x67, 0xa6, 0xc5, 0x81, 0x7d, 0xf1, 0x10, 0x46, 0x8a, 0x8f, 0x24, + 0xbd, 0xe1, 0x44, 0x6a, 0x38, 0x18, 0x49, 0x1f, 0x0a, 0x58, 0x23, 0xbb, + 0xda, 0x11, 0x4d, 0xa6, 0x82, 0xd8, 0x20, 0xe5, 0xc4, 0x64, 0x69, 0xb9, + 0xc6, 0x2e, 0xbd, 0x85, 0xac, 0x8b, 0xf6, 0xc0, 0xe5, 0x42, 0x51, 0x39, + 0x20, 0xa8, 0x2c, 0x88, 0x71, 0x4b, 0x85, 0x64, 0x9f, 0x54, 0xd5, 0x32, + 0xbb, 0xee, 0xaa, 0x72, 0xe4, 0xbc, 0x51, 0x01, 0x5a, 0xea, 0x40, 0x6a, + 0x43, 0x70, 0xcf, 0xd9, 0x69, 0x66, 0xb3, 0xac, 0x7c, 0x43, 0x2c, 0x96, + 0xe2, 0xae, 0xc8, 0xdc, 0x99, 0xab, 0x0e, 0x77, 0xd7, 0x63, 0x16, 0xa8, + 0x49, 0x62, 0x8f, 0xe8, 0xd9, 0x87, 0xd5, 0xbd, 0xab, 0x07, 0x3b, 0x48, + 0x18, 0x4d, 0x2e, 0x80, 0x44, 0x8d, 0xf6, 0x06, 0xb9, 0x2c, 0xd8, 0x22, + 0x80, 0x43, 0x41, 0x64, 0xed, 0xf0, 0x2e, 0xf6, 0x09, 0xe5, 0x04, 0x1b, + 0xf9, 0xc6, 0x15, 0x09, 0x47, 0x31, 0x9a, 0x6c, 0x95, 0x94, 0xd9, 0x36, + 0x46, 0xc3, 0xbc, 0xf0, 0xd8, 0x4a, 0x1a, 0x9d, 0x7a, 0x32, 0x97, 0x7e, + 0xd5, 0x1b, 0xce, 0x04, 0x24, 0xce, 0xb3, 0x09, 0x0b, 0x23, 0xb6, 0x27, + 0x10, 0xdb, 0x89, 0x71, 0x98, 0x96, 0x49, 0x4b, 0xa3, 0x48, 0x08, 0xa7, + 0xac, 0x78, 0x24, 0xb8, 0x4f, 0xad, 0x3c, 0x2b, 0xb4, 0x67, 0xcb, 0xe7, + 0x66, 0x9a, 0x84, 0xe5, 0x83, 0x8b, 0x60, 0xd6, 0xe2, 0x38, 0x2b, 0xc6, + 0x55, 0x14, 0x6a, 0x4d, 0x3c, 0xde, 0x1d, 0x64, 0xc7, 0x21, 0x77, 0x46, + 0xb0, 0x21, 0x94, 0xc4, 0x11, 0x23, 0x23, 0x59, 0x9e, 0x09, 0x5c, 0x94, + 0xaf, 0x24, 0x2b, 0xf4, 0x1a, 0xd7, 0x49, 0x4c, 0xdc, 0x8a, 0xd8, 0x9e, + 0x28, 0xe5, 0x66, 0x92, 0x1b, 0xe3, 0x54, 0x9c, 0x49, 0xc8, 0x49, 0x3d, + 0x2b, 0x3c, 0x38, 0x88, 0x96, 0xeb, 0x5a, 0xd7, 0xc4, 0x50, 0xa5, 0xcc, + 0x93, 0x25, 0x48, 0x04, 0x77, 0xa4, 0xcb, 0x94, 0x02, 0x14, 0xa3, 0xcb, + 0x94, 0x57, 0x66, 0x2a, 0xd2, 0x89, 0x50, 0x02, 0xe1, 0x68, 0x97, 0x5e, + 0xd3, 0x79, 0x43, 0x58, 0xe5, 0xe9, 0x6a, 0xa8, 0x84, 0x53, 0x3d, 0xb1, + 0xed, 0xda, 0x5d, 0x13, 0xb1, 0x5d, 0x6a, 0xa0, 0xc8, 0x39, 0x84, 0x12, + 0x64, 0x8c, 0xb1, 0x0e, 0xc5, 0x92, 0x58, 0x75, 0x58, 0x53, 0xeb, 0xe4, + 0x91, 0x24, 0x49, 0x85, 0xfc, 0x26, 0x26, 0x1c, 0x8c, 0xb4, 0x05, 0xe3, + 0xc9, 0x35, 0x98, 0x18, 0xca, 0xd7, 0x02, 0x38, 0x01, 0xfb, 0x43, 0xe1, + 0x68, 0x52, 0x79, 0x43, 0x4e, 0x38, 0xed, 0xe0, 0x94, 0x27, 0xd9, 0x73, + 0xd5, 0xa5, 0x80, 0x3c, 0x88, 0x9d, 0xa1, 0x84, 0xac, 0xa7, 0x55, 0x45, + 0x10, 0x72, 0xa2, 0xde, 0xde, 0x60, 0x64, 0x38, 0x44, 0xf6, 0x30, 0x4e, + 0x45, 0x3b, 0x43, 0xa8, 0x3a, 0x99, 0x71, 0x7c, 0x67, 0x38, 0xb9, 0x2e, + 0x1e, 0xc4, 0x31, 0x11, 0x59, 0x93, 0x99, 0xc5, 0x2b, 0x5f, 0x86, 0x60, + 0xc9, 0x43, 0x14, 0xc3, 0xc9, 0xad, 0x7d, 0x6f, 0x3c, 0x12, 0x4b, 0x04, + 0x95, 0x7b, 0x72, 0x68, 0x18, 0x44, 0x0b, 0x92, 0x7a, 0xee, 0xa9, 0x64, + 0xe7, 0x69, 0xde, 0xd6, 0xe4, 0xa7, 0x15, 0x3d, 0x43, 0x3c, 0xd4, 0xb6, + 0x88, 0xdc, 0xba, 0xec, 0x91, 0x50, 0x74, 0x07, 0x82, 0xb1, 0x35, 0xca, + 0x53, 0x98, 0x17, 0x35, 0x87, 0x4a, 0x7b, 0x6c, 0x1b, 0x87, 0x7f, 0xf2, + 0xc6, 0xb6, 0x6f, 0x4f, 0x86, 0x52, 0xcb, 0xf7, 0xb5, 0xa5, 0xf7, 0x87, + 0x24, 0x79, 0x62, 0xd1, 0xf4, 0x3b, 0x9a, 0x36, 0xb9, 0x01, 0x20, 0x2c, + 0x8c, 0x8a, 0x56, 0x84, 0x92, 0xa9, 0x44, 0x6c, 0x1f, 0x7b, 0xcd, 0xa8, + 0x50, 0x7b, 0x96, 0x29, 0x67, 0xda, 0xb5, 0xa6, 0x8e, 0x8a, 0x7a, 0x82, + 0x23, 0xa1, 0xf4, 0x70, 0xa8, 0x85, 0x6d, 0xb2, 0x97, 0xc3, 0x9d, 0x5d, + 0x44, 0x4f, 0x2a, 0x16, 0x8f, 0x43, 0x54, 0x82, 0x70, 0x2d, 0xdb, 0x71, + 0xca, 0xa5, 0x0d, 0x9d, 0x88, 0xc2, 0x93, 0xf6, 0x50, 0x7e, 0xcc, 0x7c, + 0xfb, 0xa6, 0x82, 0x58, 0xd6, 0x56, 0x4d, 0x79, 0xb1, 0xa8, 0x5c, 0x09, + 0x32, 0xc2, 0x52, 0x4e, 0x2c, 0x9a, 0x76, 0xe3, 0x7c, 0xc9, 0xae, 0x19, + 0x8e, 0xa4, 0xc2, 0x71, 0x0c, 0xaf, 0x43, 0x26, 0xe1, 0x8a, 0x4e, 0xde, + 0xfc, 0x65, 0x56, 0x58, 0xf4, 0x84, 0xcf, 0x0f, 0xa5, 0xf7, 0xa6, 0x5c, + 0x24, 0x11, 0xcd, 0x5b, 0xe1, 0xe1, 0x83, 0x52, 0x87, 0x44, 0x5a, 0xa7, + 0x93, 0x1b, 0x42, 0xbb, 0x50, 0x97, 0x4c, 0x9a, 0xb7, 0x7b, 0xb4, 0x41, + 0x4d, 0xb0, 0x6c, 0x83, 0x3d, 0xa6, 0x3c, 0xc1, 0x16, 0x97, 0xde, 0x9e, + 0x1f, 0xcf, 0xf2, 0xf3, 0xe9, 0xf1, 0x58, 0x7c, 0x38, 0x72, 0xda, 0x8d, + 0xd7, 0x83, 0x6d, 0x25, 0x95, 0xf5, 0x96, 0x83, 0x1c, 0x09, 0xf5, 0x26, + 0x8d, 0xca, 0x12, 0x88, 0xe4, 0x70, 0x8a, 0xc4, 0xe9, 0x5f, 0xb2, 0xd1, + 0xb4, 0x84, 0x6c, 0xe2, 0x69, 0xce, 0x33, 0x2e, 0xa5, 0xe5, 0xae, 0x50, + 0x1e, 0x8e, 0x2f, 0x3c, 0x2d, 0x72, 0xdc, 0xc9, 0x02, 0x3f, 0xa1, 0x82, + 0x24, 0x6f, 0x61, 0x99, 0xb7, 0x5e, 0x94, 0x97, 0xd4, 0x1b, 0x92, 0xdc, + 0xc7, 0x4a, 0xcc, 0xa9, 0x0e, 0xd5, 0x63, 0xb9, 0xcc, 0x8a, 0x93, 0xe3, + 0xec, 0x37, 0x32, 0x33, 0xaa, 0xc7, 0xf1, 0x89, 0xd7, 0xd7, 0x24, 0xa4, + 0xc6, 0x7d, 0x8d, 0x22, 0xed, 0x32, 0x51, 0x9a, 0x1c, 0x9c, 0xe2, 0xe6, + 0x4d, 0x48, 0xa6, 0x23, 0xf5, 0xc6, 0xb0, 0x29, 0x86, 0x4e, 0x1d, 0x57, + 0xcc, 0xdb, 0x71, 0x30, 0x25, 0x5b, 0x18, 0x08, 0x61, 0x67, 0x4e, 0x04, + 0x13, 0xfb, 0xd2, 0x21, 0x1b, 0x9b, 0x34, 0xe5, 0x26, 0x55, 0x74, 0x5e, + 0x2b, 0xc3, 0x5d, 0x32, 0x2b, 0x2a, 0xbb, 0xd2, 0x49, 0x74, 0x91, 0x07, + 0x60, 0x53, 0x38, 0x12, 0x59, 0x1b, 0x4b, 0x49, 0xdf, 0xcb, 0x4b, 0x62, + 0xc9, 0x65, 0x82, 0x52, 0x3e, 0xa7, 0x32, 0x41, 0x09, 0xc6, 0x3c, 0x7c, + 0xaa, 0x1f, 0x5c, 0x49, 0x7e, 0x12, 0x2e, 0x3d, 0x9a, 0xcc, 0x4d, 0x0e, + 0x6f, 0x4b, 0xdf, 0x1c, 0x29, 0x07, 0x89, 0xa4, 0xbc, 0x68, 0x91, 0x3d, + 0xa5, 0x76, 0xfb, 0x99, 0xa9, 0xec, 0x3d, 0x7e, 0xd5, 0xa9, 0x67, 0x95, + 0x59, 0xe3, 0x18, 0x8c, 0x39, 0xba, 0x94, 0x8f, 0x35, 0x3a, 0xcd, 0xa9, + 0xe0, 0xcc, 0x2f, 0x61, 0xc9, 0x51, 0x72, 0xc6, 0x58, 0xbb, 0xac, 0x2d, + 0x7d, 0xfa, 0x58, 0xbd, 0x79, 0xff, 0x1c, 0xa7, 0x5b, 0xd9, 0xdb, 0xa9, + 0xef, 0x14, 0x83, 0x8e, 0x31, 0xa1, 0x76, 0x8c, 0xc5, 0x98, 0x88, 0x7a, + 0xea, 0xd0, 0xf4, 0x8c, 0xe7, 0x80, 0xa7, 0x76, 0xb8, 0xe7, 0x34, 0xce, + 0x61, 0x4f, 0x0d, 0x85, 0x71, 0x77, 0xd2, 0x74, 0x2e, 0x39, 0x53, 0x31, + 0x75, 0x27, 0x26, 0x0b, 0x26, 0x94, 0x4a, 0x87, 0xe3, 0x83, 0x58, 0xae, + 0xe9, 0xe3, 0x5c, 0xc6, 0x55, 0x79, 0x53, 0xd2, 0x07, 0xb7, 0x0a, 0x65, + 0xa2, 0x52, 0xfa, 0x68, 0xc8, 0x26, 0xea, 0xac, 0xc0, 0x86, 0x99, 0xc3, + 0xe0, 0x0c, 0xb3, 0xe9, 0x38, 0xfa, 0x52, 0xb3, 0x3e, 0xab, 0xae, 0x8c, + 0x89, 0x6d, 0x44, 0x6e, 0x43, 0x0e, 0x49, 0xd6, 0x6d, 0x27, 0xeb, 0x88, + 0x3c, 0xfd, 0xf0, 0xd3, 0x1c, 0xce, 0xdc, 0x23, 0xa7, 0x1e, 0x47, 0x12, + 0x17, 0x5f, 0xbc, 0xa2, 0xe1, 0x82, 0x32, 0x0e, 0x14, 0x38, 0xcb, 0x97, + 0x2d, 0x2e, 0x83, 0x23, 0x95, 0x55, 0x97, 0x0d, 0xa0, 0xc1, 0xe1, 0x88, + 0xdc, 0x96, 0x6a, 0x76, 0x61, 0x3d, 0x43, 0x91, 0x40, 0xc5, 0xc1, 0x64, + 0x08, 0xca, 0xa1, 0x60, 0xb2, 0x06, 0x37, 0x14, 0x84, 0x96, 0xe1, 0x5d, + 0xc9, 0xb2, 0xc5, 0xdb, 0x83, 0x91, 0x64, 0xa8, 0xba, 0x6c, 0x57, 0x38, + 0x5a, 0x13, 0x8c, 0x87, 0xcb, 0x16, 0xcf, 0x5d, 0x58, 0x5d, 0x86, 0xa2, + 0x93, 0xc8, 0x8b, 0x6c, 0xf3, 0x6a, 0xe7, 0xd5, 0xd6, 0xfb, 0x6b, 0x06, + 0x43, 0x23, 0x55, 0xc1, 0x58, 0x32, 0xbe, 0xa0, 0xec, 0x22, 0x32, 0xea, + 0xc5, 0x6b, 0xc6, 0x34, 0x67, 0x89, 0xb5, 0x64, 0x5e, 0x89, 0xbd, 0x64, + 0xa0, 0x64, 0x71, 0x49, 0x1f, 0x7e, 0x73, 0x8c, 0x3a, 0x88, 0x27, 0xd5, + 0x1a, 0x7e, 0xe3, 0x76, 0x61, 0x9d, 0x72, 0x8d, 0x51, 0x92, 0x3b, 0xca, + 0xe6, 0xab, 0x3c, 0x76, 0xe4, 0x39, 0xa7, 0xc4, 0x83, 0x3c, 0xed, 0x25, + 0x4e, 0xa5, 0xf5, 0x42, 0x3b, 0x45, 0x65, 0xad, 0x56, 0x12, 0x03, 0x92, + 0x1d, 0xa3, 0xca, 0xa9, 0xc6, 0x5c, 0xce, 0x2a, 0x26, 0x55, 0x8d, 0x96, + 0x91, 0xae, 0xd3, 0xa5, 0xcc, 0x72, 0x60, 0xb6, 0x3d, 0xad, 0xb5, 0x99, + 0xb4, 0x32, 0xa7, 0x6d, 0x52, 0xe5, 0xa4, 0x8a, 0x49, 0xe5, 0x93, 0xaa, + 0x27, 0xd5, 0x90, 0xd5, 0x6e, 0xcf, 0x35, 0x84, 0x97, 0x7f, 0x17, 0x5e, + 0xb2, 0xdf, 0x7a, 0xb2, 0xc2, 0xe2, 0x7a, 0xab, 0xdc, 0xe6, 0xda, 0x5f, + 0x23, 0x5c, 0x2f, 0x00, 0xef, 0x02, 0x57, 0xd6, 0x2e, 0x12, 0x07, 0x2b, + 0x85, 0x38, 0x5a, 0x69, 0x88, 0x87, 0x41, 0x4f, 0x02, 0x1f, 0x73, 0xba, + 0x8a, 0xac, 0xc2, 0x28, 0x34, 0x84, 0xfc, 0x5d, 0xbe, 0x7f, 0xbf, 0xf5, + 0xf5, 0xba, 0x36, 0xb1, 0xdf, 0x0f, 0x8b, 0x5a, 0x32, 0x84, 0xb5, 0xe8, + 0x88, 0x4f, 0x78, 0xdb, 0x51, 0xe8, 0x91, 0x79, 0x2b, 0xc5, 0xc3, 0x10, + 0x7f, 0x58, 0x2f, 0xc4, 0xc3, 0x73, 0x85, 0xb8, 0xbb, 0x1e, 0x6a, 0x31, + 0xc1, 0x10, 0x47, 0x7c, 0x9d, 0xc8, 0x75, 0x7c, 0xde, 0x6a, 0xf1, 0xca, + 0x3c, 0xb2, 0xd8, 0xa9, 0x84, 0x73, 0x08, 0x6f, 0x17, 0xf2, 0xdc, 0xb9, + 0x40, 0x1c, 0xf6, 0x9d, 0xe4, 0xc7, 0x07, 0xfc, 0x38, 0xb2, 0x40, 0x18, + 0x87, 0x17, 0x0a, 0xe3, 0xf8, 0x42, 0x12, 0x22, 0x77, 0x8a, 0x77, 0x03, + 0xb7, 0xb5, 0xa1, 0x47, 0x7c, 0xbc, 0x10, 0xed, 0x58, 0x84, 0x62, 0x81, + 0x93, 0xc0, 0xc7, 0xcc, 0x37, 0x40, 0x06, 0x7c, 0x08, 0x9c, 0x84, 0xfe, + 0x48, 0x23, 0xaa, 0x6c, 0x24, 0x47, 0xfd, 0xcc, 0xa9, 0x5e, 0xd9, 0x56, + 0xaf, 0xfa, 0x3d, 0x07, 0x65, 0xbc, 0xb0, 0x0a, 0x85, 0x1f, 0x6d, 0xc2, + 0xe3, 0x85, 0x15, 0x78, 0xec, 0x5f, 0x8d, 0xc7, 0x09, 0x29, 0x93, 0x1c, + 0x2b, 0x5e, 0x5f, 0x89, 0xc7, 0xa7, 0xfc, 0x78, 0x89, 0x93, 0xbf, 0x67, + 0xbb, 0xe3, 0xac, 0x3d, 0xca, 0x76, 0xcf, 0x32, 0x77, 0xb0, 0x1d, 0x8f, + 0x9b, 0xf9, 0xf1, 0x18, 0x3f, 0x4e, 0xb6, 0xdb, 0x0f, 0x18, 0x24, 0x00, + 0x8b, 0x71, 0x74, 0x05, 0x53, 0x83, 0xe1, 0xfa, 0xb0, 0xdd, 0xa1, 0xe5, + 0x7f, 0x0f, 0x26, 0x00, 0xae, 0xcb, 0xc1, 0x7f, 0x59, 0xc0, 0x3e, 0x2e, + 0x5e, 0x5f, 0x2d, 0xc4, 0x95, 0x5d, 0x42, 0xdc, 0x09, 0xbc, 0xdb, 0x24, + 0xc4, 0xab, 0x5d, 0x16, 0xf1, 0x6c, 0xa3, 0x9d, 0xde, 0x5d, 0x3c, 0x41, + 0x5c, 0xb7, 0x46, 0x88, 0xfd, 0xcd, 0x18, 0x24, 0xe0, 0x25, 0xf0, 0x6f, + 0x01, 0x1f, 0x03, 0xb7, 0xae, 0x45, 0x1a, 0x78, 0x0b, 0xf8, 0x18, 0x78, + 0x1d, 0x03, 0x77, 0xe5, 0x3a, 0x21, 0x1e, 0x63, 0xc0, 0xf6, 0xc8, 0x12, + 0x21, 0x0e, 0x2e, 0x15, 0xe2, 0xba, 0x65, 0xc2, 0xfa, 0xee, 0x3a, 0x61, + 0xdd, 0xdf, 0x2d, 0xc4, 0x0b, 0xcb, 0x6c, 0xe2, 0x38, 0xe8, 0xad, 0xeb, + 0xe1, 0x1c, 0xc0, 0xab, 0xeb, 0x49, 0xfd, 0xf0, 0x67, 0x8d, 0x81, 0x55, + 0xea, 0xb3, 0xc7, 0x9d, 0xa0, 0x09, 0x13, 0x7f, 0xd1, 0x2a, 0xa5, 0x3f, + 0x6c, 0x92, 0xdd, 0xa8, 0xf9, 0xdb, 0x41, 0xef, 0x59, 0xa5, 0x3e, 0xdf, + 0x64, 0xf9, 0xc3, 0xc0, 0x4f, 0xb5, 0xfd, 0x0b, 0x26, 0xfb, 0xd7, 0xb4, + 0xec, 0x0f, 0x9a, 0xfe, 0x0d, 0x34, 0xde, 0x39, 0x5a, 0x37, 0xe9, 0xcf, + 0x5d, 0x87, 0x20, 0xbb, 0x50, 0xcb, 0xd3, 0x3f, 0x47, 0x4e, 0xb1, 0xe3, + 0xef, 0x1f, 0x39, 0x0c, 0xd9, 0x4d, 0xa7, 0xd8, 0xdd, 0x79, 0x4a, 0xfa, + 0x89, 0x53, 0xf2, 0xf1, 0xf7, 0x8b, 0x3c, 0x0c, 0xd9, 0x2b, 0xa7, 0xc8, + 0xf9, 0xff, 0x06, 0xbf, 0xd0, 0x39, 0xfa, 0xbd, 0x1c, 0xc2, 0x44, 0xd3, + 0xdf, 0xa3, 0xc5, 0xfd, 0x48, 0x7f, 0x97, 0x16, 0xf7, 0x35, 0xfd, 0x7d, + 0x5a, 0xfc, 0x59, 0x6c, 0xfa, 0x3b, 0xb5, 0xf8, 0x73, 0xda, 0xf4, 0xf7, + 0x6a, 0xf1, 0x67, 0xd4, 0xe9, 0xef, 0xd6, 0x12, 0x3e, 0xf5, 0x1d, 0x27, + 0xfc, 0xfd, 0x5a, 0x16, 0x9f, 0xfa, 0x6c, 0x98, 0xff, 0xaf, 0x9d, 0x70, + 0xab, 0xef, 0x55, 0xe1, 0xff, 0x53, 0x68, 0xf8, 0x54, 0x5d, 0xbe, 0x5a, + 0x94, 0xe9, 0x53, 0x7f, 0x43, 0xc3, 0xf3, 0x41, 0x3e, 0x55, 0x0e, 0xff, + 0x5f, 0x43, 0x8b, 0x5b, 0xfd, 0xdd, 0xc0, 0x20, 0xda, 0x6a, 0xd7, 0x72, + 0xfe, 0x7f, 0x88, 0xdc, 0x70, 0x6e, 0x2b, 0x7f, 0xef, 0xd7, 0xff, 0x05, + 0xf3, 0x27, 0x9b, 0x95, 0x30, 0x4c, 0x00, 0x00 +}; //============================================================================== #if JUCE_PUSH_NOTIFICATIONS && JUCE_MODULE_AVAILABLE_juce_gui_extra @@ -208,6 +872,13 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidWindowManagerLayoutParams28, "android/vie DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidWindowInsetsType, "android/view/WindowInsets$Type", 30) #undef JNI_CLASS_MEMBERS +#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ + FIELD (first, "first", "Ljava/lang/Object;") \ + FIELD (second, "second", "Ljava/lang/Object;") \ + + DECLARE_JNI_CLASS (AndroidPair, "android/util/Pair") +#undef JNI_CLASS_MEMBERS + //============================================================================== namespace { @@ -851,30 +1522,29 @@ public: } } - void handleKeyDownCallback (int k, int kc, int kbFlags) + static void handleKeyDownCallback (JNIEnv*, AndroidComponentPeer& t, int k, int kc, int kbFlags) { ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons() .withFlags (translateAndroidKeyboardFlags (kbFlags)); - handleKeyPress (translateAndroidKeyCode (k), static_cast (kc)); + t.handleKeyPress (translateAndroidKeyCode (k), static_cast (kc)); } - void handleKeyUpCallback (int /*k*/, int /*kc*/) + static void handleKeyUpCallback (JNIEnv*, [[maybe_unused]] AndroidComponentPeer& t, [[maybe_unused]] int k, [[maybe_unused]] int kc) { } - void handleBackButtonCallback() + static void handleBackButtonCallback (JNIEnv* env, AndroidComponentPeer& t) { bool handled = false; if (auto* app = JUCEApplicationBase::getInstance()) handled = app->backButtonPressed(); - if (isKioskModeComponent()) - setNavBarsHidden (navBarsHidden); + if (t.isKioskModeComponent()) + t.setNavBarsHidden (t.navBarsHidden); if (! handled) { - auto* env = getEnv(); LocalRef activity (getCurrentActivity()); if (activity != nullptr) @@ -885,17 +1555,27 @@ public: } } - void handleKeyboardHiddenCallback() + static void handleKeyboardHiddenCallback (JNIEnv*, [[maybe_unused]] AndroidComponentPeer& t) { Component::unfocusAllComponents(); } - void handleAppPausedCallback() {} + static void handleAppPausedCallback (JNIEnv*, [[maybe_unused]] AndroidComponentPeer& t) {} + + static void handleAppResumedCallback (JNIEnv*, AndroidComponentPeer& t) + { + if (t.isKioskModeComponent()) + t.setNavBarsHidden (t.navBarsHidden); + } + + static jlong handleGetFocusedTextInputTargetCallback (JNIEnv*, AndroidComponentPeer& t) + { + return reinterpret_cast (t.findCurrentTextInputTarget()); + } - void handleAppResumedCallback() + static void handleMovedOrResizedCallback (JNIEnv*, AndroidComponentPeer& t) { - if (isKioskModeComponent()) - setNavBarsHidden (navBarsHidden); + t.handleMovedOrResized(); } //============================================================================== @@ -911,9 +1591,9 @@ public: return nullptr; } - jboolean populateAccessibilityNodeInfoCallback (jint virtualViewId, jobject info) const + static jboolean populateAccessibilityNodeInfoCallback (JNIEnv*, const AndroidComponentPeer& t, jint virtualViewId, jobject info) { - if (auto* handle = getNativeHandleForViewId (virtualViewId)) + if (auto* handle = t.getNativeHandleForViewId (virtualViewId)) { handle->populateNodeInfo (info); return true; @@ -922,53 +1602,53 @@ public: return false; } - jboolean handlePerformActionCallback (jint virtualViewId, jint action, jobject arguments) const + static jboolean handlePerformActionCallback (JNIEnv*, const AndroidComponentPeer& t, jint virtualViewId, jint action, jobject arguments) { - if (auto* handle = getNativeHandleForViewId (virtualViewId)) + if (auto* handle = t.getNativeHandleForViewId (virtualViewId)) return handle->performAction (action, arguments); return false; } - static jobject getFocusViewIdForHandler (const AccessibilityHandler* handler) + static jobject getFocusViewIdForHandler (JNIEnv* env, const AccessibilityHandler* handler) { if (handler != nullptr) - return getEnv()->NewObject (JavaInteger, - JavaInteger.constructor, - handler->getNativeImplementation()->getVirtualViewId()); + return env->NewObject (JavaInteger, + JavaInteger.constructor, + handler->getNativeImplementation()->getVirtualViewId()); return nullptr; } - jobject getInputFocusViewIdCallback() + static jobject getInputFocusViewIdCallback (JNIEnv* env, AndroidComponentPeer& t) { - if (auto* comp = dynamic_cast (findCurrentTextInputTarget())) - return getFocusViewIdForHandler (comp->getAccessibilityHandler()); + if (auto* comp = dynamic_cast (t.findCurrentTextInputTarget())) + return getFocusViewIdForHandler (env, comp->getAccessibilityHandler()); return nullptr; } - jobject getAccessibilityFocusViewIdCallback() const + static jobject getAccessibilityFocusViewIdCallback (JNIEnv* env, const AndroidComponentPeer& t) { - if (auto* handler = component.getAccessibilityHandler()) + if (auto* handler = t.component.getAccessibilityHandler()) { if (auto* modal = Component::getCurrentlyModalComponent()) { - if (! component.isParentOf (modal) - && component.isCurrentlyBlockedByAnotherModalComponent()) + if (! t.component.isParentOf (modal) + && t.component.isCurrentlyBlockedByAnotherModalComponent()) { if (auto* modalHandler = modal->getAccessibilityHandler()) { if (auto* focusChild = modalHandler->getChildFocus()) - return getFocusViewIdForHandler (focusChild); + return getFocusViewIdForHandler (env, focusChild); - return getFocusViewIdForHandler (modalHandler); + return getFocusViewIdForHandler (env, modalHandler); } } } if (auto* focusChild = handler->getChildFocus()) - return getFocusViewIdForHandler (focusChild); + return getFocusViewIdForHandler (env, focusChild); } return nullptr; @@ -989,54 +1669,49 @@ public: view.callBooleanMethod (AndroidView.requestFocus); } - void handleFocusChangeCallback (bool hasFocus) + static void handleFocusChangeCallback (JNIEnv*, AndroidComponentPeer& t, bool hasFocus) { - if (isFullScreen()) - setFullScreen (true); + if (t.isFullScreen()) + t.setFullScreen (true); if (hasFocus) - handleFocusGain(); + t.handleFocusGain(); else - handleFocusLoss(); + t.handleFocusLoss(); } - static const char* getVirtualKeyboardType (TextInputTarget::VirtualKeyboardType type) noexcept + void textInputRequired (Point, TextInputTarget& target) override { - switch (type) - { - case TextInputTarget::textKeyboard: return "text"; - case TextInputTarget::numericKeyboard: return "number"; - case TextInputTarget::decimalKeyboard: return "numberDecimal"; - case TextInputTarget::urlKeyboard: return "textUri"; - case TextInputTarget::emailAddressKeyboard: return "textEmailAddress"; - case TextInputTarget::phoneNumberKeyboard: return "phone"; - default: jassertfalse; break; - } - - return "text"; + const auto region = target.getHighlightedRegion(); + view.callVoidMethod (ComponentPeerView.showKeyboard, + static_cast (target.getKeyboardType()), + static_cast (region.getStart()), + static_cast (region.getEnd())); } - void textInputRequired (Point, TextInputTarget& target) override + void closeInputMethodContext() override { - view.callVoidMethod (ComponentPeerView.showKeyboard, - javaString (getVirtualKeyboardType (target.getKeyboardType())).get()); + getEnv()->CallVoidMethod (view, ComponentPeerView.closeInputMethodContext); } void dismissPendingTextInput() override { closeInputMethodContext(); - view.callVoidMethod (ComponentPeerView.showKeyboard, javaString ("").get()); + view.callVoidMethod (ComponentPeerView.hideKeyboard); if (! isTimerRunning()) startTimer (500); } //============================================================================== - void handlePaintCallback (jobject canvas, jobject paint) + static void handleDoFrameCallback (JNIEnv*, AndroidComponentPeer& t, [[maybe_unused]] int64 frameTimeNanos) { - auto* env = getEnv(); + t.vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + } + static void handlePaintCallback (JNIEnv* env, AndroidComponentPeer& t, jobject canvas, jobject paint) + { jobject rect = env->CallObjectMethod (canvas, AndroidCanvas.getClipBounds); auto left = env->GetIntField (rect, AndroidRect.left); auto top = env->GetIntField (rect, AndroidRect.top); @@ -1051,30 +1726,30 @@ public: auto sizeNeeded = clip.getWidth() * clip.getHeight(); - if (sizeAllocated < sizeNeeded) + if (t.sizeAllocated < sizeNeeded) { - buffer.clear(); - sizeAllocated = sizeNeeded; - buffer = GlobalRef (LocalRef ((jobject) env->NewIntArray (sizeNeeded))); + t.buffer.clear(); + t.sizeAllocated = sizeNeeded; + t.buffer = GlobalRef (LocalRef ((jobject) env->NewIntArray (sizeNeeded))); } - if (jint* dest = env->GetIntArrayElements ((jintArray) buffer.get(), nullptr)) + if (jint* dest = env->GetIntArrayElements ((jintArray) t.buffer.get(), nullptr)) { { Image temp (new PreallocatedImage (clip.getWidth(), clip.getHeight(), - dest, ! component.isOpaque())); + dest, ! t.component.isOpaque())); { LowLevelGraphicsSoftwareRenderer g (temp); g.setOrigin (-clip.getPosition()); - g.addTransform (AffineTransform::scale (scale)); - handlePaint (g); + g.addTransform (AffineTransform::scale (t.scale)); + t.handlePaint (g); } } - env->ReleaseIntArrayElements ((jintArray) buffer.get(), dest, 0); + env->ReleaseIntArrayElements ((jintArray) t.buffer.get(), dest, 0); - env->CallVoidMethod (canvas, AndroidCanvas.drawBitmap, (jintArray) buffer.get(), 0, clip.getWidth(), + env->CallVoidMethod (canvas, AndroidCanvas.drawBitmap, (jintArray) t.buffer.get(), 0, clip.getWidth(), (jfloat) clip.getX(), (jfloat) clip.getY(), clip.getWidth(), clip.getHeight(), true, paint); } @@ -1134,81 +1809,140 @@ public: }; private: + template + static void mouseCallbackWrapper (JNIEnv*, AndroidComponentPeer& t, jint i, jfloat x, jfloat y, jlong time) { return (t.*Member) (i, Point { x, y }, time); } + //============================================================================== - #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ - METHOD (create, "", "(Landroid/content/Context;ZJ)V") \ - METHOD (clear, "clear", "()V") \ - METHOD (setViewName, "setViewName", "(Ljava/lang/String;)V") \ - METHOD (setVisible, "setVisible", "(Z)V") \ - METHOD (isVisible, "isVisible", "()Z") \ - METHOD (containsPoint, "containsPoint", "(II)Z") \ - METHOD (showKeyboard, "showKeyboard", "(Ljava/lang/String;)V") \ - METHOD (setSystemUiVisibilityCompat, "setSystemUiVisibilityCompat", "(I)V") \ - CALLBACK (handlePaintJni, "handlePaint", "(JLandroid/graphics/Canvas;Landroid/graphics/Paint;)V") \ - CALLBACK (handleMouseDownJni, "handleMouseDown", "(JIFFJ)V") \ - CALLBACK (handleMouseDragJni, "handleMouseDrag", "(JIFFJ)V") \ - CALLBACK (handleMouseUpJni, "handleMouseUp", "(JIFFJ)V") \ - CALLBACK (handleAccessibleHoverJni, "handleAccessibilityHover", "(JIFFJ)V") \ - CALLBACK (handleKeyDownJni, "handleKeyDown", "(JIII)V") \ - CALLBACK (handleKeyUpJni, "handleKeyUp", "(JII)V") \ - CALLBACK (handleBackButtonJni, "handleBackButton", "(J)V") \ - CALLBACK (handleKeyboardHiddenJni, "handleKeyboardHidden", "(J)V") \ - CALLBACK (viewSizeChangedJni, "viewSizeChanged", "(J)V") \ - CALLBACK (focusChangedJni, "focusChanged", "(JZ)V") \ - CALLBACK (handleAppPausedJni, "handleAppPaused", "(J)V") \ - CALLBACK (handleAppResumedJni, "handleAppResumed", "(J)V") \ - CALLBACK (populateAccessibilityNodeInfoJni, "populateAccessibilityNodeInfo", "(JILandroid/view/accessibility/AccessibilityNodeInfo;)Z") \ - CALLBACK (handlePerformActionJni, "handlePerformAction", "(JIILandroid/os/Bundle;)Z") \ - CALLBACK (getInputFocusViewIdJni, "getInputFocusViewId", "(J)Ljava/lang/Integer;") \ - CALLBACK (getAccessibilityFocusViewIdJni, "getAccessibilityFocusViewId", "(J)Ljava/lang/Integer;") \ - - DECLARE_JNI_CLASS_WITH_BYTECODE (ComponentPeerView, "com/rmsl/juce/ComponentPeerView", 16, javaComponentPeerView, sizeof (javaComponentPeerView)) - #undef JNI_CLASS_MEMBERS - - static void JNICALL handlePaintJni (JNIEnv*, jobject /*view*/, jlong host, jobject canvas, jobject paint) { if (auto* myself = reinterpret_cast (host)) myself->handlePaintCallback (canvas, paint); } - static void JNICALL handleMouseDownJni (JNIEnv*, jobject /*view*/, jlong host, jint i, jfloat x, jfloat y, jlong time) { if (auto* myself = reinterpret_cast (host)) myself->handleMouseDownCallback (i, Point ((float) x, (float) y), (int64) time); } - static void JNICALL handleMouseDragJni (JNIEnv*, jobject /*view*/, jlong host, jint i, jfloat x, jfloat y, jlong time) { if (auto* myself = reinterpret_cast (host)) myself->handleMouseDragCallback (i, Point ((float) x, (float) y), (int64) time); } - static void JNICALL handleMouseUpJni (JNIEnv*, jobject /*view*/, jlong host, jint i, jfloat x, jfloat y, jlong time) { if (auto* myself = reinterpret_cast (host)) myself->handleMouseUpCallback (i, Point ((float) x, (float) y), (int64) time); } - static void JNICALL handleAccessibleHoverJni(JNIEnv*, jobject /*view*/, jlong host, jint c, jfloat x, jfloat y, jlong time) { if (auto* myself = reinterpret_cast (host)) myself->handleAccessibilityHoverCallback ((int) c, Point ((float) x, (float) y), (int64) time); } - static void JNICALL viewSizeChangedJni (JNIEnv*, jobject /*view*/, jlong host) { if (auto* myself = reinterpret_cast (host)) myself->handleMovedOrResized(); } - static void JNICALL focusChangedJni (JNIEnv*, jobject /*view*/, jlong host, jboolean hasFocus) { if (auto* myself = reinterpret_cast (host)) myself->handleFocusChangeCallback (hasFocus); } - static void JNICALL handleKeyDownJni (JNIEnv*, jobject /*view*/, jlong host, jint k, jint kc, jint kbFlags) { if (auto* myself = reinterpret_cast (host)) myself->handleKeyDownCallback ((int) k, (int) kc, (int) kbFlags); } - static void JNICALL handleKeyUpJni (JNIEnv*, jobject /*view*/, jlong host, jint k, jint kc) { if (auto* myself = reinterpret_cast (host)) myself->handleKeyUpCallback ((int) k, (int) kc); } - static void JNICALL handleBackButtonJni (JNIEnv*, jobject /*view*/, jlong host) { if (auto* myself = reinterpret_cast (host)) myself->handleBackButtonCallback(); } - static void JNICALL handleKeyboardHiddenJni (JNIEnv*, jobject /*view*/, jlong host) { if (auto* myself = reinterpret_cast (host)) myself->handleKeyboardHiddenCallback(); } - static void JNICALL handleAppPausedJni (JNIEnv*, jobject /*view*/, jlong host) { if (auto* myself = reinterpret_cast (host)) myself->handleAppPausedCallback(); } - static void JNICALL handleAppResumedJni (JNIEnv*, jobject /*view*/, jlong host) { if (auto* myself = reinterpret_cast (host)) myself->handleAppResumedCallback(); } - - static jboolean JNICALL populateAccessibilityNodeInfoJni (JNIEnv*, jobject /*view*/, jlong host, jint virtualViewId, jobject info) - { - if (auto* myself = reinterpret_cast (host)) - return myself->populateAccessibilityNodeInfoCallback (virtualViewId, info); + #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ + METHOD (create, "", "(Landroid/content/Context;ZJ)V") \ + METHOD (clear, "clear", "()V") \ + METHOD (setViewName, "setViewName", "(Ljava/lang/String;)V") \ + METHOD (setVisible, "setVisible", "(Z)V") \ + METHOD (isVisible, "isVisible", "()Z") \ + METHOD (containsPoint, "containsPoint", "(II)Z") \ + METHOD (showKeyboard, "showKeyboard", "(III)V") \ + METHOD (hideKeyboard, "hideKeyboard", "()V") \ + METHOD (closeInputMethodContext, "closeInputMethodContext", "()V") \ + METHOD (setSystemUiVisibilityCompat, "setSystemUiVisibilityCompat", "(I)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleDoFrameCallback>, "handleDoFrame", "(JJ)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handlePaintCallback>, "handlePaint", "(JLandroid/graphics/Canvas;Landroid/graphics/Paint;)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleKeyDownCallback>, "handleKeyDown", "(JIII)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleKeyUpCallback>, "handleKeyUp", "(JII)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleBackButtonCallback>, "handleBackButton", "(J)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleKeyboardHiddenCallback>, "handleKeyboardHidden", "(J)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleGetFocusedTextInputTargetCallback>, "getFocusedTextInputTargetPointer", "(J)J") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleMovedOrResizedCallback>, "viewSizeChanged", "(J)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleFocusChangeCallback>, "focusChanged", "(JZ)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleAppPausedCallback>, "handleAppPaused", "(J)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handleAppResumedCallback>, "handleAppResumed", "(J)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::populateAccessibilityNodeInfoCallback>, "populateAccessibilityNodeInfo", "(JILandroid/view/accessibility/AccessibilityNodeInfo;)Z") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::handlePerformActionCallback>, "handlePerformAction", "(JIILandroid/os/Bundle;)Z") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::getInputFocusViewIdCallback>, "getInputFocusViewId", "(J)Ljava/lang/Integer;") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::getAccessibilityFocusViewIdCallback>, "getAccessibilityFocusViewId", "(J)Ljava/lang/Integer;") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetIsTextInputActive>, "textInputTargetIsTextInputActive", "(J)Z") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetHighlightedRegionBegin>, "textInputTargetGetHighlightedRegionBegin", "(J)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetHighlightedRegionEnd>, "textInputTargetGetHighlightedRegionEnd", "(J)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetSetHighlightedRegion>, "textInputTargetSetHighlightedRegion", "(JII)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetTextInRange>, "textInputTargetGetTextInRange", "(JII)Ljava/lang/String;") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetInsertTextAtCaret>, "textInputTargetInsertTextAtCaret", "(JLjava/lang/String;)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetCaretPosition>, "textInputTargetGetCaretPosition", "(J)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetTotalNumChars>, "textInputTargetGetTotalNumChars", "(J)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetCharIndexForPoint>, "textInputTargetGetCharIndexForPoint", "(JLandroid/graphics/Point;)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetGetKeyboardType>, "textInputTargetGetKeyboardType", "(J)I") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::textInputTargetSetTemporaryUnderlining>, "textInputTargetSetTemporaryUnderlining", "(JLjava/util/List;)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::mouseCallbackWrapper<&AndroidComponentPeer::handleMouseDownCallback>>, "handleMouseDown", "(JIFFJ)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::mouseCallbackWrapper<&AndroidComponentPeer::handleMouseDragCallback>>, "handleMouseDrag", "(JIFFJ)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::mouseCallbackWrapper<&AndroidComponentPeer::handleMouseUpCallback>>, "handleMouseUp", "(JIFFJ)V") \ + CALLBACK (generatedCallback<&AndroidComponentPeer::mouseCallbackWrapper<&AndroidComponentPeer::handleAccessibilityHoverCallback>>, "handleAccessibilityHover", "(JIFFJ)V") \ - return false; + DECLARE_JNI_CLASS_WITH_BYTECODE (ComponentPeerView, "com/rmsl/juce/ComponentPeerView", 16, javaComponentPeerView) + #undef JNI_CLASS_MEMBERS + + static jboolean textInputTargetIsTextInputActive (JNIEnv*, const TextInputTarget& t) + { + return t.isTextInputActive(); } - static jboolean JNICALL handlePerformActionJni (JNIEnv*, jobject /*view*/, jlong host, jint virtualViewId, jint action, jobject arguments) + static jint textInputTargetGetHighlightedRegionBegin (JNIEnv*, const TextInputTarget& t) { - if (auto* myself = reinterpret_cast (host)) - return myself->handlePerformActionCallback (virtualViewId, action, arguments); + return t.getHighlightedRegion().getStart(); + } - return false; + static jint textInputTargetGetHighlightedRegionEnd (JNIEnv*, const TextInputTarget& t) + { + return t.getHighlightedRegion().getEnd(); + } + + static void textInputTargetSetHighlightedRegion (JNIEnv*, TextInputTarget& t, jint b, jint e) + { + t.setHighlightedRegion ({ b, e }); } - static jobject JNICALL getInputFocusViewIdJni (JNIEnv*, jobject /*view*/, jlong host) + static jstring textInputTargetGetTextInRange (JNIEnv* env, const TextInputTarget& t, jint b, jint e) { - if (auto* myself = reinterpret_cast (host)) - return myself->getInputFocusViewIdCallback(); + return env->NewStringUTF (t.getTextInRange ({ b, e }).toUTF8()); + } - return nullptr; + static void textInputTargetInsertTextAtCaret (JNIEnv*, TextInputTarget& t, jstring text) + { + t.insertTextAtCaret (juceString (text)); } - static jobject JNICALL getAccessibilityFocusViewIdJni (JNIEnv*, jobject /*view*/, jlong host) + static jint textInputTargetGetCaretPosition (JNIEnv*, const TextInputTarget& t) { - if (auto* myself = reinterpret_cast (host)) - return myself->getAccessibilityFocusViewIdCallback(); + return t.getCaretPosition(); + } - return nullptr; + static jint textInputTargetGetTotalNumChars (JNIEnv*, const TextInputTarget& t) + { + return t.getTotalNumChars(); + } + + static jint textInputTargetGetCharIndexForPoint (JNIEnv* env, const TextInputTarget& t, jobject point) + { + return t.getCharIndexForPoint ({ env->GetIntField (point, AndroidPoint.x), + env->GetIntField (point, AndroidPoint.y) }); + } + + static jint textInputTargetGetKeyboardType (JNIEnv*, TextInputTarget& t) + { + return t.getKeyboardType(); + } + + static std::optional> getRangeFromPair (JNIEnv* env, jobject pair) + { + if (pair == nullptr) + return {}; + + const auto first = env->GetObjectField (pair, AndroidPair.first); + const auto second = env->GetObjectField (pair, AndroidPair.second); + + if (first == nullptr || second == nullptr) + return {}; + + const auto begin = env->CallIntMethod (first, JavaInteger.intValue); + const auto end = env->CallIntMethod (second, JavaInteger.intValue); + + return Range { begin, end }; + } + + static Array> javaListOfPairToArrayOfRange (JNIEnv* env, jobject list) + { + if (list == nullptr) + return {}; + + Array> result; + + for (jint i = 0; i < env->CallIntMethod (list, JavaList.size); ++i) + if (const auto range = getRangeFromPair (env, env->CallObjectMethod (list, JavaList.get, i))) + result.add (*range); + + return result; + } + + static void textInputTargetSetTemporaryUnderlining (JNIEnv* env, TextInputTarget& t, jobject list) + { + t.setTemporaryUnderlining (javaListOfPairToArrayOfRange (env, list)); } //============================================================================== @@ -1378,7 +2112,6 @@ Point AndroidComponentPeer::lastMousePos; int64 AndroidComponentPeer::touchesDown = 0; AndroidComponentPeer* AndroidComponentPeer::frontWindow = nullptr; GlobalRef AndroidComponentPeer::activityCallbackListener; -AndroidComponentPeer::ComponentPeerView_Class AndroidComponentPeer::ComponentPeerView; //============================================================================== ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindow) @@ -1787,10 +2520,8 @@ bool Desktop::isScreenSaverEnabled() } //============================================================================== -void Desktop::setKioskComponent (Component* kioskComp, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskComp, bool enableOrDisable, [[maybe_unused]] bool allowMenusAndBars) { - ignoreUnused (allowMenusAndBars); - if (AndroidComponentPeer* peer = dynamic_cast (kioskComp->getPeer())) peer->setFullScreen (enableOrDisable); else @@ -1918,7 +2649,7 @@ void Displays::findDisplays (float masterScale) { auto* env = getEnv(); - LocalRef usableSize (env->NewObject (AndroidPoint, AndroidPoint.create, 0, 0)); + LocalRef usableSize (makeAndroidPoint ({})); LocalRef windowServiceString (javaString ("window")); LocalRef displayMetrics (env->NewObject (AndroidDisplayMetrics, AndroidDisplayMetrics.create)); LocalRef windowManager (env->CallObjectMethod (getAppContext().get(), AndroidContext.getSystemService, windowServiceString.get())); @@ -2169,8 +2900,6 @@ const int KeyPress::rewindKey = extendedKeyModifier + 72; juce_handleOnResume(); } }; - - JuceActivityNewIntentListener::JavaActivity_Class JuceActivityNewIntentListener::JavaActivity; #endif } // namespace juce diff --git a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp index 8aea9448..04203b55 100644 --- a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp @@ -104,12 +104,9 @@ private: controller.get().excludedActivityTypes = nil; - controller.get().completionWithItemsHandler = ^ (UIActivityType type, BOOL completed, - NSArray* returnedItems, NSError* error) + controller.get().completionWithItemsHandler = ^([[maybe_unused]] UIActivityType type, BOOL completed, + [[maybe_unused]] NSArray* returnedItems, NSError* error) { - ignoreUnused (type); - ignoreUnused (returnedItems); - succeeded = completed; if (error != nil) diff --git a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm index 5da0b68e..47b5690e 100644 --- a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm @@ -23,6 +23,14 @@ ============================================================================== */ +@interface FileChooserControllerClass : UIDocumentPickerViewController +- (void) setParent: (FileChooser::Native*) ptr; +@end + +@interface FileChooserDelegateClass : NSObject +- (id) initWithOwner: (FileChooser::Native*) owner; +@end + namespace juce { @@ -33,18 +41,158 @@ namespace juce class FileChooser::Native : public FileChooser::Pimpl, public Component, - private AsyncUpdater + public AsyncUpdater, + public std::enable_shared_from_this { public: + static std::shared_ptr make (FileChooser& fileChooser, int flags) + { + std::shared_ptr result { new Native (fileChooser, flags) }; + /* Must be called after forming a shared_ptr to an instance of this class. + Note that we can't call this directly inside the class constructor, because + the owning shared_ptr might not yet exist. + */ + [result->controller.get() setParent: result.get()]; + return result; + } + + ~Native() override + { + exitModalState (0); + } + + void launch() override + { + jassert (shared_from_this() != nullptr); + + /* Normally, when deleteWhenDismissed is true, the modal component manger will keep a copy of a raw pointer + to our component and delete it when the modal state has ended. However, this is incompatible with + our class being tracked by shared_ptr as it will force delete our class regardless of the current + reference count. On the other hand, it's important that the modal manager keeps a reference as it can + sometimes be the only reference to our class. + + To do this, we set deleteWhenDismissed to false so that the modal component manager does not delete + our class. Instead, we pass in a lambda which captures a shared_ptr to ourselves to increase the + reference count while the component is modal. + */ + enterModalState (true, + ModalCallbackFunction::create ([_self = shared_from_this()] (int) {}), + false); + } + + void runModally() override + { + #if JUCE_MODAL_LOOPS_PERMITTED + launch(); + runModalLoop(); + #else + jassertfalse; + #endif + } + + void parentHierarchyChanged() override + { + auto* newPeer = dynamic_cast (getPeer()); + + if (peer != newPeer) + { + peer = newPeer; + + if (peer != nullptr) + { + if (auto* parentController = peer->controller) + [parentController showViewController: controller.get() sender: parentController]; + + peer->toFront (false); + } + } + } + + void handleAsyncUpdate() override + { + pickerWasCancelled(); + } + + //============================================================================== + void didPickDocumentsAtURLs (NSArray* urls) + { + cancelPendingUpdate(); + + const auto isWriting = controller.get().documentPickerMode == UIDocumentPickerModeExportToService + || controller.get().documentPickerMode == UIDocumentPickerModeMoveToService; + const auto accessOptions = isWriting ? 0 : NSFileCoordinatorReadingWithoutChanges; + + auto* fileCoordinator = [[[NSFileCoordinator alloc] initWithFilePresenter: nil] autorelease]; + auto* intents = [[[NSMutableArray alloc] init] autorelease]; + + for (NSURL* url in urls) + { + auto* fileAccessIntent = isWriting + ? [NSFileAccessIntent writingIntentWithURL: url options: accessOptions] + : [NSFileAccessIntent readingIntentWithURL: url options: accessOptions]; + [intents addObject: fileAccessIntent]; + } + + [fileCoordinator coordinateAccessWithIntents: intents queue: [NSOperationQueue mainQueue] byAccessor: ^(NSError* err) + { + if (err != nil) + { + [[maybe_unused]] auto desc = [err localizedDescription]; + jassertfalse; + return; + } + + Array result; + + for (NSURL* url in urls) + { + [url startAccessingSecurityScopedResource]; + + NSError* error = nil; + + auto* bookmark = [url bookmarkDataWithOptions: 0 + includingResourceValuesForKeys: nil + relativeToURL: nil + error: &error]; + + [bookmark retain]; + + [url stopAccessingSecurityScopedResource]; + + URL juceUrl (nsStringToJuce ([url absoluteString])); + + if (error == nil) + { + setURLBookmark (juceUrl, (void*) bookmark); + } + else + { + [[maybe_unused]] auto desc = [error localizedDescription]; + jassertfalse; + } + + result.add (std::move (juceUrl)); + } + + passResultsToInitiator (std::move (result)); + }]; + } + + void didPickDocumentAtURL (NSURL* url) + { + didPickDocumentsAtURLs (@[url]); + } + + void pickerWasCancelled() + { + passResultsToInitiator ({}); + } + +private: Native (FileChooser& fileChooser, int flags) : owner (fileChooser) { - static FileChooserDelegateClass delegateClass; - delegate.reset ([delegateClass.createInstance() init]); - FileChooserDelegateClass::setOwner (delegate.get(), this); - - static FileChooserControllerClass controllerClass; - auto* controllerClassInstance = controllerClass.createInstance(); + delegate.reset ([[FileChooserDelegateClass alloc] initWithOwner: this]); String firstFileExtension; auto utTypeArray = createNSArrayFromStringArray (getUTTypesForWildcards (owner.filters, firstFileExtension)); @@ -78,20 +226,17 @@ public: auto url = [[NSURL alloc] initFileURLWithPath: juceStringToNS (currentFileOrDirectory.getFullPathName())]; - controller.reset ([controllerClassInstance initWithURL: url - inMode: pickerMode]); - + controller.reset ([[FileChooserControllerClass alloc] initWithURL: url inMode: pickerMode]); [url release]; } else { - controller.reset ([controllerClassInstance initWithDocumentTypes: utTypeArray - inMode: UIDocumentPickerModeOpen]); + controller.reset ([[FileChooserControllerClass alloc] initWithDocumentTypes: utTypeArray inMode: UIDocumentPickerModeOpen]); + if (@available (iOS 11.0, *)) [controller.get() setAllowsMultipleSelection: (flags & FileBrowserComponent::canSelectMultipleItems) != 0]; } - FileChooserControllerClass::setOwner (controller.get(), this); [controller.get() setDelegate: delegate.get()]; [controller.get() setModalTransitionStyle: UIModalTransitionStyleCrossDissolve]; @@ -128,58 +273,24 @@ public: } } - ~Native() override + void passResultsToInitiator (Array urls) { + cancelPendingUpdate(); exitModalState (0); - // Our old peer may not have received a becomeFirstResponder call at this point, - // so the static currentlyFocusedPeer may be null. - // We'll try to find an appropriate peer to focus. - + // If the caller attempts to show a platform-native dialog box inside the results callback (e.g. in the DialogsDemo) + // then the original peer must already have focus. Otherwise, there's a danger that either the invisible FileChooser + // components will display the popup, locking the application, or maybe no component will have focus, and the + // dialog won't show at all. for (auto i = 0; i < ComponentPeer::getNumPeers(); ++i) if (auto* p = ComponentPeer::getPeer (i)) if (p != getPeer()) if (auto* view = (UIView*) p->getNativeHandle()) - [view becomeFirstResponder]; - } - - void launch() override - { - enterModalState (true, nullptr, true); - } - - void runModally() override - { - #if JUCE_MODAL_LOOPS_PERMITTED - runModalLoop(); - #else - jassertfalse; - #endif - } - - void parentHierarchyChanged() override - { - auto* newPeer = dynamic_cast (getPeer()); - - if (peer != newPeer) - { - peer = newPeer; - - if (peer != nullptr) - { - if (auto* parentController = peer->controller) - [parentController showViewController: controller.get() sender: parentController]; + if ([view becomeFirstResponder] && [view isFirstResponder]) + break; - peer->toFront (false); - } - } - } - -private: - //============================================================================== - void handleAsyncUpdate() override - { - pickerWasCancelled(); + // Calling owner.finished will delete this Pimpl instance, so don't call any more member functions here! + owner.finished (std::move (urls)); } //============================================================================== @@ -235,156 +346,12 @@ private: return filename; } - //============================================================================== - void didPickDocumentsAtURLs (NSArray* urls) - { - cancelPendingUpdate(); - - const auto isWriting = controller.get().documentPickerMode == UIDocumentPickerModeExportToService - || controller.get().documentPickerMode == UIDocumentPickerModeMoveToService; - const auto accessOptions = isWriting ? 0 : NSFileCoordinatorReadingWithoutChanges; - - auto* fileCoordinator = [[[NSFileCoordinator alloc] initWithFilePresenter: nil] autorelease]; - auto* intents = [[[NSMutableArray alloc] init] autorelease]; - - for (NSURL* url in urls) - { - auto* fileAccessIntent = isWriting - ? [NSFileAccessIntent writingIntentWithURL: url options: accessOptions] - : [NSFileAccessIntent readingIntentWithURL: url options: accessOptions]; - [intents addObject: fileAccessIntent]; - } - - [fileCoordinator coordinateAccessWithIntents: intents queue: [NSOperationQueue mainQueue] byAccessor: ^(NSError* err) - { - if (err != nil) - { - auto desc = [err localizedDescription]; - ignoreUnused (desc); - jassertfalse; - return; - } - - Array result; - - for (NSURL* url in urls) - { - [url startAccessingSecurityScopedResource]; - - NSError* error = nil; - - auto* bookmark = [url bookmarkDataWithOptions: 0 - includingResourceValuesForKeys: nil - relativeToURL: nil - error: &error]; - - [bookmark retain]; - - [url stopAccessingSecurityScopedResource]; - - URL juceUrl (nsStringToJuce ([url absoluteString])); - - if (error == nil) - { - setURLBookmark (juceUrl, (void*) bookmark); - } - else - { - auto desc = [error localizedDescription]; - ignoreUnused (desc); - jassertfalse; - } - - result.add (std::move (juceUrl)); - } - - owner.finished (std::move (result)); - }]; - } - - void didPickDocumentAtURL (NSURL* url) - { - didPickDocumentsAtURLs (@[url]); - } - - void pickerWasCancelled() - { - cancelPendingUpdate(); - owner.finished ({}); - // Calling owner.finished will delete this Pimpl instance, so don't call any more member functions here! - } - - //============================================================================== - struct FileChooserDelegateClass : public ObjCClass> - { - FileChooserDelegateClass() : ObjCClass> ("FileChooserDelegate_") - { - addIvar ("owner"); - - addMethod (@selector (documentPicker:didPickDocumentAtURL:), didPickDocumentAtURL); - addMethod (@selector (documentPicker:didPickDocumentsAtURLs:), didPickDocumentsAtURLs); - addMethod (@selector (documentPickerWasCancelled:), documentPickerWasCancelled); - - addProtocol (@protocol (UIDocumentPickerDelegate)); - - registerClass(); - } - - static void setOwner (id self, Native* owner) { object_setInstanceVariable (self, "owner", owner); } - static Native* getOwner (id self) { return getIvar (self, "owner"); } - - //============================================================================== - static void didPickDocumentAtURL (id self, SEL, UIDocumentPickerViewController*, NSURL* url) - { - if (auto* picker = getOwner (self)) - picker->didPickDocumentAtURL (url); - } - - static void didPickDocumentsAtURLs (id self, SEL, UIDocumentPickerViewController*, NSArray* urls) - { - if (auto* picker = getOwner (self)) - picker->didPickDocumentsAtURLs (urls); - } - - static void documentPickerWasCancelled (id self, SEL, UIDocumentPickerViewController*) - { - if (auto* picker = getOwner (self)) - picker->pickerWasCancelled(); - } - }; - - struct FileChooserControllerClass : public ObjCClass - { - FileChooserControllerClass() : ObjCClass ("FileChooserController_") - { - addIvar ("owner"); - addMethod (@selector (viewDidDisappear:), viewDidDisappear); - - registerClass(); - } - - static void setOwner (id self, Native* owner) { object_setInstanceVariable (self, "owner", owner); } - static Native* getOwner (id self) { return getIvar (self, "owner"); } - - //============================================================================== - static void viewDidDisappear (id self, SEL, BOOL animated) - { - sendSuperclassMessage (self, @selector (viewDidDisappear:), animated); - - if (auto* picker = getOwner (self)) - picker->triggerAsyncUpdate(); - } - }; - //============================================================================== FileChooser& owner; NSUniquePtr> delegate; - NSUniquePtr controller; + NSUniquePtr controller; UIViewComponentPeer* peer = nullptr; - static FileChooserDelegateClass fileChooserDelegateClass; - static FileChooserControllerClass fileChooserControllerClass; - //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Native) }; @@ -402,7 +369,7 @@ bool FileChooser::isPlatformDialogAvailable() std::shared_ptr FileChooser::showPlatformDialog (FileChooser& owner, int flags, FilePreviewComponent*) { - return std::make_shared (owner, flags); + return Native::make (owner, flags); } #if JUCE_DEPRECATION_IGNORED @@ -410,3 +377,59 @@ std::shared_ptr FileChooser::showPlatformDialog (FileChooser #endif } // namespace juce + +@implementation FileChooserControllerClass +{ + std::weak_ptr ptr; +} + +- (void) setParent: (FileChooser::Native*) parent +{ + jassert (parent != nullptr); + jassert (parent->shared_from_this() != nullptr); + ptr = parent->weak_from_this(); +} + +- (void) viewDidDisappear: (BOOL) animated +{ + [super viewDidDisappear: animated]; + + if (auto nativeParent = ptr.lock()) + nativeParent->triggerAsyncUpdate(); +} + +@end + +@implementation FileChooserDelegateClass +{ + FileChooser::Native* owner; +} + +- (id) initWithOwner: (FileChooser::Native*) o +{ + self = [super init]; + owner = o; + return self; +} + +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-implementations") +- (void) documentPicker: (UIDocumentPickerViewController*) controller didPickDocumentAtURL: (NSURL*) url +{ + if (owner != nullptr) + owner->didPickDocumentAtURL (url); +} +JUCE_END_IGNORE_WARNINGS_GCC_LIKE + +- (void) documentPicker: (UIDocumentPickerViewController*) controller didPickDocumentsAtURLs: (NSArray*) urls +{ + if (owner != nullptr) + owner->didPickDocumentsAtURLs (urls); +} + +- (void) documentPickerWasCancelled: (UIDocumentPickerViewController*) controller +{ + if (owner != nullptr) + owner->pickerWasCancelled(); +} + +@end diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 53362691..33b90e3c 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -36,6 +36,12 @@ #define JUCE_HAS_IOS_POINTER_SUPPORT 0 #endif +#if defined (__IPHONE_13_4) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_4 + #define JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT 1 +#else + #define JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT 0 +#endif + namespace juce { @@ -69,6 +75,28 @@ static NSArray* getContainerAccessibilityElements (AccessibilityHandler& handler class UIViewComponentPeer; +namespace iOSGlobals +{ +class KeysCurrentlyDown +{ +public: + bool isDown (int x) const { return down.find (x) != down.cend(); } + + void setDown (int x, bool b) + { + if (b) + down.insert (x); + else + down.erase (x); + } + +private: + std::set down; +}; +static KeysCurrentlyDown keysCurrentlyDown; +static UIViewComponentPeer* currentlyFocusedPeer = nullptr; +} // namespace iOSGlobals + static UIInterfaceOrientation getWindowOrientation() { UIApplication* sharedApplication = [UIApplication sharedApplication]; @@ -87,7 +115,7 @@ static UIInterfaceOrientation getWindowOrientation() JUCE_END_IGNORE_WARNINGS_GCC_LIKE } -namespace Orientations +struct Orientations { static Desktop::DisplayOrientation convertToJuce (UIInterfaceOrientation orientation) { @@ -119,8 +147,7 @@ namespace Orientations return UIInterfaceOrientationPortrait; } - - static NSUInteger getSupportedOrientations() + static UIInterfaceOrientationMask getSupportedOrientations() { NSUInteger allowed = 0; auto& d = Desktop::getInstance(); @@ -132,7 +159,7 @@ namespace Orientations return allowed; } -} +}; enum class MouseEventFlags { @@ -351,7 +378,7 @@ struct UIViewPeerControllerReceiver //============================================================================== class UIViewComponentPeer : public ComponentPeer, - private UIViewPeerControllerReceiver + public UIViewPeerControllerReceiver { public: UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo); @@ -404,8 +431,6 @@ public: void dismissPendingTextInput() override; void closeInputMethodContext() override; - BOOL textViewReplaceCharacters (Range, const String&); - void updateScreenBounds(); void handleTouches (UIEvent*, MouseEventFlags); @@ -415,6 +440,23 @@ public: void onScroll (UIPanGestureRecognizer*); #endif + Range getMarkedTextRange() const + { + return Range::withStartAndLength (startOfMarkedTextInTextInputTarget, + stringBeingComposed.length()); + } + + void replaceMarkedRangeWithText (TextInputTarget* target, const String& text) + { + if (stringBeingComposed.isNotEmpty()) + target->setHighlightedRegion (getMarkedTextRange()); + + target->insertTextAtCaret (text); + target->setTemporaryUnderlining ({ Range::withStartAndLength (startOfMarkedTextInTextInputTarget, + text.length()) }); + stringBeingComposed = text; + } + //============================================================================== void repaint (const Rectangle& area) override; void performAnyPendingRepaintsNow() override; @@ -425,6 +467,7 @@ public: UIViewController* controller = nil; const bool isSharedWindow, isAppex; String stringBeingComposed; + int startOfMarkedTextInTextInputTarget = 0; bool fullScreen = false, insideDrawRect = false; NSUniquePtr hiddenTextInput { [[JuceTextView alloc] initWithOwner: this] }; NSUniquePtr tokenizer { [[JuceTextInputTokenizer alloc] initWithPeer: this] }; @@ -457,9 +500,10 @@ public: case TextInputTarget::urlKeyboard: return UIKeyboardTypeURL; case TextInputTarget::emailAddressKeyboard: return UIKeyboardTypeEmailAddress; case TextInputTarget::phoneNumberKeyboard: return UIKeyboardTypePhonePad; - default: jassertfalse; break; + case TextInputTarget::passwordKeyboard: return UIKeyboardTypeASCIICapable; } + jassertfalse; return UIKeyboardTypeDefault; } @@ -747,6 +791,178 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; } #endif +static std::optional getKeyCodeForSpecialCharacterString (StringRef characters) +{ + static const auto map = [&] + { + std::map result + { + { nsStringToJuce (UIKeyInputUpArrow), KeyPress::upKey }, + { nsStringToJuce (UIKeyInputDownArrow), KeyPress::downKey }, + { nsStringToJuce (UIKeyInputLeftArrow), KeyPress::leftKey }, + { nsStringToJuce (UIKeyInputRightArrow), KeyPress::rightKey }, + { nsStringToJuce (UIKeyInputEscape), KeyPress::escapeKey }, + #if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT + // These symbols are available on iOS 8, but only declared in the headers for iOS 13.4+ + { nsStringToJuce (UIKeyInputPageUp), KeyPress::pageUpKey }, + { nsStringToJuce (UIKeyInputPageDown), KeyPress::pageDownKey }, + #endif + }; + + #if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT + if (@available (iOS 13.4, *)) + { + result.insert ({ { nsStringToJuce (UIKeyInputHome), KeyPress::homeKey }, + { nsStringToJuce (UIKeyInputEnd), KeyPress::endKey }, + { nsStringToJuce (UIKeyInputF1), KeyPress::F1Key }, + { nsStringToJuce (UIKeyInputF2), KeyPress::F2Key }, + { nsStringToJuce (UIKeyInputF3), KeyPress::F3Key }, + { nsStringToJuce (UIKeyInputF4), KeyPress::F4Key }, + { nsStringToJuce (UIKeyInputF5), KeyPress::F5Key }, + { nsStringToJuce (UIKeyInputF6), KeyPress::F6Key }, + { nsStringToJuce (UIKeyInputF7), KeyPress::F7Key }, + { nsStringToJuce (UIKeyInputF8), KeyPress::F8Key }, + { nsStringToJuce (UIKeyInputF9), KeyPress::F9Key }, + { nsStringToJuce (UIKeyInputF10), KeyPress::F10Key }, + { nsStringToJuce (UIKeyInputF11), KeyPress::F11Key }, + { nsStringToJuce (UIKeyInputF12), KeyPress::F12Key } }); + } + #endif + + #if defined (__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0 + if (@available (iOS 15.0, *)) + { + result.insert ({ { nsStringToJuce (UIKeyInputDelete), KeyPress::deleteKey } }); + } + #endif + + return result; + }(); + + const auto iter = map.find (characters); + return iter != map.cend() ? std::make_optional (iter->second) : std::nullopt; +} + +static int getKeyCodeForCharacters (StringRef unmodified) +{ + return getKeyCodeForSpecialCharacterString (unmodified).value_or (unmodified[0]); +} + +static int getKeyCodeForCharacters (NSString* characters) +{ + return getKeyCodeForCharacters (nsStringToJuce (characters)); +} + +#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT +static void updateModifiers (const UIKeyModifierFlags flags) +{ + const auto convert = [&flags] (UIKeyModifierFlags f, int result) { return (flags & f) != 0 ? result : 0; }; + const auto juceFlags = convert (UIKeyModifierAlphaShift, 0) // capslock modifier currently not implemented + | convert (UIKeyModifierShift, ModifierKeys::shiftModifier) + | convert (UIKeyModifierControl, ModifierKeys::ctrlModifier) + | convert (UIKeyModifierAlternate, ModifierKeys::altModifier) + | convert (UIKeyModifierCommand, ModifierKeys::commandModifier) + | convert (UIKeyModifierNumericPad, 0); // numpad modifier currently not implemented + + ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons().withFlags (juceFlags); +} + +API_AVAILABLE (ios(13.4)) +static int getKeyCodeForKey (UIKey* key) +{ + return getKeyCodeForCharacters ([key charactersIgnoringModifiers]); +} + +API_AVAILABLE (ios(13.4)) +static bool attemptToConsumeKeys (JuceUIView* view, NSSet* presses) +{ + auto used = false; + + for (UIPress* press in presses) + { + if (auto* key = [press key]) + { + const auto code = getKeyCodeForKey (key); + const auto handleCodepoint = [view, &used, code] (juce_wchar codepoint) + { + // These both need to fire; no short-circuiting! + used |= view->owner->handleKeyUpOrDown (true); + used |= view->owner->handleKeyPress (code, codepoint); + }; + + if (getKeyCodeForSpecialCharacterString (nsStringToJuce ([key charactersIgnoringModifiers])).has_value()) + handleCodepoint (0); + else + for (const auto codepoint : nsStringToJuce ([key characters])) + handleCodepoint (codepoint); + } + } + + return used; +} + +- (void) pressesBegan:(NSSet*) presses withEvent:(UIPressesEvent*) event +{ + const auto handledEvent = [&] + { + if (@available (iOS 13.4, *)) + { + auto isEscape = false; + + updateModifiers ([event modifierFlags]); + + for (UIPress* press in presses) + { + if (auto* key = [press key]) + { + const auto code = getKeyCodeForKey (key); + isEscape |= code == KeyPress::escapeKey; + iOSGlobals::keysCurrentlyDown.setDown (code, true); + } + } + + return ((isEscape && owner->stringBeingComposed.isEmpty()) + || owner->findCurrentTextInputTarget() == nullptr) + && attemptToConsumeKeys (self, presses); + } + + return false; + }(); + + if (! handledEvent) + [super pressesBegan: presses withEvent: event]; +} + +/* Returns true if we handled the event. */ +static bool doKeysUp (UIViewComponentPeer* owner, NSSet* presses, UIPressesEvent* event) +{ + if (@available (iOS 13.4, *)) + { + updateModifiers ([event modifierFlags]); + + for (UIPress* press in presses) + if (auto* key = [press key]) + iOSGlobals::keysCurrentlyDown.setDown (getKeyCodeForKey (key), false); + + return owner->findCurrentTextInputTarget() == nullptr && owner->handleKeyUpOrDown (false); + } + + return false; +} + +- (void) pressesEnded:(NSSet*) presses withEvent:(UIPressesEvent*) event +{ + if (! doKeysUp (owner, presses, event)) + [super pressesEnded: presses withEvent: event]; +} + +- (void) pressesCancelled:(NSSet*) presses withEvent:(UIPressesEvent*) event +{ + if (! doKeysUp (owner, presses, event)) + [super pressesCancelled: presses withEvent: event]; +} +#endif + //============================================================================== - (BOOL) becomeFirstResponder { @@ -920,7 +1136,10 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; const auto rangeToDelete = range.isEmpty() ? range.withStartAndLength (jmax (range.getStart() - 1, 0), range.getStart() != 0 ? 1 : 0) : range; + const auto start = rangeToDelete.getStart(); + // This ensures that the cursor is at the beginning, rather than the end, of the selection + target->setHighlightedRegion ({ start, start }); target->setHighlightedRegion (rangeToDelete); target->insertTextAtCaret (""); } @@ -930,10 +1149,48 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; if (owner == nullptr) return; - owner->stringBeingComposed.clear(); - if (auto* target = owner->findCurrentTextInputTarget()) - target->insertTextAtCaret (nsStringToJuce (text)); + { + // If we're in insertText, it's because there's a focused TextInputTarget, + // and key presses from pressesBegan and pressesEnded have been composed + // into a string that is now ready for insertion. + // Because JUCE has been passing key events to the system for composition, it + // won't have been processing those key presses itself, so it may not have had + // a chance to process keys like return/tab/etc. + // It's not possible to filter out these keys during pressesBegan, because they + // may form part of a longer composition sequence. + // e.g. when entering Japanese text, the return key may be used to select an option + // from the IME menu, and in this situation the return key should not be propagated + // to the JUCE view. + // If we receive a special character (return/tab/etc.) in insertText, it can + // only be because the composition has finished, so we can turn the event into + // a KeyPress and trust the current TextInputTarget to process it correctly. + const auto redirectKeyPresses = [&] (juce_wchar codepoint) + { + // Simulate a key down + const auto code = getKeyCodeForCharacters (String::charToString (codepoint)); + iOSGlobals::keysCurrentlyDown.setDown (code, true); + owner->handleKeyUpOrDown (true); + + owner->handleKeyPress (code, codepoint); + + // Simulate a key up + iOSGlobals::keysCurrentlyDown.setDown (code, false); + owner->handleKeyUpOrDown (false); + }; + + if ([text isEqual: @"\n"] || [text isEqual: @"\r"]) + redirectKeyPresses ('\r'); + else if ([text isEqual: @"\t"]) + redirectKeyPresses ('\t'); + else + owner->replaceMarkedRangeWithText (target, nsStringToJuce (text)); + + target->setTemporaryUnderlining ({}); + } + + owner->stringBeingComposed.clear(); + owner->startOfMarkedTextInTextInputTarget = 0; } - (BOOL) hasText @@ -972,7 +1229,7 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; { if (owner != nullptr && owner->stringBeingComposed.isNotEmpty()) if (auto* target = owner->findCurrentTextInputTarget()) - return [JuceUITextRange withRange: target->getHighlightedRegion()]; + return [JuceUITextRange withRange: owner->getMarkedTextRange()]; return nil; } @@ -980,22 +1237,24 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; - (void) setMarkedText: (NSString*) markedText selectedRange: (NSRange) selectedRange { - ignoreUnused (selectedRange); - if (owner == nullptr) return; - owner->stringBeingComposed = nsStringToJuce (markedText); + const auto newMarkedText = nsStringToJuce (markedText); + const ScopeGuard scope { [&] { owner->stringBeingComposed = newMarkedText; } }; auto* target = owner->findCurrentTextInputTarget(); if (target == nullptr) return; - const auto currentHighlight = target->getHighlightedRegion(); - target->insertTextAtCaret (owner->stringBeingComposed); - target->setHighlightedRegion (currentHighlight.withLength (0)); - target->setHighlightedRegion (currentHighlight.withLength (owner->stringBeingComposed.length())); + if (owner->stringBeingComposed.isEmpty()) + owner->startOfMarkedTextInTextInputTarget = target->getHighlightedRegion().getStart(); + + owner->replaceMarkedRangeWithText (target, newMarkedText); + + const auto newSelection = nsRangeToJuce (selectedRange) + owner->startOfMarkedTextInTextInputTarget; + target->setHighlightedRegion (newSelection); } - (void) unmarkText @@ -1008,8 +1267,10 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; if (target == nullptr) return; - target->insertTextAtCaret (owner->stringBeingComposed); + owner->replaceMarkedRangeWithText (target, owner->stringBeingComposed); + target->setTemporaryUnderlining ({}); owner->stringBeingComposed.clear(); + owner->startOfMarkedTextInTextInputTarget = 0; } - (NSDictionary*) markedTextStyle @@ -1309,6 +1570,11 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; return UITextAutocorrectionTypeNo; } +- (UITextSpellCheckingType) spellCheckingType +{ + return UITextSpellCheckingTypeNo; +} + - (BOOL) canBecomeFirstResponder { return YES; @@ -1367,9 +1633,15 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; namespace juce { -bool KeyPress::isKeyCurrentlyDown (int) +bool KeyPress::isKeyCurrentlyDown (int keyCode) { + #if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT + return iOSGlobals::keysCurrentlyDown.isDown (keyCode) + || ('A' <= keyCode && keyCode <= 'Z' && iOSGlobals::keysCurrentlyDown.isDown ((int) CharacterFunctions::toLowerCase ((juce_wchar) keyCode))) + || ('a' <= keyCode && keyCode <= 'z' && iOSGlobals::keysCurrentlyDown.isDown ((int) CharacterFunctions::toUpperCase ((juce_wchar) keyCode))); + #else return false; + #endif } Point juce_lastMousePos; @@ -1391,7 +1663,10 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags, #if JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS if (@available (iOS 13, *)) - metalRenderer = std::make_unique> (view, comp.isOpaque()); + { + metalRenderer = CoreGraphicsMetalLayerRenderer::create (view, comp.isOpaque()); + jassert (metalRenderer != nullptr); + } #endif if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0) @@ -1428,12 +1703,10 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags, setVisible (component.isVisible()); } -static UIViewComponentPeer* currentlyFocusedPeer = nullptr; - UIViewComponentPeer::~UIViewComponentPeer() { - if (currentlyFocusedPeer == this) - currentlyFocusedPeer = nullptr; + if (iOSGlobals::currentlyFocusedPeer == this) + iOSGlobals::currentlyFocusedPeer = nullptr; currentTouches.deleteAllTouchesForPeer (this); @@ -1651,6 +1924,13 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv if (event == nullptr) return; + #if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT + if (@available (iOS 13.4, *)) + { + updateModifiers ([event modifierFlags]); + } + #endif + NSArray* touches = [[event touchesForView: view] allObjects]; for (unsigned int i = 0; i < [touches count]; ++i) @@ -1754,8 +2034,10 @@ void UIViewComponentPeer::onScroll (UIPanGestureRecognizer* gesture) details.isSmooth = true; details.isInertial = false; + const auto reconstructedMousePosition = convertToPointFloat ([gesture locationInView: view]) - convertToPointFloat (offset); + handleMouseWheel (MouseInputSource::InputSourceType::touch, - convertToPointFloat ([gesture locationInView: view]), + reconstructedMousePosition, UIViewComponentPeer::getMouseTime ([[NSProcessInfo processInfo] systemUptime]), details); } @@ -1764,12 +2046,12 @@ void UIViewComponentPeer::onScroll (UIPanGestureRecognizer* gesture) //============================================================================== void UIViewComponentPeer::viewFocusGain() { - if (currentlyFocusedPeer != this) + if (iOSGlobals::currentlyFocusedPeer != this) { - if (ComponentPeer::isValidPeer (currentlyFocusedPeer)) - currentlyFocusedPeer->handleFocusLoss(); + if (ComponentPeer::isValidPeer (iOSGlobals::currentlyFocusedPeer)) + iOSGlobals::currentlyFocusedPeer->handleFocusLoss(); - currentlyFocusedPeer = this; + iOSGlobals::currentlyFocusedPeer = this; handleFocusGain(); } @@ -1777,9 +2059,9 @@ void UIViewComponentPeer::viewFocusGain() void UIViewComponentPeer::viewFocusLoss() { - if (currentlyFocusedPeer == this) + if (iOSGlobals::currentlyFocusedPeer == this) { - currentlyFocusedPeer = nullptr; + iOSGlobals::currentlyFocusedPeer = nullptr; handleFocusLoss(); } } @@ -1789,7 +2071,7 @@ bool UIViewComponentPeer::isFocused() const if (isAppex) return true; - return isSharedWindow ? this == currentlyFocusedPeer + return isSharedWindow ? this == iOSGlobals::currentlyFocusedPeer : (window != nil && [window isKeyWindow]); } @@ -1804,6 +2086,10 @@ void UIViewComponentPeer::grabFocus() void UIViewComponentPeer::textInputRequired (Point, TextInputTarget&) { + // We need to restart the text input session so that the keyboard can change types if necessary. + if ([hiddenTextInput.get() isFirstResponder]) + [hiddenTextInput.get() resignFirstResponder]; + [hiddenTextInput.get() becomeFirstResponder]; } @@ -1825,30 +2111,11 @@ void UIViewComponentPeer::dismissPendingTextInput() [hiddenTextInput.get() resignFirstResponder]; } -BOOL UIViewComponentPeer::textViewReplaceCharacters (Range range, const String& text) -{ - if (auto* target = findCurrentTextInputTarget()) - { - auto currentSelection = target->getHighlightedRegion(); - - if (range.getLength() == 1 && text.isEmpty()) // (detect backspace) - if (currentSelection.isEmpty()) - target->setHighlightedRegion (currentSelection.withStart (currentSelection.getStart() - 1)); - - WeakReference deletionChecker (dynamic_cast (target)); - - if (text == "\r" || text == "\n" || text == "\r\n") - handleKeyPress (KeyPress::returnKey, text[0]); - else - target->insertTextAtCaret (text); - } - - return NO; -} - //============================================================================== void UIViewComponentPeer::displayLinkCallback() { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + if (deferredRepaints.isEmpty()) return; @@ -1913,6 +2180,40 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable, void Desktop::allowedOrientationsChanged() { + #if defined (__IPHONE_16_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0 + if (@available (iOS 16.0, *)) + { + UIApplication* sharedApplication = [UIApplication sharedApplication]; + + const NSUniquePtr preferences { [UIWindowSceneGeometryPreferencesIOS alloc] }; + [preferences.get() initWithInterfaceOrientations: Orientations::getSupportedOrientations()]; + + for (UIScene* scene in [sharedApplication connectedScenes]) + { + if ([scene isKindOfClass: [UIWindowScene class]]) + { + [static_cast (scene) requestGeometryUpdateWithPreferences: preferences.get() + errorHandler: ^([[maybe_unused]] NSError* error) + { + // Failed to set the new set of supported orientations. + // You may have hit this assertion because you're trying to restrict the supported orientations + // of an app that allows multitasking (i.e. the app does not require fullscreen, and supports + // all orientations). + // iPadOS apps that allow multitasking must support all interface orientations, + // so attempting to change the set of supported orientations will fail. + // If you hit this assertion in an application that requires fullscreen, it may be because the + // set of supported orientations declared in the app's plist doesn't have any entries in common + // with the orientations passed to Desktop::setOrientationsEnabled. + DBG (nsStringToJuce ([error localizedDescription])); + jassertfalse; + }]; + } + } + + return; + } + #endif + // if the current orientation isn't allowed anymore then switch orientations if (! isOrientationEnabled (getCurrentOrientation())) { diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index 4b254a46..6fffc44e 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -480,7 +480,7 @@ public: : callback (std::move (cb)), shouldDeleteThis (deleteOnCompletion) { - if (currentlyFocusedPeer != nullptr) + if (iOSGlobals::currentlyFocusedPeer != nullptr) { UIAlertController* alert = [UIAlertController alertControllerWithTitle: juceStringToNS (opts.getTitle()) message: juceStringToNS (opts.getMessage()) @@ -490,9 +490,9 @@ public: addButton (alert, opts.getButtonText (1)); addButton (alert, opts.getButtonText (2)); - [currentlyFocusedPeer->controller presentViewController: alert - animated: YES - completion: nil]; + [iOSGlobals::currentlyFocusedPeer->controller presentViewController: alert + animated: YES + completion: nil]; } else { diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index 7eb7176e..f1e71c00 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -61,6 +61,8 @@ public: xSettings->addListener (this); getNativeRealtimeModifiers = []() -> ModifierKeys { return XWindowSystem::getInstance()->getNativeRealtimeModifiers(); }; + + updateVBlankTimer(); } ~LinuxComponentPeer() override @@ -369,6 +371,8 @@ public: bounds = parentWindow == 0 ? Desktop::getInstance().getDisplays().physicalToLogical (physicalBounds) : physicalBounds / currentScaleFactor; + + updateVBlankTimer(); } void updateBorderSize() @@ -390,13 +394,22 @@ public: } } + bool setWindowAssociation (::Window windowIn) + { + clearWindowAssociation(); + association = { this, windowIn }; + return association.isValid(); + } + + void clearWindowAssociation() { association = {}; } + //============================================================================== static bool isActiveApplication; bool focused = false; private: //============================================================================== - class LinuxRepaintManager : public Timer + class LinuxRepaintManager { public: LinuxRepaintManager (LinuxComponentPeer& p) @@ -405,7 +418,7 @@ private: { } - void timerCallback() override + void dispatchDeferredRepaints() { XWindowSystem::getInstance()->processPendingPaintsForWindow (peer.windowH); @@ -413,32 +426,20 @@ private: return; if (! regionsNeedingRepaint.isEmpty()) - { - stopTimer(); performAnyPendingRepaintsNow(); - } else if (Time::getApproximateMillisecondCounter() > lastTimeImageUsed + 3000) - { - stopTimer(); image = Image(); - } } void repaint (Rectangle area) { - if (! isTimerRunning()) - startTimer (repaintTimerPeriod); - regionsNeedingRepaint.add (area * peer.currentScaleFactor); } void performAnyPendingRepaintsNow() { if (XWindowSystem::getInstance()->getNumPaintsPendingForWindow (peer.windowH) > 0) - { - startTimer (repaintTimerPeriod); return; - } auto originalRepaintRegion = regionsNeedingRepaint; regionsNeedingRepaint.clear(); @@ -473,8 +474,6 @@ private: } } - startTimer (repaintTimerPeriod); - RectangleList adjustedList (originalRepaintRegion); adjustedList.offsetAll (-totalArea.getX(), -totalArea.getY()); @@ -495,12 +494,9 @@ private: } lastTimeImageUsed = Time::getApproximateMillisecondCounter(); - startTimer (repaintTimerPeriod); } private: - enum { repaintTimerPeriod = 1000 / 100 }; - LinuxComponentPeer& peer; const bool isSemiTransparentWindow; Image image; @@ -512,6 +508,26 @@ private: JUCE_DECLARE_NON_COPYABLE (LinuxRepaintManager) }; + class LinuxVBlankManager : public Timer + { + public: + explicit LinuxVBlankManager (std::function cb) : callback (std::move (cb)) + { + jassert (callback); + } + + ~LinuxVBlankManager() override { stopTimer(); } + + //============================================================================== + void timerCallback() override { callback(); } + + private: + std::function callback; + + JUCE_DECLARE_NON_COPYABLE (LinuxVBlankManager) + JUCE_DECLARE_NON_MOVEABLE (LinuxVBlankManager) + }; + //============================================================================== template static Point localToGlobal (This& t, Point relativePosition) @@ -554,8 +570,31 @@ private: } } + void onVBlank() + { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + + if (repainter != nullptr) + repainter->dispatchDeferredRepaints(); + } + + void updateVBlankTimer() + { + if (auto* display = Desktop::getInstance().getDisplays().getDisplayForRect (bounds)) + { + // Some systems fail to set an explicit refresh rate, or ask for a refresh rate of 0 + // (observed on Raspbian Bullseye over VNC). In these situations, use a fallback value. + const auto newIntFrequencyHz = roundToInt (display->verticalFrequencyHz.value_or (0.0)); + const auto frequencyToUse = newIntFrequencyHz != 0 ? newIntFrequencyHz : 100; + + if (vBlankManager.getTimerInterval() != frequencyToUse) + vBlankManager.startTimerHz (frequencyToUse); + } + } + //============================================================================== std::unique_ptr repainter; + LinuxVBlankManager vBlankManager { [this]() { onVBlank(); } }; ::Window windowH = {}, parentWindow = {}; Rectangle bounds; @@ -563,6 +602,7 @@ private: bool fullScreen = false, isAlwaysOnTop = false; double currentScaleFactor = 1.0; Array glRepaintListeners; + ScopedWindowAssociation association; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LinuxComponentPeer) diff --git a/modules/juce_gui_basics/native/juce_mac_CGMetalLayerRenderer.h b/modules/juce_gui_basics/native/juce_mac_CGMetalLayerRenderer.h index 791379c7..bfa8f0cb 100644 --- a/modules/juce_gui_basics/native/juce_mac_CGMetalLayerRenderer.h +++ b/modules/juce_gui_basics/native/juce_mac_CGMetalLayerRenderer.h @@ -35,12 +35,11 @@ class CoreGraphicsMetalLayerRenderer { public: //============================================================================== - CoreGraphicsMetalLayerRenderer (ViewType* view, bool isOpaque) + static auto create (ViewType* view, bool isOpaque) { - device.reset (MTLCreateSystemDefaultDevice()); - commandQueue.reset ([device.get() newCommandQueue]); - - attach (view, isOpaque); + ObjCObjectHandle> device { MTLCreateSystemDefaultDevice() }; + return rawToUniquePtr (device != nullptr ? new CoreGraphicsMetalLayerRenderer (device, view, isOpaque) + : nullptr); } ~CoreGraphicsMetalLayerRenderer() @@ -223,6 +222,16 @@ public: } private: + //============================================================================== + CoreGraphicsMetalLayerRenderer (ObjCObjectHandle> mtlDevice, + ViewType* view, + bool isOpaque) + : device (mtlDevice), + commandQueue ([device.get() newCommandQueue]) + { + attach (view, isOpaque); + } + //============================================================================== static auto alignTo (size_t n, size_t alignment) { diff --git a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm index 81d8b6d7..9f6bc9dc 100644 --- a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm @@ -279,10 +279,9 @@ private: && ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: juceStringToNS (f.getFullPathName())]; } - void panelSelectionDidChange (id sender) + void panelSelectionDidChange ([[maybe_unused]] id sender) { jassert (sender == panel); - ignoreUnused (sender); // NB: would need to extend FilePreviewComponent to handle the full list rather than just the first one if (preview != nullptr) diff --git a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm index c77a92a9..0e6ba3e3 100644 --- a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm +++ b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm @@ -453,16 +453,12 @@ private: { ValidatorClass() : ObjCClass ("JUCEMenuValidator_") { - addMethod (menuItemInvokedSelector, menuItemInvoked); - addMethod (@selector (validateMenuItem:), validateMenuItem); + addMethod (menuItemInvokedSelector, [] (id, SEL, NSMenuItem*) {}); + addMethod (@selector (validateMenuItem:), [] (id, SEL, NSMenuItem*) { return YES; }); addProtocol (@protocol (NSMenuItemValidation)); registerClass(); } - - private: - static BOOL validateMenuItem (id, SEL, NSMenuItem*) { return YES; } - static void menuItemInvoked (id, SEL, NSMenuItem*) {} }; static ValidatorClass validatorClass; @@ -504,7 +500,7 @@ private: return m; } - // Apple Bug: For some reason [NSMenu removeAllItems] seems to leak it's objects + // Apple Bug: For some reason [NSMenu removeAllItems] seems to leak its objects // on shutdown, so we need this method to release the items one-by-one manually static void removeItemRecursive (NSMenu* parentMenu, int menuItemIndex) { @@ -544,9 +540,24 @@ private: { addIvar ("owner"); - addMethod (menuItemInvokedSelector, menuItemInvoked); - addMethod (@selector (menuNeedsUpdate:), menuNeedsUpdate); - addMethod (@selector (validateMenuItem:), validateMenuItem); + addMethod (menuItemInvokedSelector, [] (id self, SEL, NSMenuItem* item) + { + if (auto* juceItem = getPopupMenuItem (item)) + getOwner (self)->invoke (*juceItem, static_cast ([item tag])); + }); + + addMethod (@selector (menuNeedsUpdate:), [] (id self, SEL, NSMenu* menu) + { + getOwner (self)->updateTopLevelMenu (menu); + }); + + addMethod (@selector (validateMenuItem:), [] (id, SEL, NSMenuItem* item) -> BOOL + { + if (auto* juceItem = getPopupMenuItem (item)) + return juceItem->isEnabled; + + return YES; + }); addProtocol (@protocol (NSMenuDelegate)); addProtocol (@protocol (NSMenuItemValidation)); @@ -560,34 +571,15 @@ private: } private: - static auto* getPopupMenuItem (NSMenuItem* item) + static PopupMenu::Item* getPopupMenuItem (NSMenuItem* item) { return getJuceClassFromNSObject ([item representedObject]); } - static auto* getOwner (id self) + static JuceMainMenuHandler* getOwner (id self) { return getIvar (self, "owner"); } - - static void menuItemInvoked (id self, SEL, NSMenuItem* item) - { - if (auto* juceItem = getPopupMenuItem (item)) - getOwner (self)->invoke (*juceItem, static_cast ([item tag])); - } - - static void menuNeedsUpdate (id self, SEL, NSMenu* menu) - { - getOwner (self)->updateTopLevelMenu (menu); - } - - static BOOL validateMenuItem (id, SEL, NSMenuItem* item) - { - if (auto* juceItem = getPopupMenuItem (item)) - return juceItem->isEnabled; - - return YES; - } }; }; diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 2047f6f9..95321245 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -151,7 +151,7 @@ public: #if USE_COREGRAPHICS_RENDERING #if JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS if (@available (macOS 10.14, *)) - metalRenderer = std::make_unique> (view, getComponent().isOpaque()); + metalRenderer = CoreGraphicsMetalLayerRenderer::create (view, getComponent().isOpaque()); #endif if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0) { @@ -163,8 +163,6 @@ public: } #endif - createCVDisplayLink(); - if (isSharedWindow) { window = [viewToAttachTo window]; @@ -180,6 +178,7 @@ public: styleMask: getNSWindowStyleMask (windowStyleFlags) backing: NSBackingStoreBuffered defer: YES]; + [window setColorSpace: [NSColorSpace sRGBColorSpace]]; setOwner (window, this); if (@available (macOS 10.10, *)) @@ -221,7 +220,7 @@ public: scopedObservers.emplace_back (view, frameChangedSelector, NSWindowDidMoveNotification, window); scopedObservers.emplace_back (view, frameChangedSelector, NSWindowDidMiniaturizeNotification, window); scopedObservers.emplace_back (view, @selector (windowWillMiniaturize:), NSWindowWillMiniaturizeNotification, window); - scopedObservers.emplace_back (view, @selector (windowDidMiniaturize:), NSWindowDidMiniaturizeNotification, window); + scopedObservers.emplace_back (view, @selector (windowDidDeminiaturize:), NSWindowDidDeminiaturizeNotification, window); } auto alpha = component.getAlpha(); @@ -242,9 +241,6 @@ public: ~NSViewComponentPeer() override { - CVDisplayLinkStop (displayLink); - dispatch_source_cancel (displaySource); - scopedObservers.clear(); setOwner (view, nullptr); @@ -415,12 +411,12 @@ public: if (forceFullScreen) return NSWindowCollectionBehaviorFullScreenPrimary; - // Some SDK versions don't define NSWindowCollectionBehaviorFullScreenNone - constexpr auto fullScreenNone = (NSUInteger) (1 << 9); + // Some SDK versions don't define NSWindowCollectionBehaviorFullScreenAuxiliary + constexpr auto fullScreenAux = (NSUInteger) (1 << 8); return (getStyleFlags() & (windowHasMaximiseButton | windowIsResizable)) == (windowHasMaximiseButton | windowIsResizable) ? NSWindowCollectionBehaviorFullScreenPrimary - : fullScreenNone; + : fullScreenAux; } void setCollectionBehaviour (bool forceFullScreen) const @@ -645,7 +641,7 @@ public: return usingCoreGraphics ? 1 : 0; } - void setCurrentRenderingEngine (int index) override + void setCurrentRenderingEngine ([[maybe_unused]] int index) override { #if USE_COREGRAPHICS_RENDERING if (usingCoreGraphics != (index > 0)) @@ -653,8 +649,6 @@ public: usingCoreGraphics = index > 0; [view setNeedsDisplay: true]; } - #else - ignoreUnused (index); #endif } @@ -809,10 +803,8 @@ public: { bool used = false; - for (auto u = unicode.getCharPointer(); ! u.isEmpty();) + for (auto textCharacter : unicode) { - auto textCharacter = u.getAndAdvance(); - switch (keyCode) { case NSLeftArrowFunctionKey: @@ -834,8 +826,8 @@ public: break; } - used = handleKeyUpOrDown (true) || used; - used = handleKeyPress (keyCode, textCharacter) || used; + used |= handleKeyUpOrDown (true); + used |= handleKeyPress (keyCode, textCharacter); } return used; @@ -1028,6 +1020,12 @@ public: return areAnyWindowsInLiveResize(); } + void onVBlank() + { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + setNeedsDisplayRectangles(); + } + void setNeedsDisplayRectangles() { if (deferredRepaints.isEmpty()) @@ -1200,11 +1198,6 @@ public: setNeedsDisplayRectangles(); } - void windowDidChangeScreen() - { - updateCVDisplayLinkScreen(); - } - void viewMovedToWindow() { if (isSharedWindow) @@ -1224,9 +1217,6 @@ public: windowObservers.emplace_back (view, dismissModalsSelector, NSWindowWillMiniaturizeNotification, currentWindow); windowObservers.emplace_back (view, becomeKeySelector, NSWindowDidBecomeKeyNotification, currentWindow); windowObservers.emplace_back (view, resignKeySelector, NSWindowDidResignKeyNotification, currentWindow); - windowObservers.emplace_back (view, @selector (windowDidChangeScreen:), NSWindowDidChangeScreenNotification, currentWindow); - - updateCVDisplayLinkScreen(); } } @@ -1330,9 +1320,9 @@ public: if (auto keyCode = getKeyCodeFromEvent (ev)) { if (isKeyDown) - keysCurrentlyDown.addIfNotAlreadyThere (keyCode); + keysCurrentlyDown.insert (keyCode); else - keysCurrentlyDown.removeFirstMatchingValue (keyCode); + keysCurrentlyDown.erase (keyCode); } } @@ -1563,9 +1553,8 @@ public: void closeInputMethodContext() override { stringBeingComposed.clear(); - const auto* inputContext = [NSTextInputContext currentInputContext]; - if (inputContext != nil) + if (const auto* inputContext = [view inputContext]) [inputContext discardMarkedText]; } @@ -1586,6 +1575,39 @@ public: [window setDocumentEdited: b]; } + bool sendEventToInputContextOrComponent (NSEvent* ev) + { + // We assume that the event will be handled by the IME. + // Occasionally, the inputContext may be sent key events like cmd+Q, which it will turn + // into a noop: call and forward to doCommandBySelector:. + // In this case, the event will be extracted from keyEventBeingHandled and passed to the + // focused component, and viewCannotHandleEvent will be set depending on whether the event + // was handled by the component. + // If the event was *not* handled by the component, and was also not consumed completely by + // the IME, it's important to return the event to the system for further handling, so that + // the main menu works as expected. + viewCannotHandleEvent = false; + keyEventBeingHandled.reset ([ev retain]); + const WeakReference ref { this }; + // redirectKeyDown may delete this peer! + const ScopeGuard scope { [&ref] { if (ref != nullptr) ref->keyEventBeingHandled = nullptr; } }; + + const auto handled = [&]() -> bool + { + if (auto* target = findCurrentTextInputTarget()) + if (const auto* inputContext = [view inputContext]) + return [inputContext handleEvent: ev] && ! viewCannotHandleEvent; + + return false; + }(); + + if (handled) + return true; + + stringBeingComposed.clear(); + return redirectKeyDown (ev); + } + //============================================================================== NSWindow* window = nil; NSView* view = nil; @@ -1596,18 +1618,20 @@ public: #else bool usingCoreGraphics = false; #endif - bool isZooming = false, isFirstLiveResize = false, textWasInserted = false; + NSUniquePtr keyEventBeingHandled; + bool isFirstLiveResize = false, viewCannotHandleEvent = false; bool isStretchingTop = false, isStretchingLeft = false, isStretchingBottom = false, isStretchingRight = false; bool windowRepresentsFile = false; bool isAlwaysOnTop = false, wasAlwaysOnTop = false; String stringBeingComposed; + int startOfMarkedTextInTextInputTarget = 0; Rectangle lastSizeBeforeZoom; RectangleList deferredRepaints; uint32 lastRepaintTime; static ComponentPeer* currentlyFocusedPeer; - static Array keysCurrentlyDown; + static std::set keysCurrentlyDown; static int insideToFrontCall; static const SEL dismissModalsSelector; @@ -1618,6 +1642,65 @@ public: static const SEL resignKeySelector; private: + JUCE_DECLARE_WEAK_REFERENCEABLE (NSViewComponentPeer) + + // Note: the OpenGLContext also has a SharedResourcePointer to + // avoid unnecessarily duplicating display-link threads. + SharedResourcePointer sharedDisplayLinks; + + class AsyncRepainter : private AsyncUpdater + { + public: + explicit AsyncRepainter (NSViewComponentPeer& o) : owner (o) {} + ~AsyncRepainter() override { cancelPendingUpdate(); } + + void markUpdated (const CGDirectDisplayID x) + { + { + const std::scoped_lock lock { mutex }; + + if (std::find (backgroundDisplays.cbegin(), backgroundDisplays.cend(), x) == backgroundDisplays.cend()) + backgroundDisplays.push_back (x); + } + + triggerAsyncUpdate(); + } + + private: + void handleAsyncUpdate() override + { + { + const std::scoped_lock lock { mutex }; + mainThreadDisplays = backgroundDisplays; + backgroundDisplays.clear(); + } + + for (const auto& display : mainThreadDisplays) + if (auto* peerView = owner.view) + if (auto* peerWindow = [peerView window]) + if (display == ScopedDisplayLink::getDisplayIdForScreen ([peerWindow screen])) + owner.onVBlank(); + } + + NSViewComponentPeer& owner; + std::mutex mutex; + std::vector backgroundDisplays, mainThreadDisplays; + }; + + AsyncRepainter asyncRepainter { *this }; + + /* Creates a function object that can be called from an arbitrary thread (probably a CVLink + thread). When called, this function object will trigger a call to setNeedsDisplayRectangles + as soon as possible on the main thread, for any peers currently on the provided NSScreen. + */ + PerScreenDisplayLinks::Connection connection + { + sharedDisplayLinks->registerFactory ([this] (CGDirectDisplayID display) + { + return [this, display] { asyncRepainter.markUpdated (display); }; + }) + }; + static NSView* createViewInstance(); static NSWindow* createWindowInstance(); @@ -1784,48 +1867,6 @@ private: } //============================================================================== - void onDisplaySourceCallback() - { - setNeedsDisplayRectangles(); - } - - void onDisplayLinkCallback() - { - dispatch_source_merge_data (displaySource, 1); - } - - static CVReturn displayLinkCallback (CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, - CVOptionFlags, CVOptionFlags*, void* context) - { - static_cast (context)->onDisplayLinkCallback(); - return kCVReturnSuccess; - } - - void updateCVDisplayLinkScreen() - { - auto viewDisplayID = (CGDirectDisplayID) [[window.screen.deviceDescription objectForKey: @"NSScreenNumber"] unsignedIntegerValue]; - auto result = CVDisplayLinkSetCurrentCGDisplay (displayLink, viewDisplayID); - jassertquiet (result == kCVReturnSuccess); - } - - void createCVDisplayLink() - { - displaySource = dispatch_source_create (DISPATCH_SOURCE_TYPE_DATA_ADD, 0, 0, dispatch_get_main_queue()); - dispatch_source_set_event_handler (displaySource, ^(){ onDisplaySourceCallback(); }); - dispatch_resume (displaySource); - - auto cvReturn = CVDisplayLinkCreateWithActiveCGDisplays (&displayLink); - jassertquiet (cvReturn == kCVReturnSuccess); - - cvReturn = CVDisplayLinkSetOutputCallback (displayLink, &displayLinkCallback, this); - jassertquiet (cvReturn == kCVReturnSuccess); - - CVDisplayLinkStart (displayLink); - } - - CVDisplayLinkRef displayLink = nullptr; - dispatch_source_t displaySource = nullptr; - int numFramesToSkipMetalRenderer = 0; std::unique_ptr> metalRenderer; @@ -1969,12 +2010,6 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> } }); - addMethod (@selector (windowDidChangeScreen:), [] (id self, SEL, NSNotification*) - { - if (auto* p = getOwner (self)) - p->windowDidChangeScreen(); - }); - addMethod (@selector (wantsDefaultClipping), [] (id, SEL) { return YES; }); // (this is the default, but may want to customise it in future) addMethod (@selector (worksWhenModal), [] (id self, SEL) @@ -2000,19 +2035,16 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> addMethod (@selector (keyDown:), [] (id self, SEL, NSEvent* ev) { - if (auto* owner = getOwner (self)) + const auto handled = [&] { - auto* target = owner->findCurrentTextInputTarget(); - owner->textWasInserted = false; + if (auto* owner = getOwner (self)) + return owner->sendEventToInputContextOrComponent (ev); - if (target != nullptr) - [(NSView*) self interpretKeyEvents: [NSArray arrayWithObject: ev]]; - else - owner->stringBeingComposed.clear(); + return false; + }(); - if (! (owner->textWasInserted || owner->redirectKeyDown (ev))) - sendSuperclassMessage (self, @selector (keyDown:), ev); - } + if (! handled) + sendSuperclassMessage (self, @selector (keyDown:), ev); }); addMethod (@selector (keyUp:), [] (id self, SEL, NSEvent* ev) @@ -2023,41 +2055,160 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> sendSuperclassMessage (self, @selector (keyUp:), ev); }); - addMethod (@selector (insertText:), [] (id self, SEL, id aString) + // See "The Path of Key Events" on this page: + // https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html + // Normally, 'special' key presses (cursor keys, shortcuts, return, delete etc.) will be + // sent down the view hierarchy to this function before any of the other keyboard handling + // functions. + // If any object returns YES from performKeyEquivalent, then the event is consumed. + // If no object handles the key equivalent, then the event will be sent to the main menu. + // If the menu is also unable to respond to the event, then the event will be sent + // to keyDown:/keyUp: via sendEvent:, but this time the event will be sent to the first + // responder and propagated back up the responder chain. + // This architecture presents some issues in JUCE apps, which always expect the focused + // Component to be sent all key presses *including* special keys. + // There are also some slightly pathological cases that JUCE needs to support, for example + // the situation where one of the cursor keys is bound to a main menu item. By default, + // macOS would send the cursor event to performKeyEquivalent on each NSResponder, then send + // the event to the main menu if no responder handled it. This would mean that the focused + // Component would never see the event, which would break widgets like the TextEditor, which + // expect to take precedence over menu items when they have focus. + // Another layer of subtlety is that some IMEs require cursor key input. When long-pressing + // the 'e' key to bring up the accent menu, the popup menu should receive cursor events + // before the focused component. + // To fulfil all of these requirements, we handle special keys ('key equivalents') like any + // other key event, and send these events firstly to the NSTextInputContext (if there's an + // active TextInputTarget), and then on to the focused Component in the case that the + // input handler is unable to use the keypress. If the event still hasn't been used, then + // it will be sent to the superclass's performKeyEquivalent: function, which will give the + // OS a chance to handle events like cmd+Q, cmd+`, cmd+H etc. + addMethod (@selector (performKeyEquivalent:), [] (id self, SEL s, NSEvent* ev) -> BOOL { - // This commits multi-byte text when return is pressed, or after every keypress for western keyboards if (auto* owner = getOwner (self)) - { - NSString* newText = [aString isKindOfClass: [NSAttributedString class]] ? [aString string] : aString; + return owner->sendEventToInputContextOrComponent (ev); + + return sendSuperclassMessage (self, s, ev); + }); - if ([newText length] > 0) + addMethod (@selector (insertText:replacementRange:), [] (id self, SEL, id aString, NSRange replacementRange) + { + // This commits multi-byte text when using an IME, or after every keypress for western keyboards + if (auto* owner = getOwner (self)) + { + if (auto* target = owner->findCurrentTextInputTarget()) { - if (auto* target = owner->findCurrentTextInputTarget()) + const auto newText = nsStringToJuce ([aString isKindOfClass: [NSAttributedString class]] ? [aString string] : aString); + + if (newText.isNotEmpty()) { - target->insertTextAtCaret (nsStringToJuce (newText)); - owner->textWasInserted = true; + target->setHighlightedRegion ([&] + { + // To test this, try long-pressing 'e' to bring up the accent popup, + // then select one of the accented options. + if (replacementRange.location != NSNotFound) + return nsRangeToJuce (replacementRange); + + // To test this, try entering the characters 'a b ' with the 2-Set + // Korean IME. The input client should receive three calls to setMarkedText: + // followed by a call to insertText: + // The final call to insertText should overwrite the currently-marked + // text, and reset the composition string. + if (owner->stringBeingComposed.isNotEmpty()) + return Range::withStartAndLength (owner->startOfMarkedTextInTextInputTarget, + owner->stringBeingComposed.length()); + + return target->getHighlightedRegion(); + }()); + + target->insertTextAtCaret (newText); + target->setTemporaryUnderlining ({}); } } + else + jassertfalse; // The system should not attempt to insert text when there is no active TextInputTarget owner->stringBeingComposed.clear(); } }); - addMethod (@selector (doCommandBySelector:), [] (id, SEL, SEL) {}); + addMethod (@selector (doCommandBySelector:), [] (id self, SEL, SEL sel) + { + const auto handled = [&] + { + // 'Special' keys, like backspace, return, tab, and escape, are converted to commands by the system. + // Components still expect to receive these events as key presses, so we send the currently-processed + // key event (if any). + if (auto* owner = getOwner (self)) + { + owner->viewCannotHandleEvent = [&] + { + if (auto* e = owner->keyEventBeingHandled.get()) + { + if ([e type] != NSEventTypeKeyDown && [e type] != NSEventTypeKeyUp) + return true; + + return ! ([e type] == NSEventTypeKeyDown ? owner->redirectKeyDown (e) + : owner->redirectKeyUp (e)); + } + + return true; + }(); + + return ! owner->viewCannotHandleEvent; + } + + return false; + }(); - addMethod (@selector (setMarkedText:selectedRange:), [] (id self, SEL, id aString, NSRange) + if (! handled) + sendSuperclassMessage (self, @selector (doCommandBySelector:), sel); + }); + + addMethod (@selector (setMarkedText:selectedRange:replacementRange:), [] (id self, + SEL, + id aString, + const NSRange selectedRange, + const NSRange replacementRange) { if (auto* owner = getOwner (self)) { - owner->stringBeingComposed = nsStringToJuce ([aString isKindOfClass: [NSAttributedString class]] - ? [aString string] : aString); - if (auto* target = owner->findCurrentTextInputTarget()) { - auto currentHighlight = target->getHighlightedRegion(); - target->insertTextAtCaret (owner->stringBeingComposed); - target->setHighlightedRegion (currentHighlight.withLength (owner->stringBeingComposed.length())); - owner->textWasInserted = true; + const auto toInsert = nsStringToJuce ([aString isKindOfClass: [NSAttributedString class]] ? [aString string] : aString); + const auto [initialHighlight, marked, finalHighlight] = [&] + { + if (owner->stringBeingComposed.isNotEmpty()) + { + const auto toReplace = Range::withStartAndLength (owner->startOfMarkedTextInTextInputTarget, + owner->stringBeingComposed.length()); + + return replacementRange.location != NSNotFound + // There's a composition underway, so replacementRange is relative to the marked text, + // and selectedRange is relative to the inserted string. + ? std::tuple (toReplace, + owner->stringBeingComposed.replaceSection (static_cast (replacementRange.location), + static_cast (replacementRange.length), + toInsert), + nsRangeToJuce (selectedRange) + static_cast (replacementRange.location)) + // The replacementRange is invalid, so replace all the marked text. + : std::tuple (toReplace, toInsert, nsRangeToJuce (selectedRange)); + } + + if (replacementRange.location != NSNotFound) + // There's no string composition in progress, so replacementRange is relative to the start + // of the document. + return std::tuple (nsRangeToJuce (replacementRange), toInsert, nsRangeToJuce (selectedRange)); + + return std::tuple (target->getHighlightedRegion(), toInsert, nsRangeToJuce (selectedRange)); + }(); + + owner->stringBeingComposed = marked; + owner->startOfMarkedTextInTextInputTarget = initialHighlight.getStart(); + + target->setHighlightedRegion (initialHighlight); + target->insertTextAtCaret (marked); + target->setTemporaryUnderlining ({ Range::withStartAndLength (initialHighlight.getStart(), marked.length()) }); + target->setHighlightedRegion (finalHighlight + owner->startOfMarkedTextInTextInputTarget); } } }); @@ -2071,7 +2222,7 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> if (auto* target = owner->findCurrentTextInputTarget()) { target->insertTextAtCaret (owner->stringBeingComposed); - owner->textWasInserted = true; + target->setTemporaryUnderlining ({}); } owner->stringBeingComposed.clear(); @@ -2085,21 +2236,20 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> return owner != nullptr && owner->stringBeingComposed.isNotEmpty(); }); - addMethod (@selector (conversationIdentifier), [] (id self, SEL) + addMethod (@selector (attributedSubstringForProposedRange:actualRange:), [] (id self, SEL, NSRange theRange, NSRangePointer actualRange) -> NSAttributedString* { - return (long) (pointer_sized_int) self; - }); + jassert (theRange.location != NSNotFound); - addMethod (@selector (attributedSubstringFromRange:), [] (id self, SEL, NSRange theRange) -> NSAttributedString* - { if (auto* owner = getOwner (self)) { if (auto* target = owner->findCurrentTextInputTarget()) { - Range r ((int) theRange.location, - (int) (theRange.location + theRange.length)); + const auto clamped = Range { 0, target->getTotalNumChars() }.constrainRange (nsRangeToJuce (theRange)); - return [[[NSAttributedString alloc] initWithString: juceStringToNS (target->getTextInRange (r))] autorelease]; + if (actualRange != nullptr) + *actualRange = juceRangeToNS (clamped); + + return [[[NSAttributedString alloc] initWithString: juceStringToNS (target->getTextInRange (clamped))] autorelease]; } } @@ -2110,7 +2260,8 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> { if (auto* owner = getOwner (self)) if (owner->stringBeingComposed.isNotEmpty()) - return NSMakeRange (0, (NSUInteger) owner->stringBeingComposed.length()); + return NSMakeRange (static_cast (owner->startOfMarkedTextInTextInputTarget), + static_cast (owner->stringBeingComposed.length())); return NSMakeRange (NSNotFound, 0); }); @@ -2121,22 +2272,40 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> { if (auto* target = owner->findCurrentTextInputTarget()) { - auto highlight = target->getHighlightedRegion(); + const auto highlight = target->getHighlightedRegion(); - if (! highlight.isEmpty()) - return NSMakeRange ((NSUInteger) highlight.getStart(), - (NSUInteger) highlight.getLength()); + // The accent-selector popup does not show if the selectedRange location is NSNotFound! + return NSMakeRange ((NSUInteger) highlight.getStart(), + (NSUInteger) highlight.getLength()); } } return NSMakeRange (NSNotFound, 0); }); - addMethod (@selector (firstRectForCharacterRange:), [] (id self, SEL, NSRange) + addMethod (@selector (firstRectForCharacterRange:actualRange:), [] (id self, SEL, NSRange range, NSRangePointer actualRange) { if (auto* owner = getOwner (self)) - if (auto* comp = dynamic_cast (owner->findCurrentTextInputTarget())) - return flippedScreenRect (makeNSRect (comp->getScreenBounds())); + { + if (auto* target = owner->findCurrentTextInputTarget()) + { + if (auto* comp = dynamic_cast (target)) + { + const auto codePointRange = range.location == NSNotFound ? Range::emptyRange (target->getCaretPosition()) + : nsRangeToJuce (range); + const auto clamped = Range { 0, target->getTotalNumChars() }.constrainRange (codePointRange); + + if (actualRange != nullptr) + *actualRange = juceRangeToNS (clamped); + + const auto rect = codePointRange.isEmpty() ? target->getCaretRectangleForCharIndex (codePointRange.getStart()) + : target->getTextBounds (codePointRange).getRectangle (0); + const auto areaOnDesktop = comp->localAreaToGlobal (rect); + + return flippedScreenRect (makeNSRect (ScalingHelpers::scaledScreenPosToUnscaled (areaOnDesktop))); + } + } + } return NSZeroRect; }); @@ -2188,47 +2357,12 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> addMethod (@selector (isFlipped), [] (id, SEL) { return true; }); - addMethod (@selector (performKeyEquivalent:), [] (id self, SEL s, NSEvent* event) - { - // We try passing shortcut keys to the currently focused component first. - // If the component doesn't want the event, we'll fall back to the superclass - // implementation, which will pass the event to the main menu. - if (tryPassingKeyEventToPeer (event)) - return YES; - - return sendSuperclassMessage (self, s, event); - }); - - addProtocol (@protocol (NSTextInput)); + addProtocol (@protocol (NSTextInputClient)); registerClass(); } private: - static void updateTrackingAreas (id self, SEL) - { - sendSuperclassMessage (self, @selector (updateTrackingAreas)); - - resetTrackingArea (static_cast (self)); - } - - static bool tryPassingKeyEventToPeer (NSEvent* e) - { - if ([e type] != NSEventTypeKeyDown && [e type] != NSEventTypeKeyUp) - return false; - - if (auto* focused = Component::getCurrentlyFocusedComponent()) - { - if (auto* peer = dynamic_cast (focused->getPeer())) - { - return [e type] == NSEventTypeKeyDown ? peer->redirectKeyDown (e) - : peer->redirectKeyUp (e); - } - } - - return false; - } - template static void callOnOwner (id self, Func&& func, Args&&... args) { @@ -2362,7 +2496,7 @@ struct JuceNSWindowClass : public NSViewComponentPeerWrapperisZooming) + if (owner == nullptr) return proposedFrameSize; NSRect frameRect = flippedScreenRect ([(NSWindow*) self frame]); @@ -2473,29 +2607,6 @@ struct JuceNSWindowClass : public NSViewComponentPeerWrapper NSViewComponentPeer::keysCurrentlyDown; +std::set NSViewComponentPeer::keysCurrentlyDown; //============================================================================== bool KeyPress::isKeyCurrentlyDown (int keyCode) { - if (NSViewComponentPeer::keysCurrentlyDown.contains (keyCode)) + const auto isDown = [] (int k) + { + return NSViewComponentPeer::keysCurrentlyDown.find (k) != NSViewComponentPeer::keysCurrentlyDown.cend(); + }; + + if (isDown (keyCode)) return true; if (keyCode >= 'A' && keyCode <= 'Z' - && NSViewComponentPeer::keysCurrentlyDown.contains ((int) CharacterFunctions::toLowerCase ((juce_wchar) keyCode))) + && isDown ((int) CharacterFunctions::toLowerCase ((juce_wchar) keyCode))) return true; if (keyCode >= 'a' && keyCode <= 'z' - && NSViewComponentPeer::keysCurrentlyDown.contains ((int) CharacterFunctions::toUpperCase ((juce_wchar) keyCode))) + && isDown ((int) CharacterFunctions::toUpperCase ((juce_wchar) keyCode))) return true; return false; diff --git a/modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h b/modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h new file mode 100644 index 00000000..7082db1b --- /dev/null +++ b/modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h @@ -0,0 +1,304 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +//============================================================================== +/* + Forwards NSNotificationCenter callbacks to a std::function. +*/ +class FunctionNotificationCenterObserver +{ +public: + FunctionNotificationCenterObserver (NSNotificationName notificationName, + id objectToObserve, + std::function callback) + : onNotification (std::move (callback)), + observer (observerObject.get(), getSelector(), notificationName, objectToObserve) + {} + +private: + struct ObserverClass + { + ObserverClass() + { + klass.addIvar ("owner"); + + klass.addMethod (getSelector(), [] (id self, SEL, NSNotification*) + { + getIvar (self, "owner")->onNotification(); + }); + + klass.registerClass(); + } + + NSObject* createInstance() const { return klass.createInstance(); } + + private: + ObjCClass klass { "JUCEObserverClass_" }; + }; + + static SEL getSelector() + { + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wundeclared-selector") + return @selector (notificationFired:); + JUCE_END_IGNORE_WARNINGS_GCC_LIKE + } + + std::function onNotification; + + NSUniquePtr observerObject + { + [this] + { + static ObserverClass observerClass; + auto* result = observerClass.createInstance(); + object_setInstanceVariable (result, "owner", this); + return result; + }() + }; + + ScopedNotificationCenterObserver observer; + + // Instances can't be copied or moved, because 'this' is stored as a member of the ObserverClass + // object. + JUCE_DECLARE_NON_COPYABLE (FunctionNotificationCenterObserver) + JUCE_DECLARE_NON_MOVEABLE (FunctionNotificationCenterObserver) +}; + +//============================================================================== +/* + Manages the lifetime of a CVDisplayLinkRef for a single display, and automatically starts and + stops it. +*/ +class ScopedDisplayLink +{ +public: + static CGDirectDisplayID getDisplayIdForScreen (NSScreen* screen) + { + return (CGDirectDisplayID) [[screen.deviceDescription objectForKey: @"NSScreenNumber"] unsignedIntegerValue]; + } + + ScopedDisplayLink (NSScreen* screenIn, std::function onCallbackIn) + : displayId (getDisplayIdForScreen (screenIn)), + link ([display = displayId] + { + CVDisplayLinkRef ptr = nullptr; + const auto result = CVDisplayLinkCreateWithCGDisplay (display, &ptr); + jassertquiet (result == kCVReturnSuccess); + jassertquiet (ptr != nullptr); + return ptr; + }()), + onCallback (std::move (onCallbackIn)) + { + const auto callback = [] (CVDisplayLinkRef, + const CVTimeStamp*, + const CVTimeStamp*, + CVOptionFlags, + CVOptionFlags*, + void* context) -> int + { + static_cast (context)->onCallback(); + return kCVReturnSuccess; + }; + + const auto callbackResult = CVDisplayLinkSetOutputCallback (link.get(), callback, this); + jassertquiet (callbackResult == kCVReturnSuccess); + + const auto startResult = CVDisplayLinkStart (link.get()); + jassertquiet (startResult == kCVReturnSuccess); + } + + ~ScopedDisplayLink() noexcept + { + if (link != nullptr) + CVDisplayLinkStop (link.get()); + } + + CGDirectDisplayID getDisplayId() const { return displayId; } + + double getNominalVideoRefreshPeriodS() const + { + const auto nominalVideoRefreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod (link.get()); + + if ((nominalVideoRefreshPeriod.flags & kCVTimeIsIndefinite) == 0) + return (double) nominalVideoRefreshPeriod.timeValue / (double) nominalVideoRefreshPeriod.timeScale; + + return 0.0; + } + +private: + struct DisplayLinkDestructor + { + void operator() (CVDisplayLinkRef ptr) const + { + if (ptr != nullptr) + CVDisplayLinkRelease (ptr); + } + }; + + CGDirectDisplayID displayId; + std::unique_ptr, DisplayLinkDestructor> link; + std::function onCallback; + + // Instances can't be copied or moved, because 'this' is passed as context to + // CVDisplayLinkSetOutputCallback + JUCE_DECLARE_NON_COPYABLE (ScopedDisplayLink) + JUCE_DECLARE_NON_MOVEABLE (ScopedDisplayLink) +}; + +//============================================================================== +/* + Holds a ScopedDisplayLink for each screen. When the screen configuration changes, the + ScopedDisplayLinks will be recreated automatically to match the new configuration. +*/ +class PerScreenDisplayLinks +{ +public: + PerScreenDisplayLinks() + { + refreshScreens(); + } + + using RefreshCallback = std::function; + using Factory = std::function; + + /* + Automatically unregisters a CVDisplayLink callback factory when ~Connection() is called. + */ + class Connection + { + public: + Connection() = default; + + Connection (PerScreenDisplayLinks& linksIn, std::list::const_iterator it) + : links (&linksIn), iter (it) {} + + ~Connection() noexcept + { + if (links != nullptr) + links->unregisterFactory (iter); + } + + Connection (const Connection&) = delete; + Connection& operator= (const Connection&) = delete; + + Connection (Connection&& other) noexcept + : links (std::exchange (other.links, nullptr)), iter (other.iter) {} + + Connection& operator= (Connection&& other) noexcept + { + Connection { std::move (other) }.swap (*this); + return *this; + } + + private: + void swap (Connection& other) noexcept + { + std::swap (other.links, links); + std::swap (other.iter, iter); + } + + PerScreenDisplayLinks* links = nullptr; + std::list::const_iterator iter; + }; + + /* Stores the provided factory for as long as the returned Connection remains alive. + + Whenever the screen configuration changes, the factory function will be called for each + screen. The RefreshCallback returned by the factory will be called every time that screen's + display link callback fires. + */ + [[nodiscard]] Connection registerFactory (Factory factory) + { + const ScopedLock lock (mutex); + factories.push_front (std::move (factory)); + refreshScreens(); + return { *this, factories.begin() }; + } + + double getNominalVideoRefreshPeriodSForScreen (CGDirectDisplayID display) const + { + const ScopedLock lock (mutex); + + for (const auto& link : links) + if (link.getDisplayId() == display) + return link.getNominalVideoRefreshPeriodS(); + + return 0.0; + } + +private: + void unregisterFactory (std::list::const_iterator iter) + { + const ScopedLock lock (mutex); + factories.erase (iter); + refreshScreens(); + } + + void refreshScreens() + { + auto newLinks = [&] + { + std::list result; + + for (NSScreen* screen in [NSScreen screens]) + { + std::vector callbacks; + + for (auto& factory : factories) + callbacks.push_back (factory (ScopedDisplayLink::getDisplayIdForScreen (screen))); + + // This is the callback that will actually fire in response to this screen's display + // link callback. + result.emplace_back (screen, [callbacks = std::move (callbacks)] + { + for (const auto& callback : callbacks) + callback(); + }); + } + + return result; + }(); + + const ScopedLock lock (mutex); + links = std::move (newLinks); + } + + CriticalSection mutex; + // This is a list rather than a vector so that the iterators are stable, even when items are + // added/removed from the list. This is important because Connection objects store an iterator + // internally, and may be created/destroyed arbitrarily. + std::list factories; + // This is a list rather than a vector because ScopedDisplayLink is non-moveable. + std::list links; + + FunctionNotificationCenterObserver screenParamsObserver { NSApplicationDidChangeScreenParametersNotification, + nullptr, + [this] { refreshScreens(); } }; +}; + +} // namespace juce diff --git a/modules/juce_gui_basics/native/juce_mac_Windowing.mm b/modules/juce_gui_basics/native/juce_mac_Windowing.mm index eb736ded..aaa892da 100644 --- a/modules/juce_gui_basics/native/juce_mac_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_mac_Windowing.mm @@ -446,13 +446,43 @@ Point MouseInputSource::getCurrentRawMousePosition() } } +static ComponentPeer* findPeerContainingPoint (Point globalPos) +{ + for (int i = 0; i < juce::ComponentPeer::getNumPeers(); ++i) + { + auto* peer = juce::ComponentPeer::getPeer (i); + + if (peer->contains (peer->globalToLocal (globalPos).toInt(), false)) + return peer; + } + + return nullptr; +} + void MouseInputSource::setRawMousePosition (Point newPosition) { + const auto oldPosition = Desktop::getInstance().getMainMouseSource().getRawScreenPosition(); + // this rubbish needs to be done around the warp call, to avoid causing a // bizarre glitch.. CGAssociateMouseAndMouseCursorPosition (false); CGWarpMouseCursorPosition (convertToCGPoint (newPosition)); CGAssociateMouseAndMouseCursorPosition (true); + + // Mouse enter and exit events seem to be always generated as a consequence of programmatically + // moving the mouse. However, when the mouse stays within the same peer no mouse move event is + // generated, and we lose track of the correct Component under the mouse. Hence, we need to + // generate this missing event here. + if (auto* peer = findPeerContainingPoint (newPosition); peer != nullptr + && peer == findPeerContainingPoint (oldPosition)) + { + peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, + peer->globalToLocal (newPosition), + ModifierKeys::currentModifiers, + 0.0f, + 0.0f, + Time::currentTimeMillis()); + } } double Desktop::getDefaultMasterScale() @@ -483,7 +513,11 @@ public: { static DelegateClass delegateClass; delegate.reset ([delegateClass.createInstance() init]); - observer.emplace (delegate.get(), darkModeSelector, @"AppleInterfaceThemeChangedNotification", nil); + observer.emplace (delegate.get(), + darkModeSelector, + @"AppleInterfaceThemeChangedNotification", + nil, + [NSDistributedNotificationCenter class]); } private: @@ -534,11 +568,11 @@ public: { PMAssertion() : assertionID (kIOPMNullAssertionID) { - IOReturn res = IOPMAssertionCreateWithName (kIOPMAssertionTypePreventUserIdleDisplaySleep, - kIOPMAssertionLevelOn, - CFSTR ("JUCE Playback"), - &assertionID); - jassert (res == kIOReturnSuccess); ignoreUnused (res); + [[maybe_unused]] IOReturn res = IOPMAssertionCreateWithName (kIOPMAssertionTypePreventUserIdleDisplaySleep, + kIOPMAssertionLevelOn, + CFSTR ("JUCE Playback"), + &assertionID); + jassert (res == kIOReturnSuccess); } ~PMAssertion() @@ -750,10 +784,9 @@ void Process::setDockIconVisible (bool isVisible) { ProcessSerialNumber psn { 0, kCurrentProcess }; - OSStatus err = TransformProcessType (&psn, isVisible ? kProcessTransformToForegroundApplication - : kProcessTransformToUIElementApplication); + [[maybe_unused]] OSStatus err = TransformProcessType (&psn, isVisible ? kProcessTransformToForegroundApplication + : kProcessTransformToUIElementApplication); jassert (err == 0); - ignoreUnused (err); } } // namespace juce diff --git a/modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp b/modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp index e64459fa..22432627 100644 --- a/modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp +++ b/modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp @@ -262,7 +262,7 @@ namespace DragAndDropHelpers JobStatus runJob() override { - ignoreUnused (OleInitialize (nullptr)); + [[maybe_unused]] const auto result = OleInitialize (nullptr); auto* source = new JuceDropSource(); auto* data = new JuceDataObject (&format, &medium); diff --git a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp index 4c3df9e4..31652605 100644 --- a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp @@ -515,7 +515,7 @@ private: struct ScopedCoInitialize { // IUnknown_GetWindow will only succeed when instantiated in a single-thread apartment - ScopedCoInitialize() { ignoreUnused (CoInitializeEx (nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)); } + ScopedCoInitialize() { [[maybe_unused]] const auto result = CoInitializeEx (nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); } ~ScopedCoInitialize() { CoUninitialize(); } }; diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index cb247722..6756cfd0 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -453,10 +453,9 @@ static bool isPerMonitorDPIAwareProcess() #endif } -static bool isPerMonitorDPIAwareWindow (HWND nativeWindow) +static bool isPerMonitorDPIAwareWindow ([[maybe_unused]] HWND nativeWindow) { #if ! JUCE_WIN_PER_MONITOR_DPI_AWARE - ignoreUnused (nativeWindow); return false; #else setDPIAwareness(); @@ -499,30 +498,97 @@ static double getGlobalDPI() return (GetDeviceCaps (deviceContext.dc, LOGPIXELSX) + GetDeviceCaps (deviceContext.dc, LOGPIXELSY)) / 2.0; } +//============================================================================== +class ScopedSuspendResumeNotificationRegistration +{ + static auto& getFunctions() + { + struct Functions + { + using Register = HPOWERNOTIFY (WINAPI*) (HANDLE, DWORD); + using Unregister = BOOL (WINAPI*) (HPOWERNOTIFY); + + Register registerNotification = (Register) getUser32Function ("RegisterSuspendResumeNotification"); + Unregister unregisterNotification = (Unregister) getUser32Function ("UnregisterSuspendResumeNotification"); + + bool isValid() const { return registerNotification != nullptr && unregisterNotification != nullptr; } + + Functions() = default; + JUCE_DECLARE_NON_COPYABLE (Functions) + JUCE_DECLARE_NON_MOVEABLE (Functions) + }; + + static const Functions functions; + return functions; + } + +public: + ScopedSuspendResumeNotificationRegistration() = default; + + explicit ScopedSuspendResumeNotificationRegistration (HWND window) + : handle (getFunctions().isValid() + ? getFunctions().registerNotification (window, DEVICE_NOTIFY_WINDOW_HANDLE) + : nullptr) + {} + +private: + struct Destructor + { + void operator() (HPOWERNOTIFY ptr) const + { + if (ptr != nullptr) + getFunctions().unregisterNotification (ptr); + } + }; + + std::unique_ptr, Destructor> handle; +}; + //============================================================================== class ScopedThreadDPIAwarenessSetter::NativeImpl { public: - explicit NativeImpl (HWND nativeWindow) + static auto& getFunctions() { - ignoreUnused (nativeWindow); + struct Functions + { + SetThreadDPIAwarenessContextFunc setThreadAwareness = (SetThreadDPIAwarenessContextFunc) getUser32Function ("SetThreadDpiAwarenessContext"); + GetWindowDPIAwarenessContextFunc getWindowAwareness = (GetWindowDPIAwarenessContextFunc) getUser32Function ("GetWindowDpiAwarenessContext"); + GetThreadDPIAwarenessContextFunc getThreadAwareness = (GetThreadDPIAwarenessContextFunc) getUser32Function ("GetThreadDpiAwarenessContext"); + GetAwarenessFromDpiAwarenessContextFunc getAwarenessFromContext = (GetAwarenessFromDpiAwarenessContextFunc) getUser32Function ("GetAwarenessFromDpiAwarenessContext"); + + bool isLoaded() const noexcept + { + return setThreadAwareness != nullptr + && getWindowAwareness != nullptr + && getThreadAwareness != nullptr + && getAwarenessFromContext != nullptr; + } + + Functions() = default; + JUCE_DECLARE_NON_COPYABLE (Functions) + JUCE_DECLARE_NON_MOVEABLE (Functions) + }; + static const Functions functions; + return functions; + } + + explicit NativeImpl (HWND nativeWindow [[maybe_unused]]) + { #if JUCE_WIN_PER_MONITOR_DPI_AWARE - if (auto* functionSingleton = FunctionSingleton::getInstance()) + if (const auto& functions = getFunctions(); functions.isLoaded()) { - if (! functionSingleton->isLoaded()) - return; - - auto dpiAwareWindow = (functionSingleton->getAwarenessFromContext (functionSingleton->getWindowAwareness (nativeWindow)) + auto dpiAwareWindow = (functions.getAwarenessFromContext (functions.getWindowAwareness (nativeWindow)) == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware); - auto dpiAwareThread = (functionSingleton->getAwarenessFromContext (functionSingleton->getThreadAwareness()) + auto dpiAwareThread = (functions.getAwarenessFromContext (functions.getThreadAwareness()) == DPI_Awareness::DPI_Awareness_Per_Monitor_Aware); if (dpiAwareWindow && ! dpiAwareThread) - oldContext = functionSingleton->setThreadAwareness (DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); + oldContext = functions.setThreadAwareness (DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); else if (! dpiAwareWindow && dpiAwareThread) - oldContext = functionSingleton->setThreadAwareness (DPI_AWARENESS_CONTEXT_UNAWARE); + oldContext = functions.setThreadAwareness (DPI_AWARENESS_CONTEXT_UNAWARE); } #endif } @@ -530,44 +596,16 @@ public: ~NativeImpl() { if (oldContext != nullptr) - if (auto* functionSingleton = FunctionSingleton::getInstance()) - functionSingleton->setThreadAwareness (oldContext); + getFunctions().setThreadAwareness (oldContext); } private: - struct FunctionSingleton : public DeletedAtShutdown - { - FunctionSingleton() = default; - ~FunctionSingleton() override { clearSingletonInstance(); } - - SetThreadDPIAwarenessContextFunc setThreadAwareness = (SetThreadDPIAwarenessContextFunc) getUser32Function ("SetThreadDpiAwarenessContext"); - GetWindowDPIAwarenessContextFunc getWindowAwareness = (GetWindowDPIAwarenessContextFunc) getUser32Function ("GetWindowDpiAwarenessContext"); - GetThreadDPIAwarenessContextFunc getThreadAwareness = (GetThreadDPIAwarenessContextFunc) getUser32Function ("GetThreadDpiAwarenessContext"); - GetAwarenessFromDpiAwarenessContextFunc getAwarenessFromContext = (GetAwarenessFromDpiAwarenessContextFunc) getUser32Function ("GetAwarenessFromDpiAwarenessContext"); - - bool isLoaded() const noexcept - { - return setThreadAwareness != nullptr - && getWindowAwareness != nullptr - && getThreadAwareness != nullptr - && getAwarenessFromContext != nullptr; - } - - JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (FunctionSingleton) - - JUCE_DECLARE_NON_COPYABLE (FunctionSingleton) - JUCE_DECLARE_NON_MOVEABLE (FunctionSingleton) - }; - DPI_AWARENESS_CONTEXT oldContext = nullptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeImpl) JUCE_DECLARE_NON_MOVEABLE (NativeImpl) }; - -JUCE_IMPLEMENT_SINGLETON (ScopedThreadDPIAwarenessSetter::NativeImpl::FunctionSingleton) - ScopedThreadDPIAwarenessSetter::ScopedThreadDPIAwarenessSetter (void* nativeWindow) { pimpl = std::make_unique ((HWND) nativeWindow); @@ -575,17 +613,31 @@ ScopedThreadDPIAwarenessSetter::ScopedThreadDPIAwarenessSetter (void* nativeWind ScopedThreadDPIAwarenessSetter::~ScopedThreadDPIAwarenessSetter() = default; +static auto& getScopedDPIAwarenessDisablerFunctions() +{ + struct Functions + { + GetThreadDPIAwarenessContextFunc localGetThreadDpiAwarenessContext = (GetThreadDPIAwarenessContextFunc) getUser32Function ("GetThreadDpiAwarenessContext"); + GetAwarenessFromDpiAwarenessContextFunc localGetAwarenessFromDpiAwarenessContextFunc = (GetAwarenessFromDpiAwarenessContextFunc) getUser32Function ("GetAwarenessFromDpiAwarenessContext"); + SetThreadDPIAwarenessContextFunc localSetThreadDPIAwarenessContext = (SetThreadDPIAwarenessContextFunc) getUser32Function ("SetThreadDpiAwarenessContext"); + + Functions() = default; + JUCE_DECLARE_NON_COPYABLE (Functions) + JUCE_DECLARE_NON_MOVEABLE (Functions) + }; + + static const Functions functions; + return functions; +} + ScopedDPIAwarenessDisabler::ScopedDPIAwarenessDisabler() { - static auto localGetThreadDpiAwarenessContext = (GetThreadDPIAwarenessContextFunc) getUser32Function ("GetThreadDpiAwarenessContext"); - static auto localGetAwarenessFromDpiAwarenessContextFunc = (GetAwarenessFromDpiAwarenessContextFunc) getUser32Function ("GetAwarenessFromDpiAwarenessContext"); + const auto& functions = getScopedDPIAwarenessDisablerFunctions(); - if (! isPerMonitorDPIAwareThread (localGetThreadDpiAwarenessContext, localGetAwarenessFromDpiAwarenessContextFunc)) + if (! isPerMonitorDPIAwareThread (functions.localGetThreadDpiAwarenessContext, functions.localGetAwarenessFromDpiAwarenessContextFunc)) return; - static auto localSetThreadDPIAwarenessContext = (SetThreadDPIAwarenessContextFunc) getUser32Function ("SetThreadDpiAwarenessContext"); - - if (localSetThreadDPIAwarenessContext != nullptr) + if (auto* localSetThreadDPIAwarenessContext = functions.localSetThreadDPIAwarenessContext) { previousContext = localSetThreadDPIAwarenessContext (DPI_AWARENESS_CONTEXT_UNAWARE); @@ -599,9 +651,7 @@ ScopedDPIAwarenessDisabler::~ScopedDPIAwarenessDisabler() { if (previousContext != nullptr) { - static auto localSetThreadDPIAwarenessContext = (SetThreadDPIAwarenessContextFunc) getUser32Function ("SetThreadDpiAwarenessContext"); - - if (localSetThreadDPIAwarenessContext != nullptr) + if (auto* localSetThreadDPIAwarenessContext = getScopedDPIAwarenessDisablerFunctions().localSetThreadDPIAwarenessContext) localSetThreadDPIAwarenessContext ((DPI_AWARENESS_CONTEXT) previousContext); #if JUCE_DEBUG @@ -663,17 +713,7 @@ JUCE_API double getScaleFactorForWindow (HWND h) { // NB. Using a local function here because we need to call this method from the plug-in wrappers // which don't load the DPI-awareness functions on startup - static GetDPIForWindowFunc localGetDPIForWindow = nullptr; - - static bool hasChecked = false; - - if (! hasChecked) - { - hasChecked = true; - - if (localGetDPIForWindow == nullptr) - localGetDPIForWindow = (GetDPIForWindowFunc) getUser32Function ("GetDpiForWindow"); - } + static auto localGetDPIForWindow = (GetDPIForWindowFunc) getUser32Function ("GetDpiForWindow"); if (localGetDPIForWindow != nullptr) return (double) localGetDPIForWindow (h) / USER_DEFAULT_SCREEN_DPI; @@ -1113,6 +1153,13 @@ Image createSnapshotOfNativeWindow (void* nativeWindowHandle) //============================================================================== namespace IconConverters { + struct IconDestructor + { + void operator() (HICON ptr) const { if (ptr != nullptr) DestroyIcon (ptr); } + }; + + using IconPtr = std::unique_ptr, IconDestructor>; + static Image createImageFromHICON (HICON icon) { if (icon == nullptr) @@ -1381,10 +1428,7 @@ static HMONITOR getMonitorFromOutput (ComSmartPtr output) : desc.Monitor; } -struct VBlankListener -{ - virtual void onVBlank() = 0; -}; +using VBlankListener = ComponentPeer::VBlankListener; //============================================================================== class VSyncThread : private Thread, @@ -1399,7 +1443,7 @@ public: monitor (mon) { listeners.push_back (listener); - startThread (10); + startThread (Priority::highest); } ~VSyncThread() override @@ -1615,6 +1659,31 @@ private: JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher) +//============================================================================== +class SimpleTimer : private Timer +{ +public: + SimpleTimer (int intervalMs, std::function callbackIn) + : callback (std::move (callbackIn)) + { + jassert (callback); + startTimer (intervalMs); + } + + ~SimpleTimer() override + { + stopTimer(); + } + +private: + void timerCallback() override + { + callback(); + } + + std::function callback; +}; + //============================================================================== class HWNDComponentPeer : public ComponentPeer, private VBlankListener, @@ -1656,12 +1725,18 @@ public: return ModifierKeys::currentModifiers; }; - if (updateCurrentMonitor()) - VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor); + updateCurrentMonitorAndRefreshVBlankDispatcher(); + + if (parentToAddTo != nullptr) + monitorUpdateTimer.emplace (1000, [this] { updateCurrentMonitorAndRefreshVBlankDispatcher(); }); + + suspendResumeRegistration = ScopedSuspendResumeNotificationRegistration { hwnd }; } ~HWNDComponentPeer() override { + suspendResumeRegistration = {}; + VBlankDispatcher::getInstance()->removeListener (*this); // do this first to avoid messages arriving for this window before it's destroyed @@ -1675,9 +1750,6 @@ public: callFunctionIfNotLocked (&destroyWindowCallback, (void*) hwnd); - if (currentWindowIcon != nullptr) - DestroyIcon (currentWindowIcon); - if (dropTarget != nullptr) { dropTarget->peerIsDeleted = true; @@ -2072,6 +2144,7 @@ public: //============================================================================== void onVBlank() override { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); dispatchDeferredRepaints(); } @@ -2223,8 +2296,7 @@ public: nameBuffer.clear(); nameBuffer.resize (bufferSize + 1, 0); // + 1 for the null terminator - const auto readCharacters = DragQueryFile (dropFiles, i, nameBuffer.data(), (UINT) nameBuffer.size()); - ignoreUnused (readCharacters); + [[maybe_unused]] const auto readCharacters = DragQueryFile (dropFiles, i, nameBuffer.data(), (UINT) nameBuffer.size()); jassert (readCharacters == bufferSize); dragInfo.files.add (String (nameBuffer.data())); @@ -2315,7 +2387,7 @@ private: bool fullScreen = false, isDragging = false, isMouseOver = false, hasCreatedCaret = false, constrainerIsResizing = false; BorderSize windowBorder; - HICON currentWindowIcon = nullptr; + IconConverters::IconPtr currentWindowIcon; FileDropTarget* dropTarget = nullptr; uint8 updateLayeredWindowAlpha = 255; UWPUIViewSettings uwpViewSettings; @@ -2377,7 +2449,6 @@ private: TCHAR moduleFile[1024] = {}; GetModuleFileName (moduleHandle, moduleFile, 1024); - WORD iconNum = 0; WNDCLASSEX wcex = {}; wcex.cbSize = sizeof (wcex); @@ -2386,9 +2457,13 @@ private: wcex.lpszClassName = windowClassName.toWideCharPointer(); wcex.cbWndExtra = 32; wcex.hInstance = moduleHandle; - wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); - iconNum = 1; - wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); + + for (const auto& [index, field, ptr] : { std::tuple { 0, &wcex.hIcon, &iconBig }, + std::tuple { 1, &wcex.hIconSm, &iconSmall } }) + { + auto iconNum = static_cast (index); + ptr->reset (*field = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum)); + } atom = RegisterClassEx (&wcex); jassert (atom != 0); @@ -2483,6 +2558,8 @@ private: return false; } + IconConverters::IconPtr iconBig, iconSmall; + JUCE_DECLARE_NON_COPYABLE (WindowClassHolder) }; @@ -2668,15 +2745,11 @@ private: void setIcon (const Image& newIcon) override { - if (auto hicon = IconConverters::createHICONFromImage (newIcon, TRUE, 0, 0)) + if (IconConverters::IconPtr hicon { IconConverters::createHICONFromImage (newIcon, TRUE, 0, 0) }) { - SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); - SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon); - - if (currentWindowIcon != nullptr) - DestroyIcon (currentWindowIcon); - - currentWindowIcon = hicon; + SendMessage (hwnd, WM_SETICON, ICON_BIG, reinterpret_cast (hicon.get())); + SendMessage (hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast (hicon.get())); + currentWindowIcon = std::move (hicon); } } @@ -2684,7 +2757,9 @@ private: { using ChangeWindowMessageFilterExFunc = BOOL (WINAPI*) (HWND, UINT, DWORD, PVOID); - if (auto changeMessageFilter = (ChangeWindowMessageFilterExFunc) getUser32Function ("ChangeWindowMessageFilterEx")) + static auto changeMessageFilter = (ChangeWindowMessageFilterExFunc) getUser32Function ("ChangeWindowMessageFilterEx"); + + if (changeMessageFilter != nullptr) { changeMessageFilter (hwnd, WM_DROPFILES, 1 /*MSGFLT_ALLOW*/, nullptr); changeMessageFilter (hwnd, WM_COPYDATA, 1 /*MSGFLT_ALLOW*/, nullptr); @@ -2811,7 +2886,7 @@ private: CombineRgn (rgn, rgn, clipRgn, RGN_AND); DeleteObject (clipRgn); - std::aligned_storage<8192, alignof (RGNDATA)>::type rgnData; + std::aligned_storage_t<8192, alignof (RGNDATA)> rgnData; const DWORD res = GetRegionData (rgn, sizeof (rgnData), (RGNDATA*) &rgnData); if (res > 0 && res <= sizeof (rgnData)) @@ -2909,10 +2984,8 @@ private: } #endif - void setCurrentRenderingEngine (int index) override + void setCurrentRenderingEngine ([[maybe_unused]] int index) override { - ignoreUnused (index); - #if JUCE_DIRECT2D if (getAvailableRenderingEngines().size() > 1) { @@ -3481,7 +3554,7 @@ private: const UINT keyChar = MapVirtualKey ((UINT) key, 2); const UINT scanCode = MapVirtualKey ((UINT) key, 0); BYTE keyState[256]; - ignoreUnused (GetKeyboardState (keyState)); + [[maybe_unused]] const auto state = GetKeyboardState (keyState); WCHAR text[16] = { 0 }; if (ToUnicode ((UINT) key, scanCode, keyState, text, 8, 0) != 1) @@ -3649,10 +3722,18 @@ private: return 0; } - bool updateCurrentMonitor() + enum class ForceRefreshDispatcher + { + no, + yes + }; + + void updateCurrentMonitorAndRefreshVBlankDispatcher (ForceRefreshDispatcher force = ForceRefreshDispatcher::no) { auto monitor = MonitorFromWindow (hwnd, MONITOR_DEFAULTTONULL); - return std::exchange (currentMonitor, monitor) != monitor; + + if (std::exchange (currentMonitor, monitor) != monitor || force == ForceRefreshDispatcher::yes) + VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor); } bool handlePositionChanged() @@ -3671,9 +3752,7 @@ private: } handleMovedOrResized(); - - if (updateCurrentMonitor()) - VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor); + updateCurrentMonitorAndRefreshVBlankDispatcher(); return ! dontRepaint; // to allow non-accelerated openGL windows to draw themselves correctly. } @@ -3831,8 +3910,7 @@ private: auto* dispatcher = VBlankDispatcher::getInstance(); dispatcher->reconfigureDisplays(); - updateCurrentMonitor(); - dispatcher->updateDisplay (*this, currentMonitor); + updateCurrentMonitorAndRefreshVBlankDispatcher (ForceRefreshDispatcher::yes); } //============================================================================== @@ -4598,6 +4676,8 @@ private: bool shouldIgnoreModalDismiss = false; RectangleList deferredRepaints; + ScopedSuspendResumeNotificationRegistration suspendResumeRegistration; + std::optional monitorUpdateTimer; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponentPeer) @@ -5367,27 +5447,23 @@ void Displays::findDisplays (float masterScale) } //============================================================================== -static HICON extractFileHICON (const File& file) +static auto extractFileHICON (const File& file) { WORD iconNum = 0; WCHAR name[MAX_PATH * 2]; file.getFullPathName().copyToUTF16 (name, sizeof (name)); - return ExtractAssociatedIcon ((HINSTANCE) Process::getCurrentModuleInstanceHandle(), - name, &iconNum); + return IconConverters::IconPtr { ExtractAssociatedIcon ((HINSTANCE) Process::getCurrentModuleInstanceHandle(), + name, + &iconNum) }; } Image juce_createIconForFile (const File& file) { - Image image; + if (const auto icon = extractFileHICON (file)) + return IconConverters::createImageFromHICON (icon.get()); - if (auto icon = extractFileHICON (file)) - { - image = IconConverters::createImageFromHICON (icon); - DestroyIcon (icon); - } - - return image; + return {}; } //============================================================================== @@ -5435,12 +5511,6 @@ private: public: explicit ImageImpl (const CustomMouseCursorInfo& infoIn) : info (infoIn) {} - ~ImageImpl() override - { - for (auto& pair : cursorsBySize) - DestroyCursor (pair.second); - } - HCURSOR getCursor (ComponentPeer& peer) override { JUCE_ASSERT_MESSAGE_THREAD; @@ -5451,7 +5521,7 @@ private: const auto iter = cursorsBySize.find (size); if (iter != cursorsBySize.end()) - return iter->second; + return iter->second.get(); const auto logicalSize = info.image.getScaledBounds(); const auto scale = (float) size / (float) unityCursorSize; @@ -5466,12 +5536,19 @@ private: const auto hx = jlimit (0, rescaled.getWidth(), roundToInt ((float) info.hotspot.x * effectiveScale)); const auto hy = jlimit (0, rescaled.getHeight(), roundToInt ((float) info.hotspot.y * effectiveScale)); - return cursorsBySize.emplace (size, IconConverters::createHICONFromImage (rescaled, false, hx, hy)).first->second; + return cursorsBySize.emplace (size, CursorPtr { IconConverters::createHICONFromImage (rescaled, false, hx, hy) }).first->second.get(); } private: + struct CursorDestructor + { + void operator() (HCURSOR ptr) const { if (ptr != nullptr) DestroyCursor (ptr); } + }; + + using CursorPtr = std::unique_ptr, CursorDestructor>; + const CustomMouseCursorInfo info; - std::map cursorsBySize; + std::map cursorsBySize; }; static auto getCursorSizeForPeerFunction() -> int (*) (ComponentPeer&) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h b/modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h new file mode 100644 index 00000000..82b90388 --- /dev/null +++ b/modules/juce_gui_basics/native/x11/juce_linux_ScopedWindowAssociation.h @@ -0,0 +1,118 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +extern XContext windowHandleXContext; + +/* Attaches a pointer to a given window, so that it can be retrieved with XFindContext on + the windowHandleXContext. +*/ +class ScopedWindowAssociation +{ +public: + ScopedWindowAssociation() = default; + + ScopedWindowAssociation (void* associatedIn, Window windowIn) + : associatedPointer ([&]() -> void* + { + if (associatedIn == nullptr) + return nullptr; + + // If you hit this, there's already a pointer associated with this window. + const auto display = XWindowSystem::getInstance()->getDisplay(); + jassert (! getAssociatedPointer (display, windowIn).has_value()); + + if (X11Symbols::getInstance()->xSaveContext (display, + static_cast (windowIn), + windowHandleXContext, + unalignedPointerCast (associatedIn)) != 0) + { + jassertfalse; + return nullptr; + } + + return associatedIn; + }()), + window (static_cast (windowIn)) {} + + ScopedWindowAssociation (const ScopedWindowAssociation&) = delete; + ScopedWindowAssociation& operator= (const ScopedWindowAssociation&) = delete; + + ScopedWindowAssociation (ScopedWindowAssociation&& other) noexcept + : associatedPointer (std::exchange (other.associatedPointer, nullptr)), window (other.window) {} + + ScopedWindowAssociation& operator= (ScopedWindowAssociation&& other) noexcept + { + ScopedWindowAssociation { std::move (other) }.swap (*this); + return *this; + } + + ~ScopedWindowAssociation() noexcept + { + if (associatedPointer == nullptr) + return; + + const auto display = XWindowSystem::getInstance()->getDisplay(); + const auto ptr = getAssociatedPointer (display, window); + + if (! ptr.has_value()) + { + // If you hit this, something else has cleared this association before we were able to. + jassertfalse; + return; + } + + jassert (unalignedPointerCast (associatedPointer) == *ptr); + + if (X11Symbols::getInstance()->xDeleteContext (display, window, windowHandleXContext) != 0) + jassertfalse; + } + + bool isValid() const { return associatedPointer != nullptr; } + +private: + static std::optional getAssociatedPointer (Display* display, Window window) + { + XPointer ptr{}; + + if (X11Symbols::getInstance()->xFindContext (display, window, windowHandleXContext, &ptr) != 0) + return std::nullopt; + + return ptr; + } + + void swap (ScopedWindowAssociation& other) noexcept + { + std::swap (other.associatedPointer, associatedPointer); + std::swap (other.window, window); + } + + void* associatedPointer = nullptr; + XID window{}; +}; + +} // namespace juce diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index da1a2730..6103b744 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -361,10 +361,8 @@ namespace X11ErrorHandling return 0; } - static int errorHandler (::Display* display, XErrorEvent* event) + static int errorHandler ([[maybe_unused]] ::Display* display, [[maybe_unused]] XErrorEvent* event) { - ignoreUnused (display, event); - #if JUCE_DEBUG_XERRORS char errorStr[64] = { 0 }; char requestStr[64] = { 0 }; @@ -1434,15 +1432,21 @@ ComponentPeer* getPeerFor (::Window windowH) if (windowH == 0) return nullptr; - XPointer peer = nullptr; - if (auto* display = XWindowSystem::getInstance()->getDisplay()) { XWindowSystemUtilities::ScopedXLock xLock; - X11Symbols::getInstance()->xFindContext (display, (XID) windowH, windowHandleXContext, &peer); + + if (XPointer peer = nullptr; + X11Symbols::getInstance()->xFindContext (display, + static_cast (windowH), + windowHandleXContext, + &peer) == 0) + { + return unalignedPointerCast (peer); + } } - return unalignedPointerCast (peer); + return nullptr; } //============================================================================== @@ -1545,7 +1549,7 @@ static int getAllEventsMask (bool ignoresMouseClicks) &swa); // Set the window context to identify the window handle object - if (X11Symbols::getInstance()->xSaveContext (display, (XID) windowH, windowHandleXContext, (XPointer) peer)) + if (! peer->setWindowAssociation (windowH)) { // Failed jassertfalse; @@ -1627,10 +1631,7 @@ void XWindowSystem::destroyWindow (::Window windowH) XWindowSystemUtilities::ScopedXLock xLock; - XPointer handlePointer; - - if (! X11Symbols::getInstance()->xFindContext (display, (XID) windowH, windowHandleXContext, &handlePointer)) - X11Symbols::getInstance()->xDeleteContext (display, (XID) windowH, windowHandleXContext); + peer->clearWindowAssociation(); X11Symbols::getInstance()->xDestroyWindow (display, windowH); @@ -2565,6 +2566,22 @@ Array XWindowSystem::findDisplays (float masterScale) const d.isMain = (mainDisplay == screens->outputs[j]) && (i == 0); d.dpi = DisplayHelpers::getDisplayDPI (display, 0); + d.verticalFrequencyHz = [&]() -> std::optional + { + if (crtc->mode != None) + { + if (auto it = std::find_if (screens->modes, + screens->modes + screens->nmode, + [&crtc] (const auto& m) { return m.id == crtc->mode; }); + it != screens->modes + screens->nmode) + { + return (double) it->dotClock / ((double) it->hTotal * (double) it->vTotal); + } + } + + return {}; + }(); + // The raspberry pi returns a zero sized display, so we need to guard for divide-by-zero if (output->mm_width > 0 && output->mm_height > 0) d.dpi = ((static_cast (crtc->width) * 25.4 * 0.5) / static_cast (output->mm_width)) @@ -2666,7 +2683,7 @@ Array XWindowSystem::findDisplays (float masterScale) const return displays; } -::Window XWindowSystem::createKeyProxy (::Window windowH) const +::Window XWindowSystem::createKeyProxy (::Window windowH) { jassert (windowH != 0); @@ -2680,7 +2697,6 @@ Array XWindowSystem::findDisplays (float masterScale) const &swa); X11Symbols::getInstance()->xMapWindow (display, keyProxy); - X11Symbols::getInstance()->xSaveContext (display, (XID) keyProxy, windowHandleXContext, (XPointer) this); return keyProxy; } @@ -2689,11 +2705,6 @@ void XWindowSystem::deleteKeyProxy (::Window keyProxy) const { jassert (keyProxy != 0); - XPointer handlePointer; - - if (! X11Symbols::getInstance()->xFindContext (display, (XID) keyProxy, windowHandleXContext, &handlePointer)) - X11Symbols::getInstance()->xDeleteContext (display, (XID) keyProxy, windowHandleXContext); - X11Symbols::getInstance()->xDestroyWindow (display, keyProxy); X11Symbols::getInstance()->xSync (display, false); @@ -3129,6 +3140,12 @@ XWindowSystem::VisualAndDepth XWindowSystem::DisplayVisuals::getBestVisualForWin if (visual24Bit != nullptr) return { visual24Bit, 24 }; + if (visual32Bit != nullptr) + return { visual32Bit, 32 }; + + // No visual available! + jassert (visual16Bit != nullptr); + return { visual16Bit, 16 }; } diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h index 0659adbe..7fd30a84 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h @@ -225,7 +225,7 @@ public: Array findDisplays (float masterScale) const; - ::Window createKeyProxy (::Window) const; + ::Window createKeyProxy (::Window); void deleteKeyProxy (::Window) const; bool externalDragFileInit (LinuxComponentPeer*, const StringArray& files, bool canMove, std::function&& callback) const; diff --git a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp index e0ff54a4..b6f26545 100644 --- a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp @@ -630,6 +630,9 @@ void ComboBox::handleAsyncUpdate() if (onChange != nullptr) onChange(); + if (checker.shouldBailOut()) + return; + if (auto* handler = getAccessibilityHandler()) handler->notifyAccessibilityEvent (AccessibilityEvent::valueChanged); } diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index f58f2f81..43700aa3 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -525,7 +525,7 @@ ListBox::ListBox (const String& name, ListBoxModel* const m) setFocusContainerType (FocusContainerType::focusContainer); colourChanged(); - setModel (m); + assignModelPtr (m); } ListBox::~ListBox() @@ -1207,9 +1207,8 @@ std::unique_ptr ListBox::createAccessibilityHandler() } //============================================================================== -Component* ListBoxModel::refreshComponentForRow (int, bool, Component* existingComponentToUpdate) +Component* ListBoxModel::refreshComponentForRow (int, bool, [[maybe_unused]] Component* existingComponentToUpdate) { - ignoreUnused (existingComponentToUpdate); jassert (existingComponentToUpdate == nullptr); // indicates a failure in the code that recycles the components return nullptr; } diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index d1182ec9..58e59318 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -221,7 +221,6 @@ public: updateText(); owner.repaint(); - updatePopupDisplay (newValue); triggerChangeMessage (notification); } @@ -255,7 +254,7 @@ public: lastValueMin = newValue; valueMin = newValue; owner.repaint(); - updatePopupDisplay (newValue); + updatePopupDisplay(); triggerChangeMessage (notification); } @@ -289,7 +288,7 @@ public: lastValueMax = newValue; valueMax = newValue; owner.repaint(); - updatePopupDisplay (valueMax.getValue()); + updatePopupDisplay(); triggerChangeMessage (notification); } @@ -363,6 +362,9 @@ public: if (owner.onValueChange != nullptr) owner.onValueChange(); + if (checker.shouldBailOut()) + return; + if (auto* handler = owner.getAccessibilityHandler()) handler->notifyAccessibilityEvent (AccessibilityEvent::valueChanged); } @@ -453,6 +455,8 @@ public: if (newValue != valueBox->getText()) valueBox->setText (newValue, dontSendNotification); } + + updatePopupDisplay(); } double constrainedValue (double value) const @@ -1061,25 +1065,36 @@ public: | ComponentPeer::windowIgnoresKeyPresses | ComponentPeer::windowIgnoresMouseClicks); - if (style == SliderStyle::TwoValueHorizontal - || style == SliderStyle::TwoValueVertical) - { - updatePopupDisplay (sliderBeingDragged == 2 ? getMaxValue() - : getMinValue()); - } - else - { - updatePopupDisplay (getValue()); - } - + updatePopupDisplay(); popupDisplay->setVisible (true); } } - void updatePopupDisplay (double valueToShow) + void updatePopupDisplay() { - if (popupDisplay != nullptr) - popupDisplay->updatePosition (owner.getTextFromValue (valueToShow)); + if (popupDisplay == nullptr) + return; + + const auto valueToShow = [this] + { + constexpr SliderStyle multiSliderStyles[] { SliderStyle::TwoValueHorizontal, + SliderStyle::TwoValueVertical, + SliderStyle::ThreeValueHorizontal, + SliderStyle::ThreeValueVertical }; + + if (std::find (std::begin (multiSliderStyles), std::end (multiSliderStyles), style) == std::end (multiSliderStyles)) + return getValue(); + + if (sliderBeingDragged == 2) + return getMaxValue(); + + if (sliderBeingDragged == 1) + return getMinValue(); + + return getValue(); + }(); + + popupDisplay->updatePosition (owner.getTextFromValue (valueToShow)); } bool canDoubleClickToValue() const diff --git a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp index 4dc53dc3..11075ace 100644 --- a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp @@ -500,6 +500,33 @@ void TableHeaderComponent::reactToMenuItem (const int menuReturnId, const int /* setColumnVisible (menuReturnId, ! isColumnVisible (menuReturnId)); } +void TableHeaderComponent::drawColumnHeader (Graphics& g, LookAndFeel& lf, const ColumnInfo& ci) +{ + // Only paint columns that are visible + if (! ci.isVisible()) + return; + + // If this column is being dragged, it shouldn't be drawn in the table header + if (ci.id == columnIdBeingDragged && dragOverlayComp != nullptr && dragOverlayComp->isVisible()) + return; + + // There's no point drawing this column header if no part of it is visible + if (! g.getClipBounds() + .getHorizontalRange() + .intersects (Range::withStartAndLength (ci.getX(), ci.width))) + return; + + Graphics::ScopedSaveState ss (g); + + g.setOrigin (ci.getX(), ci.getY()); + g.reduceClipRegion (0, 0, ci.width, ci.getHeight()); + + lf.drawTableHeaderColumn (g, *this, ci.getTitle(), ci.id, ci.width, getHeight(), + ci.id == columnIdUnderMouse, + ci.id == columnIdUnderMouse && isMouseButtonDown(), + ci.propertyFlags); +} + void TableHeaderComponent::paint (Graphics& g) { auto& lf = getLookAndFeel(); @@ -507,48 +534,18 @@ void TableHeaderComponent::paint (Graphics& g) lf.drawTableHeaderBackground (g, *this); for (auto* ci : columns) - { - if (ci->isVisible() && ci->getWidth() > 0) - { - Graphics::ScopedSaveState ss (g); - - g.setOrigin (ci->getX(), ci->getY()); - g.reduceClipRegion (0, 0, ci->getWidth(), ci->getHeight()); - - lf.drawTableHeaderColumn (g, *this, ci->getTitle(), ci->id, ci->width, getHeight(), - ci->id == columnIdUnderMouse, - ci->id == columnIdUnderMouse && isMouseButtonDown(), - ci->propertyFlags); - } - } + drawColumnHeader (g, lf, *ci); } void TableHeaderComponent::resized() { - auto clip = getBounds(); - int x = 0; - for (auto* ci : columns) - ci->setBounds (0, 0, 0, 0); - for (auto* ci : columns) { - if (ci->isVisible()) - { - if (x + ci->width > clip.getX() - && (ci->id != columnIdBeingDragged - || dragOverlayComp == nullptr - || ! dragOverlayComp->isVisible())) - { - ci->setBounds (x, 0, ci->width, getHeight()); - } - - x += ci->width; - - if (x >= clip.getRight()) - break; - } + const auto widthToUse = ci->isVisible() ? ci->width : 0; + ci->setBounds (x, 0, widthToUse, getHeight()); + x += widthToUse; } } diff --git a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h index 3d1b0173..5afa5a38 100644 --- a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h +++ b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h @@ -453,6 +453,7 @@ private: void updateColumnUnderMouse (const MouseEvent&); void setColumnUnderMouse (int columnId); void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth); + void drawColumnHeader (Graphics&, LookAndFeel&, const ColumnInfo&); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TableHeaderComponent) }; diff --git a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp index b332e5dc..00cd8c79 100644 --- a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp @@ -725,9 +725,8 @@ void TableListBoxModel::listWasScrolled() {} String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return {}; } var TableListBoxModel::getDragSourceDescription (const SparseSet&) { return {}; } -Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) +Component* TableListBoxModel::refreshComponentForCell (int, int, bool, [[maybe_unused]] Component* existingComponentToUpdate) { - ignoreUnused (existingComponentToUpdate); jassert (existingComponentToUpdate == nullptr); // indicates a failure in the code that recycles the components return nullptr; } diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index 10a09d3a..79be3ecc 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -944,13 +944,14 @@ TextEditor::TextEditor (const String& name, juce_wchar passwordChar) setWantsKeyboardFocus (true); recreateCaret(); - - juce::Desktop::getInstance().addGlobalMouseListener (this); } TextEditor::~TextEditor() { - juce::Desktop::getInstance().removeGlobalMouseListener (this); + giveAwayKeyboardFocus(); + + if (auto* peer = getPeer()) + peer->refreshTextInputTarget(); textValue.removeListener (textHolder); textValue.referTo (Value()); @@ -1046,7 +1047,7 @@ bool TextEditor::isReadOnly() const noexcept bool TextEditor::isTextInputActive() const { - return ! isReadOnly() && (! clicksOutsideDismissVirtualKeyboard || mouseDownInEditor); + return ! isReadOnly() && (! clicksOutsideDismissVirtualKeyboard || globalMouseListener.lastMouseDownInEditor()); } void TextEditor::setReturnKeyStartsNewLine (bool shouldStartNewLine) @@ -1244,7 +1245,7 @@ void TextEditor::setText (const String& newText, bool sendTextChangeMessage) textValue = newText; auto oldCursorPos = caretPosition; - bool cursorWasAtEnd = oldCursorPos >= getTotalNumChars(); + auto cursorWasAtEnd = oldCursorPos >= getTotalNumChars(); clearInternal (nullptr); insert (newText, 0, currentFont, findColour (textColourId), nullptr, caretPosition); @@ -1380,26 +1381,23 @@ void TextEditor::repaintText (Range range) } //============================================================================== -void TextEditor::moveCaret (int newCaretPos) +void TextEditor::moveCaret (const int newCaretPos) { - if (newCaretPos < 0) - newCaretPos = 0; - else - newCaretPos = jmin (newCaretPos, getTotalNumChars()); + const auto clamped = std::clamp (newCaretPos, 0, getTotalNumChars()); - if (newCaretPos != getCaretPosition()) - { - caretPosition = newCaretPos; + if (clamped == getCaretPosition()) + return; - if (hasKeyboardFocus (false)) - textHolder->restartTimer(); + caretPosition = clamped; - scrollToMakeSureCursorIsVisible(); - updateCaretPosition(); + if (hasKeyboardFocus (false)) + textHolder->restartTimer(); - if (auto* handler = getAccessibilityHandler()) - handler->notifyAccessibilityEvent (AccessibilityEvent::textChanged); - } + scrollToMakeSureCursorIsVisible(); + updateCaretPosition(); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::textChanged); } int TextEditor::getCaretPosition() const @@ -1654,15 +1652,11 @@ int TextEditor::getCharIndexForPoint (const Point point) const void TextEditor::insertTextAtCaret (const String& t) { - String newText (inputFilter != nullptr ? inputFilter->filterNewText (*this, t) : t); - - if (isMultiLine()) - newText = newText.replace ("\r\n", "\n"); - else - newText = newText.replaceCharacters ("\r\n", " "); - - const int insertIndex = selection.getStart(); - const int newCaretPos = insertIndex + newText.length(); + const auto filtered = inputFilter != nullptr ? inputFilter->filterNewText (*this, t) : t; + const auto newText = isMultiLine() ? filtered.replace ("\r\n", "\n") + : filtered.replaceCharacters ("\r\n", " "); + const auto insertIndex = selection.getStart(); + const auto newCaretPos = insertIndex + newText.length(); remove (selection, getUndoManager(), newText.isNotEmpty() ? newCaretPos - 1 : newCaretPos); @@ -1851,11 +1845,6 @@ void TextEditor::performPopupMenuAction (const int menuItemID) //============================================================================== void TextEditor::mouseDown (const MouseEvent& e) { - mouseDownInEditor = e.originalComponent == this; - - if (! mouseDownInEditor) - return; - beginDragAutoRepeat (100); newTransaction(); @@ -1893,9 +1882,6 @@ void TextEditor::mouseDown (const MouseEvent& e) void TextEditor::mouseDrag (const MouseEvent& e) { - if (! mouseDownInEditor) - return; - if (wasFocused || ! selectAllTextWhenFocused) if (! (popupMenuEnabled && e.mods.isPopupMenu())) moveCaretTo (getTextIndexAt (e.getPosition()), true); @@ -1903,9 +1889,6 @@ void TextEditor::mouseDrag (const MouseEvent& e) void TextEditor::mouseUp (const MouseEvent& e) { - if (! mouseDownInEditor) - return; - newTransaction(); textHolder->restartTimer(); @@ -1918,9 +1901,6 @@ void TextEditor::mouseUp (const MouseEvent& e) void TextEditor::mouseDoubleClick (const MouseEvent& e) { - if (! mouseDownInEditor) - return; - int tokenEnd = getTextIndexAt (e.getPosition()); int tokenStart = 0; @@ -1987,9 +1967,6 @@ void TextEditor::mouseDoubleClick (const MouseEvent& e) void TextEditor::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) { - if (! mouseDownInEditor) - return; - if (! viewport->useMouseWheelMoveIfNeeded (e, wheel)) Component::mouseWheelMove (e, wheel); } @@ -2036,7 +2013,13 @@ bool TextEditor::moveCaretUp (bool selecting) return moveCaretToStartOfLine (selecting); const auto caretPos = (getCaretRectangle() - getTextOffset()).toFloat(); - return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getY() - 1.0f), selecting); + + const auto newY = caretPos.getY() - 1.0f; + + if (newY < 0.0f) + return moveCaretToStartOfLine (selecting); + + return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), newY), selecting); } bool TextEditor::moveCaretDown (bool selecting) @@ -2283,24 +2266,24 @@ void TextEditor::handleCommandMessage (const int commandId) case TextEditorDefs::textChangeMessageId: listeners.callChecked (checker, [this] (Listener& l) { l.textEditorTextChanged (*this); }); - if (! checker.shouldBailOut() && onTextChange != nullptr) - onTextChange(); + if (! checker.shouldBailOut()) + NullCheckedInvocation::invoke (onTextChange); break; case TextEditorDefs::returnKeyMessageId: listeners.callChecked (checker, [this] (Listener& l) { l.textEditorReturnKeyPressed (*this); }); - if (! checker.shouldBailOut() && onReturnKey != nullptr) - onReturnKey(); + if (! checker.shouldBailOut()) + NullCheckedInvocation::invoke (onReturnKey); break; case TextEditorDefs::escapeKeyMessageId: listeners.callChecked (checker, [this] (Listener& l) { l.textEditorEscapeKeyPressed (*this); }); - if (! checker.shouldBailOut() && onEscapeKey != nullptr) - onEscapeKey(); + if (! checker.shouldBailOut()) + NullCheckedInvocation::invoke (onEscapeKey); break; @@ -2308,8 +2291,8 @@ void TextEditor::handleCommandMessage (const int commandId) updateValueFromText(); listeners.callChecked (checker, [this] (Listener& l) { l.textEditorFocusLost (*this); }); - if (! checker.shouldBailOut() && onFocusLost != nullptr) - onFocusLost(); + if (! checker.shouldBailOut()) + NullCheckedInvocation::invoke (onFocusLost); break; @@ -2325,6 +2308,11 @@ void TextEditor::setTemporaryUnderlining (const Array>& newUnderlined repaint(); } +TextInputTarget::VirtualKeyboardType TextEditor::getKeyboardType() +{ + return passwordCharacter != 0 ? passwordKeyboard : keyboardType; +} + //============================================================================== UndoManager* TextEditor::getUndoManager() noexcept { @@ -2614,9 +2602,9 @@ int TextEditor::indexAtPosition (const float x, const float y) const { for (Iterator i (*this); i.next();) { - if (y < i.lineY + i.lineHeight) + if (y < i.lineY + (i.lineHeight * lineSpacing)) { - if (y < i.lineY) + if (jmax (0.0f, y) < i.lineY) return jmax (0, i.indexInText - 1); if (x <= i.atomX || i.atom->isNewLine()) diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.h b/modules/juce_gui_basics/widgets/juce_TextEditor.h index d93e6af1..748bdcf9 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.h +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.h @@ -742,7 +742,7 @@ public: /** @internal */ void setTemporaryUnderlining (const Array>&) override; /** @internal */ - VirtualKeyboardType getKeyboardType() override { return keyboardType; } + VirtualKeyboardType getKeyboardType() override; protected: //============================================================================== @@ -771,10 +771,26 @@ private: struct RemoveAction; class EditorAccessibilityHandler; + class GlobalMouseListener : private MouseListener + { + public: + explicit GlobalMouseListener (Component& e) : editor (e) { Desktop::getInstance().addGlobalMouseListener (this); } + ~GlobalMouseListener() override { Desktop::getInstance().removeGlobalMouseListener (this); } + + bool lastMouseDownInEditor() const { return mouseDownInEditor; } + + private: + void mouseDown (const MouseEvent& event) override { mouseDownInEditor = event.originalComponent == &editor; } + + Component& editor; + bool mouseDownInEditor = false; + }; + std::unique_ptr viewport; TextHolderComponent* textHolder; BorderSize borderSize { 1, 1, 1, 3 }; Justification justification { Justification::topLeft }; + const GlobalMouseListener globalMouseListener { *this }; bool readOnly = false; bool caretVisible = true; @@ -791,7 +807,6 @@ private: bool valueTextNeedsUpdating = false; bool consumeEscAndReturnKeys = true; bool underlineWhitespace = true; - bool mouseDownInEditor = false; bool clicksOutsideDismissVirtualKeyboard = false; UndoManager undoManager; diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.cpp b/modules/juce_gui_basics/widgets/juce_TreeView.cpp index 38c22777..75d26178 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.cpp +++ b/modules/juce_gui_basics/widgets/juce_TreeView.cpp @@ -747,9 +747,10 @@ public: enum class Async { yes, no }; - void recalculatePositions (Async useAsyncUpdate) + void recalculatePositions (Async useAsyncUpdate, std::optional> viewportPosition) { needsRecalculating = true; + viewportAfterRecalculation = std::move (viewportPosition); if (useAsyncUpdate == Async::yes) triggerAsyncUpdate(); @@ -765,15 +766,13 @@ private: void handleAsyncUpdate() override { - if (structureChanged) + if (std::exchange (structureChanged, false)) { if (auto* handler = owner.getAccessibilityHandler()) handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged); - - structureChanged = false; } - if (needsRecalculating) + if (std::exchange (needsRecalculating, false)) { if (auto* root = owner.rootItem) { @@ -790,7 +789,8 @@ private: updateComponents (false); - needsRecalculating = false; + if (const auto viewportPosition = std::exchange (viewportAfterRecalculation, {})) + setViewPosition (viewportPosition->getX(), viewportPosition->getY()); } } @@ -810,6 +810,7 @@ private: TreeView& owner; int lastX = -1; bool structureChanged = false, needsRecalculating = false; + std::optional> viewportAfterRecalculation; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeViewport) }; @@ -858,7 +859,7 @@ void TreeView::setRootItem (TreeViewItem* const newRootItem) rootItem->setOpen (true); } - viewport->recalculatePositions (TreeViewport::Async::no); + viewport->recalculatePositions (TreeViewport::Async::no, {}); } } @@ -1020,10 +1021,6 @@ void TreeView::restoreOpennessState (const XmlElement& newState, bool restoreSto { rootItem->restoreOpennessState (newState); - if (newState.hasAttribute ("scrollPos")) - viewport->setViewPosition (viewport->getViewPositionX(), - newState.getIntAttribute ("scrollPos")); - if (restoreStoredSelection) { clearSelectedItems(); @@ -1033,7 +1030,11 @@ void TreeView::restoreOpennessState (const XmlElement& newState, bool restoreSto item->setSelected (true, false); } - updateVisibleItems(); + const auto scrollPos = newState.hasAttribute ("scrollPos") + ? std::make_optional> (viewport->getViewPositionX(), newState.getIntAttribute ("scrollPos")) + : std::nullopt; + + updateVisibleItems (std::move (scrollPos)); } } @@ -1216,9 +1217,9 @@ bool TreeView::keyPressed (const KeyPress& key) return false; } -void TreeView::updateVisibleItems() +void TreeView::updateVisibleItems (std::optional> viewportPosition) { - viewport->recalculatePositions (TreeViewport::Async::yes); + viewport->recalculatePositions (TreeViewport::Async::yes, std::move (viewportPosition)); } //============================================================================== diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.h b/modules/juce_gui_basics/widgets/juce_TreeView.h index 0a40a90f..608b3542 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.h +++ b/modules/juce_gui_basics/widgets/juce_TreeView.h @@ -935,7 +935,7 @@ private: std::unique_ptr createAccessibilityHandler() override; void itemsChanged() noexcept; - void updateVisibleItems(); + void updateVisibleItems (std::optional> viewportPosition = {}); void updateButtonUnderMouse (const MouseEvent&); void showDragHighlight (const InsertPoint&) noexcept; void hideDragHighlight() noexcept; diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 3ab01734..fdb36953 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -182,7 +182,6 @@ bool ComponentPeer::handleKeyPress (const int keyCode, const juce_wchar textChar textCharacter)); } - bool ComponentPeer::handleKeyPress (const KeyPress& keyInfo) { bool keyWasUsed = false; @@ -587,8 +586,8 @@ void ComponentPeer::setRepresentedFile (const File&) } //============================================================================== -int ComponentPeer::getCurrentRenderingEngine() const { return 0; } -void ComponentPeer::setCurrentRenderingEngine (int index) { jassert (index == 0); ignoreUnused (index); } +int ComponentPeer::getCurrentRenderingEngine() const { return 0; } +void ComponentPeer::setCurrentRenderingEngine ([[maybe_unused]] int index) { jassert (index == 0); } //============================================================================== std::function ComponentPeer::getNativeRealtimeModifiers = nullptr; @@ -607,7 +606,7 @@ void ComponentPeer::forceDisplayUpdate() Desktop::getInstance().displays->refresh(); } -void ComponentPeer::globalFocusChanged (Component*) +void ComponentPeer::globalFocusChanged ([[maybe_unused]] Component* comp) { refreshTextInputTarget(); } diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.h b/modules/juce_gui_basics/windows/juce_ComponentPeer.h index 64084b9d..fd1c4d09 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.h +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.h @@ -473,6 +473,34 @@ public: /** Removes a scale factor listener. */ void removeScaleFactorListener (ScaleFactorListener* listenerToRemove) { scaleFactorListeners.remove (listenerToRemove); } + //============================================================================== + /** Used to receive callbacks on every vertical blank event of the display that the peer + currently belongs to. + + On Linux this is currently limited to receiving callbacks from a timer approximately at + display refresh rate. + + This is a low-level facility used by the peer implementations. If you wish to synchronise + Component events with the display refresh, you should probably use the VBlankAttachment, + which automatically takes care of listening to the vblank events of the right peer. + + @see VBlankAttachment + */ + struct JUCE_API VBlankListener + { + /** Destructor. */ + virtual ~VBlankListener() = default; + + /** Called on every vertical blank of the display to which the peer is associated. */ + virtual void onVBlank() = 0; + }; + + /** Adds a VBlankListener. */ + void addVBlankListener (VBlankListener* listenerToAdd) { vBlankListeners.add (listenerToAdd); } + + /** Removes a VBlankListener. */ + void removeVBlankListener (VBlankListener* listenerToRemove) { vBlankListeners.remove (listenerToRemove); } + //============================================================================== /** On Windows and Linux this will return the OS scaling factor currently being applied to the native window. This is used to convert between physical and logical pixels @@ -524,6 +552,7 @@ protected: ComponentBoundsConstrainer* constrainer = nullptr; static std::function getNativeRealtimeModifiers; ListenerList scaleFactorListeners; + ListenerList vBlankListeners; Style style = Style::automatic; private: diff --git a/modules/juce_gui_basics/windows/juce_MessageBoxOptions.h b/modules/juce_gui_basics/windows/juce_MessageBoxOptions.h index 3a4dc59d..b8d70abb 100644 --- a/modules/juce_gui_basics/windows/juce_MessageBoxOptions.h +++ b/modules/juce_gui_basics/windows/juce_MessageBoxOptions.h @@ -68,13 +68,13 @@ public: //============================================================================== /** Sets the type of icon that should be used for the dialog box. */ - JUCE_NODISCARD MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); } + [[nodiscard]] MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); } /** Sets the title of the dialog box. */ - JUCE_NODISCARD MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); } + [[nodiscard]] MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); } /** Sets the message that should be displayed in the dialog box. */ - JUCE_NODISCARD MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); } + [[nodiscard]] MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); } /** If the string passed in is not empty, this will add a button to the dialog box with the specified text. @@ -82,10 +82,10 @@ public: Generally up to 3 buttons are supported for dialog boxes, so adding any more than this may have no effect. */ - JUCE_NODISCARD MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; } + [[nodiscard]] MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; } /** The component that the dialog box should be associated with. */ - JUCE_NODISCARD MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); } + [[nodiscard]] MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); } //============================================================================== /** Returns the icon type of the dialog box. diff --git a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp index 4ec6b765..2cd5ff42 100644 --- a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp @@ -56,11 +56,11 @@ ThreadWithProgressWindow::~ThreadWithProgressWindow() stopThread (timeOutMsWhenCancelling); } -void ThreadWithProgressWindow::launchThread (int priority) +void ThreadWithProgressWindow::launchThread (Priority threadPriority) { JUCE_ASSERT_MESSAGE_THREAD - startThread (priority); + startThread (threadPriority); startTimer (100); { @@ -105,9 +105,9 @@ void ThreadWithProgressWindow::timerCallback() void ThreadWithProgressWindow::threadComplete (bool) {} #if JUCE_MODAL_LOOPS_PERMITTED -bool ThreadWithProgressWindow::runThread (const int priority) +bool ThreadWithProgressWindow::runThread (Priority threadPriority) { - launchThread (priority); + launchThread (threadPriority); while (isTimerRunning()) MessageManager::getInstance()->runDispatchLoopUntil (5); diff --git a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h index 0e6c3c42..87bf0ef4 100644 --- a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h +++ b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h @@ -122,10 +122,10 @@ public: Before returning, the dialog box will be hidden. @param priority the priority to use when starting the thread - see - Thread::startThread() for values + Thread::Priority for values @returns true if the thread finished normally; false if the user pressed cancel */ - bool runThread (int priority = 5); + bool runThread (Priority priority = Priority::normal); #endif /** Starts the thread and returns. @@ -135,9 +135,9 @@ public: hidden and the threadComplete() method will be called. @param priority the priority to use when starting the thread - see - Thread::startThread() for values + Thread::Priority for values */ - void launchThread (int priority = 5); + void launchThread (Priority priority = Priority::normal); /** The thread should call this periodically to update the position of the progress bar. diff --git a/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp b/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp index a4f00bf8..106adb16 100644 --- a/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp @@ -300,14 +300,15 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const { const auto scale = getDesktopScaleFactor() / Desktop::getInstance().getGlobalScaleFactor(); - auto targetCentre = c->localPointToGlobal (c->getLocalBounds().getCentre()) / scale; - auto parentArea = getLocalArea (nullptr, c->getParentMonitorArea()); - - if (auto* parent = getParentComponent()) + const auto [targetCentre, parentArea] = [&] { - targetCentre = parent->getLocalPoint (nullptr, targetCentre); - parentArea = parent->getLocalBounds(); - } + const auto globalTargetCentre = c->localPointToGlobal (c->getLocalBounds().getCentre()) / scale; + + if (auto* parent = getParentComponent()) + return std::make_pair (parent->getLocalPoint (nullptr, globalTargetCentre), parent->getLocalBounds()); + + return std::make_pair (globalTargetCentre, c->getParentMonitorArea() / scale); + }(); setBounds (Rectangle (targetCentre.x - width / 2, targetCentre.y - height / 2, diff --git a/modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp b/modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp new file mode 100644 index 00000000..1b9be3bb --- /dev/null +++ b/modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp @@ -0,0 +1,113 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +VBlankAttachment::VBlankAttachment (Component* c, std::function callbackIn) + : owner (c), + callback (std::move (callbackIn)) +{ + jassert (owner != nullptr && callback); + + updateOwner(); + updatePeer(); +} + +VBlankAttachment::VBlankAttachment (VBlankAttachment&& other) + : VBlankAttachment (other.owner, std::move (other.callback)) +{ + other.cleanup(); +} + +VBlankAttachment& VBlankAttachment::operator= (VBlankAttachment&& other) +{ + cleanup(); + + owner = other.owner; + callback = std::move (other.callback); + updateOwner(); + updatePeer(); + + other.cleanup(); + + return *this; +} + +VBlankAttachment::~VBlankAttachment() +{ + cleanup(); +} + +void VBlankAttachment::onVBlank() +{ + callback(); +} + +void VBlankAttachment::componentParentHierarchyChanged (Component&) +{ + updatePeer(); +} + +void VBlankAttachment::updateOwner() +{ + if (auto previousLastOwner = std::exchange (lastOwner, owner); previousLastOwner != owner) + { + if (previousLastOwner != nullptr) + previousLastOwner->removeComponentListener (this); + + if (owner != nullptr) + owner->addComponentListener (this); + } +} + +void VBlankAttachment::updatePeer() +{ + if (owner != nullptr) + { + if (auto* peer = owner->getPeer()) + { + peer->addVBlankListener (this); + + if (lastPeer != peer && ComponentPeer::isValidPeer (lastPeer)) + lastPeer->removeVBlankListener (this); + + lastPeer = peer; + } + } + else if (auto peer = std::exchange (lastPeer, nullptr); ComponentPeer::isValidPeer (peer)) + { + peer->removeVBlankListener (this); + } +} + +void VBlankAttachment::cleanup() +{ + owner = nullptr; + updateOwner(); + updatePeer(); +} + +} // namespace juce diff --git a/modules/juce_gui_basics/windows/juce_VBlankAttachement.h b/modules/juce_gui_basics/windows/juce_VBlankAttachement.h new file mode 100644 index 00000000..2eb9daa9 --- /dev/null +++ b/modules/juce_gui_basics/windows/juce_VBlankAttachement.h @@ -0,0 +1,73 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +/** Helper class to synchronise Component updates to the vertical blank event of the display that + the Component is presented on. This is useful when animating the Component's contents. +*/ +class JUCE_API VBlankAttachment final : public ComponentPeer::VBlankListener, + public ComponentListener +{ +public: + /** Default constructor for creating an empty object. */ + VBlankAttachment() {} + + /** Constructor. Creates an attachment that will call the passed in function at every vertical + blank event of the display that the passed in Component is currently visible on. + + The Component must be valid for the entire lifetime of the VBlankAttachment. + */ + VBlankAttachment (Component* c, std::function callbackIn); + VBlankAttachment (VBlankAttachment&& other); + VBlankAttachment& operator= (VBlankAttachment&& other); + + /** Destructor. */ + ~VBlankAttachment() override; + + /** Returns true for a default constructed object. */ + bool isEmpty() { return owner == nullptr; } + + //============================================================================== + void onVBlank() override; + + //============================================================================== + void componentParentHierarchyChanged (Component&) override; + +private: + void updateOwner(); + void updatePeer(); + void cleanup(); + + Component* owner = nullptr; + Component* lastOwner = nullptr; + std::function callback; + ComponentPeer* lastPeer = nullptr; + + JUCE_DECLARE_NON_COPYABLE (VBlankAttachment) +}; + +} // namespace juce diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index da5b4a9a..dd434529 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -476,6 +476,11 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons CodeEditorComponent::~CodeEditorComponent() { + giveAwayKeyboardFocus(); + + if (auto* peer = getPeer()) + peer->refreshTextInputTarget(); + document.removeListener (pimpl.get()); } @@ -670,10 +675,9 @@ void CodeEditorComponent::codeDocumentChanged (const int startIndex, const int e updateScrollBars(); } -void CodeEditorComponent::retokenise (int startIndex, int endIndex) +void CodeEditorComponent::retokenise (int startIndex, [[maybe_unused]] int endIndex) { const CodeDocument::Position affectedTextStart (document, startIndex); - juce::ignoreUnused (endIndex); // Leave room for more efficient impl in future. clearCachedIterators (affectedTextStart.getLineNumber()); diff --git a/modules/juce_gui_extra/embedding/juce_ActiveXControlComponent.h b/modules/juce_gui_extra/embedding/juce_ActiveXControlComponent.h index bb99430f..f789948f 100644 --- a/modules/juce_gui_extra/embedding/juce_ActiveXControlComponent.h +++ b/modules/juce_gui_extra/embedding/juce_ActiveXControlComponent.h @@ -107,6 +107,11 @@ public: */ bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; } + //============================================================================== + /** Set an instance of IDispatch where dispatch events should be delivered to + */ + void setEventHandler (void* eventHandler); + //============================================================================== /** @internal */ void paint (Graphics&) override; diff --git a/modules/juce_gui_extra/embedding/juce_NSViewComponent.h b/modules/juce_gui_extra/embedding/juce_NSViewComponent.h index 98760295..a935de75 100644 --- a/modules/juce_gui_extra/embedding/juce_NSViewComponent.h +++ b/modules/juce_gui_extra/embedding/juce_NSViewComponent.h @@ -71,6 +71,12 @@ public: /** Resizes this component to fit the view that it contains. */ void resizeToFitView(); + /** Resizes the NSView to match the bounds of this component. + + Most of the time, this will be done for you automatically. + */ + void resizeViewToFit(); + //============================================================================== /** @internal */ void paint (Graphics&) override; diff --git a/modules/juce_gui_extra/juce_gui_extra.cpp b/modules/juce_gui_extra/juce_gui_extra.cpp index 4f60cb8f..9a50b88b 100644 --- a/modules/juce_gui_extra/juce_gui_extra.cpp +++ b/modules/juce_gui_extra/juce_gui_extra.cpp @@ -135,6 +135,7 @@ #include "misc/juce_SystemTrayIconComponent.cpp" #include "misc/juce_LiveConstantEditor.cpp" #include "misc/juce_AnimatedAppComponent.cpp" +#include "misc/juce_WebBrowserComponent.cpp" //============================================================================== #if JUCE_MAC || JUCE_IOS @@ -167,6 +168,7 @@ #elif JUCE_LINUX || JUCE_BSD JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant") + #include #include "native/juce_linux_XEmbedComponent.cpp" #if JUCE_WEB_BROWSER @@ -185,11 +187,3 @@ #include "native/juce_android_WebBrowserComponent.cpp" #endif #endif - -//============================================================================== -#if ! JUCE_WINDOWS && JUCE_WEB_BROWSER - juce::WebBrowserComponent::WebBrowserComponent (ConstructWithoutPimpl) {} - juce::WindowsWebView2WebBrowserComponent::WindowsWebView2WebBrowserComponent (bool unloadWhenHidden, - const WebView2Preferences&) - : WebBrowserComponent (unloadWhenHidden) {} -#endif diff --git a/modules/juce_gui_extra/juce_gui_extra.h b/modules/juce_gui_extra/juce_gui_extra.h index 7dd7c685..f431570f 100644 --- a/modules/juce_gui_extra/juce_gui_extra.h +++ b/modules/juce_gui_extra/juce_gui_extra.h @@ -35,12 +35,12 @@ ID: juce_gui_extra vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE extended GUI classes description: Miscellaneous GUI classes for specialised tasks. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_gui_basics OSXFrameworks: WebKit diff --git a/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.cpp b/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.cpp index f2798e48..ab2b8fcb 100644 --- a/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.cpp @@ -27,15 +27,41 @@ namespace juce { AnimatedAppComponent::AnimatedAppComponent() - : lastUpdateTime (Time::getCurrentTime()), totalUpdates (0) { setOpaque (true); } -void AnimatedAppComponent::setFramesPerSecond (int framesPerSecond) +void AnimatedAppComponent::setFramesPerSecond (int framesPerSecondIn) { - jassert (framesPerSecond > 0 && framesPerSecond < 1000); - startTimerHz (framesPerSecond); + jassert (0 < framesPerSecond && framesPerSecond < 1000); + framesPerSecond = framesPerSecondIn; + updateSync(); +} + +void AnimatedAppComponent::updateSync() +{ + if (useVBlank) + { + stopTimer(); + + if (vBlankAttachment.isEmpty()) + vBlankAttachment = { this, [this] { timerCallback(); } }; + } + else + { + vBlankAttachment = {}; + + const auto interval = 1000 / framesPerSecond; + + if (getTimerInterval() != interval) + startTimer (interval); + } +} + +void AnimatedAppComponent::setSynchroniseToVBlank (bool syncToVBlank) +{ + useVBlank = syncToVBlank; + updateSync(); } int AnimatedAppComponent::getMillisecondsSinceLastUpdate() const noexcept diff --git a/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h b/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h index b4e55a81..18d5db10 100644 --- a/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h +++ b/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h @@ -36,8 +36,8 @@ namespace juce @tags{GUI} */ -class AnimatedAppComponent : public Component, - private Timer +class JUCE_API AnimatedAppComponent : public Component, + private Timer { public: AnimatedAppComponent(); @@ -47,6 +47,11 @@ public: */ void setFramesPerSecond (int framesPerSecond); + /** You can use this function to synchronise animation updates with the current display's vblank + events. When this mode is enabled the value passed to setFramesPerSecond() is ignored. + */ + void setSynchroniseToVBlank (bool syncToVBlank); + /** Called periodically, at the frequency specified by setFramesPerSecond(). This is a the best place to do things like advancing animation parameters, checking the mouse position, etc. @@ -66,8 +71,13 @@ public: private: //============================================================================== - Time lastUpdateTime; - int totalUpdates; + void updateSync(); + + Time lastUpdateTime = Time::getCurrentTime(); + int totalUpdates = 0; + int framesPerSecond = 60; + bool useVBlank = false; + VBlankAttachment vBlankAttachment; void timerCallback() override; diff --git a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp index 5642deb8..ece6c622 100644 --- a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp +++ b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp @@ -86,12 +86,11 @@ PushNotifications::~PushNotifications() { clearSingletonInstance(); } void PushNotifications::addListener (Listener* l) { listeners.add (l); } void PushNotifications::removeListener (Listener* l) { listeners.remove (l); } -void PushNotifications::requestPermissionsWithSettings (const PushNotifications::Settings& settings) +void PushNotifications::requestPermissionsWithSettings ([[maybe_unused]] const PushNotifications::Settings& settings) { #if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC) pimpl->requestPermissionsWithSettings (settings); #else - ignoreUnused (settings); listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); #endif } @@ -137,12 +136,10 @@ String PushNotifications::getDeviceToken() const #endif } -void PushNotifications::setupChannels (const Array& groups, const Array& channels) +void PushNotifications::setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { #if JUCE_PUSH_NOTIFICATIONS pimpl->setupChannels (groups, channels); - #else - ignoreUnused (groups, channels); #endif } @@ -160,58 +157,48 @@ void PushNotifications::removeAllPendingLocalNotifications() #endif } -void PushNotifications::subscribeToTopic (const String& topic) +void PushNotifications::subscribeToTopic ([[maybe_unused]] const String& topic) { #if JUCE_PUSH_NOTIFICATIONS pimpl->subscribeToTopic (topic); - #else - ignoreUnused (topic); #endif } -void PushNotifications::unsubscribeFromTopic (const String& topic) +void PushNotifications::unsubscribeFromTopic ([[maybe_unused]] const String& topic) { #if JUCE_PUSH_NOTIFICATIONS pimpl->unsubscribeFromTopic (topic); - #else - ignoreUnused (topic); #endif } -void PushNotifications::sendLocalNotification (const Notification& n) +void PushNotifications::sendLocalNotification ([[maybe_unused]] const Notification& n) { #if JUCE_PUSH_NOTIFICATIONS pimpl->sendLocalNotification (n); - #else - ignoreUnused (n); #endif } -void PushNotifications::removeDeliveredNotification (const String& identifier) +void PushNotifications::removeDeliveredNotification ([[maybe_unused]] const String& identifier) { #if JUCE_PUSH_NOTIFICATIONS pimpl->removeDeliveredNotification (identifier); - #else - ignoreUnused (identifier); #endif } -void PushNotifications::removePendingLocalNotification (const String& identifier) +void PushNotifications::removePendingLocalNotification ([[maybe_unused]] const String& identifier) { #if JUCE_PUSH_NOTIFICATIONS pimpl->removePendingLocalNotification (identifier); - #else - ignoreUnused (identifier); #endif } -void PushNotifications::sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) +void PushNotifications::sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { #if JUCE_PUSH_NOTIFICATIONS pimpl->sendUpstreamMessage (serverSenderId, @@ -220,10 +207,24 @@ void PushNotifications::sendUpstreamMessage (const String& serverSenderId, messageType, timeToLive, additionalData); - #else - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); #endif } +//============================================================================== +void PushNotifications::Listener::notificationSettingsReceived ([[maybe_unused]] const Settings& settings) {} +void PushNotifications::Listener::pendingLocalNotificationsListReceived ([[maybe_unused]] const Array& notifications) {} +void PushNotifications::Listener::handleNotification ([[maybe_unused]] bool isLocalNotification, + [[maybe_unused]] const Notification& notification) {} +void PushNotifications::Listener::handleNotificationAction ([[maybe_unused]] bool isLocalNotification, + [[maybe_unused]] const Notification& notification, + [[maybe_unused]] const String& actionIdentifier, + [[maybe_unused]] const String& optionalResponse) {} +void PushNotifications::Listener::localNotificationDismissedByUser ([[maybe_unused]] const Notification& notification) {} +void PushNotifications::Listener::deliveredNotificationsListReceived ([[maybe_unused]] const Array& notifications) {} +void PushNotifications::Listener::deviceTokenRefreshed ([[maybe_unused]] const String& token) {} +void PushNotifications::Listener::remoteNotificationsDeleted() {} +void PushNotifications::Listener::upstreamMessageSent ([[maybe_unused]] const String& messageId) {} +void PushNotifications::Listener::upstreamMessageSendingError ([[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& error) {} + } // namespace juce diff --git a/modules/juce_gui_extra/misc/juce_PushNotifications.h b/modules/juce_gui_extra/misc/juce_PushNotifications.h index 52cf1dbc..384b43ab 100644 --- a/modules/juce_gui_extra/misc/juce_PushNotifications.h +++ b/modules/juce_gui_extra/misc/juce_PushNotifications.h @@ -601,12 +601,12 @@ public: with no categories and all allow flags set to true will be received in Listener::notificationSettingsReceived(). */ - virtual void notificationSettingsReceived (const Settings& settings) { ignoreUnused (settings); } + virtual void notificationSettingsReceived (const Settings& settings); /** Called when the list of pending notifications, requested by calling getPendingLocalNotifications() is returned. iOS 10 or above only. */ - virtual void pendingLocalNotificationsListReceived (const Array& notifications) { ignoreUnused (notifications); } + virtual void pendingLocalNotificationsListReceived (const Array& notifications); /** This can be called in multiple different situations, depending on the OS and the situation. @@ -622,7 +622,7 @@ public: Note you can receive this callback on startup, if the application was launched from a notification. */ - virtual void handleNotification (bool isLocalNotification, const Notification& notification) { ignoreUnused (isLocalNotification); ignoreUnused (notification); } + virtual void handleNotification (bool isLocalNotification, const Notification& notification); /** This can be called when a user performs some action on the notification such as pressing on an action button or responding with a text input. @@ -641,18 +641,12 @@ public: virtual void handleNotificationAction (bool isLocalNotification, const Notification& notification, const String& actionIdentifier, - const String& optionalResponse) - { - ignoreUnused (isLocalNotification); - ignoreUnused (notification); - ignoreUnused (actionIdentifier); - ignoreUnused (optionalResponse); - } + const String& optionalResponse); /** For iOS10 and Android, this can be also called when a user dismissed the notification before responding to it. */ - virtual void localNotificationDismissedByUser (const Notification& notification) { ignoreUnused (notification); } + virtual void localNotificationDismissedByUser (const Notification& notification); /** Called after getDeliveredNotifications() request is fulfilled. Returns notifications that are visible in the notification area on the device and that are still waiting @@ -661,31 +655,31 @@ public: On iOS, iOS version 10 or higher is required. On Android, API level 18 or higher is required. For unsupported platforms, an empty array will be returned. */ - virtual void deliveredNotificationsListReceived (const Array& notifications) { ignoreUnused (notifications); } + virtual void deliveredNotificationsListReceived (const Array& notifications); /** Called whenever a token gets refreshed. You should monitor any token updates, because only the last token that is assigned to device is valid and can be used. */ - virtual void deviceTokenRefreshed (const String& token) { ignoreUnused (token); } + virtual void deviceTokenRefreshed (const String& token); /** Called when Firebase Cloud Messaging server deletes pending messages. This can happen when 1) too many messages were sent to the server (hint: use collapsible messages). 2) the devices hasn't been online in a long time (refer to Firebase documentation for the maximum time a message can be stored on FCM before expiring). */ - virtual void remoteNotificationsDeleted() {} + virtual void remoteNotificationsDeleted(); /** Called when an upstream message sent with PushNotifications::sendUpstreamMessage() has been sent successfully. Bear in mind that in may take several minutes or more to receive this callback. */ - virtual void upstreamMessageSent (const String& messageId) { ignoreUnused (messageId); } + virtual void upstreamMessageSent (const String& messageId); /** Called when there was an error sending an upstream message with PushNotifications::sendUpstreamMessage(). Bear in mind that in may take several minutes or more to receive this callback. */ - virtual void upstreamMessageSendingError (const String& messageId, const String& error) { ignoreUnused (messageId); ignoreUnused (error); } + virtual void upstreamMessageSendingError (const String& messageId, const String& error); }; void addListener (Listener* l); diff --git a/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp b/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp index 94fb3263..c5a4efb8 100644 --- a/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp +++ b/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp @@ -132,19 +132,17 @@ void RecentlyOpenedFilesList::restoreFromString (const String& stringifiedVersio //============================================================================== -void RecentlyOpenedFilesList::registerRecentFileNatively (const File& file) +void RecentlyOpenedFilesList::registerRecentFileNatively ([[maybe_unused]] const File& file) { #if JUCE_MAC JUCE_AUTORELEASEPOOL { [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: createNSURLFromFile (file)]; } - #else - ignoreUnused (file); #endif } -void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file) +void RecentlyOpenedFilesList::forgetRecentFileNatively ([[maybe_unused]] const File& file) { #if JUCE_MAC JUCE_AUTORELEASEPOOL @@ -166,8 +164,6 @@ void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file) if (! [url isEqual:nsFile]) [sharedDocController noteNewRecentDocumentURL:url]; } - #else - ignoreUnused (file); #endif } diff --git a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp new file mode 100644 index 00000000..ce8af6ef --- /dev/null +++ b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp @@ -0,0 +1,39 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +#if JUCE_WEB_BROWSER || DOXYGEN + +bool WebBrowserComponent::pageAboutToLoad ([[maybe_unused]] const String& newURL) { return true; } +void WebBrowserComponent::pageFinishedLoading ([[maybe_unused]] const String& url) {} +bool WebBrowserComponent::pageLoadHadNetworkError ([[maybe_unused]] const String& errorInfo) { return true; } +void WebBrowserComponent::windowCloseRequest() {} +void WebBrowserComponent::newWindowAttemptingToLoad ([[maybe_unused]] const String& newURL) {} + +#endif + +} // namespace juce diff --git a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h index 3ecdc5a6..758d2587 100644 --- a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h +++ b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h @@ -46,21 +46,149 @@ class JUCE_API WebBrowserComponent : public Component { public: //============================================================================== + class JUCE_API Options + { + public: + //============================================================================== + enum class Backend + { + /** + Default web browser backend. WebKit will be used on macOS, gtk-webkit2 on Linux and internet + explorer on Windows. On Windows, the default may change to webview2 in the fututre. + */ + defaultBackend, + + /** + Use Internet Explorer as the backend on Windows. By default, IE will use an ancient version + of IE. To change this behaviour, you either need to add the following html element into your page's + head section: + + + + or you need to change windows registry values for your application. More infromation on the latter + can be found here: + + https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)?redirectedfrom=MSDN#browser-emulation + */ + ie, + + /** + Use the chromium based WebView2 engine on Windows + */ + webview2 + }; + + /** + Use a particular backend to create the WebViewBrowserComponent. JUCE will silently + fallback to the default backend if the selected backend is not supported. To check + if a specific backend is supported on your platform or not, use + WebBrowserComponent::areOptionsSupported. + */ + [[nodiscard]] Options withBackend (Backend backend) const { return withMember (*this, &Options::browserBackend, backend); } + + //============================================================================== + /** + Tell JUCE to keep the web page alive when the WebBrowserComponent is not visible. + By default, JUCE will replace the current page with a blank page - this can be + handy to stop the browser using resources in the background when it's not + actually being used. + */ + [[nodiscard]] Options withKeepPageLoadedWhenBrowserIsHidden () const { return withMember (*this, &Options::keepPageLoadedWhenBrowserIsHidden, true); } + + /** + Use a specific user agent string when requesting web pages. + */ + [[nodiscard]] Options withUserAgent (String ua) const { return withMember (*this, &Options::userAgent, std::move (ua)); } + + //============================================================================== + /** Options specific to the WebView2 backend. These options will be ignored + if another backend is used. + */ + class WinWebView2 + { + public: + //============================================================================== + /** Sets a custom location for the WebView2Loader.dll that is not a part of the + standard system DLL search paths. + */ + [[nodiscard]] WinWebView2 withDLLLocation (const File& location) const { return withMember (*this, &WinWebView2::dllLocation, location); } + + /** Sets a non-default location for storing user data for the browser instance. */ + [[nodiscard]] WinWebView2 withUserDataFolder (const File& folder) const { return withMember (*this, &WinWebView2::userDataFolder, folder); } + + /** If this is set, the status bar usually displayed in the lower-left of the webview + will be disabled. + */ + [[nodiscard]] WinWebView2 withStatusBarDisabled() const { return withMember (*this, &WinWebView2::disableStatusBar, true); } + + /** If this is set, a blank page will be displayed on error instead of the default + built-in error page. + */ + [[nodiscard]] WinWebView2 withBuiltInErrorPageDisabled() const { return withMember (*this, &WinWebView2::disableBuiltInErrorPage, true); } + + /** Sets the background colour that WebView2 renders underneath all web content. + + This colour must either be fully opaque or transparent. On Windows 7 this + colour must be opaque. + */ + [[nodiscard]] WinWebView2 withBackgroundColour (const Colour& colour) const + { + // the background colour must be either fully opaque or transparent! + jassert (colour.isOpaque() || colour.isTransparent()); + + return withMember (*this, &WinWebView2::backgroundColour, colour); + } + + //============================================================================== + File getDLLLocation() const { return dllLocation; } + File getUserDataFolder() const { return userDataFolder; } + bool getIsStatusBarDisabled() const noexcept { return disableStatusBar; } + bool getIsBuiltInErrorPageDisabled() const noexcept { return disableBuiltInErrorPage; } + Colour getBackgroundColour() const { return backgroundColour; } + + private: + //============================================================================== + File dllLocation, userDataFolder; + bool disableStatusBar = false, disableBuiltInErrorPage = false; + Colour backgroundColour; + }; + + [[nodiscard]] Options withWinWebView2Options (const WinWebView2& winWebView2Options) const + { + return withMember (*this, &Options::winWebView2, winWebView2Options); + } + + //============================================================================== + Backend getBackend() const noexcept { return browserBackend; } + bool keepsPageLoadedWhenBrowserIsHidden() const noexcept { return keepPageLoadedWhenBrowserIsHidden; } + String getUserAgent() const { return userAgent; } + WinWebView2 getWinWebView2BackendOptions() const { return winWebView2; } + + private: + //============================================================================== + Backend browserBackend = Backend::defaultBackend; + bool keepPageLoadedWhenBrowserIsHidden = false; + String userAgent; + WinWebView2 winWebView2; + }; + + //============================================================================== + /** Creates a WebBrowserComponent with default options*/ + WebBrowserComponent() : WebBrowserComponent (Options {}) {} + /** Creates a WebBrowserComponent. Once it's created and visible, send the browser to a URL using goToURL(). - - @param unloadPageWhenBrowserIsHidden if this is true, then when the browser - component is taken offscreen, it'll clear the current page - and replace it with a blank page - this can be handy to stop - the browser using resources in the background when it's not - actually being used. */ - explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true); + explicit WebBrowserComponent (const Options& options); /** Destructor. */ ~WebBrowserComponent() override; + //============================================================================== + /** Check if the specified options are supported on this platform. */ + static bool areOptionsSupported (const Options& options); + //============================================================================== /** Sends the browser to a particular URL. @@ -98,10 +226,10 @@ public: tries to go to a particular URL. To allow the operation to carry on, return true, or return false to stop the navigation happening. */ - virtual bool pageAboutToLoad (const String& newURL) { ignoreUnused (newURL); return true; } + virtual bool pageAboutToLoad (const String& newURL); /** This callback happens when the browser has finished loading a page. */ - virtual void pageFinishedLoading (const String& url) { ignoreUnused (url); } + virtual void pageFinishedLoading (const String& url); /** This callback happens when a network error was encountered while trying to load a page. @@ -113,18 +241,18 @@ public: The errorInfo contains some platform dependent string describing the error. */ - virtual bool pageLoadHadNetworkError (const String& errorInfo) { ignoreUnused (errorInfo); return true; } + virtual bool pageLoadHadNetworkError (const String& errorInfo); /** This callback occurs when a script or other activity in the browser asks for the window to be closed. */ - virtual void windowCloseRequest() {} + virtual void windowCloseRequest(); /** This callback occurs when the browser attempts to load a URL in a new window. This won't actually load the window but gives you a chance to either launch a new window yourself or just load the URL into the current window with goToURL(). */ - virtual void newWindowAttemptingToLoad (const String& newURL) { ignoreUnused (newURL); } + virtual void newWindowAttemptingToLoad (const String& newURL); //============================================================================== /** @internal */ @@ -141,17 +269,6 @@ public: /** @internal */ class Pimpl; -protected: - friend class WindowsWebView2WebBrowserComponent; - - /** @internal */ - struct ConstructWithoutPimpl - { - explicit ConstructWithoutPimpl (bool unloadOnHide) : unloadWhenHidden (unloadOnHide) {} - const bool unloadWhenHidden; - }; - explicit WebBrowserComponent (ConstructWithoutPimpl); - private: //============================================================================== std::unique_ptr browser; @@ -166,122 +283,6 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebBrowserComponent) }; -//============================================================================== -/** Class used to create a set of preferences to pass to the WindowsWebView2WebBrowserComponent - wrapper constructor to modify aspects of its behaviour and settings. - - You can chain together a series of calls to this class's methods to create a set of whatever - preferences you want to specify. - - @tags{GUI} -*/ -class JUCE_API WebView2Preferences -{ -public: - //============================================================================== - /** Sets a custom location for the WebView2Loader.dll that is not a part of the - standard system DLL search paths. - */ - JUCE_NODISCARD WebView2Preferences withDLLLocation (const File& location) const { return with (&WebView2Preferences::dllLocation, location); } - - /** Sets a non-default location for storing user data for the browser instance. */ - WebView2Preferences withUserDataFolder (const File& folder) const { return with (&WebView2Preferences::userDataFolder, folder); } - - /** If this is set, the status bar usually displayed in the lower-left of the webview - will be disabled. - */ - JUCE_NODISCARD WebView2Preferences withStatusBarDisabled() const { return with (&WebView2Preferences::disableStatusBar, true); } - - /** If this is set, a blank page will be displayed on error instead of the default - built-in error page. - */ - JUCE_NODISCARD WebView2Preferences withBuiltInErrorPageDisabled() const { return with (&WebView2Preferences::disableBuiltInErrorPage, true); } - - /** Sets the background colour that WebView2 renders underneath all web content. - - This colour must either be fully opaque or transparent. On Windows 7 this - colour must be opaque. - */ - JUCE_NODISCARD WebView2Preferences withBackgroundColour (const Colour& colour) const - { - // the background colour must be either fully opaque or transparent! - jassert (colour.isOpaque() || colour.isTransparent()); - - return with (&WebView2Preferences::backgroundColour, colour); - } - - //============================================================================== - File getDLLLocation() const { return dllLocation; } - File getUserDataFolder() const { return userDataFolder; } - bool getIsStatusBarDisabled() const noexcept { return disableStatusBar; } - bool getIsBuiltInErrorPageDisabled() const noexcept { return disableBuiltInErrorPage; } - Colour getBackgroundColour() const { return backgroundColour; } - -private: - //============================================================================== - template - WebView2Preferences with (Member&& member, Item&& item) const - { - auto options = *this; - options.*member = std::forward (item); - - return options; - } - - File dllLocation, userDataFolder; - bool disableStatusBar = false, disableBuiltInErrorPage = false; - Colour backgroundColour = Colours::white; -}; - -/** - If you have enabled the JUCE_USE_WIN_WEBVIEW2 flag then this wrapper will attempt to - use the Microsoft Edge (Chromium) WebView2 control instead of IE on Windows. It will - behave the same as WebBrowserComponent on all other platforms and will fall back to - IE on Windows if the WebView2 requirements are not met. - - This requires Microsoft Edge (minimum version 82.0.488.0) to be installed at runtime. - - Currently this also requires that WebView2Loader.dll, which can be found in the - Microsoft.Web.WebView package, is installed at runtime. As this is not a standard - system DLL, we can't rely on it being found via the normal system DLL search paths. - Therefore in order to use WebView2 you need to ensure that WebView2Loader.dll is - installed either to a location covered by the Windows DLL system search paths or - to the folder specified in the WebView2Preferences. - - @tags{GUI} -*/ -class WindowsWebView2WebBrowserComponent : public WebBrowserComponent -{ -public: - //============================================================================== - /** Creates a WebBrowserComponent that is compatible with the WebView2 control - on Windows. - - @param unloadPageWhenBrowserIsHidden if this is true, then when the browser - component is taken offscreen, it'll clear the current page - and replace it with a blank page - this can be handy to stop - the browser using resources in the background when it's not - actually being used. - @param preferences a set of preferences used to control aspects of the webview's - behaviour. - - @see WebView2Preferences - */ - WindowsWebView2WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true, - const WebView2Preferences& preferences = {}); - - // This constructor has been deprecated. Use the new constructor that takes a - // WebView2Preferences instead. - explicit WindowsWebView2WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true, - const File& dllLocation = {}, - const File& userDataFolder = {}) - : WindowsWebView2WebBrowserComponent (unloadPageWhenBrowserIsHidden, - WebView2Preferences().withDLLLocation (dllLocation) - .withUserDataFolder (userDataFolder)) - { - } -}; - #endif } // namespace juce diff --git a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp index 87b461c0..b382a3b9 100644 --- a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp @@ -447,20 +447,18 @@ struct PushNotifications::Pimpl #endif } - void notifyListenersTokenRefreshed (const String& token) + void notifyListenersTokenRefreshed ([[maybe_unused]] const String& token) { #if defined(JUCE_FIREBASE_INSTANCE_ID_SERVICE_CLASSNAME) MessageManager::callAsync ([this, token] { owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (token); }); }); - #else - ignoreUnused (token); #endif } //============================================================================== - void subscribeToTopic (const String& topic) + void subscribeToTopic ([[maybe_unused]] const String& topic) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -469,12 +467,10 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallObjectMethod (firebaseMessaging, FirebaseMessaging.subscribeToTopic, javaString (topic).get()); - #else - ignoreUnused (topic); #endif } - void unsubscribeFromTopic (const String& topic) + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -483,17 +479,15 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallObjectMethod (firebaseMessaging, FirebaseMessaging.unsubscribeFromTopic, javaString (topic).get()); - #else - ignoreUnused (topic); #endif } - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -521,13 +515,10 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallVoidMethod (firebaseMessaging, FirebaseMessaging.send, message.get()); - #else - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); #endif } - void notifyListenersAboutRemoteNotificationFromSystemTray (const LocalRef& intent) + void notifyListenersAboutRemoteNotificationFromSystemTray ([[maybe_unused]] const LocalRef& intent) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -536,12 +527,10 @@ struct PushNotifications::Pimpl auto notification = remoteNotificationBundleToJuceNotification (bundle); owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); - #else - ignoreUnused (intent); #endif } - void notifyListenersAboutRemoteNotificationFromService (const LocalRef& remoteNotification) + void notifyListenersAboutRemoteNotificationFromService ([[maybe_unused]] const LocalRef& remoteNotification) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef rn (remoteNotification); @@ -551,8 +540,6 @@ struct PushNotifications::Pimpl auto notification = firebaseRemoteNotificationToJuceNotification (rn.get()); owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); }); - #else - ignoreUnused (remoteNotification); #endif } @@ -566,7 +553,7 @@ struct PushNotifications::Pimpl #endif } - void notifyListenersAboutUpstreamMessageSent (const LocalRef& messageId) + void notifyListenersAboutUpstreamMessageSent ([[maybe_unused]] const LocalRef& messageId) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef mid (LocalRef(messageId.get())); @@ -576,13 +563,11 @@ struct PushNotifications::Pimpl auto midString = juceString ((jstring) mid.get()); owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSent (midString); }); }); - #else - ignoreUnused (messageId); #endif } - void notifyListenersAboutUpstreamMessageSendingError (const LocalRef& messageId, - const LocalRef& error) + void notifyListenersAboutUpstreamMessageSendingError ([[maybe_unused]] const LocalRef& messageId, + [[maybe_unused]] const LocalRef& error) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef mid (LocalRef(messageId.get())), e (LocalRef(error.get())); @@ -594,8 +579,6 @@ struct PushNotifications::Pimpl owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSendingError (midString, eString); }); }); - #else - ignoreUnused (messageId, error); #endif } @@ -1566,8 +1549,6 @@ struct JuceFirebaseInstanceIdService instance->pimpl->notifyListenersTokenRefreshed (juceString (static_cast (token))); } }; - -JuceFirebaseInstanceIdService::InstanceIdService_Class JuceFirebaseInstanceIdService::InstanceIdService; #endif #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) @@ -1609,8 +1590,6 @@ struct JuceFirebaseMessagingService LocalRef (static_cast (error))); } }; - -JuceFirebaseMessagingService::MessagingService_Class JuceFirebaseMessagingService::MessagingService; #endif //============================================================================== diff --git a/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp index 35adf391..b4871cd9 100644 --- a/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp @@ -29,7 +29,7 @@ namespace juce //============================================================================== // This byte-code is generated from native/java/com/rmsl/juce/JuceWebView.java with min sdk version 16 // See juce_core/native/java/README.txt on how to generate this byte-code. -static const unsigned char JuceWebView16ByteCode[] = +static const uint8 JuceWebView16ByteCode[] = {31,139,8,8,150,114,161,94,0,3,74,117,99,101,87,101,98,86,105,101,119,49,54,66,121,116,101,67,111,100,101,46,100,101,120,0,125, 150,93,108,20,85,20,199,207,124,236,78,119,218,110,183,5,74,191,40,109,69,168,72,89,176,162,165,11,88,40,159,101,81,161,88,226, 106,34,211,221,107,59,101,118,102,153,153,109,27,67,16,161,137,134,240,96,4,222,72,140,9,18,35,62,18,195,131,15,4,53,250,226,155, @@ -81,7 +81,7 @@ static const unsigned char JuceWebView16ByteCode[] = //============================================================================== // This byte-code is generated from native/javacore/app/com/rmsl/juce/JuceWebView21.java with min sdk version 21 // See juce_core/native/java/README.txt on how to generate this byte-code. -static const unsigned char JuceWebView21ByteCode[] = +static const uint8 JuceWebView21ByteCode[] = {31,139,8,8,45,103,161,94,0,3,74,117,99,101,87,101,98,86,105,101,119,50,49,46,100,101,120,0,141,151,93,140,27,87,21,199,207, 204,216,30,219,99,59,182,55,251,145,143,221,110,210,173,178,105,154,186,155,164,52,169,211,106,241,38,219,221,48,41,52,155,108, 138,43,85,154,181,47,235,73,188,51,206,204,120,119,65,162,132,80,148,138,34,148,168,20,181,125,129,135,16,129,4,18,168,125,136, @@ -175,7 +175,8 @@ DECLARE_JNI_CLASS (AndroidCookieManager, "android/webkit/CookieManager") METHOD (setBuiltInZoomControls, "setBuiltInZoomControls", "(Z)V") \ METHOD (setDisplayZoomControls, "setDisplayZoomControls", "(Z)V") \ METHOD (setJavaScriptEnabled, "setJavaScriptEnabled", "(Z)V") \ - METHOD (setSupportMultipleWindows, "setSupportMultipleWindows", "(Z)V") + METHOD (setSupportMultipleWindows, "setSupportMultipleWindows", "(Z)V") \ + METHOD (setUserAgentString, "setUserAgentString", "(Ljava/lang/String;)V") DECLARE_JNI_CLASS (WebSettings, "android/webkit/WebSettings") #undef JNI_CLASS_MEMBERS @@ -197,7 +198,7 @@ class WebBrowserComponent::Pimpl : public AndroidViewComponent, public AsyncUpdater { public: - Pimpl (WebBrowserComponent& o) + Pimpl (WebBrowserComponent& o, const String& userAgent) : owner (o) { auto* env = getEnv(); @@ -210,6 +211,9 @@ public: env->CallVoidMethod (settings, WebSettings.setDisplayZoomControls, false); env->CallVoidMethod (settings, WebSettings.setSupportMultipleWindows, true); + if (userAgent.isNotEmpty()) + env->CallVoidMethod (settings, WebSettings.setUserAgentString, javaString (userAgent).get()); + juceWebChromeClient = GlobalRef (LocalRef (env->NewObject (JuceWebChromeClient, JuceWebChromeClient.constructor, reinterpret_cast (this)))); env->CallVoidMethod ((jobject) getView(), AndroidWebView.setWebChromeClient, juceWebChromeClient.get()); @@ -475,82 +479,62 @@ private: #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ METHOD (hostDeleted, "hostDeleted", "()V") \ - CALLBACK (webViewReceivedHttpError, "webViewReceivedHttpError", "(JLandroid/webkit/WebView;Landroid/webkit/WebResourceRequest;Landroid/webkit/WebResourceResponse;)V") \ - CALLBACK (webViewPageLoadStarted, "webViewPageLoadStarted", "(JLandroid/webkit/WebView;Ljava/lang/String;)Z") \ - CALLBACK (webViewPageLoadFinished, "webViewPageLoadFinished", "(JLandroid/webkit/WebView;Ljava/lang/String;)V") \ - CALLBACK (webViewReceivedSslError, "webViewReceivedSslError", "(JLandroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewReceivedHttpError>, "webViewReceivedHttpError", "(JLandroid/webkit/WebView;Landroid/webkit/WebResourceRequest;Landroid/webkit/WebResourceResponse;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewPageLoadStarted>, "webViewPageLoadStarted", "(JLandroid/webkit/WebView;Ljava/lang/String;)Z") \ + CALLBACK (generatedCallback<&Pimpl::webViewPageLoadFinished>, "webViewPageLoadFinished", "(JLandroid/webkit/WebView;Ljava/lang/String;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewReceivedSslError>, "webViewReceivedSslError", "(JLandroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V") \ - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceWebViewClient21, "com/rmsl/juce/JuceWebView21$Client", 21, JuceWebView21ByteCode, sizeof (JuceWebView21ByteCode)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceWebViewClient21, "com/rmsl/juce/JuceWebView21$Client", 21, JuceWebView21ByteCode) #undef JNI_CLASS_MEMBERS #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ METHOD (hostDeleted, "hostDeleted", "()V") \ - CALLBACK (webViewPageLoadStarted, "webViewPageLoadStarted", "(JLandroid/webkit/WebView;Ljava/lang/String;)Z") \ - CALLBACK (webViewPageLoadFinished, "webViewPageLoadFinished", "(JLandroid/webkit/WebView;Ljava/lang/String;)V") \ - CALLBACK (webViewReceivedSslError, "webViewReceivedSslError", "(JLandroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewPageLoadStarted>, "webViewPageLoadStarted", "(JLandroid/webkit/WebView;Ljava/lang/String;)Z") \ + CALLBACK (generatedCallback<&Pimpl::webViewPageLoadFinished>, "webViewPageLoadFinished", "(JLandroid/webkit/WebView;Ljava/lang/String;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewReceivedSslError>, "webViewReceivedSslError", "(JLandroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V") \ - DECLARE_JNI_CLASS_WITH_BYTECODE (JuceWebViewClient16, "com/rmsl/juce/JuceWebView$Client", 16, JuceWebView16ByteCode, sizeof (JuceWebView16ByteCode)) + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceWebViewClient16, "com/rmsl/juce/JuceWebView$Client", 16, JuceWebView16ByteCode) #undef JNI_CLASS_MEMBERS - static jboolean JNICALL webViewPageLoadStarted (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/, jstring url) + static jboolean webViewPageLoadStarted (JNIEnv*, Pimpl& t, jstring url) { - if (auto* myself = reinterpret_cast (host)) - return myself->handlePageAboutToLoad (juceString (url)); - - return 0; + return t.handlePageAboutToLoad (juceString (url)); } - static void JNICALL webViewPageLoadFinished (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/, jstring url) + static void webViewPageLoadFinished (JNIEnv*, Pimpl& t, jstring url) { - if (auto* myself = reinterpret_cast (host)) - myself->owner.pageFinishedLoading (juceString (url)); + t.owner.pageFinishedLoading (juceString (url)); } - static void JNICALL webViewReceivedHttpError (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/, jobject /*request*/, jobject errorResponse) + static void webViewReceivedSslError (JNIEnv* env, Pimpl& t, jobject sslError) { - if (auto* myself = reinterpret_cast (host)) - myself->webReceivedHttpError (errorResponse); - } - - static void JNICALL webViewReceivedSslError (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/, jobject /*sslErrorHandler*/, jobject sslError) - { - auto* env = getEnv(); - - if (auto* myself = reinterpret_cast (host)) - { - auto errorString = LocalRef ((jstring) env->CallObjectMethod (sslError, SslError.toString)); - - myself->owner.pageLoadHadNetworkError (juceString (errorString)); - } + const auto errorString = LocalRef ((jstring) env->CallObjectMethod (sslError, SslError.toString)); + t.owner.pageLoadHadNetworkError (juceString (errorString)); } //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ - CALLBACK (webViewCloseWindowRequest, "webViewCloseWindowRequest", "(JLandroid/webkit/WebView;)V") \ - CALLBACK (webViewCreateWindowRequest, "webViewCreateWindowRequest", "(JLandroid/webkit/WebView;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewCloseWindowRequest>, "webViewCloseWindowRequest", "(JLandroid/webkit/WebView;)V") \ + CALLBACK (generatedCallback<&Pimpl::webViewCreateWindowRequest>, "webViewCreateWindowRequest", "(JLandroid/webkit/WebView;)V") \ DECLARE_JNI_CLASS (JuceWebChromeClient, "com/rmsl/juce/JuceWebView$ChromeClient") #undef JNI_CLASS_MEMBERS - static void JNICALL webViewCloseWindowRequest (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/) + static void webViewCloseWindowRequest (JNIEnv*, Pimpl& t, jobject) { - if (auto* myself = reinterpret_cast (host)) - myself->owner.windowCloseRequest(); + t.owner.windowCloseRequest(); } - static void JNICALL webViewCreateWindowRequest (JNIEnv*, jobject /*activity*/, jlong host, jobject /*webView*/) + static void webViewCreateWindowRequest (JNIEnv*, Pimpl& t, jobject) { - if (auto* myself = reinterpret_cast (host)) - myself->owner.newWindowAttemptingToLoad ({}); + t.owner.newWindowAttemptingToLoad ({}); } //============================================================================== - void webReceivedHttpError (jobject errorResponse) + static void webViewReceivedHttpError (JNIEnv* env, Pimpl& t, jobject errorResponse) { - auto* env = getEnv(); - LocalRef responseClass (env->FindClass ("android/webkit/WebResourceResponse")); if (responseClass != nullptr) @@ -561,14 +545,14 @@ private: { auto errorString = LocalRef ((jstring) env->CallObjectMethod (errorResponse, method)); - owner.pageLoadHadNetworkError (juceString (errorString)); + t.owner.pageLoadHadNetworkError (juceString (errorString)); return; } } // Should never get here! jassertfalse; - owner.pageLoadHadNetworkError ({}); + t.owner.pageLoadHadNetworkError ({}); } //============================================================================== @@ -582,19 +566,17 @@ private: }; //============================================================================== -WebBrowserComponent::WebBrowserComponent (const bool unloadWhenHidden) +WebBrowserComponent::WebBrowserComponent (const Options& options) : blankPageShown (false), - unloadPageWhenHidden (unloadWhenHidden) + unloadPageWhenHidden (! options.keepsPageLoadedWhenBrowserIsHidden()) { setOpaque (true); - browser.reset (new Pimpl (*this)); + browser.reset (new Pimpl (*this, options.getUserAgent())); addAndMakeVisible (browser.get()); } -WebBrowserComponent::~WebBrowserComponent() -{ -} +WebBrowserComponent::~WebBrowserComponent() = default; //============================================================================== void WebBrowserComponent::goToURL (const String& url, @@ -719,7 +701,9 @@ void WebBrowserComponent::clearCookies() } } -WebBrowserComponent::Pimpl::JuceWebViewClient16_Class WebBrowserComponent::Pimpl::JuceWebViewClient16; -WebBrowserComponent::Pimpl::JuceWebViewClient21_Class WebBrowserComponent::Pimpl::JuceWebViewClient21; -WebBrowserComponent::Pimpl::JuceWebChromeClient_Class WebBrowserComponent::Pimpl::JuceWebChromeClient; +bool WebBrowserComponent::areOptionsSupported (const Options& options) +{ + return (options.getBackend() == Options::Backend::defaultBackend); +} + } // namespace juce diff --git a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp index ade2379d..d7c85d08 100644 --- a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp @@ -587,7 +587,7 @@ struct PushNotifications::Pimpl } } - void removeDeliveredNotification (const String& identifier) + void removeDeliveredNotification ([[maybe_unused]] const String& identifier) { if (@available (iOS 10, *)) { @@ -598,15 +598,13 @@ struct PushNotifications::Pimpl } else { - ignoreUnused (identifier); // Not supported on this platform jassertfalse; } } - void setupChannels (const Array& groups, const Array& channels) + void setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { - ignoreUnused (groups, channels); } void getPendingLocalNotifications() const @@ -679,18 +677,16 @@ struct PushNotifications::Pimpl return deviceToken; } - void subscribeToTopic (const String& topic) { ignoreUnused (topic); } - void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); } + void subscribeToTopic ([[maybe_unused]] const String& topic) {} + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) {} - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); } private: @@ -719,10 +715,8 @@ private: owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } - void failedToRegisterForRemoteNotifications (NSError* error) + void failedToRegisterForRemoteNotifications ([[maybe_unused]] NSError* error) { - ignoreUnused (error); - deviceToken.clear(); } @@ -794,15 +788,13 @@ private: JUCE_END_IGNORE_WARNINGS_GCC_LIKE - void willPresentNotificationWithCompletionHandler (UNNotification* notification, + void willPresentNotificationWithCompletionHandler ([[maybe_unused]] UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options)) { NSUInteger options = NSUInteger ((int)settings.allowBadge << 0 | (int)settings.allowSound << 1 | (int)settings.allowAlert << 2); - ignoreUnused (notification); - completionHandler (options); } diff --git a/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp index 30869457..6acaada9 100644 --- a/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp @@ -40,6 +40,9 @@ public: JUCE_GENERATE_FUNCTION_WITH_DEFAULT (webkit_settings_set_hardware_acceleration_policy, juce_webkit_settings_set_hardware_acceleration_policy, (WebKitSettings*, int), void) + JUCE_GENERATE_FUNCTION_WITH_DEFAULT (webkit_settings_set_user_agent, juce_webkit_settings_set_user_agent, + (WebKitSettings*, const gchar*), void) + JUCE_GENERATE_FUNCTION_WITH_DEFAULT (webkit_web_view_new_with_settings, juce_webkit_web_view_new_with_settings, (WebKitSettings*), GtkWidget*) @@ -116,6 +119,10 @@ public: JUCE_GENERATE_FUNCTION_WITH_DEFAULT (g_signal_connect_data, juce_g_signal_connect_data, (gpointer, const gchar*, GCallback, gpointer, GClosureNotify, GConnectFlags), gulong) + //============================================================================== + JUCE_GENERATE_FUNCTION_WITH_DEFAULT (gdk_set_allowed_backends, juce_gdk_set_allowed_backends, + (const char*), void) + //============================================================================== JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL (WebKitSymbols) @@ -164,6 +171,7 @@ private: return loadSymbols (webkitLib, makeSymbolBinding (juce_webkit_settings_new, "webkit_settings_new"), makeSymbolBinding (juce_webkit_settings_set_hardware_acceleration_policy, "webkit_settings_set_hardware_acceleration_policy"), + makeSymbolBinding (juce_webkit_settings_set_user_agent, "webkit_settings_set_user_agent"), makeSymbolBinding (juce_webkit_web_view_new_with_settings, "webkit_web_view_new_with_settings"), makeSymbolBinding (juce_webkit_policy_decision_use, "webkit_policy_decision_use"), makeSymbolBinding (juce_webkit_policy_decision_ignore, "webkit_policy_decision_ignore"), @@ -182,18 +190,19 @@ private: bool loadGtkSymbols() { return loadSymbols (gtkLib, - makeSymbolBinding (juce_gtk_init, "gtk_init"), - makeSymbolBinding (juce_gtk_plug_new, "gtk_plug_new"), - makeSymbolBinding (juce_gtk_scrolled_window_new, "gtk_scrolled_window_new"), - makeSymbolBinding (juce_gtk_container_add, "gtk_container_add"), - makeSymbolBinding (juce_gtk_widget_show_all, "gtk_widget_show_all"), - makeSymbolBinding (juce_gtk_plug_get_id, "gtk_plug_get_id"), - makeSymbolBinding (juce_gtk_main, "gtk_main"), - makeSymbolBinding (juce_gtk_main_quit, "gtk_main_quit"), - makeSymbolBinding (juce_g_unix_fd_add, "g_unix_fd_add"), - makeSymbolBinding (juce_g_object_ref, "g_object_ref"), - makeSymbolBinding (juce_g_object_unref, "g_object_unref"), - makeSymbolBinding (juce_g_signal_connect_data, "g_signal_connect_data")); + makeSymbolBinding (juce_gtk_init, "gtk_init"), + makeSymbolBinding (juce_gtk_plug_new, "gtk_plug_new"), + makeSymbolBinding (juce_gtk_scrolled_window_new, "gtk_scrolled_window_new"), + makeSymbolBinding (juce_gtk_container_add, "gtk_container_add"), + makeSymbolBinding (juce_gtk_widget_show_all, "gtk_widget_show_all"), + makeSymbolBinding (juce_gtk_plug_get_id, "gtk_plug_get_id"), + makeSymbolBinding (juce_gtk_main, "gtk_main"), + makeSymbolBinding (juce_gtk_main_quit, "gtk_main_quit"), + makeSymbolBinding (juce_g_unix_fd_add, "g_unix_fd_add"), + makeSymbolBinding (juce_g_object_ref, "g_object_ref"), + makeSymbolBinding (juce_g_object_unref, "g_object_unref"), + makeSymbolBinding (juce_g_signal_connect_data, "g_signal_connect_data"), + makeSymbolBinding (juce_gdk_set_allowed_backends, "gdk_set_allowed_backends")); } //============================================================================== @@ -339,20 +348,26 @@ class GtkChildProcess : private CommandReceiver::Responder { public: //============================================================================== - GtkChildProcess (int inChannel, int outChannelToUse) + GtkChildProcess (int inChannel, int outChannelToUse, const String& userAgentToUse) : outChannel (outChannelToUse), - receiver (this, inChannel) + receiver (this, inChannel), + userAgent (userAgentToUse) {} int entry() { CommandReceiver::setBlocking (outChannel, true); + // webkit2gtk crashes when using the wayland backend embedded into an x11 window + WebKitSymbols::getInstance()->juce_gdk_set_allowed_backends ("x11"); + WebKitSymbols::getInstance()->juce_gtk_init (nullptr, nullptr); auto* settings = WebKitSymbols::getInstance()->juce_webkit_settings_new(); WebKitSymbols::getInstance()->juce_webkit_settings_set_hardware_acceleration_policy (settings, /* WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER */ 2); + if (userAgent.isNotEmpty()) + WebKitSymbols::getInstance()->juce_webkit_settings_set_user_agent (settings, userAgent.toRawUTF8()); auto* plug = WebKitSymbols::getInstance()->juce_gtk_plug_new (0); auto* container = WebKitSymbols::getInstance()->juce_gtk_scrolled_window_new (nullptr, nullptr); @@ -540,10 +555,9 @@ public: break; case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: { - auto* response = (WebKitNavigationPolicyDecision*) decision; + [[maybe_unused]] auto* response = (WebKitNavigationPolicyDecision*) decision; // for now just always allow response requests - ignoreUnused (response); WebKitSymbols::getInstance()->juce_webkit_policy_decision_use (decision); return true; } @@ -598,6 +612,7 @@ private: int outChannel = 0; CommandReceiver receiver; + String userAgent; WebKitWebView* webview = nullptr; Array decisions; }; @@ -607,8 +622,8 @@ class WebBrowserComponent::Pimpl : private Thread, private CommandReceiver::Responder { public: - Pimpl (WebBrowserComponent& parent) - : Thread ("Webview"), owner (parent) + Pimpl (WebBrowserComponent& parent, const String& userAgentToUse) + : Thread ("Webview"), owner (parent), userAgent (userAgentToUse) { webKitIsAvailable = WebKitSymbols::getInstance()->isWebKitAvailable(); } @@ -626,9 +641,8 @@ public: launchChild(); - auto ret = pipe (threadControl); + [[maybe_unused]] auto ret = pipe (threadControl); - ignoreUnused (ret); jassert (ret == 0); CommandReceiver::setBlocking (inChannel, true); @@ -756,11 +770,11 @@ private: { int inPipe[2], outPipe[2]; - auto ret = pipe (inPipe); - ignoreUnused (ret); jassert (ret == 0); + [[maybe_unused]] auto ret = pipe (inPipe); + jassert (ret == 0); ret = pipe (outPipe); - ignoreUnused (ret); jassert (ret == 0); + jassert (ret == 0); auto pid = fork(); if (pid == 0) @@ -768,7 +782,6 @@ private: close (inPipe[0]); close (outPipe[1]); - HeapBlock argv (5); StringArray arguments; arguments.add (File::getSpecialLocation (File::currentExecutableFile).getFullPathName()); @@ -776,15 +789,21 @@ private: arguments.add (String (outPipe[0])); arguments.add (String (inPipe [1])); - for (int i = 0; i < arguments.size(); ++i) - argv[i] = arguments[i].toRawUTF8(); + if (userAgent.isNotEmpty()) + arguments.add (userAgent); - argv[4] = nullptr; + std::vector argv; + argv.reserve (static_cast (arguments.size() + 1)); + + for (const auto& arg : arguments) + argv.push_back (arg.toRawUTF8()); + + argv.push_back (nullptr); if (JUCEApplicationBase::isStandaloneApp()) - execv (arguments[0].toRawUTF8(), (char**) argv.getData()); + execv (arguments[0].toRawUTF8(), (char**) argv.data()); else - juce_gtkWebkitMain (4, (const char**) argv.getData()); + juce_gtkWebkitMain (arguments.size(), (const char**) argv.data()); exit (0); } @@ -896,6 +915,7 @@ private: bool webKitIsAvailable = false; WebBrowserComponent& owner; + String userAgent; std::unique_ptr receiver; int childProcess = 0, inChannel = 0, outChannel = 0; int threadControl[2]; @@ -905,9 +925,8 @@ private: }; //============================================================================== -WebBrowserComponent::WebBrowserComponent (const bool unloadWhenHidden) - : browser (new Pimpl (*this)), - unloadPageWhenHidden (unloadWhenHidden) +WebBrowserComponent::WebBrowserComponent (const Options& options) + : browser (new Pimpl (*this, options.getUserAgent())) { ignoreUnused (blankPageShown); ignoreUnused (unloadPageWhenHidden); @@ -1010,13 +1029,19 @@ void WebBrowserComponent::clearCookies() jassertfalse; } +bool WebBrowserComponent::areOptionsSupported (const Options& options) +{ + return (options.getBackend() == Options::Backend::defaultBackend); +} + int juce_gtkWebkitMain (int argc, const char* argv[]) { - if (argc != 4) + if (argc < 4) return -1; GtkChildProcess child (String (argv[2]).getIntValue(), - String (argv[3]).getIntValue()); + String (argv[3]).getIntValue(), + argc >= 5 ? String (argv[4]) : String()); return child.entry(); } diff --git a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp index a56538de..76801527 100644 --- a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp +++ b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp @@ -73,11 +73,13 @@ public: { SharedKeyWindow (ComponentPeer* peerToUse) : keyPeer (peerToUse), - keyProxy (juce_createKeyProxyWindow (keyPeer)) + keyProxy (juce_createKeyProxyWindow (keyPeer)), + association (peerToUse, keyProxy) {} ~SharedKeyWindow() { + association = {}; juce_deleteKeyProxyWindow (keyProxy); auto& keyWindows = getKeyWindows(); @@ -120,6 +122,7 @@ public: //============================================================================== ComponentPeer* keyPeer; Window keyProxy; + ScopedWindowAssociation association; static HashMap& getKeyWindows() { diff --git a/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm b/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm index 014fa7f0..9dddc12a 100644 --- a/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm +++ b/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm @@ -85,11 +85,9 @@ namespace &cfPlugInInterface, &score) == kIOReturnSuccess) { - HRESULT hr = (*cfPlugInInterface)->QueryInterface (cfPlugInInterface, - CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), - device); - - ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = (*cfPlugInInterface)->QueryInterface (cfPlugInInterface, + CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), + device); (*cfPlugInInterface)->Release (cfPlugInInterface); } diff --git a/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm b/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm index 7c85aef6..762e747c 100644 --- a/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm +++ b/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm @@ -164,6 +164,12 @@ void NSViewComponent::resizeToFitView() } } +void NSViewComponent::resizeViewToFit() +{ + if (attachment != nullptr) + static_cast (attachment.get())->componentMovedOrResized (true, true); +} + void NSViewComponent::paint (Graphics&) {} void NSViewComponent::alphaChanged() diff --git a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp index f35ec878..4a06ebb1 100644 --- a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp @@ -33,9 +33,7 @@ namespace PushNotificationsDelegateDetailsOsx using Action = PushNotifications::Notification::Action; //============================================================================== - NSUserNotification* juceNotificationToNSUserNotification (const PushNotifications::Notification& n, - bool isEarlierThanMavericks, - bool isEarlierThanYosemite) + static NSUserNotification* juceNotificationToNSUserNotification (const PushNotifications::Notification& n) { auto notification = [[NSUserNotification alloc] init]; @@ -78,7 +76,7 @@ namespace PushNotificationsDelegateDetailsOsx if (n.actions.size() > 0) notification.actionButtonTitle = juceStringToNS (n.actions.getReference (0).title); - if (! isEarlierThanMavericks) + if (@available (macOS 10.9, *)) { notification.identifier = juceStringToNS (n.identifier); @@ -112,7 +110,7 @@ namespace PushNotificationsDelegateDetailsOsx notification.contentImage = [[NSImage alloc] initWithContentsOfFile: imagePath]; - if (! isEarlierThanYosemite) + if (@available (macOS 10.10, *)) { if (n.actions.size() > 1) { @@ -133,9 +131,7 @@ namespace PushNotificationsDelegateDetailsOsx } //============================================================================== - PushNotifications::Notification nsUserNotificationToJuceNotification (NSUserNotification* n, - bool isEarlierThanMavericks, - bool isEarlierThanYosemite) + static PushNotifications::Notification nsUserNotificationToJuceNotification (NSUserNotification* n) { PushNotifications::Notification notif; @@ -160,7 +156,7 @@ namespace PushNotificationsDelegateDetailsOsx notif.soundToPlay = URL (nsStringToJuce (n.soundName)); notif.properties = nsDictionaryToVar (n.userInfo); - if (! isEarlierThanMavericks) + if (@available (macOS 10.9, *)) { notif.identifier = nsStringToJuce (n.identifier); @@ -175,7 +171,7 @@ namespace PushNotificationsDelegateDetailsOsx Action action; action.title = nsStringToJuce (n.actionButtonTitle); - if (! isEarlierThanMavericks) + if (@available (macOS 10.9, *)) { if (n.hasReplyButton) action.style = Action::text; @@ -187,7 +183,7 @@ namespace PushNotificationsDelegateDetailsOsx actions.add (action); } - if (! isEarlierThanYosemite) + if (@available (macOS 10.10, *)) { if (n.additionalActions != nil) { @@ -206,7 +202,7 @@ namespace PushNotificationsDelegateDetailsOsx } //============================================================================== - var getNotificationPropertiesFromDictionaryVar (const var& dictionaryVar) + static var getNotificationPropertiesFromDictionaryVar (const var& dictionaryVar) { auto* dictionaryVarObject = dictionaryVar.getDynamicObject(); @@ -230,7 +226,7 @@ namespace PushNotificationsDelegateDetailsOsx return var (propsVarObject.get()); } - PushNotifications::Notification nsDictionaryToJuceNotification (NSDictionary* dictionary) + static PushNotifications::Notification nsDictionaryToJuceNotification (NSDictionary* dictionary) { const var dictionaryVar = nsDictionaryToVar (dictionary); @@ -362,44 +358,48 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate void requestPermissionsWithSettings (const PushNotifications::Settings& settingsToUse) { - if (isEarlierThanLion) - return; - - settings = settingsToUse; + if (@available (macOS 10.7, *)) + { + settings = settingsToUse; - NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); + NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); - if (isAtLeastMountainLion) - types |= (NSUInteger) ((bool) settings.allowSound << 1 | (bool) settings.allowAlert << 2); + if (@available (macOS 10.8, *)) + { + types |= (NSUInteger) ((settings.allowSound ? NSRemoteNotificationTypeSound : 0) + | (settings.allowAlert ? NSRemoteNotificationTypeAlert : 0)); + } - [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; + [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; + } } void requestSettingsUsed() { - if (isEarlierThanLion) + if (@available (macOS 10.7, *)) { - // no settings available - owner.listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); - return; - } + settings.allowBadge = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeBadge; - settings.allowBadge = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeBadge; + if (@available (macOS 10.8, *)) + { + settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; + settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; + } - if (isAtLeastMountainLion) + owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); + } + else { - settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; - settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; + // no settings available + owner.listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); } - - owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } bool areNotificationsEnabled() const { return true; } void sendLocalNotification (const Notification& n) { - auto* notification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n, isEarlierThanMavericks, isEarlierThanYosemite); + auto* notification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n); [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification: notification]; } @@ -409,7 +409,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate Array notifs; for (NSUserNotification* n in [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications) - notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n, isEarlierThanMavericks, isEarlierThanYosemite)); + notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n)); owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); }); } @@ -424,14 +424,13 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate PushNotifications::Notification n; n.identifier = identifier; - auto nsNotification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n, isEarlierThanMavericks, isEarlierThanYosemite); + auto nsNotification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n); [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification: nsNotification]; } - void setupChannels (const Array& groups, const Array& channels) + void setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { - ignoreUnused (groups, channels); } void getPendingLocalNotifications() const @@ -439,7 +438,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate Array notifs; for (NSUserNotification* n in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) - notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n, isEarlierThanMavericks, isEarlierThanYosemite)); + notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n)); owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); }); } @@ -449,7 +448,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate PushNotifications::Notification n; n.identifier = identifier; - auto nsNotification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n, isEarlierThanMavericks, isEarlierThanYosemite); + auto nsNotification = PushNotificationsDelegateDetailsOsx::juceNotificationToNSUserNotification (n); [[NSUserNotificationCenter defaultUserNotificationCenter] removeScheduledNotification: nsNotification]; } @@ -494,9 +493,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } - void failedToRegisterForRemoteNotifications (NSError* error) override + void failedToRegisterForRemoteNotifications ([[maybe_unused]] NSError* error) override { - ignoreUnused (error); deviceToken.clear(); } @@ -506,14 +504,13 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, n); }); } - void didDeliverNotification (NSUserNotification* notification) override + void didDeliverNotification ([[maybe_unused]] NSUserNotification* notification) override { - ignoreUnused (notification); } void didActivateNotification (NSUserNotification* notification) override { - auto n = PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (notification, isEarlierThanMavericks, isEarlierThanYosemite); + auto n = PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (notification); if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) { @@ -521,9 +518,14 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate } else { - auto actionIdentifier = (! isEarlierThanYosemite && notification.additionalActivationAction != nil) - ? nsStringToJuce (notification.additionalActivationAction.identifier) - : nsStringToJuce (notification.actionButtonTitle); + const auto actionIdentifier = nsStringToJuce ([&] + { + if (@available (macOS 10.10, *)) + if (notification.additionalActivationAction != nil) + return notification.additionalActivationAction.identifier; + + return notification.actionButtonTitle; + }()); auto reply = notification.activationType == NSUserNotificationActivationTypeReplied ? nsStringToJuce ([notification.response string]) @@ -535,28 +537,21 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate bool shouldPresentNotification (NSUserNotification*) override { return true; } - void subscribeToTopic (const String& topic) { ignoreUnused (topic); } - void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); } + void subscribeToTopic ([[maybe_unused]] const String& topic) {} + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) {} - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); } private: PushNotifications& owner; - const bool isEarlierThanLion = std::floor (NSFoundationVersionNumber) < std::floor (NSFoundationVersionNumber10_7); - const bool isAtLeastMountainLion = std::floor (NSFoundationVersionNumber) >= NSFoundationVersionNumber10_7; - const bool isEarlierThanMavericks = std::floor (NSFoundationVersionNumber) < NSFoundationVersionNumber10_9; - const bool isEarlierThanYosemite = std::floor (NSFoundationVersionNumber) <= NSFoundationVersionNumber10_9; - bool initialised = false; String deviceToken; diff --git a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm index 8f3c3701..1d0fef01 100644 --- a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm +++ b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm @@ -412,7 +412,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") class WebViewImpl : public WebViewBase { public: - WebViewImpl (WebBrowserComponent* owner) + WebViewImpl (WebBrowserComponent* owner, const String& userAgent) { static WebViewKeyEquivalentResponder webviewClass; @@ -420,6 +420,8 @@ public: frameName: nsEmptyString() groupName: nsEmptyString()]); + webView.get().customUserAgent = juceStringToNS (userAgent); + static DownloadClickDetectorClass cls; clickListener.reset ([cls.createInstance() init]); DownloadClickDetectorClass::setOwner (clickListener.get(), owner); @@ -497,22 +499,29 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE class API_AVAILABLE (macos (10.11)) WKWebViewImpl : public WebViewBase { public: - WKWebViewImpl (WebBrowserComponent* owner) + WKWebViewImpl (WebBrowserComponent* owner, const String& userAgent) { - #if JUCE_MAC - static WebViewKeyEquivalentResponder webviewClass; + #if JUCE_MAC + static WebViewKeyEquivalentResponder webviewClass; + + webView.reset ([webviewClass.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)]); + #else + webView.reset ([[WKWebView alloc] initWithFrame: CGRectMake (0, 0, 100.0f, 100.0f)]); + #endif + + if (userAgent.isNotEmpty()) + webView.get().customUserAgent = juceStringToNS (userAgent); - webView.reset ([webviewClass.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)]); - #else - webView.reset ([[WKWebView alloc] initWithFrame: CGRectMake (0, 0, 100.0f, 100.0f)]); - #endif + static WebViewDelegateClass cls; + webViewDelegate.reset ([cls.createInstance() init]); + WebViewDelegateClass::setOwner (webViewDelegate.get(), owner); - static WebViewDelegateClass cls; - webViewDelegate.reset ([cls.createInstance() init]); - WebViewDelegateClass::setOwner (webViewDelegate.get(), owner); + [webView.get() setNavigationDelegate: webViewDelegate.get()]; + [webView.get() setUIDelegate: webViewDelegate.get()]; - [webView.get() setNavigationDelegate: webViewDelegate.get()]; - [webView.get() setUIDelegate: webViewDelegate.get()]; + #if JUCE_DEBUG + [[[webView.get() configuration] preferences] setValue: @(true) forKey: @"developerExtrasEnabled"]; + #endif } ~WKWebViewImpl() override @@ -572,19 +581,19 @@ class WebBrowserComponent::Pimpl #endif { public: - Pimpl (WebBrowserComponent* owner) + Pimpl (WebBrowserComponent* owner, const String& userAgent) { if (@available (macOS 10.11, *)) - webView = std::make_unique (owner); + webView = std::make_unique (owner, userAgent); #if JUCE_MAC else - webView = std::make_unique (owner); + webView = std::make_unique (owner, userAgent); #endif setView (webView->getWebView()); } - ~Pimpl() + ~Pimpl() override { webView = nullptr; setView (nil); @@ -608,11 +617,11 @@ private: }; //============================================================================== -WebBrowserComponent::WebBrowserComponent (bool unloadWhenHidden) - : unloadPageWhenHidden (unloadWhenHidden) +WebBrowserComponent::WebBrowserComponent (const Options& options) + : unloadPageWhenHidden (! options.keepsPageLoadedWhenBrowserIsHidden()) { setOpaque (true); - browser.reset (new Pimpl (this)); + browser.reset (new Pimpl (this, options.getUserAgent())); addAndMakeVisible (browser.get()); } @@ -734,4 +743,10 @@ void WebBrowserComponent::clearCookies() [[NSUserDefaults standardUserDefaults] synchronize]; } +//============================================================================== +bool WebBrowserComponent::areOptionsSupported (const Options& options) +{ + return (options.getBackend() == Options::Backend::defaultBackend); +} + } // namespace juce diff --git a/modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp b/modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp index 29593758..d4d9a45e 100644 --- a/modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp +++ b/modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp @@ -147,6 +147,12 @@ namespace ActiveXHelpers ~JuceIOleClientSite() { inplaceSite->Release(); + + if (dispatchEventHandler != nullptr) + { + dispatchEventHandler->Release(); + dispatchEventHandler = nullptr; + } } JUCE_COMRESULT QueryInterface (REFIID type, void** result) @@ -159,6 +165,12 @@ namespace ActiveXHelpers *result = static_cast (inplaceSite); return S_OK; } + else if (type == __uuidof(IDispatch) && dispatchEventHandler != nullptr) + { + dispatchEventHandler->AddRef(); + *result = dispatchEventHandler; + return S_OK; + } return ComBaseClassHelper ::QueryInterface (type, result); @@ -180,7 +192,31 @@ namespace ActiveXHelpers return S_FALSE; } + void setEventHandler (void* eventHandler) + { + IDispatch* newEventHandler = nullptr; + + if (eventHandler != nullptr) + { + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token") + + auto iidIDispatch = __uuidof (IDispatch); + + if (static_cast(eventHandler)->QueryInterface (iidIDispatch, (void**) &newEventHandler) != S_OK + || newEventHandler == nullptr) + return; + + JUCE_END_IGNORE_WARNINGS_GCC_LIKE + } + + if (dispatchEventHandler != nullptr) + dispatchEventHandler->Release(); + + dispatchEventHandler = newEventHandler; + } + JuceIOleInPlaceSite* inplaceSite; + IDispatch* dispatchEventHandler = nullptr; }; //============================================================================== @@ -251,6 +287,11 @@ public: ~Pimpl() override { + // If the wndproc of the ActiveX HWND isn't set back to it's original + // wndproc, then clientSite will leak when control is released + if (controlHWND != nullptr) + SetWindowLongPtr ((HWND) controlHWND, GWLP_WNDPROC, (LONG_PTR) originalWndProc); + if (control != nullptr) { control->Close (OLECLOSE_NOSAVE); @@ -418,7 +459,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID) if (newControl->control->DoVerb (OLEIVERB_SHOW, nullptr, newControl->clientSite, 0, hwnd, &rect) == S_OK) { - control.reset (newControl.release()); + control = std::move (newControl); control->controlHWND = ActiveXHelpers::getHWND (this); if (control->controlHWND != nullptr) @@ -485,6 +526,12 @@ intptr_t ActiveXControlComponent::offerEventToActiveXControlStatic (void* ptr) return S_FALSE; } +void ActiveXControlComponent::setEventHandler (void* eventHandler) +{ + if (control->clientSite != nullptr) + control->clientSite->setEventHandler (eventHandler); +} + LRESULT juce_offerEventToActiveXControl (::MSG& msg); LRESULT juce_offerEventToActiveXControl (::MSG& msg) { diff --git a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp index 04083be6..7d23c7f0 100644 --- a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp @@ -52,7 +52,9 @@ class Win32WebView : public InternalWebViewType, public ActiveXControlComponent { public: - Win32WebView (WebBrowserComponent& owner) + Win32WebView (WebBrowserComponent& parent, const String& userAgentToUse) + : owner (parent), + userAgent (userAgentToUse) { owner.addAndMakeVisible (this); } @@ -60,7 +62,10 @@ public: ~Win32WebView() override { if (connectionPoint != nullptr) + { connectionPoint->Unadvise (adviseCookie); + connectionPoint->Release(); + } if (browser != nullptr) browser->Release(); @@ -75,6 +80,7 @@ public: auto iidWebBrowser2 = __uuidof (IWebBrowser2); auto iidConnectionPointContainer = __uuidof (IConnectionPointContainer); + auto iidOleControl = __uuidof (IOleControl); browser = (IWebBrowser2*) queryInterface (&iidWebBrowser2); @@ -84,13 +90,19 @@ public: if (connectionPoint != nullptr) { - if (auto* owner = dynamic_cast (Component::getParentComponent())) - { - auto handler = new EventHandler (*owner); - connectionPoint->Advise (handler, &adviseCookie); - handler->Release(); - } + auto handler = new EventHandler (*this); + connectionPoint->Advise (handler, &adviseCookie); + setEventHandler (handler); + handler->Release(); } + + connectionPointContainer->Release(); + } + + if (auto oleControl = (IOleControl*) queryInterface (&iidOleControl)) + { + oleControl->OnAmbientPropertyChange (/*DISPID_AMBIENT_USERAGENT*/-5513); + oleControl->Release(); } JUCE_END_IGNORE_WARNINGS_GCC_LIKE @@ -101,7 +113,7 @@ public: return browser != nullptr; } - void goToURL (const String& url, const StringArray* headers, const MemoryBlock* postData) override + void goToURL (const String& url, const StringArray* requestedHeaders, const MemoryBlock* postData) override { if (browser != nullptr) { @@ -111,10 +123,18 @@ public: VariantInit (&postDataVar); VariantInit (&headersVar); - if (headers != nullptr) + StringArray headers; + + if (userAgent.isNotEmpty()) + headers.add("User-Agent: " + userAgent); + + if (requestedHeaders != nullptr) + headers.addArray (*requestedHeaders); + + if (headers.size() > 0) { V_VT (&headersVar) = VT_BSTR; - V_BSTR (&headersVar) = SysAllocString ((const OLECHAR*) headers->joinIntoString ("\r\n").toWideCharPointer()); + V_BSTR (&headersVar) = SysAllocString ((const OLECHAR*) headers.joinIntoString ("\r\n").toWideCharPointer()); } if (postData != nullptr && postData->getSize() > 0) @@ -220,41 +240,51 @@ public: } private: + WebBrowserComponent& owner; IWebBrowser2* browser = nullptr; IConnectionPoint* connectionPoint = nullptr; DWORD adviseCookie = 0; + String userAgent; //============================================================================== struct EventHandler : public ComBaseClassHelper, public ComponentMovementWatcher { - EventHandler (WebBrowserComponent& w) : ComponentMovementWatcher (&w), owner (w) {} + EventHandler (Win32WebView& w) : ComponentMovementWatcher (&w.owner), owner (w) {} JUCE_COMRESULT GetTypeInfoCount (UINT*) override { return E_NOTIMPL; } JUCE_COMRESULT GetTypeInfo (UINT, LCID, ITypeInfo**) override { return E_NOTIMPL; } JUCE_COMRESULT GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) override { return E_NOTIMPL; } JUCE_COMRESULT Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams, - VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/) override + VARIANT* pVarResult, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/) override { + + if (dispIdMember == /*DISPID_AMBIENT_USERAGENT*/-5513) + { + V_VT( pVarResult ) = VT_BSTR; + V_BSTR( pVarResult ) = SysAllocString ((const OLECHAR*) String(owner.userAgent).toWideCharPointer());; + return S_OK; + } + if (dispIdMember == DISPID_BEFORENAVIGATE2) { *pDispParams->rgvarg->pboolVal - = owner.pageAboutToLoad (getStringFromVariant (pDispParams->rgvarg[5].pvarVal)) ? VARIANT_FALSE + = owner.owner.pageAboutToLoad (getStringFromVariant (pDispParams->rgvarg[5].pvarVal)) ? VARIANT_FALSE : VARIANT_TRUE; return S_OK; } if (dispIdMember == 273 /*DISPID_NEWWINDOW3*/) { - owner.newWindowAttemptingToLoad (pDispParams->rgvarg[0].bstrVal); + owner.owner.newWindowAttemptingToLoad (pDispParams->rgvarg[0].bstrVal); *pDispParams->rgvarg[3].pboolVal = VARIANT_TRUE; return S_OK; } if (dispIdMember == DISPID_DOCUMENTCOMPLETE) { - owner.pageFinishedLoading (getStringFromVariant (pDispParams->rgvarg[0].pvarVal)); + owner.owner.pageFinishedLoading (getStringFromVariant (pDispParams->rgvarg[0].pvarVal)); return S_OK; } @@ -275,7 +305,7 @@ private: String message (messageBuffer, size); LocalFree (messageBuffer); - if (! owner.pageLoadHadNetworkError (message)) + if (! owner.owner.pageLoadHadNetworkError (message)) *pDispParams->rgvarg[0].pboolVal = VARIANT_TRUE; } @@ -284,7 +314,7 @@ private: if (dispIdMember == 263 /*DISPID_WINDOWCLOSING*/) { - owner.windowCloseRequest(); + owner.owner.windowCloseRequest(); // setting this bool tells the browser to ignore the event - we'll handle it. if (pDispParams->cArgs > 0 && pDispParams->rgvarg[0].vt == (VT_BYREF | VT_BOOL)) @@ -304,7 +334,7 @@ private: using ComponentMovementWatcher::componentMovedOrResized; private: - WebBrowserComponent& owner; + Win32WebView& owner; static String getStringFromVariant (VARIANT* v) { @@ -328,12 +358,15 @@ class WebView2 : public InternalWebViewType, public ComponentMovementWatcher { public: - WebView2 (WebBrowserComponent& o, const WebView2Preferences& prefs) + WebView2 (WebBrowserComponent& o, const WebBrowserComponent::Options& prefs) : ComponentMovementWatcher (&o), owner (o), - preferences (prefs) + preferences (prefs.getWinWebView2BackendOptions()), + userAgent (prefs.getUserAgent()) { - if (! createWebViewEnvironment()) + if (auto handle = createWebViewHandle (preferences)) + webViewHandle = std::move (*handle); + else throw std::runtime_error ("Failed to create the CoreWebView2Environemnt"); owner.addAndMakeVisible (this); @@ -343,16 +376,13 @@ public: { removeEventHandlers(); closeWebView(); - - if (webView2LoaderHandle != nullptr) - ::FreeLibrary (webView2LoaderHandle); } void createBrowser() override { if (webView == nullptr) { - jassert (webViewEnvironment != nullptr); + jassert (webViewHandle.environment != nullptr); createWebView(); } } @@ -432,6 +462,56 @@ public: owner.visibilityChanged(); } + //============================================================================== + struct WebViewHandle + { + using LibraryRef = std::unique_ptr::element_type, decltype(&::FreeLibrary)>; + LibraryRef loaderHandle {nullptr, &::FreeLibrary}; + ComSmartPtr environment; + }; + + static std::optional createWebViewHandle(const WebBrowserComponent::Options::WinWebView2& options) + { + using CreateWebViewEnvironmentWithOptionsFunc = HRESULT (*) (PCWSTR, PCWSTR, + ICoreWebView2EnvironmentOptions*, + ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler*); + + auto dllPath = options.getDLLLocation().getFullPathName(); + + if (dllPath.isEmpty()) + dllPath = "WebView2Loader.dll"; + + WebViewHandle result; + + result.loaderHandle = WebViewHandle::LibraryRef (LoadLibraryA (dllPath.toUTF8()), &::FreeLibrary); + + if (result.loaderHandle == nullptr) + return {}; + + auto* createWebViewEnvironmentWithOptions = (CreateWebViewEnvironmentWithOptionsFunc) GetProcAddress (result.loaderHandle.get(), + "CreateCoreWebView2EnvironmentWithOptions"); + if (createWebViewEnvironmentWithOptions == nullptr) + return {}; + + auto webViewOptions = Microsoft::WRL::Make(); + const auto userDataFolder = options.getUserDataFolder().getFullPathName(); + + auto hr = createWebViewEnvironmentWithOptions (nullptr, + userDataFolder.isNotEmpty() ? userDataFolder.toWideCharPointer() : nullptr, + webViewOptions.Get(), + Callback( + [&result] (HRESULT, ICoreWebView2Environment* env) -> HRESULT + { + result.environment = env; + return S_OK; + }).Get()); + + if (! SUCCEEDED (hr)) + return {}; + + return result; + } + private: //============================================================================== template @@ -613,50 +693,17 @@ private: { settings->put_IsStatusBarEnabled (! preferences.getIsStatusBarDisabled()); settings->put_IsBuiltInErrorPageEnabled (! preferences.getIsBuiltInErrorPageDisabled()); - } - } - - bool createWebViewEnvironment() - { - using CreateWebViewEnvironmentWithOptionsFunc = HRESULT (*) (PCWSTR, PCWSTR, - ICoreWebView2EnvironmentOptions*, - ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler*); - - auto dllPath = preferences.getDLLLocation().getFullPathName(); - if (dllPath.isEmpty()) - dllPath = "WebView2Loader.dll"; - - webView2LoaderHandle = LoadLibraryA (dllPath.toUTF8()); + if (userAgent.isNotEmpty()) + { + ComSmartPtr settings2; - if (webView2LoaderHandle == nullptr) - return false; + settings.QueryInterface (settings2); - auto* createWebViewEnvironmentWithOptions = (CreateWebViewEnvironmentWithOptionsFunc) GetProcAddress (webView2LoaderHandle, - "CreateCoreWebView2EnvironmentWithOptions"); - if (createWebViewEnvironmentWithOptions == nullptr) - { - // failed to load WebView2Loader.dll - jassertfalse; - return false; + if (settings2 != nullptr) + settings2->put_UserAgent (userAgent.toWideCharPointer()); + } } - - auto options = Microsoft::WRL::Make(); - const auto userDataFolder = preferences.getUserDataFolder().getFullPathName(); - - auto hr = createWebViewEnvironmentWithOptions (nullptr, - userDataFolder.isNotEmpty() ? userDataFolder.toWideCharPointer() : nullptr, - options.Get(), - Callback( - [weakThis = WeakReference { this }] (HRESULT, ICoreWebView2Environment* env) -> HRESULT - { - if (weakThis != nullptr) - weakThis->webViewEnvironment = env; - - return S_OK; - }).Get()); - - return SUCCEEDED (hr); } void createWebView() @@ -667,7 +714,7 @@ private: WeakReference weakThis (this); - webViewEnvironment->CreateCoreWebView2Controller ((HWND) peer->getNativeHandle(), + webViewHandle.environment->CreateCoreWebView2Controller ((HWND) peer->getNativeHandle(), Callback ( [weakThis = WeakReference { this }] (HRESULT, ICoreWebView2Controller* controller) -> HRESULT { @@ -706,7 +753,7 @@ private: webView = nullptr; } - webViewEnvironment = nullptr; + webViewHandle.environment = nullptr; } //============================================================================== @@ -732,11 +779,10 @@ private: //============================================================================== WebBrowserComponent& owner; - WebView2Preferences preferences; - - HMODULE webView2LoaderHandle = nullptr; + WebBrowserComponent::Options::WinWebView2 preferences; + String userAgent; - ComSmartPtr webViewEnvironment; + WebViewHandle webViewHandle; ComSmartPtr webViewController; ComSmartPtr webView; @@ -769,8 +815,9 @@ class WebBrowserComponent::Pimpl { public: Pimpl (WebBrowserComponent& owner, - const WebView2Preferences& preferences, - bool useWebView2) + [[maybe_unused]] const Options& preferences, + bool useWebView2, + const String& userAgent) { if (useWebView2) { @@ -783,10 +830,8 @@ public: #endif } - ignoreUnused (preferences); - if (internal == nullptr) - internal.reset (new Win32WebView (owner)); + internal.reset (new Win32WebView (owner, userAgent)); } InternalWebViewType& getInternalWebView() @@ -799,15 +844,10 @@ private: }; //============================================================================== -WebBrowserComponent::WebBrowserComponent (bool unloadWhenHidden) - : browser (new Pimpl (*this, {}, false)), - unloadPageWhenHidden (unloadWhenHidden) -{ - setOpaque (true); -} - -WebBrowserComponent::WebBrowserComponent (ConstructWithoutPimpl args) - : unloadPageWhenHidden (args.unloadWhenHidden) +WebBrowserComponent::WebBrowserComponent (const Options& options) + : browser (new Pimpl (*this, options, + options.getBackend() == Options::Backend::webview2, options.getUserAgent())), + unloadPageWhenHidden (! options.keepsPageLoadedWhenBrowserIsHidden()) { setOpaque (true); } @@ -816,13 +856,6 @@ WebBrowserComponent::~WebBrowserComponent() { } -WindowsWebView2WebBrowserComponent::WindowsWebView2WebBrowserComponent (bool unloadWhenHidden, - const WebView2Preferences& preferences) - : WebBrowserComponent (ConstructWithoutPimpl { unloadWhenHidden }) -{ - browser = std::make_unique (*this, preferences, true); -} - //============================================================================== void WebBrowserComponent::goToURL (const String& url, const StringArray* headers, @@ -977,4 +1010,21 @@ void WebBrowserComponent::clearCookies() } } +//============================================================================== +bool WebBrowserComponent::areOptionsSupported (const Options& options) +{ + if (options.getBackend() == Options::Backend::defaultBackend || options.getBackend() == Options::Backend::ie) + return true; + + #if JUCE_USE_WIN_WEBVIEW2 + if (options.getBackend() != Options::Backend::webview2) + return false; + + if (auto webView = WebView2::createWebViewHandle (options.getWinWebView2BackendOptions())) + return true; + #endif + + return false; +} + } // namespace juce diff --git a/modules/juce_opengl/juce_opengl.cpp b/modules/juce_opengl/juce_opengl.cpp index 7f2a1ae0..66d7be3f 100644 --- a/modules/juce_opengl/juce_opengl.cpp +++ b/modules/juce_opengl/juce_opengl.cpp @@ -163,24 +163,22 @@ static bool checkPeerIsValid (OpenGLContext* context) { if (auto* comp = context->getTargetComponent()) { - if (auto* peer = comp->getPeer()) + if (auto* peer [[maybe_unused]] = comp->getPeer()) { #if JUCE_MAC || JUCE_IOS if (auto* nsView = (JUCE_IOS_MAC_VIEW*) peer->getNativeHandle()) { - if (auto nsWindow = [nsView window]) + if ([[maybe_unused]] auto nsWindow = [nsView window]) { #if JUCE_MAC return ([nsWindow isVisible] && (! [nsWindow hidesOnDeactivate] || [NSApp isActive])); #else - ignoreUnused (nsWindow); return true; #endif } } #else - ignoreUnused (peer); return true; #endif } @@ -215,7 +213,9 @@ static void checkGLError (const char* file, const int line) static void clearGLError() noexcept { + #if JUCE_DEBUG while (glGetError() != GL_NO_ERROR) {} + #endif } struct OpenGLTargetSaver @@ -240,6 +240,22 @@ private: OpenGLTargetSaver& operator= (const OpenGLTargetSaver&); }; +static bool contextRequiresTexture2DEnableDisable() +{ + #if JUCE_OPENGL_ES + return false; + #else + clearGLError(); + GLint mask = 0; + glGetIntegerv (GL_CONTEXT_PROFILE_MASK, &mask); + + if (glGetError() == GL_INVALID_ENUM) + return true; + + return (mask & (GLint) GL_CONTEXT_CORE_PROFILE_BIT) == 0; + #endif +} + } // namespace juce //============================================================================== @@ -275,6 +291,7 @@ JUCE_IMPL_WGL_EXTENSION_FUNCTION (wglCreateContextAttribsARB) #undef JUCE_IMPL_WGL_EXTENSION_FUNCTION #elif JUCE_LINUX || JUCE_BSD + #include #include "native/juce_OpenGL_linux_X11.h" #elif JUCE_ANDROID diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h index 8cf05c27..fb3f9fd7 100644 --- a/modules/juce_opengl/juce_opengl.h +++ b/modules/juce_opengl/juce_opengl.h @@ -35,12 +35,12 @@ ID: juce_opengl vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE OpenGL classes description: Classes for rendering OpenGL in a JUCE window. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_gui_extra OSXFrameworks: OpenGL diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index d6a642c5..dc1c2aa1 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -103,28 +103,8 @@ static const uint8 javaJuceOpenGLView[] = }; //============================================================================== -struct AndroidGLCallbacks -{ - static void attachedToWindow (JNIEnv*, jobject, jlong); - static void detachedFromWindow (JNIEnv*, jobject, jlong); - static void dispatchDraw (JNIEnv*, jobject, jlong, jobject); -}; - -//============================================================================== -#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ - METHOD (constructor, "", "(Landroid/content/Context;J)V") \ - METHOD (getParent, "getParent", "()Landroid/view/ViewParent;") \ - METHOD (getHolder, "getHolder", "()Landroid/view/SurfaceHolder;") \ - METHOD (layout, "layout", "(IIII)V" ) \ - CALLBACK (AndroidGLCallbacks::attachedToWindow, "onAttchedWindowNative", "(J)V") \ - CALLBACK (AndroidGLCallbacks::detachedFromWindow, "onDetachedFromWindowNative", "(J)V") \ - CALLBACK (AndroidGLCallbacks::dispatchDraw, "onDrawNative", "(JLandroid/graphics/Canvas;)V") - -DECLARE_JNI_CLASS_WITH_BYTECODE (JuceOpenGLViewSurface, "com/rmsl/juce/JuceOpenGLView", 16, javaJuceOpenGLView, sizeof(javaJuceOpenGLView)) -#undef JNI_CLASS_MEMBERS - //============================================================================== -class OpenGLContext::NativeContext : private SurfaceHolderCallback +class OpenGLContext::NativeContext : private SurfaceHolderCallback { public: NativeContext (Component& comp, @@ -132,8 +112,7 @@ public: void* /*contextToShareWith*/, bool useMultisamplingIn, OpenGLVersion) - : component (comp), - surface (EGL_NO_SURFACE), context (EGL_NO_CONTEXT) + : component (comp) { auto env = getEnv(); @@ -175,88 +154,45 @@ public: } //============================================================================== - bool initialiseOnRenderThread (OpenGLContext& aContext) + InitResult initialiseOnRenderThread (OpenGLContext& ctx) { - jassert (hasInitialised); - - // has the context already attached? - jassert (surface == EGL_NO_SURFACE && context == EGL_NO_CONTEXT); - - auto env = getEnv(); - - ANativeWindow* window = nullptr; - - LocalRef holder (env->CallObjectMethod (surfaceView.get(), JuceOpenGLViewSurface.getHolder)); - - if (holder != nullptr) - { - LocalRef jSurface (env->CallObjectMethod (holder.get(), AndroidSurfaceHolder.getSurface)); - - if (jSurface != nullptr) - { - window = ANativeWindow_fromSurface(env, jSurface.get()); - - // if we didn't succeed the first time, wait 25ms and try again - if (window == nullptr) - { - Thread::sleep (200); - window = ANativeWindow_fromSurface (env, jSurface.get()); - } - } - } - - if (window == nullptr) - { - // failed to get a pointer to the native window after second try so bail out - jassertfalse; - return false; - } + // The "real" initialisation happens when the surface is created. Here, we'll + // just return true if the initialisation happened successfully, or false if + // it hasn't happened yet, or was unsuccessful. + const std::lock_guard lock { nativeHandleMutex }; - // create the surface - surface = eglCreateWindowSurface (display, config, window, nullptr); - jassert (surface != EGL_NO_SURFACE); - - ANativeWindow_release (window); + if (! hasInitialised) + return InitResult::fatal; - // create the OpenGL context - EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; - context = eglCreateContext (display, config, EGL_NO_CONTEXT, contextAttribs); - jassert (context != EGL_NO_CONTEXT); + if (context.get() == EGL_NO_CONTEXT && surface.get() == EGL_NO_SURFACE) + return InitResult::retry; - juceContext = &aContext; - return true; + juceContext = &ctx; + return InitResult::success; } void shutdownOnRenderThread() { - jassert (hasInitialised); - - // is there a context available to detach? - jassert (surface != EGL_NO_SURFACE && context != EGL_NO_CONTEXT); - - eglDestroyContext (display, context); - context = EGL_NO_CONTEXT; - - eglDestroySurface (display, surface); - surface = EGL_NO_SURFACE; + const std::lock_guard lock { nativeHandleMutex }; + juceContext = nullptr; } //============================================================================== bool makeActive() const noexcept { - if (! hasInitialised) - return false; - - if (surface == EGL_NO_SURFACE || context == EGL_NO_CONTEXT) - return false; - - if (! eglMakeCurrent (display, surface, surface, context)) - return false; + const std::lock_guard lock { nativeHandleMutex }; - return true; + return hasInitialised + && surface.get() != EGL_NO_SURFACE + && context.get() != EGL_NO_CONTEXT + && eglMakeCurrent (display, surface.get(), surface.get(), context.get()); } - bool isActive() const noexcept { return eglGetCurrentContext() == context; } + bool isActive() const noexcept + { + const std::lock_guard lock { nativeHandleMutex }; + return eglGetCurrentContext() == context.get(); + } static void deactivateCurrentContext() { @@ -264,7 +200,7 @@ public: } //============================================================================== - void swapBuffers() const noexcept { eglSwapBuffers (display, surface); } + void swapBuffers() const noexcept { eglSwapBuffers (display, surface.get()); } bool setSwapInterval (const int) { return false; } int getSwapInterval() const { return 0; } @@ -290,52 +226,66 @@ public: //============================================================================== // Android Surface Callbacks: - void surfaceChanged (LocalRef holder, int format, int width, int height) override + void surfaceChanged ([[maybe_unused]] LocalRef holder, + [[maybe_unused]] int format, + [[maybe_unused]] int width, + [[maybe_unused]] int height) override { - ignoreUnused (holder, format, width, height); } - void surfaceCreated (LocalRef holder) override; - void surfaceDestroyed (LocalRef holder) override; + void surfaceCreated (LocalRef) override; + void surfaceDestroyed (LocalRef) override; //============================================================================== - struct Locker { Locker (NativeContext&) {} }; + struct Locker + { + explicit Locker (NativeContext& ctx) : lock (ctx.mutex) {} + const ScopedLock lock; + }; Component& component; private: - //============================================================================== - friend struct AndroidGLCallbacks; + #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ + METHOD (constructor, "", "(Landroid/content/Context;J)V") \ + METHOD (getParent, "getParent", "()Landroid/view/ViewParent;") \ + METHOD (getHolder, "getHolder", "()Landroid/view/SurfaceHolder;") \ + METHOD (layout, "layout", "(IIII)V" ) \ + CALLBACK (generatedCallback<&NativeContext::attachedToWindow>, "onAttchedWindowNative", "(J)V") \ + CALLBACK (generatedCallback<&NativeContext::detachedFromWindow>, "onDetachedFromWindowNative", "(J)V") \ + CALLBACK (generatedCallback<&NativeContext::dispatchDraw>, "onDrawNative", "(JLandroid/graphics/Canvas;)V") + + DECLARE_JNI_CLASS_WITH_BYTECODE (JuceOpenGLViewSurface, "com/rmsl/juce/JuceOpenGLView", 16, javaJuceOpenGLView) + #undef JNI_CLASS_MEMBERS - void attachedToWindow() + //============================================================================== + static void attachedToWindow (JNIEnv* env, NativeContext& t) { - auto* env = getEnv(); - - LocalRef holder (env->CallObjectMethod (surfaceView.get(), JuceOpenGLViewSurface.getHolder)); + LocalRef holder (env->CallObjectMethod (t.surfaceView.get(), JuceOpenGLViewSurface.getHolder)); - if (surfaceHolderCallback == nullptr) - surfaceHolderCallback = GlobalRef (CreateJavaInterface (this, "android/view/SurfaceHolder$Callback")); + if (t.surfaceHolderCallback == nullptr) + t.surfaceHolderCallback = GlobalRef (CreateJavaInterface (&t, "android/view/SurfaceHolder$Callback")); - env->CallVoidMethod (holder, AndroidSurfaceHolder.addCallback, surfaceHolderCallback.get()); + env->CallVoidMethod (holder, AndroidSurfaceHolder.addCallback, t.surfaceHolderCallback.get()); } - void detachedFromWindow() + static void detachedFromWindow (JNIEnv* env, NativeContext& t) { - if (surfaceHolderCallback != nullptr) + if (t.surfaceHolderCallback != nullptr) { - auto* env = getEnv(); + LocalRef holder (env->CallObjectMethod (t.surfaceView.get(), JuceOpenGLViewSurface.getHolder)); - LocalRef holder (env->CallObjectMethod (surfaceView.get(), JuceOpenGLViewSurface.getHolder)); - - env->CallVoidMethod (holder.get(), AndroidSurfaceHolder.removeCallback, surfaceHolderCallback.get()); - surfaceHolderCallback.clear(); + env->CallVoidMethod (holder.get(), AndroidSurfaceHolder.removeCallback, t.surfaceHolderCallback.get()); + t.surfaceHolderCallback.clear(); } } - void dispatchDraw (jobject /*canvas*/) + static void dispatchDraw (JNIEnv*, NativeContext& t, jobject /*canvas*/) { - if (juceContext != nullptr) - juceContext->triggerRepaint(); + const std::lock_guard lock { t.nativeHandleMutex }; + + if (t.juceContext != nullptr) + t.juceContext->triggerRepaint(); } bool tryChooseConfig (const std::vector& optionalAttribs) @@ -389,15 +339,55 @@ private: return false; } + struct NativeWindowReleaser + { + void operator() (ANativeWindow* ptr) const { if (ptr != nullptr) ANativeWindow_release (ptr); } + }; + + std::unique_ptr getNativeWindow() const + { + auto* env = getEnv(); + + const LocalRef holder (env->CallObjectMethod (surfaceView.get(), JuceOpenGLViewSurface.getHolder)); + + if (holder == nullptr) + return nullptr; + + const LocalRef jSurface (env->CallObjectMethod (holder.get(), AndroidSurfaceHolder.getSurface)); + + if (jSurface == nullptr) + return nullptr; + + constexpr auto numAttempts = 2; + + for (auto i = 0; i < numAttempts; Thread::sleep (200), ++i) + if (auto* ptr = ANativeWindow_fromSurface (env, jSurface.get())) + return std::unique_ptr { ptr }; + + return nullptr; + } + //============================================================================== + CriticalSection mutex; bool hasInitialised = false; GlobalRef surfaceView; Rectangle lastBounds; + struct SurfaceDestructor + { + void operator() (EGLSurface x) const { if (x != EGL_NO_SURFACE) eglDestroySurface (display, x); } + }; + + struct ContextDestructor + { + void operator() (EGLContext x) const { if (x != EGL_NO_CONTEXT) eglDestroyContext (display, x); } + }; + + mutable std::mutex nativeHandleMutex; OpenGLContext* juceContext = nullptr; - EGLSurface surface; - EGLContext context; + std::unique_ptr, SurfaceDestructor> surface { EGL_NO_SURFACE }; + std::unique_ptr, ContextDestructor> context { EGL_NO_CONTEXT }; GlobalRef surfaceHolderCallback; @@ -407,24 +397,8 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeContext) }; -//============================================================================== -void AndroidGLCallbacks::attachedToWindow (JNIEnv*, jobject /*this*/, jlong host) -{ - if (auto* nativeContext = reinterpret_cast (host)) - nativeContext->attachedToWindow(); -} - -void AndroidGLCallbacks::detachedFromWindow (JNIEnv*, jobject /*this*/, jlong host) -{ - if (auto* nativeContext = reinterpret_cast (host)) - nativeContext->detachedFromWindow(); -} - -void AndroidGLCallbacks::dispatchDraw (JNIEnv*, jobject /*this*/, jlong host, jobject canvas) -{ - if (auto* nativeContext = reinterpret_cast (host)) - nativeContext->dispatchDraw (canvas); -} +EGLDisplay OpenGLContext::NativeContext::display = EGL_NO_DISPLAY; +EGLDisplay OpenGLContext::NativeContext::config; //============================================================================== bool OpenGLHelpers::isContextActive() diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index c67a19d9..813aa7a6 100644 --- a/modules/juce_opengl/native/juce_OpenGL_ios.h +++ b/modules/juce_opengl/native/juce_OpenGL_ios.h @@ -72,24 +72,19 @@ public: [((UIView*) peer->getNativeHandle()) addSubview: view]; - if (version == openGL3_2 && [[UIDevice currentDevice].systemVersion floatValue] >= 7.0) - { - if (! createContext (kEAGLRenderingAPIOpenGLES3, contextToShare)) - { - releaseContext(); - createContext (kEAGLRenderingAPIOpenGLES2, contextToShare); - } - } - else - { - createContext (kEAGLRenderingAPIOpenGLES2, contextToShare); - } + const auto shouldUseES3 = version != defaultGLVersion + && [[UIDevice currentDevice].systemVersion floatValue] >= 7.0; + + const auto gotContext = (shouldUseES3 && createContext (kEAGLRenderingAPIOpenGLES3, contextToShare)) + || createContext (kEAGLRenderingAPIOpenGLES2, contextToShare); + + jassertquiet (gotContext); if (context != nil) { // I'd prefer to put this stuff in the initialiseOnRenderThread() call, but doing // so causes mysterious timing-related failures. - [EAGLContext setCurrentContext: context]; + [EAGLContext setCurrentContext: context.get()]; gl::loadFunctions(); createGLBuffers(); deactivateCurrentContext(); @@ -108,12 +103,12 @@ public: ~NativeContext() { - releaseContext(); + context.reset(); [view removeFromSuperview]; [view release]; } - bool initialiseOnRenderThread (OpenGLContext&) { return true; } + InitResult initialiseOnRenderThread (OpenGLContext&) { return InitResult::success; } void shutdownOnRenderThread() { @@ -123,12 +118,12 @@ public: } bool createdOk() const noexcept { return getRawContext() != nullptr; } - void* getRawContext() const noexcept { return context; } + void* getRawContext() const noexcept { return context.get(); } GLuint getFrameBufferID() const noexcept { return useMSAA ? msaaBufferHandle : frameBufferHandle; } bool makeActive() const noexcept { - if (! [EAGLContext setCurrentContext: context]) + if (! [EAGLContext setCurrentContext: context.get()]) return false; glBindFramebuffer (GL_FRAMEBUFFER, useMSAA ? msaaBufferHandle @@ -138,7 +133,7 @@ public: bool isActive() const noexcept { - return [EAGLContext currentContext] == context; + return [EAGLContext currentContext] == context.get(); } static void deactivateCurrentContext() @@ -170,7 +165,7 @@ public: } glBindRenderbuffer (GL_RENDERBUFFER, colorBufferHandle); - [context presentRenderbuffer: GL_RENDERBUFFER]; + [context.get() presentRenderbuffer: GL_RENDERBUFFER]; if (needToRebuildBuffers) { @@ -203,13 +198,18 @@ public: int getSwapInterval() const noexcept { return swapFrames; } - struct Locker { Locker (NativeContext&) {} }; + struct Locker + { + explicit Locker (NativeContext& ctx) : lock (ctx.mutex) {} + const ScopedLock lock; + }; private: + CriticalSection mutex; Component& component; JuceGLView* view = nil; CAEAGLLayer* glLayer = nil; - EAGLContext* context = nil; + NSUniquePtr context; const OpenGLVersion openGLversion; const bool useDepthBuffer, useMSAA; @@ -223,21 +223,16 @@ private: bool createContext (EAGLRenderingAPI type, void* contextToShare) { jassert (context == nil); - context = [EAGLContext alloc]; + context.reset ([EAGLContext alloc]); - context = contextToShare != nullptr - ? [context initWithAPI: type sharegroup: [(EAGLContext*) contextToShare sharegroup]] - : [context initWithAPI: type]; + if (contextToShare != nullptr) + [context.get() initWithAPI: type sharegroup: [(EAGLContext*) contextToShare sharegroup]]; + else + [context.get() initWithAPI: type]; return context != nil; } - void releaseContext() - { - [context release]; - context = nil; - } - //============================================================================== void createGLBuffers() { @@ -249,8 +244,8 @@ private: glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferHandle); - bool ok = [context renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; - jassert (ok); ignoreUnused (ok); + [[maybe_unused]] bool ok = [context.get() renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; + jassert (ok); GLint width, height; glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width); @@ -289,7 +284,7 @@ private: void freeGLBuffers() { JUCE_CHECK_OPENGL_ERROR - [context renderbufferStorage: GL_RENDERBUFFER fromDrawable: nil]; + [context.get() renderbufferStorage: GL_RENDERBUFFER fromDrawable: nil]; deleteFrameBuffer (frameBufferHandle); deleteFrameBuffer (msaaBufferHandle); diff --git a/modules/juce_opengl/native/juce_OpenGL_linux_X11.h b/modules/juce_opengl/native/juce_OpenGL_linux_X11.h index cda1c8ab..cd12b414 100644 --- a/modules/juce_opengl/native/juce_OpenGL_linux_X11.h +++ b/modules/juce_opengl/native/juce_OpenGL_linux_X11.h @@ -26,13 +26,52 @@ namespace juce { -extern XContext windowHandleXContext; +struct XFreeDeleter +{ + void operator() (void* ptr) const + { + if (ptr != nullptr) + X11Symbols::getInstance()->xFree (ptr); + } +}; + +template +std::unique_ptr makeXFreePtr (Data* raw) { return std::unique_ptr (raw); } //============================================================================== // Defined juce_linux_Windowing.cpp void juce_LinuxAddRepaintListener (ComponentPeer*, Component* dummy); void juce_LinuxRemoveRepaintListener (ComponentPeer*, Component* dummy); +class PeerListener : private ComponentMovementWatcher +{ +public: + PeerListener (Component& comp, Window embeddedWindow) + : ComponentMovementWatcher (&comp), + window (embeddedWindow), + association (comp.getPeer(), window) {} + +private: + using ComponentMovementWatcher::componentMovedOrResized, + ComponentMovementWatcher::componentVisibilityChanged; + + void componentMovedOrResized (bool, bool) override {} + void componentVisibilityChanged() override {} + + void componentPeerChanged() override + { + // This should not be rewritten as a ternary expression or similar. + // The old association must be destroyed before the new one is created. + association = {}; + + if (auto* comp = getComponent()) + association = ScopedWindowAssociation (comp->getPeer(), window); + } + + Window window{}; + ScopedWindowAssociation association; +}; + //============================================================================== class OpenGLContext::NativeContext { @@ -80,15 +119,15 @@ public: jassert (peer != nullptr); auto windowH = (Window) peer->getNativeHandle(); - auto colourMap = X11Symbols::getInstance()->xCreateColormap (display, windowH, bestVisual->visual, AllocNone); + auto visual = glXGetVisualFromFBConfig (display, *bestConfig); + auto colourMap = X11Symbols::getInstance()->xCreateColormap (display, windowH, visual->visual, AllocNone); XSetWindowAttributes swa; swa.colormap = colourMap; swa.border_pixel = 0; swa.event_mask = embeddedWindowEventMask; - auto glBounds = component.getTopLevelComponent() - ->getLocalArea (&component, component.getLocalBounds()); + auto glBounds = component.getTopLevelComponent()->getLocalArea (&component, component.getLocalBounds()); glBounds = Desktop::getInstance().getDisplays().logicalToPhysical (glBounds); @@ -96,13 +135,13 @@ public: glBounds.getX(), glBounds.getY(), (unsigned int) jmax (1, glBounds.getWidth()), (unsigned int) jmax (1, glBounds.getHeight()), - 0, bestVisual->depth, + 0, visual->depth, InputOutput, - bestVisual->visual, + visual->visual, CWBorderPixel | CWColormap | CWEventMask, &swa); - X11Symbols::getInstance()->xSaveContext (display, (XID) embeddedWindow, windowHandleXContext, (XPointer) peer); + peerListener.emplace (component, embeddedWindow); X11Symbols::getInstance()->xMapWindow (display, embeddedWindow); X11Symbols::getInstance()->xFreeColormap (display, colourMap); @@ -135,19 +174,60 @@ public: } } } - - if (bestVisual != nullptr) - X11Symbols::getInstance()->xFree (bestVisual); } - bool initialiseOnRenderThread (OpenGLContext& c) + InitResult initialiseOnRenderThread (OpenGLContext& c) { XWindowSystemUtilities::ScopedXLock xLock; - renderContext = glXCreateContext (display, bestVisual, (GLXContext) contextToShareWith, GL_TRUE); + + const auto components = [&]() -> Optional + { + switch (c.versionRequired) + { + case OpenGLVersion::openGL3_2: return Version { 3, 2 }; + case OpenGLVersion::openGL4_1: return Version { 4, 1 }; + case OpenGLVersion::openGL4_3: return Version { 4, 3 }; + + case OpenGLVersion::defaultGLVersion: break; + } + + return {}; + }(); + + if (components.hasValue()) + { + using GLXCreateContextAttribsARB = GLXContext (*) (Display*, GLXFBConfig, GLXContext, Bool, const int*); + + if (const auto glXCreateContextAttribsARB = (GLXCreateContextAttribsARB) OpenGLHelpers::getExtensionFunction ("glXCreateContextAttribsARB")) + { + #if JUCE_DEBUG + constexpr auto contextFlags = GLX_CONTEXT_DEBUG_BIT_ARB; + #else + constexpr auto contextFlags = 0; + #endif + + const int attribs[] + { + GLX_CONTEXT_MAJOR_VERSION_ARB, components->major, + GLX_CONTEXT_MINOR_VERSION_ARB, components->minor, + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + GLX_CONTEXT_FLAGS_ARB, contextFlags, + None + }; + + renderContext = glXCreateContextAttribsARB (display, *bestConfig, (GLXContext) contextToShareWith, GL_TRUE, attribs); + } + } + + if (renderContext == nullptr) + renderContext = glXCreateNewContext (display, *bestConfig, GLX_RGBA_TYPE, (GLXContext) contextToShareWith, GL_TRUE); + + if (renderContext == nullptr) + return InitResult::fatal; + c.makeActive(); context = &c; - - return true; + return InitResult::success; } void shutdownOnRenderThread() @@ -227,15 +307,19 @@ public: context->triggerRepaint(); } - struct Locker { Locker (NativeContext&) {} }; + struct Locker + { + explicit Locker (NativeContext& ctx) : lock (ctx.mutex) {} + const ScopedLock lock; + }; private: bool tryChooseVisual (const OpenGLPixelFormat& format, const std::vector& optionalAttribs) { std::vector allAttribs { - GLX_RGBA, - GLX_DOUBLEBUFFER, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DOUBLEBUFFER, True, GLX_RED_SIZE, format.redBits, GLX_GREEN_SIZE, format.greenBits, GLX_BLUE_SIZE, format.blueBits, @@ -252,20 +336,24 @@ private: allAttribs.push_back (None); - bestVisual = glXChooseVisual (display, X11Symbols::getInstance()->xDefaultScreen (display), allAttribs.data()); + int nElements = 0; + bestConfig = makeXFreePtr (glXChooseFBConfig (display, X11Symbols::getInstance()->xDefaultScreen (display), allAttribs.data(), &nElements)); - return bestVisual != nullptr; + return nElements != 0 && bestConfig != nullptr; } static constexpr int embeddedWindowEventMask = ExposureMask | StructureNotifyMask; + CriticalSection mutex; Component& component; GLXContext renderContext = {}; Window embeddedWindow = {}; + std::optional peerListener; + int swapFrames = 1; Rectangle bounds; - XVisualInfo* bestVisual = nullptr; + std::unique_ptr bestConfig; void* contextToShareWith; OpenGLContext* context = nullptr; diff --git a/modules/juce_opengl/native/juce_OpenGL_osx.h b/modules/juce_opengl/native/juce_OpenGL_osx.h index f3c21b92..4996de7b 100644 --- a/modules/juce_opengl/native/juce_OpenGL_osx.h +++ b/modules/juce_opengl/native/juce_OpenGL_osx.h @@ -38,10 +38,9 @@ public: OpenGLVersion version) : owner (component) { - NSOpenGLPixelFormatAttribute attribs[64] = { 0 }; - createAttribs (attribs, version, pixFormat, shouldUseMultisampling); + const auto attribs = createAttribs (version, pixFormat, shouldUseMultisampling); - NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes: attribs]; + NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes: attribs.data()]; static MouseForwardingNSOpenGLViewClass cls; view = [cls.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f) @@ -75,46 +74,55 @@ public: [view release]; } - static void createAttribs (NSOpenGLPixelFormatAttribute* attribs, OpenGLVersion version, - const OpenGLPixelFormat& pixFormat, bool shouldUseMultisampling) + static std::vector createAttribs (OpenGLVersion version, + const OpenGLPixelFormat& pixFormat, + bool shouldUseMultisampling) { - ignoreUnused (version); - int numAttribs = 0; - - attribs[numAttribs++] = NSOpenGLPFAOpenGLProfile; - attribs[numAttribs++] = version >= openGL3_2 ? NSOpenGLProfileVersion3_2Core - : NSOpenGLProfileVersionLegacy; - - attribs[numAttribs++] = NSOpenGLPFADoubleBuffer; - attribs[numAttribs++] = NSOpenGLPFAClosestPolicy; - attribs[numAttribs++] = NSOpenGLPFANoRecovery; - attribs[numAttribs++] = NSOpenGLPFAColorSize; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) (pixFormat.redBits + pixFormat.greenBits + pixFormat.blueBits); - attribs[numAttribs++] = NSOpenGLPFAAlphaSize; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) pixFormat.alphaBits; - attribs[numAttribs++] = NSOpenGLPFADepthSize; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) pixFormat.depthBufferBits; - attribs[numAttribs++] = NSOpenGLPFAStencilSize; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) pixFormat.stencilBufferBits; - attribs[numAttribs++] = NSOpenGLPFAAccumSize; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) (pixFormat.accumulationBufferRedBits + pixFormat.accumulationBufferGreenBits - + pixFormat.accumulationBufferBlueBits + pixFormat.accumulationBufferAlphaBits); + std::vector attribs + { + NSOpenGLPFAOpenGLProfile, [version] + { + if (version == openGL3_2) + return NSOpenGLProfileVersion3_2Core; + + if (version != defaultGLVersion) + if (@available (macOS 10.10, *)) + return NSOpenGLProfileVersion4_1Core; + + return NSOpenGLProfileVersionLegacy; + }(), + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAClosestPolicy, + NSOpenGLPFANoRecovery, + NSOpenGLPFAColorSize, static_cast (pixFormat.redBits + pixFormat.greenBits + pixFormat.blueBits), + NSOpenGLPFAAlphaSize, static_cast (pixFormat.alphaBits), + NSOpenGLPFADepthSize, static_cast (pixFormat.depthBufferBits), + NSOpenGLPFAStencilSize, static_cast (pixFormat.stencilBufferBits), + NSOpenGLPFAAccumSize, static_cast (pixFormat.accumulationBufferRedBits + pixFormat.accumulationBufferGreenBits + + pixFormat.accumulationBufferBlueBits + pixFormat.accumulationBufferAlphaBits) + }; if (shouldUseMultisampling) { - attribs[numAttribs++] = NSOpenGLPFAMultisample; - attribs[numAttribs++] = NSOpenGLPFASampleBuffers; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) 1; - attribs[numAttribs++] = NSOpenGLPFASamples; - attribs[numAttribs++] = (NSOpenGLPixelFormatAttribute) pixFormat.multisamplingLevel; + attribs.insert (attribs.cend(), + { + NSOpenGLPFAMultisample, + NSOpenGLPFASampleBuffers, static_cast (1), + NSOpenGLPFASamples, static_cast (pixFormat.multisamplingLevel) + }); } + + attribs.push_back (0); + + return attribs; } - bool initialiseOnRenderThread (OpenGLContext&) { return true; } - void shutdownOnRenderThread() { deactivateCurrentContext(); } + InitResult initialiseOnRenderThread (OpenGLContext&) { return InitResult::success; } + void shutdownOnRenderThread() { deactivateCurrentContext(); } bool createdOk() const noexcept { return getRawContext() != nullptr; } - void* getRawContext() const noexcept { return static_cast (renderContext); } + NSOpenGLView* getNSView() const noexcept { return view; } + NSOpenGLContext* getRawContext() const noexcept { return renderContext; } GLuint getFrameBufferID() const noexcept { return 0; } bool makeActive() const noexcept @@ -264,24 +272,17 @@ public: //============================================================================== struct MouseForwardingNSOpenGLViewClass : public ObjCClass { - MouseForwardingNSOpenGLViewClass() : ObjCClass ("JUCEGLView_") + MouseForwardingNSOpenGLViewClass() : ObjCClass ("JUCEGLView_") { - addMethod (@selector (rightMouseDown:), rightMouseDown); - addMethod (@selector (rightMouseUp:), rightMouseUp); - addMethod (@selector (acceptsFirstMouse:), acceptsFirstMouse); - addMethod (@selector (accessibilityHitTest:), accessibilityHitTest); + addMethod (@selector (rightMouseDown:), [] (id self, SEL, NSEvent* ev) { [[(NSOpenGLView*) self superview] rightMouseDown: ev]; }); + addMethod (@selector (rightMouseUp:), [] (id self, SEL, NSEvent* ev) { [[(NSOpenGLView*) self superview] rightMouseUp: ev]; }); + addMethod (@selector (acceptsFirstMouse:), [] (id, SEL, NSEvent*) -> BOOL { return YES; }); + addMethod (@selector (accessibilityHitTest:), [] (id self, SEL, NSPoint p) -> id { return [[(NSOpenGLView*) self superview] accessibilityHitTest: p]; }); registerClass(); } - - private: - static void rightMouseDown (id self, SEL, NSEvent* ev) { [[(NSOpenGLView*) self superview] rightMouseDown: ev]; } - static void rightMouseUp (id self, SEL, NSEvent* ev) { [[(NSOpenGLView*) self superview] rightMouseUp: ev]; } - static BOOL acceptsFirstMouse (id, SEL, NSEvent*) { return YES; } - static id accessibilityHitTest (id self, SEL, NSPoint p) { return [[(NSOpenGLView*) self superview] accessibilityHitTest: p]; } }; - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeContext) }; diff --git a/modules/juce_opengl/native/juce_OpenGL_win32.h b/modules/juce_opengl/native/juce_OpenGL_win32.h index 12dcab98..db07f7a8 100644 --- a/modules/juce_opengl/native/juce_OpenGL_win32.h +++ b/modules/juce_opengl/native/juce_OpenGL_win32.h @@ -44,13 +44,13 @@ public: PIXELFORMATDESCRIPTOR pfd; initialisePixelFormatDescriptor (pfd, pixelFormat); - auto pixFormat = ChoosePixelFormat (dc, &pfd); + auto pixFormat = ChoosePixelFormat (dc.get(), &pfd); if (pixFormat != 0) - SetPixelFormat (dc, pixFormat, &pfd); + SetPixelFormat (dc.get(), pixFormat, &pfd); - initialiseWGLExtensions (dc); - renderContext = createRenderContext (version, dc); + initialiseWGLExtensions (dc.get()); + renderContext.reset (createRenderContext (version, dc.get())); if (renderContext != nullptr) { @@ -62,20 +62,20 @@ public: if (wglFormat != pixFormat && wglFormat != 0) { // can't change the pixel format of a window, so need to delete the - // old one and create a new one.. - releaseDC(); + // old one and create a new one. + dc.reset(); nativeWindow = nullptr; createNativeWindow (component); - if (SetPixelFormat (dc, wglFormat, &pfd)) + if (SetPixelFormat (dc.get(), wglFormat, &pfd)) { - deleteRenderContext(); - renderContext = createRenderContext (version, dc); + renderContext.reset(); + renderContext.reset (createRenderContext (version, dc.get())); } } if (contextToShareWithIn != nullptr) - wglShareLists ((HGLRC) contextToShareWithIn, renderContext); + wglShareLists ((HGLRC) contextToShareWithIn, renderContext.get()); component.getTopLevelComponent()->repaint(); component.repaint(); @@ -84,19 +84,19 @@ public: ~NativeContext() override { - deleteRenderContext(); - releaseDC(); + renderContext.reset(); + dc.reset(); if (safeComponent != nullptr) if (auto* peer = safeComponent->getTopLevelComponent()->getPeer()) peer->removeScaleFactorListener (this); } - bool initialiseOnRenderThread (OpenGLContext& c) + InitResult initialiseOnRenderThread (OpenGLContext& c) { threadAwarenessSetter = std::make_unique (nativeWindow->getNativeHandle()); context = &c; - return true; + return InitResult::success; } void shutdownOnRenderThread() @@ -107,9 +107,9 @@ public: } static void deactivateCurrentContext() { wglMakeCurrent (nullptr, nullptr); } - bool makeActive() const noexcept { return isActive() || wglMakeCurrent (dc, renderContext) != FALSE; } - bool isActive() const noexcept { return wglGetCurrentContext() == renderContext; } - void swapBuffers() const noexcept { SwapBuffers (dc); } + bool makeActive() const noexcept { return isActive() || wglMakeCurrent (dc.get(), renderContext.get()) != FALSE; } + bool isActive() const noexcept { return wglGetCurrentContext() == renderContext.get(); } + void swapBuffers() const noexcept { SwapBuffers (dc.get()); } bool setSwapInterval (int numFramesPerSwap) { @@ -137,7 +137,7 @@ public: } bool createdOk() const noexcept { return getRawContext() != nullptr; } - void* getRawContext() const noexcept { return renderContext; } + void* getRawContext() const noexcept { return renderContext.get(); } unsigned int getFrameBufferID() const noexcept { return 0; } void triggerRepaint() @@ -146,7 +146,11 @@ public: context->triggerRepaint(); } - struct Locker { Locker (NativeContext&) {} }; + struct Locker + { + explicit Locker (NativeContext& ctx) : lock (ctx.mutex) {} + const ScopedLock lock; + }; HWND getNativeHandle() { @@ -206,13 +210,37 @@ private: static HGLRC createRenderContext (OpenGLVersion version, HDC dcIn) { - if (version >= openGL3_2 && wglCreateContextAttribsARB != nullptr) + const auto components = [&]() -> Optional + { + switch (version) + { + case OpenGLVersion::openGL3_2: return Version { 3, 2 }; + case OpenGLVersion::openGL4_1: return Version { 4, 1 }; + case OpenGLVersion::openGL4_3: return Version { 4, 3 }; + + case OpenGLVersion::defaultGLVersion: break; + } + + return {}; + }(); + + if (components.hasValue() && wglCreateContextAttribsARB != nullptr) { + #if JUCE_DEBUG + constexpr auto contextFlags = WGL_CONTEXT_DEBUG_BIT_ARB; + constexpr auto noErrorChecking = GL_FALSE; + #else + constexpr auto contextFlags = 0; + constexpr auto noErrorChecking = GL_TRUE; + #endif + const int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGL_CONTEXT_MINOR_VERSION_ARB, 2, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, + WGL_CONTEXT_MAJOR_VERSION_ARB, components->major, + WGL_CONTEXT_MINOR_VERSION_ARB, components->minor, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, + WGL_CONTEXT_FLAGS_ARB, contextFlags, + WGL_CONTEXT_OPENGL_NO_ERROR_ARB, noErrorChecking, 0 }; @@ -271,21 +299,8 @@ private: } nativeWindow->setVisible (true); - dc = GetDC ((HWND) nativeWindow->getNativeHandle()); - } - - void deleteRenderContext() - { - if (renderContext != nullptr) - { - wglDeleteContext (renderContext); - renderContext = nullptr; - } - } - - void releaseDC() - { - ReleaseDC ((HWND) nativeWindow->getNativeHandle(), dc); + dc = std::unique_ptr, DeviceContextDeleter> { GetDC ((HWND) nativeWindow->getNativeHandle()), + DeviceContextDeleter { (HWND) nativeWindow->getNativeHandle() } }; } int wglChoosePixelFormatExtension (const OpenGLPixelFormat& pixelFormat) const @@ -330,7 +345,7 @@ private: jassert (n <= numElementsInArray (atts)); UINT formatsCount = 0; - wglChoosePixelFormatARB (dc, atts, nullptr, 1, &format, &formatsCount); + wglChoosePixelFormatARB (dc.get(), atts, nullptr, 1, &format, &formatsCount); } return format; @@ -347,12 +362,24 @@ private: #undef JUCE_DECLARE_WGL_EXTENSION_FUNCTION //============================================================================== + struct RenderContextDeleter + { + void operator() (HGLRC ptr) const { wglDeleteContext (ptr); } + }; + + struct DeviceContextDeleter + { + void operator() (HDC ptr) const { ReleaseDC (hwnd, ptr); } + HWND hwnd; + }; + + CriticalSection mutex; std::unique_ptr dummyComponent; std::unique_ptr nativeWindow; std::unique_ptr threadAwarenessSetter; Component::SafePointer safeComponent; - HGLRC renderContext; - HDC dc; + std::unique_ptr, RenderContextDeleter> renderContext; + std::unique_ptr, DeviceContextDeleter> dc; OpenGLContext* context = nullptr; double nativeScaleFactor = 1.0; diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 909cda6e..af3a354f 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -23,6 +23,10 @@ ============================================================================== */ +#if JUCE_MAC + #include +#endif + namespace juce { @@ -88,9 +92,11 @@ static bool contextHasTextureNpotFeature() } //============================================================================== -class OpenGLContext::CachedImage : public CachedComponentImage, - private ThreadPoolJob +class OpenGLContext::CachedImage : public CachedComponentImage { + template + static constexpr bool isFlagSet (const T& t, const U& u) { return (t & u) != 0; } + struct AreaAndScale { Rectangle area; @@ -132,8 +138,7 @@ class OpenGLContext::CachedImage : public CachedComponentImage, public: CachedImage (OpenGLContext& c, Component& comp, const OpenGLPixelFormat& pixFormat, void* contextToShare) - : ThreadPoolJob ("OpenGL Rendering"), - context (c), + : context (c), component (comp) { nativeContext.reset (new NativeContext (component, pixFormat, contextToShare, @@ -143,6 +148,8 @@ public: context.nativeContext = nativeContext.get(); else nativeContext.reset(); + + refreshDisplayLinkConnection(); } ~CachedImage() override @@ -154,67 +161,61 @@ public: void start() { if (nativeContext != nullptr) - { - #if JUCE_MAC - cvDisplayLinkWrapper = std::make_unique (*this); - cvDisplayLinkWrapper->updateActiveDisplay(); - #endif - - renderThread = std::make_unique (1); resume(); - } } void stop() { - if (renderThread != nullptr) - { - // make sure everything has finished executing - destroying = true; - - if (workQueue.size() > 0) - { - if (! renderThread->contains (this)) - resume(); + // make sure everything has finished executing + state |= StateFlags::pendingDestruction; - while (workQueue.size() != 0) - Thread::sleep (20); - } + if (workQueue.size() > 0) + { + if (! renderThread->contains (this)) + resume(); - pause(); - renderThread.reset(); + while (workQueue.size() != 0) + Thread::sleep (20); } - #if JUCE_MAC - cvDisplayLinkWrapper = nullptr; - #endif - - hasInitialised = false; + pause(); } //============================================================================== void pause() { - signalJobShouldExit(); - messageManagerLock.abort(); + renderThread->remove (this); - if (renderThread != nullptr) + if ((state.fetch_and (~StateFlags::initialised) & StateFlags::initialised) != 0) { - repaintEvent.signal(); - renderThread->removeJob (this, true, -1); + context.makeActive(); + shutdownOnThread(); + OpenGLContext::deactivateCurrentContext(); } } void resume() { - if (renderThread != nullptr) - renderThread->addJob (this, false); + renderThread->add (this); } //============================================================================== void paint (Graphics&) override { - updateViewportSize (false); + if (MessageManager::getInstance()->isThisTheMessageThread()) + { + updateViewportSize(); + } + else + { + // If you hit this assertion, it's because paint has been called from a thread other + // than the message thread. This commonly happens when nesting OpenGL contexts, because + // the 'outer' OpenGL renderer will attempt to call paint on the 'inner' context's + // component from the OpenGL thread. + // Nesting OpenGL contexts is not directly supported, however there is a workaround: + // https://forum.juce.com/t/opengl-how-do-3d-with-custom-shaders-and-2d-with-juce-paint-methods-work-together/28026/7 + jassertfalse; + } } bool invalidateAll() override @@ -238,8 +239,8 @@ public: void triggerRepaint() { - needsUpdate = 1; - repaintEvent.signal(); + state |= (StateFlags::pendingRender | StateFlags::paintComponents); + renderThread->triggerRepaint(); } //============================================================================== @@ -282,89 +283,154 @@ public: JUCE_CHECK_OPENGL_ERROR } - bool renderFrame() + struct ScopedContextActivator { - MessageManager::Lock::ScopedTryLockType mmLock (messageManagerLock, false); + bool activate (OpenGLContext& ctx) + { + if (! active) + active = ctx.makeActive(); - auto isUpdatingTestValue = true; - auto isUpdating = needsUpdate.compare_exchange_strong (isUpdatingTestValue, false); + return active; + } - if (context.renderComponents && isUpdating) + ~ScopedContextActivator() { - // This avoids hogging the message thread when doing intensive rendering. - if (lastMMLockReleaseTime + 1 >= Time::getMillisecondCounter()) - Thread::sleep (2); + if (active) + OpenGLContext::deactivateCurrentContext(); + } - while (! shouldExit()) - { - doWorkWhileWaitingForLock (false); + private: + bool active = false; + }; - if (mmLock.retryLock()) - break; - } + enum class RenderStatus + { + nominal, + messageThreadAborted, + noWork, + }; - if (shouldExit()) - return false; + RenderStatus renderFrame (MessageManager::Lock& mmLock) + { + if (! isFlagSet (state, StateFlags::initialised)) + { + switch (initialiseOnThread()) + { + case InitResult::fatal: + case InitResult::retry: return RenderStatus::noWork; + case InitResult::success: break; + } } - if (! context.makeActive()) - return false; + state |= StateFlags::initialised; - NativeContext::Locker locker (*nativeContext); + #if JUCE_IOS + if (backgroundProcessCheck.isBackgroundProcess()) + return RenderStatus::noWork; + #endif - JUCE_CHECK_OPENGL_ERROR + std::optional scopedLock; + ScopedContextActivator contextActivator; - doWorkWhileWaitingForLock (true); + const auto stateToUse = state.fetch_and (StateFlags::persistent); - const auto currentAreaAndScale = areaAndScale.get(); - const auto viewportArea = currentAreaAndScale.area; + #if JUCE_MAC + // On macOS, we use a display link callback to trigger repaints, rather than + // letting them run at full throttle + const auto noAutomaticRepaint = true; + #else + const auto noAutomaticRepaint = ! context.continuousRepaint; + #endif - if (context.renderer != nullptr) + if (! isFlagSet (stateToUse, StateFlags::pendingRender) && noAutomaticRepaint) + return RenderStatus::noWork; + + const auto isUpdating = isFlagSet (stateToUse, StateFlags::paintComponents); + + if (context.renderComponents && isUpdating) { - glViewport (0, 0, viewportArea.getWidth(), viewportArea.getHeight()); - context.currentRenderScale = currentAreaAndScale.scale; - context.renderer->renderOpenGL(); - clearGLError(); + bool abortScope = false; + // If we early-exit here, we need to restore these flags so that the render is + // attempted again in the next time slice. + const ScopeGuard scope { [&] { if (! abortScope) state |= stateToUse; } }; - bindVertexArray(); + // This avoids hogging the message thread when doing intensive rendering. + std::this_thread::sleep_until (lastMMLockReleaseTime + std::chrono::milliseconds { 2 }); + + if (renderThread->isListChanging()) + return RenderStatus::messageThreadAborted; + + doWorkWhileWaitingForLock (contextActivator); + + scopedLock.emplace (mmLock); + + // If we can't get the lock here, it's probably because a context has been removed + // on the main thread. + // We return, just in case this renderer needs to be removed from the rendering thread. + // If another renderer is being removed instead, then we should be able to get the lock + // next time round. + if (! scopedLock->isLocked()) + return RenderStatus::messageThreadAborted; + + abortScope = true; } - if (context.renderComponents) + if (! contextActivator.activate (context)) + return RenderStatus::noWork; + { - if (isUpdating) - { - paintComponent (currentAreaAndScale); + NativeContext::Locker locker (*nativeContext); - if (! hasInitialised) - return false; + JUCE_CHECK_OPENGL_ERROR - messageManagerLock.exit(); - lastMMLockReleaseTime = Time::getMillisecondCounter(); + doWorkWhileWaitingForLock (contextActivator); + + const auto currentAreaAndScale = areaAndScale.get(); + const auto viewportArea = currentAreaAndScale.area; + + if (context.renderer != nullptr) + { + glViewport (0, 0, viewportArea.getWidth(), viewportArea.getHeight()); + context.currentRenderScale = currentAreaAndScale.scale; + context.renderer->renderOpenGL(); + clearGLError(); + + bindVertexArray(); } - glViewport (0, 0, viewportArea.getWidth(), viewportArea.getHeight()); - drawComponentBuffer(); - } + if (context.renderComponents) + { + if (isUpdating) + { + paintComponent (currentAreaAndScale); - context.swapBuffers(); + if (! isFlagSet (state, StateFlags::initialised)) + return RenderStatus::noWork; - OpenGLContext::deactivateCurrentContext(); - return true; + scopedLock.reset(); + lastMMLockReleaseTime = std::chrono::steady_clock::now(); + } + + glViewport (0, 0, viewportArea.getWidth(), viewportArea.getHeight()); + drawComponentBuffer(); + } + } + + nativeContext->swapBuffers(); + return RenderStatus::nominal; } - void updateViewportSize (bool canTriggerUpdate) + void updateViewportSize() { JUCE_ASSERT_MESSAGE_THREAD if (auto* peer = component.getPeer()) { #if JUCE_MAC + updateScreen(); + const auto displayScale = Desktop::getInstance().getGlobalScaleFactor() * [this] { - if (auto* wrapper = cvDisplayLinkWrapper.get()) - if (wrapper->updateActiveDisplay()) - nativeContext->setNominalVideoRefreshPeriodS (wrapper->getNominalVideoRefreshPeriodS()); - if (auto* view = getCurrentView()) { if ([view respondsToSelector: @selector (backingScaleFactor)]) @@ -377,20 +443,25 @@ public: return areaAndScale.get().scale; }(); #else - const auto displayScale = Desktop::getInstance().getDisplays().getDisplayForRect (component.getTopLevelComponent()->getScreenBounds())->scale; + const auto displayScale = Desktop::getInstance().getDisplays() + .getDisplayForRect (component.getTopLevelComponent() + ->getScreenBounds()) + ->scale; #endif - auto localBounds = component.getLocalBounds(); - auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale; + const auto localBounds = component.getLocalBounds(); + const auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale; #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE - auto newScale = getScaleFactorForWindow (nativeContext->getNativeHandle()); - auto desktopScale = Desktop::getInstance().getGlobalScaleFactor(); - - if (! approximatelyEqual (1.0f, desktopScale)) - newScale *= desktopScale; + // Some hosts (Pro Tools 2022.7) do not take the current DPI into account when sizing + // plugin editor windows. Instead of querying the OS for the DPI of the editor window, + // we approximate based on the physical size of the window that was actually provided + // for the context to draw into. This may break if the OpenGL context's component is + // scaled differently in its width and height - but in this case, a single scale factor + // isn't that helpful anyway. + const auto newScale = (float) newArea.getWidth() / (float) localBounds.getWidth(); #else - auto newScale = displayScale; + const auto newScale = (float) displayScale; #endif areaAndScale.set ({ newArea, newScale }, [&] @@ -400,9 +471,7 @@ public: (float) newArea.getHeight() / (float) localBounds.getHeight()); nativeContext->updateWindowPosition (peer->getAreaCoveredBy (component)); - - if (canTriggerUpdate) - invalidateAll(); + invalidateAll(); }); } } @@ -420,7 +489,7 @@ public: if (lastScreenBounds != screenBounds) { - updateViewportSize (true); + updateViewportSize(); lastScreenBounds = screenBounds; } } @@ -461,10 +530,8 @@ public: void drawComponentBuffer() { - #if ! JUCE_ANDROID - glEnable (GL_TEXTURE_2D); - clearGLError(); - #endif + if (contextRequiresTexture2DEnableDisable()) + glEnable (GL_TEXTURE_2D); #if JUCE_WINDOWS // some stupidly old drivers are missing this function, so try to at least avoid a crash here, @@ -473,7 +540,9 @@ public: jassert (context.extensions.glActiveTexture != nullptr); if (context.extensions.glActiveTexture != nullptr) #endif + { context.extensions.glActiveTexture (GL_TEXTURE0); + } glBindTexture (GL_TEXTURE_2D, cachedImageFrameBuffer.getTextureID()); bindVertexArray(); @@ -523,80 +592,22 @@ public: void handleResize() { - updateViewportSize (true); + updateViewportSize(); #if JUCE_MAC - if (hasInitialised) + if (isFlagSet (state, StateFlags::initialised)) { [nativeContext->view update]; - renderFrame(); + + // We're already on the message thread, no need to lock it again. + MessageManager::Lock mml; + renderFrame (mml); } #endif } //============================================================================== - JobStatus runJob() override - { - { - // Allow the message thread to finish setting-up the context before using it. - MessageManager::Lock::ScopedTryLockType mmLock (messageManagerLock, false); - - do - { - if (shouldExit()) - return ThreadPoolJob::jobHasFinished; - - } while (! mmLock.retryLock()); - } - - if (! initialiseOnThread()) - { - hasInitialised = false; - - return ThreadPoolJob::jobHasFinished; - } - - hasInitialised = true; - - while (! shouldExit()) - { - #if JUCE_IOS - if (backgroundProcessCheck.isBackgroundProcess()) - { - repaintEvent.wait (300); - repaintEvent.reset(); - continue; - } - #endif - - if (shouldExit()) - break; - - #if JUCE_MAC - if (context.continuousRepaint) - { - repaintEvent.wait (-1); - renderFrame(); - } - else - #endif - if (! renderFrame()) - repaintEvent.wait (5); // failed to render, so avoid a tight fail-loop. - else if (! context.continuousRepaint && ! shouldExit()) - repaintEvent.wait (-1); - - repaintEvent.reset(); - } - - hasInitialised = false; - context.makeActive(); - shutdownOnThread(); - OpenGLContext::deactivateCurrentContext(); - - return ThreadPoolJob::jobHasFinished; - } - - bool initialiseOnThread() + InitResult initialiseOnThread() { // On android, this can get called twice, so drop any previous state. associatedObjectNames.clear(); @@ -605,8 +616,8 @@ public: context.makeActive(); - if (! nativeContext->initialiseOnRenderThread (context)) - return false; + if (const auto nativeResult = nativeContext->initialiseOnRenderThread (context); nativeResult != InitResult::success) + return nativeResult; #if JUCE_ANDROID // On android the context may be created in initialiseOnRenderThread @@ -622,6 +633,21 @@ public: bindVertexArray(); } + #if JUCE_DEBUG + if (getOpenGLVersion() >= Version { 4, 3 } && glDebugMessageCallback != nullptr) + { + glEnable (GL_DEBUG_OUTPUT); + glDebugMessageCallback ([] (GLenum type, GLenum, GLuint, GLenum severity, GLsizei, const GLchar* message, const void*) + { + // This may reiterate issues that are also flagged by JUCE_CHECK_OPENGL_ERROR. + // The advantage of this callback is that it will catch *all* errors, even if we + // forget to check manually. + DBG ("OpenGL DBG message: " << message); + jassertquiet (type != GL_DEBUG_TYPE_ERROR && severity != GL_DEBUG_SEVERITY_HIGH); + }, nullptr); + } + #endif + const auto currentViewportArea = areaAndScale.get().area; glViewport (0, 0, currentViewportArea.getWidth(), currentViewportArea.getHeight()); @@ -638,12 +664,7 @@ public: if (context.renderer != nullptr) context.renderer->newOpenGLContextCreated(); - #if JUCE_MAC - jassert (cvDisplayLinkWrapper != nullptr); - nativeContext->setNominalVideoRefreshPeriodS (cvDisplayLinkWrapper->getNominalVideoRefreshPeriodS()); - #endif - - return true; + return InitResult::success; } void shutdownOnThread() @@ -706,36 +727,23 @@ public: WaitableEvent finishedSignal; }; - bool doWorkWhileWaitingForLock (bool contextIsAlreadyActive) + void doWorkWhileWaitingForLock (ScopedContextActivator& contextActivator) { - bool contextActivated = false; - - for (OpenGLContext::AsyncWorker::Ptr work = workQueue.removeAndReturn (0); - work != nullptr && (! shouldExit()); work = workQueue.removeAndReturn (0)) + while (const auto work = workQueue.removeAndReturn (0)) { - if ((! contextActivated) && (! contextIsAlreadyActive)) - { - if (! context.makeActive()) - break; - - contextActivated = true; - } + if (renderThread->isListChanging() || ! contextActivator.activate (context)) + break; NativeContext::Locker locker (*nativeContext); (*work) (context); clearGLError(); } - - if (contextActivated) - OpenGLContext::deactivateCurrentContext(); - - return shouldExit(); } - void execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool shouldBlock, bool calledFromDestructor = false) + void execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool shouldBlock) { - if (calledFromDestructor || ! destroying) + if (! isFlagSet (state, StateFlags::pendingDestruction)) { if (shouldBlock) { @@ -743,7 +751,7 @@ public: OpenGLContext::AsyncWorker::Ptr worker (*blocker); workQueue.add (worker); - messageManagerLock.abort(); + renderThread->abortLock(); context.triggerRepaint(); blocker->block(); @@ -752,7 +760,7 @@ public: { workQueue.add (std::move (workerToUse)); - messageManagerLock.abort(); + renderThread->abortLock(); context.triggerRepaint(); } } @@ -768,6 +776,180 @@ public: return dynamic_cast (c.getCachedComponentImage()); } + class RenderThread + { + public: + RenderThread() = default; + + ~RenderThread() + { + flags.setDestructing(); + thread.join(); + } + + void add (CachedImage* x) + { + const std::scoped_lock lock { listMutex }; + images.push_back (x); + } + + void remove (CachedImage* x) + { + JUCE_ASSERT_MESSAGE_THREAD; + + flags.setSafe (false); + abortLock(); + + { + const std::scoped_lock lock { callbackMutex, listMutex }; + images.remove (x); + } + + flags.setSafe (true); + } + + bool contains (CachedImage* x) + { + const std::scoped_lock lock { listMutex }; + return std::find (images.cbegin(), images.cend(), x) != images.cend(); + } + + void triggerRepaint() { flags.setRenderRequested(); } + + void abortLock() { messageManagerLock.abort(); } + + bool isListChanging() { return ! flags.isSafe(); } + + private: + RenderStatus renderAll() + { + auto result = RenderStatus::noWork; + + const std::scoped_lock lock { callbackMutex, listMutex }; + + for (auto* x : images) + { + listMutex.unlock(); + const ScopeGuard scope { [&] { listMutex.lock(); } }; + + const auto status = x->renderFrame (messageManagerLock); + + switch (status) + { + case RenderStatus::noWork: break; + case RenderStatus::nominal: result = RenderStatus::nominal; break; + case RenderStatus::messageThreadAborted: return RenderStatus::messageThreadAborted; + } + + } + + return result; + } + + /* Allows the main thread to communicate changes to the render thread. + + When the render thread needs to change in some way (asked to resume rendering, + a renderer is added/removed, or the thread needs to stop prior to destruction), + the main thread can set the appropriate flag on this structure. The render thread + will call waitForWork() repeatedly, pausing when the render thread has no work to do, + and resuming when requested by the main thread. + */ + class Flags + { + public: + void setDestructing() { update ([] (auto& f) { f |= destructorCalled; }); } + void setRenderRequested() { update ([] (auto& f) { f |= renderRequested; }); } + + void setSafe (const bool safe) + { + update ([safe] (auto& f) + { + if (safe) + f |= listSafe; + else + f &= ~listSafe; + }); + } + + bool isSafe() + { + const std::scoped_lock lock { mutex }; + return (flags & listSafe) != 0; + } + + /* Blocks until the 'safe' flag is set, and at least one other flag is set. + After returning, the renderRequested flag will be unset. + Returns true if rendering should continue. + */ + bool waitForWork (bool requestRender) + { + std::unique_lock lock { mutex }; + flags |= (requestRender ? renderRequested : 0); + condvar.wait (lock, [this] { return flags > listSafe; }); + flags &= ~renderRequested; + return ((flags & destructorCalled) == 0); + } + + private: + template + void update (Fn fn) + { + { + const std::scoped_lock lock { mutex }; + fn (flags); + } + + condvar.notify_one(); + } + + enum + { + renderRequested = 1 << 0, + destructorCalled = 1 << 1, + listSafe = 1 << 2 + }; + + std::mutex mutex; + std::condition_variable condvar; + int flags = listSafe; + }; + + MessageManager::Lock messageManagerLock; + std::mutex listMutex, callbackMutex; + std::list images; + Flags flags; + + std::thread thread { [this] + { + Thread::setCurrentThreadName ("OpenGL Renderer"); + while (flags.waitForWork (renderAll() != RenderStatus::noWork)) {} + } }; + }; + + void refreshDisplayLinkConnection() + { + #if JUCE_MAC + if (context.continuousRepaint) + { + connection.emplace (sharedDisplayLinks->registerFactory ([this] (CGDirectDisplayID display) + { + return [this, display] + { + if (auto* view = nativeContext->getNSView()) + if (auto* window = [view window]) + if (auto* screen = [window screen]) + if (display == ScopedDisplayLink::getDisplayIdForScreen (screen)) + triggerRepaint(); + }; + })); + } + else + { + connection.reset(); + } + #endif + } + //============================================================================== friend class NativeContext; std::unique_ptr nativeContext; @@ -775,6 +957,8 @@ public: OpenGLContext& context; Component& component; + SharedResourcePointer renderThread; + OpenGLFrameBuffer cachedImageFrameBuffer; RectangleList validArea; Rectangle lastScreenBounds; @@ -785,102 +969,101 @@ public: StringArray associatedObjectNames; ReferenceCountedArray associatedObjects; - WaitableEvent canPaintNowFlag, finishedPaintingFlag, repaintEvent { true }; + WaitableEvent canPaintNowFlag, finishedPaintingFlag; #if JUCE_OPENGL_ES bool shadersAvailable = true; #else bool shadersAvailable = false; #endif bool textureNpotSupported = false; - std::atomic hasInitialised { false }, needsUpdate { true }, destroying { false }; - uint32 lastMMLockReleaseTime = 0; + std::chrono::steady_clock::time_point lastMMLockReleaseTime{}; #if JUCE_MAC NSView* getCurrentView() const { + JUCE_ASSERT_MESSAGE_THREAD; + if (auto* peer = component.getPeer()) return static_cast (peer->getNativeHandle()); return nullptr; } - NSScreen* getCurrentScreen() const + NSWindow* getCurrentWindow() const { JUCE_ASSERT_MESSAGE_THREAD; if (auto* view = getCurrentView()) - if (auto* window = [view window]) - return [window screen]; + return [view window]; return nullptr; } - struct CVDisplayLinkWrapper + NSScreen* getCurrentScreen() const { - explicit CVDisplayLinkWrapper (CachedImage& cachedImageIn) - : cachedImage (cachedImageIn), - continuousRepaint (cachedImageIn.context.continuousRepaint.load()) - { - CVDisplayLinkCreateWithActiveCGDisplays (&displayLink); - CVDisplayLinkSetOutputCallback (displayLink, &displayLinkCallback, this); - CVDisplayLinkStart (displayLink); - } - - double getNominalVideoRefreshPeriodS() const - { - const auto nominalVideoRefreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod (displayLink); + JUCE_ASSERT_MESSAGE_THREAD; - if ((nominalVideoRefreshPeriod.flags & kCVTimeIsIndefinite) == 0) - return (double) nominalVideoRefreshPeriod.timeValue / (double) nominalVideoRefreshPeriod.timeScale; + if (auto* window = getCurrentWindow()) + return [window screen]; - return 0.0; - } + return nullptr; + } - /* Returns true if updated, or false otherwise. */ - bool updateActiveDisplay() - { - auto* oldScreen = std::exchange (currentScreen, cachedImage.getCurrentScreen()); + void updateScreen() + { + const auto screen = getCurrentScreen(); + const auto display = ScopedDisplayLink::getDisplayIdForScreen (screen); - if (oldScreen == currentScreen) - return false; + if (lastDisplay.exchange (display) == display) + return; - for (NSScreen* screen in [NSScreen screens]) - if (screen == currentScreen) - if (NSNumber* number = [[screen deviceDescription] objectForKey: @"NSScreenNumber"]) - CVDisplayLinkSetCurrentCGDisplay (displayLink, [number unsignedIntValue]); + const auto newRefreshPeriod = sharedDisplayLinks->getNominalVideoRefreshPeriodSForScreen (display); - return true; - } + if (newRefreshPeriod != 0.0 && std::exchange (refreshPeriod, newRefreshPeriod) != newRefreshPeriod) + nativeContext->setNominalVideoRefreshPeriodS (newRefreshPeriod); - ~CVDisplayLinkWrapper() - { - CVDisplayLinkStop (displayLink); - CVDisplayLinkRelease (displayLink); - } + updateColourSpace(); + } - static CVReturn displayLinkCallback (CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, - CVOptionFlags, CVOptionFlags*, void* displayLinkContext) - { - auto* self = reinterpret_cast (displayLinkContext); + void updateColourSpace() + { + if (auto* view = nativeContext->getNSView()) + if (auto* window = [view window]) + [window setColorSpace: [NSColorSpace sRGBColorSpace]]; + } - if (self->continuousRepaint) - self->cachedImage.repaintEvent.signal(); + std::atomic lastDisplay { 0 }; + double refreshPeriod = 0.0; - return kCVReturnSuccess; - } + FunctionNotificationCenterObserver observer { NSWindowDidChangeScreenNotification, + getCurrentWindow(), + [this] { updateScreen(); } }; - CachedImage& cachedImage; - const bool continuousRepaint; - CVDisplayLinkRef displayLink; - NSScreen* currentScreen = nullptr; - }; + // Note: the NSViewComponentPeer also has a SharedResourcePointer to + // avoid unnecessarily duplicating display-link threads. + SharedResourcePointer sharedDisplayLinks; - std::unique_ptr cvDisplayLinkWrapper; + // On macOS, rather than letting swapBuffers block as appropriate, we use a display link + // callback to mark the view as needing to repaint. + std::optional connection; #endif - std::unique_ptr renderThread; + enum StateFlags + { + pendingRender = 1 << 0, + paintComponents = 1 << 1, + pendingDestruction = 1 << 2, + initialised = 1 << 3, + + // Flags that may change state after each frame + transient = pendingRender | paintComponents, + + // Flags that should retain their state after each frame + persistent = initialised | pendingDestruction + }; + + std::atomic state { 0 }; ReferenceCountedArray workQueue; - MessageManager::Lock messageManagerLock; #if JUCE_IOS iOSBackgroundProcessCheck backgroundProcessCheck; @@ -971,16 +1154,6 @@ public: } #endif - void update() - { - auto& comp = *getComponent(); - - if (canBeAttached (comp)) - start(); - else - stop(); - } - private: OpenGLContext& context; @@ -1037,7 +1210,7 @@ private: if (auto* cachedImage = CachedImage::get (comp)) { cachedImage->start(); // (must wait until this is attached before starting its thread) - cachedImage->updateViewportSize (true); + cachedImage->updateViewportSize(); startTimer (400); } @@ -1082,13 +1255,16 @@ void OpenGLContext::setContinuousRepainting (bool shouldContinuouslyRepaint) noe { continuousRepaint = shouldContinuouslyRepaint; - #if JUCE_MAC - if (auto* component = getTargetComponent()) - { - detach(); - attachment.reset (new Attachment (*this, *component)); - } - #endif + #if JUCE_MAC + if (auto* component = getTargetComponent()) + { + detach(); + attachment.reset (new Attachment (*this, *component)); + } + + if (auto* cachedImage = getCachedImage()) + cachedImage->refreshDisplayLinkConnection(); + #endif triggerRepaint(); } @@ -1351,7 +1527,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, struct OverlayShaderProgram : public ReferenceCountedObject { OverlayShaderProgram (OpenGLContext& context) - : program (context), builder (program), params (program) + : program (context), params (program) {} static const OverlayShaderProgram& select (OpenGLContext& context) @@ -1369,11 +1545,12 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, return *program; } - struct ProgramBuilder + struct BuiltProgram : public OpenGLShaderProgram { - ProgramBuilder (OpenGLShaderProgram& prog) + explicit BuiltProgram (OpenGLContext& ctx) + : OpenGLShaderProgram (ctx) { - prog.addVertexShader (OpenGLHelpers::translateVertexShaderToV3 ( + addVertexShader (OpenGLHelpers::translateVertexShaderToV3 ( "attribute " JUCE_HIGHP " vec2 position;" "uniform " JUCE_HIGHP " vec2 screenSize;" "uniform " JUCE_HIGHP " float textureBounds[4];" @@ -1387,7 +1564,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, "texturePos = vec2 (texturePos.x, vOffsetAndScale.x + vOffsetAndScale.y * texturePos.y);" "}")); - prog.addFragmentShader (OpenGLHelpers::translateFragmentShaderToV3 ( + addFragmentShader (OpenGLHelpers::translateFragmentShaderToV3 ( "uniform sampler2D imageTexture;" "varying " JUCE_HIGHP " vec2 texturePos;" "void main()" @@ -1395,7 +1572,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, "gl_FragColor = texture2D (imageTexture, texturePos);" "}")); - prog.link(); + link(); } }; @@ -1424,8 +1601,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, OpenGLShaderProgram::Uniform screenSize, imageTexture, textureBounds, vOffsetAndScale; }; - OpenGLShaderProgram program; - ProgramBuilder builder; + BuiltProgram program; Params params; }; @@ -1471,40 +1647,56 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, } #if JUCE_ANDROID -EGLDisplay OpenGLContext::NativeContext::display = EGL_NO_DISPLAY; -EGLDisplay OpenGLContext::NativeContext::config; -void OpenGLContext::NativeContext::surfaceCreated (LocalRef holder) +void OpenGLContext::NativeContext::surfaceCreated (LocalRef) { - ignoreUnused (holder); - - if (auto* cachedImage = CachedImage::get (component)) { - if (auto* pool = cachedImage->renderThread.get()) + const std::lock_guard lock { nativeHandleMutex }; + + jassert (hasInitialised); + + // has the context already attached? + jassert (surface.get() == EGL_NO_SURFACE && context.get() == EGL_NO_CONTEXT); + + const auto window = getNativeWindow(); + + if (window == nullptr) { - if (! pool->contains (cachedImage)) - { - cachedImage->resume(); - cachedImage->context.triggerRepaint(); - } + // failed to get a pointer to the native window so bail out + jassertfalse; + return; } + + // create the surface + surface.reset (eglCreateWindowSurface (display, config, window.get(), nullptr)); + jassert (surface.get() != EGL_NO_SURFACE); + + // create the OpenGL context + EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; + context.reset (eglCreateContext (display, config, EGL_NO_CONTEXT, contextAttribs)); + jassert (context.get() != EGL_NO_CONTEXT); + } + + if (auto* cached = CachedImage::get (component)) + { + cached->resume(); + cached->triggerRepaint(); } } -void OpenGLContext::NativeContext::surfaceDestroyed (LocalRef holder) +void OpenGLContext::NativeContext::surfaceDestroyed (LocalRef) { - ignoreUnused (holder); + if (auto* cached = CachedImage::get (component)) + cached->pause(); - // unlike the name suggests this will be called just before the - // surface is destroyed. We need to pause the render thread. - if (auto* cachedImage = CachedImage::get (component)) { - cachedImage->pause(); + const std::lock_guard lock { nativeHandleMutex }; - if (auto* threadPool = cachedImage->renderThread.get()) - threadPool->waitForJobToFinish (cachedImage, -1); + context.reset (EGL_NO_CONTEXT); + surface.reset (EGL_NO_SURFACE); } } + #endif } // namespace juce diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.h b/modules/juce_opengl/opengl/juce_OpenGLContext.h index b272ee2a..86191f84 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.h +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.h @@ -136,8 +136,10 @@ public: /** OpenGL versions, used by setOpenGLVersionRequired(). */ enum OpenGLVersion { - defaultGLVersion = 0, - openGL3_2 + defaultGLVersion = 0, ///< Whatever the device decides to give us, normally a compatibility profile + openGL3_2, ///< 3.2 Core profile + openGL4_1, ///< 4.1 Core profile, the latest supported by macOS at time of writing + openGL4_3 ///< 4.3 Core profile, will enable improved debugging support when building in Debug }; /** Sets a preference for the version of GL that this context should use, if possible. @@ -318,6 +320,13 @@ public: #endif private: + enum class InitResult + { + fatal, + retry, + success + }; + friend class OpenGLTexture; class CachedImage; diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index 56380e51..1ec0f17f 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -964,8 +964,10 @@ struct StateHelpers //============================================================================== struct ActiveTextures { - ActiveTextures (const OpenGLContext& c) noexcept : context (c) - {} + explicit ActiveTextures (const OpenGLContext& c) noexcept + : context (c) + { + } void clear() noexcept { @@ -979,23 +981,28 @@ struct StateHelpers { quadQueue.flush(); - for (int i = 3; --i >= 0;) + for (int i = numTextures; --i >= 0;) { if ((texturesEnabled & (1 << i)) != (textureIndexMask & (1 << i))) { setActiveTexture (i); JUCE_CHECK_OPENGL_ERROR + const auto thisTextureEnabled = (textureIndexMask & (1 << i)) != 0; + + if (! thisTextureEnabled) + currentTextureID[i] = 0; + #if ! JUCE_ANDROID - if ((textureIndexMask & (1 << i)) != 0) - glEnable (GL_TEXTURE_2D); - else + if (needsToEnableTexture) { - glDisable (GL_TEXTURE_2D); - currentTextureID[i] = 0; - } + if (thisTextureEnabled) + glEnable (GL_TEXTURE_2D); + else + glDisable (GL_TEXTURE_2D); - clearGLError(); + JUCE_CHECK_OPENGL_ERROR + } #endif } } @@ -1079,6 +1086,7 @@ struct StateHelpers GLuint currentTextureID[numTextures]; int texturesEnabled = 0, currentActiveTexture = -1; const OpenGLContext& context; + const bool needsToEnableTexture = contextRequiresTexture2DEnableDisable(); ActiveTextures& operator= (const ActiveTextures&); }; diff --git a/modules/juce_osc/juce_osc.h b/modules/juce_osc/juce_osc.h index a1e8444a..99e838fa 100644 --- a/modules/juce_osc/juce_osc.h +++ b/modules/juce_osc/juce_osc.h @@ -35,12 +35,12 @@ ID: juce_osc vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE OSC classes description: Open Sound Control implementation. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_events diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp index 9ced7d1a..7030a49f 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp @@ -60,8 +60,8 @@ void InAppPurchases::getProductsInformation (const StringArray& productIdentifie } void InAppPurchases::purchaseProduct (const String& productIdentifier, - const String& upgradeProductIdentifier, - bool creditForUnusedSubscription) + [[maybe_unused]] const String& upgradeProductIdentifier, + [[maybe_unused]] bool creditForUnusedSubscription) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->purchaseProduct (productIdentifier, upgradeProductIdentifier, creditForUnusedSubscription); @@ -69,66 +69,55 @@ void InAppPurchases::purchaseProduct (const String& productIdentifier, Listener::PurchaseInfo purchaseInfo { Purchase { "", productIdentifier, {}, {}, {} }, {} }; listeners.call ([&] (Listener& l) { l.productPurchaseFinished (purchaseInfo, false, "In-app purchases unavailable"); }); - ignoreUnused (upgradeProductIdentifier, creditForUnusedSubscription); #endif } -void InAppPurchases::restoreProductsBoughtList (bool includeDownloadInfo, const String& subscriptionsSharedSecret) +void InAppPurchases::restoreProductsBoughtList ([[maybe_unused]] bool includeDownloadInfo, [[maybe_unused]] const String& subscriptionsSharedSecret) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->restoreProductsBoughtList (includeDownloadInfo, subscriptionsSharedSecret); #else listeners.call ([] (Listener& l) { l.purchasesListRestored ({}, false, "In-app purchases unavailable"); }); - ignoreUnused (includeDownloadInfo, subscriptionsSharedSecret); #endif } -void InAppPurchases::consumePurchase (const String& productIdentifier, const String& purchaseToken) +void InAppPurchases::consumePurchase (const String& productIdentifier, [[maybe_unused]] const String& purchaseToken) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->consumePurchase (productIdentifier, purchaseToken); #else listeners.call ([&] (Listener& l) { l.productConsumed (productIdentifier, false, "In-app purchases unavailable"); }); - ignoreUnused (purchaseToken); #endif } void InAppPurchases::addListener (Listener* l) { listeners.add (l); } void InAppPurchases::removeListener (Listener* l) { listeners.remove (l); } -void InAppPurchases::startDownloads (const Array& downloads) +void InAppPurchases::startDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->startDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::pauseDownloads (const Array& downloads) +void InAppPurchases::pauseDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->pauseDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::resumeDownloads (const Array& downloads) +void InAppPurchases::resumeDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->resumeDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::cancelDownloads (const Array& downloads) +void InAppPurchases::cancelDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->cancelDownloads (downloads); - #else - ignoreUnused (downloads); #endif } diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h index 2f89af71..d67755b8 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h @@ -261,12 +261,10 @@ public: "and only a single subscription can be upgraded/downgraded. Use the updated purchaseProduct method " "which takes a single String argument.")]] void purchaseProduct (const String& productIdentifier, - bool isSubscription, + [[maybe_unused]] bool isSubscription, const StringArray& upgradeOrDowngradeFromSubscriptionsWithProductIdentifiers = {}, bool creditForUnusedSubscription = true) { - - ignoreUnused (isSubscription); purchaseProduct (productIdentifier, upgradeOrDowngradeFromSubscriptionsWithProductIdentifiers[0], creditForUnusedSubscription); diff --git a/modules/juce_product_unlocking/juce_product_unlocking.h b/modules/juce_product_unlocking/juce_product_unlocking.h index d5726bf1..db9b0ab4 100644 --- a/modules/juce_product_unlocking/juce_product_unlocking.h +++ b/modules/juce_product_unlocking/juce_product_unlocking.h @@ -35,12 +35,12 @@ ID: juce_product_unlocking vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE Online marketplace support description: Classes for online product authentication website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_cryptography diff --git a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp index 9872a080..90dda054 100644 --- a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp +++ b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp @@ -58,7 +58,7 @@ struct OnlineUnlockForm::OverlayComp : public Component, cancelButton->addListener (this); } - startThread (4); + startThread (Priority::normal); } ~OverlayComp() override diff --git a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.cpp b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.cpp index f2d527ee..0114483b 100644 --- a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.cpp +++ b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.cpp @@ -314,6 +314,14 @@ void OnlineUnlockStatus::MachineIDUtilities::addMACAddressesToList (StringArray& ids.add (getEncodedIDString (address.toString())); } +String OnlineUnlockStatus::MachineIDUtilities::getUniqueMachineID() +{ + return getEncodedIDString (SystemStats::getUniqueDeviceID()); +} + +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") +JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996) + StringArray OnlineUnlockStatus::MachineIDUtilities::getLocalMachineIDs() { auto identifiers = SystemStats::getDeviceIdentifiers(); @@ -329,6 +337,9 @@ StringArray OnlineUnlockStatus::getLocalMachineIDs() return MachineIDUtilities::getLocalMachineIDs(); } +JUCE_END_IGNORE_WARNINGS_GCC_LIKE +JUCE_END_IGNORE_WARNINGS_MSVC + void OnlineUnlockStatus::userCancelled() { } @@ -378,22 +389,19 @@ bool OnlineUnlockStatus::applyKeyFile (String keyFileContent) return false; } -static bool canConnectToWebsite (const URL& url) -{ - return url.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress) - .withConnectionTimeoutMs (2000)) != nullptr; -} - static bool areMajorWebsitesAvailable() { - const char* urlsToTry[] = { "http://google.com", "http://bing.com", "http://amazon.com", - "https://google.com", "https://bing.com", "https://amazon.com", nullptr}; - - for (const char** url = urlsToTry; *url != nullptr; ++url) - if (canConnectToWebsite (URL (*url))) - return true; + static constexpr const char* const urlsToTry[] = { "http://google.com", "http://bing.com", "http://amazon.com", + "https://google.com", "https://bing.com", "https://amazon.com" }; + const auto canConnectToWebsite = [] (auto url) + { + return URL (url).createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress) + .withConnectionTimeoutMs (2000)) != nullptr; + }; - return false; + return std::any_of (std::begin (urlsToTry), + std::end (urlsToTry), + canConnectToWebsite); } OnlineUnlockStatus::UnlockResult OnlineUnlockStatus::handleXmlReply (XmlElement xml) diff --git a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.h b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.h index 819830d2..cdf9a2cf 100644 --- a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.h +++ b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockStatus.h @@ -242,6 +242,7 @@ public: /** Utility function that you may want to use in your machine-ID generation code. This adds some ID strings to the given array which represent each MAC address of the machine. */ + [[deprecated ("MAC addresses are no longer reliable methods of ID generation. You should use getUniqueMachineID() instead, You can still get a list of this device's MAC addresses with MACAddress::findAllAddresses().")]] static void addMACAddressesToList (StringArray& result); /** This method calculates some machine IDs based on things like network @@ -259,7 +260,14 @@ public: registration on machines which have had hardware added/removed since the product was first registered. */ + [[deprecated ("The identifiers generated by this function are no longer reliable. Use getUniqueMachineID() instead.")]] static StringArray getLocalMachineIDs(); + + /** Returns an encoded unique machine ID. + + @see SystemStats::getUniqueDeviceID + */ + static String getUniqueMachineID(); }; private: diff --git a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp index b382e5a1..bed2c811 100644 --- a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp @@ -143,7 +143,7 @@ inline StringArray javaListOfStringToJuceStringArray (const LocalRef& j } //============================================================================== -constexpr unsigned char juceBillingClientCompiled[] +constexpr uint8 juceBillingClientCompiled[] { 0x1f, 0x8b, 0x08, 0x08, 0xa4, 0x53, 0xd0, 0x62, 0x04, 0x03, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x78, 0x00, 0x9d, 0x5a, @@ -685,31 +685,27 @@ struct InAppPurchases::Pimpl } //============================================================================== - void startDownloads (const Array& downloads) + void startDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void pauseDownloads (const Array& downloads) + void pauseDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void resumeDownloads (const Array& downloads) + void resumeDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void cancelDownloads (const Array& downloads) + void cancelDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } @@ -724,42 +720,17 @@ private: METHOD (queryPurchases, "queryPurchases", "()V") \ METHOD (consumePurchase, "consumePurchase", "(Ljava/lang/String;Ljava/lang/String;)V") \ \ - CALLBACK (productDetailsQueryCallback, "productDetailsQueryCallback", "(JLjava/util/List;)V") \ - CALLBACK (purchasesListQueryCallback, "purchasesListQueryCallback", "(JLjava/util/List;)V") \ - CALLBACK (purchaseCompletedCallback, "purchaseCompletedCallback", "(JLcom/android/billingclient/api/Purchase;I)V") \ - CALLBACK (purchaseConsumedCallback, "purchaseConsumedCallback", "(JLjava/lang/String;I)V") + CALLBACK (generatedCallback<&Pimpl::updateProductDetails>, "productDetailsQueryCallback", "(JLjava/util/List;)V") \ + CALLBACK (generatedCallback<&Pimpl::updatePurchasesList>, "purchasesListQueryCallback", "(JLjava/util/List;)V") \ + CALLBACK (generatedCallback<&Pimpl::purchaseCompleted>, "purchaseCompletedCallback", "(JLcom/android/billingclient/api/Purchase;I)V") \ + CALLBACK (generatedCallback<&Pimpl::purchaseConsumed>, "purchaseConsumedCallback", "(JLjava/lang/String;I)V") DECLARE_JNI_CLASS_WITH_BYTECODE (JuceBillingClient, "com/rmsl/juce/JuceBillingClient", 16, - juceBillingClientCompiled, - numElementsInArray (juceBillingClientCompiled)) + juceBillingClientCompiled) #undef JNI_CLASS_MEMBERS - static void JNICALL productDetailsQueryCallback (JNIEnv*, jobject, jlong host, jobject productDetailsList) - { - if (auto* myself = reinterpret_cast (host)) - myself->updateProductDetails (productDetailsList); - } - - static void JNICALL purchasesListQueryCallback (JNIEnv*, jobject, jlong host, jobject purchasesList) - { - if (auto* myself = reinterpret_cast (host)) - myself->updatePurchasesList (purchasesList); - } - - static void JNICALL purchaseCompletedCallback (JNIEnv*, jobject, jlong host, jobject purchase, int responseCode) - { - if (auto* myself = reinterpret_cast (host)) - myself->purchaseCompleted (purchase, responseCode); - } - - static void JNICALL purchaseConsumedCallback (JNIEnv*, jobject, jlong host, jstring productIdentifier, int responseCode) - { - if (auto* myself = reinterpret_cast (host)) - myself->purchaseConsumed (productIdentifier, responseCode); - } - //============================================================================== bool isReady() const { @@ -1041,32 +1012,32 @@ private: return responseCode == 0; } - void purchaseCompleted (jobject purchase, int responseCode) + static void purchaseCompleted (JNIEnv*, Pimpl& t, jobject purchase, int responseCode) { - notifyListenersAboutPurchase (buildPurchase (LocalRef { purchase }), - wasSuccessful (responseCode), - getStatusDescriptionFromResponseCode (responseCode)); + t.notifyListenersAboutPurchase (buildPurchase (LocalRef { purchase }), + wasSuccessful (responseCode), + getStatusDescriptionFromResponseCode (responseCode)); } - void purchaseConsumed (jstring productIdentifier, int responseCode) + static void purchaseConsumed (JNIEnv*, Pimpl& t, jstring productIdentifier, int responseCode) { - notifyListenersAboutConsume (juceString (LocalRef { productIdentifier }), - wasSuccessful (responseCode), - getStatusDescriptionFromResponseCode (responseCode)); + t.notifyListenersAboutConsume (juceString (LocalRef { productIdentifier }), + wasSuccessful (responseCode), + getStatusDescriptionFromResponseCode (responseCode)); } - void updateProductDetails (jobject productDetailsList) + static void updateProductDetails (JNIEnv*, Pimpl& t, jobject productDetailsList) { - jassert (! productDetailsQueryCallbackQueue.empty()); - productDetailsQueryCallbackQueue.front() (LocalRef { productDetailsList }); - productDetailsQueryCallbackQueue.pop(); + jassert (! t.productDetailsQueryCallbackQueue.empty()); + t.productDetailsQueryCallbackQueue.front() (LocalRef { productDetailsList }); + t.productDetailsQueryCallbackQueue.pop(); } - void updatePurchasesList (jobject purchasesList) + static void updatePurchasesList (JNIEnv*, Pimpl& t, jobject purchasesList) { - jassert (! purchasesListQueryCallbackQueue.empty()); - purchasesListQueryCallbackQueue.front() (LocalRef { purchasesList }); - purchasesListQueryCallbackQueue.pop(); + jassert (! t.purchasesListQueryCallbackQueue.empty()); + t.purchasesListQueryCallbackQueue.front() (LocalRef { purchasesList }); + t.purchasesListQueryCallbackQueue.pop(); } //============================================================================== @@ -1099,7 +1070,4 @@ void juce_handleOnResume() }); } - -InAppPurchases::Pimpl::JuceBillingClient_Class InAppPurchases::Pimpl::JuceBillingClient; - } // namespace juce diff --git a/modules/juce_video/capture/juce_CameraDevice.cpp b/modules/juce_video/capture/juce_CameraDevice.cpp index da0f3a6d..5a317a72 100644 --- a/modules/juce_video/capture/juce_CameraDevice.cpp +++ b/modules/juce_video/capture/juce_CameraDevice.cpp @@ -191,10 +191,10 @@ StringArray CameraDevice::getAvailableDevices() } } -CameraDevice* CameraDevice::openDevice (int index, - int minWidth, int minHeight, - int maxWidth, int maxHeight, - bool useHighQuality) +CameraDevice* CameraDevice::openDevice ([[maybe_unused]] int index, + [[maybe_unused]] int minWidth, [[maybe_unused]] int minHeight, + [[maybe_unused]] int maxWidth, [[maybe_unused]] int maxHeight, + [[maybe_unused]] bool useHighQuality) { jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager()); @@ -204,9 +204,6 @@ CameraDevice* CameraDevice::openDevice (int index, if (d != nullptr && d->pimpl->openedOk()) return d.release(); #else - ignoreUnused (index, minWidth, minHeight); - ignoreUnused (maxWidth, maxHeight, useHighQuality); - // Use openDeviceAsync to open a camera device on iOS or Android. jassertfalse; #endif diff --git a/modules/juce_video/juce_video.h b/modules/juce_video/juce_video.h index d08cc542..f6056caa 100644 --- a/modules/juce_video/juce_video.h +++ b/modules/juce_video/juce_video.h @@ -35,12 +35,12 @@ ID: juce_video vendor: juce - version: 7.0.2 + version: 7.0.5 name: JUCE video playback and capture classes description: Classes for playing video and capturing camera input. website: http://www.juce.com/juce license: GPL/Commercial - minimumCppStandard: 14 + minimumCppStandard: 17 dependencies: juce_gui_extra OSXFrameworks: AVKit AVFoundation CoreMedia diff --git a/modules/juce_video/native/juce_android_CameraDevice.h b/modules/juce_video/native/juce_android_CameraDevice.h index 45a731cc..fd29bfb7 100644 --- a/modules/juce_video/native/juce_android_CameraDevice.h +++ b/modules/juce_video/native/juce_android_CameraDevice.h @@ -400,7 +400,7 @@ class MediaRecorderOnInfoListener : public AndroidInterfaceImplementer public: struct Owner { - virtual ~Owner() {} + virtual ~Owner() = default; virtual void onInfo (LocalRef& mediaRecorder, int what, int extra) = 0; }; @@ -715,7 +715,7 @@ private: { auto key = LocalRef (env->CallObjectMethod (keysList, JavaList.get, i)); auto jKeyName = LocalRef ((jstring) env->CallObjectMethod (key, CameraCharacteristicsKey.getName)); - auto keyName = juceString (jKeyName); + [[maybe_unused]] auto keyName = juceString (jKeyName); auto keyValue = LocalRef (env->CallObjectMethod (characteristics, CameraCharacteristics.get, key.get())); auto jKeyValueString = LocalRef ((jstring) env->CallObjectMethod (keyValue, JavaObject.toString)); @@ -747,16 +747,12 @@ private: JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + keyValueString); } } - - ignoreUnused (keyName); } } - static void printPrimitiveArrayElements (const LocalRef& keyValue, const String& keyName, + static void printPrimitiveArrayElements (const LocalRef& keyValue, [[maybe_unused]] const String& keyName, const String& keyValueString) { - ignoreUnused (keyName); - String result = "["; auto* env = getEnv(); @@ -790,7 +786,7 @@ private: JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result); } - static void printRangeArrayElements (const LocalRef& rangeArray, const String& keyName) + static void printRangeArrayElements (const LocalRef& rangeArray, [[maybe_unused]] const String& keyName) { auto* env = getEnv(); @@ -809,7 +805,6 @@ private: result << juceString (jRangeString) << " "; } - ignoreUnused (keyName); JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result); } @@ -921,10 +916,8 @@ private: javaString (name).get())); } - static void printSizesLog (const Array>& sizes, const String& className) + static void printSizesLog ([[maybe_unused]] const Array>& sizes, [[maybe_unused]] const String& className) { - ignoreUnused (sizes, className); - JUCE_CAMERA_LOG ("Sizes for class " + className); #if JUCE_CAMERA_LOG_ENABLED @@ -1489,18 +1482,14 @@ private: Desktop::getInstance().setOrientationsEnabled (orientationsEnabled); } - void onInfo (LocalRef& recorder, int what, int extra) override + void onInfo ([[maybe_unused]] LocalRef& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override { - ignoreUnused (recorder, what, extra); - JUCE_CAMERA_LOG ("MediaRecorder::OnInfo: " + getInfoStringFromCode (what) + ", extra code = " + String (extra)); } - void onError (LocalRef& recorder, int what, int extra) override + void onError ([[maybe_unused]] LocalRef& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override { - ignoreUnused (recorder, what, extra); - JUCE_CAMERA_LOG ("MediaRecorder::onError: " + getErrorStringFromCode (what) + ", extra code = " + String (extra)); } @@ -1722,26 +1711,25 @@ private: //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(JZ)V") \ - CALLBACK (cameraCaptureSessionCaptureCompletedCallback, "cameraCaptureSessionCaptureCompleted", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/TotalCaptureResult;)V") \ - CALLBACK (cameraCaptureSessionCaptureFailedCallback, "cameraCaptureSessionCaptureFailed", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CaptureFailure;)V") \ - CALLBACK (cameraCaptureSessionCaptureProgressedCallback, "cameraCaptureSessionCaptureProgressed", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CaptureResult;)V") \ - CALLBACK (cameraCaptureSessionCaptureStartedCallback, "cameraCaptureSessionCaptureStarted", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V") \ - CALLBACK (cameraCaptureSessionCaptureSequenceAbortedCallback, "cameraCaptureSessionCaptureSequenceAborted", "(JZLandroid/hardware/camera2/CameraCaptureSession;I)V") \ - CALLBACK (cameraCaptureSessionCaptureSequenceCompletedCallback, "cameraCaptureSessionCaptureSequenceCompleted", "(JZLandroid/hardware/camera2/CameraCaptureSession;IJ)V") - - DECLARE_JNI_CLASS_WITH_BYTECODE (CameraCaptureSessionCaptureCallback, "com/rmsl/juce/CameraCaptureSessionCaptureCallback", 21, CameraSupportByteCode, sizeof(CameraSupportByteCode)) + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureCompletedCallback>, "cameraCaptureSessionCaptureCompleted", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/TotalCaptureResult;)V") \ + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureFailedCallback>, "cameraCaptureSessionCaptureFailed", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CaptureFailure;)V") \ + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureProgressedCallback>, "cameraCaptureSessionCaptureProgressed", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CaptureResult;)V") \ + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureStartedCallback>, "cameraCaptureSessionCaptureStarted", "(JZLandroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V") \ + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureSequenceAbortedCallback>, "cameraCaptureSessionCaptureSequenceAborted", "(JZLandroid/hardware/camera2/CameraCaptureSession;I)V") \ + CALLBACK (generatedCallback<&StillPictureTaker::cameraCaptureSessionCaptureSequenceCompletedCallback>, "cameraCaptureSessionCaptureSequenceCompleted", "(JZLandroid/hardware/camera2/CameraCaptureSession;IJ)V") + + DECLARE_JNI_CLASS_WITH_BYTECODE (CameraCaptureSessionCaptureCallback, "com/rmsl/juce/CameraCaptureSessionCaptureCallback", 21, CameraSupportByteCode) #undef JNI_CLASS_MEMBERS LocalRef createCaptureSessionCallback (bool createPreviewSession) { - return LocalRef(getEnv()->NewObject (CameraCaptureSessionCaptureCallback, - CameraCaptureSessionCaptureCallback.constructor, - reinterpret_cast (this), - createPreviewSession ? 1 : 0)); + return LocalRef (getEnv()->NewObject (CameraCaptureSessionCaptureCallback, + CameraCaptureSessionCaptureCallback.constructor, + reinterpret_cast (this), + createPreviewSession ? 1 : 0)); } //============================================================================== - enum class State { idle = 0, @@ -1976,122 +1964,110 @@ private: } //============================================================================== - void cameraCaptureSessionCaptureCompleted (bool isPreview, jobject session, jobject request, jobject result) + void cameraCaptureSessionCaptureCompleted (bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + jobject result) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureCompleted()"); - ignoreUnused (session, request); - if (isPreview) updateState (result); else if (currentState != State::idle) unlockFocus(); } - void cameraCaptureSessionCaptureFailed (bool isPreview, jobject session, jobject request, jobject failure) + void cameraCaptureSessionCaptureFailed ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + [[maybe_unused]] jobject failure) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureFailed()"); - - ignoreUnused (isPreview, session, request, failure); } - void cameraCaptureSessionCaptureProgressed (bool isPreview, jobject session, jobject request, jobject partialResult) + void cameraCaptureSessionCaptureProgressed (bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + jobject partialResult) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureProgressed()"); - ignoreUnused (session, request); - if (isPreview) updateState (partialResult); } - void cameraCaptureSessionCaptureSequenceAborted (bool isPreview, jobject session, int sequenceId) + void cameraCaptureSessionCaptureSequenceAborted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] int sequenceId) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceAborted()"); - - ignoreUnused (isPreview, isPreview, session, sequenceId); } - void cameraCaptureSessionCaptureSequenceCompleted (bool isPreview, jobject session, int sequenceId, int64 frameNumber) + void cameraCaptureSessionCaptureSequenceCompleted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] int sequenceId, + [[maybe_unused]] int64 frameNumber) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceCompleted()"); - - ignoreUnused (isPreview, session, sequenceId, frameNumber); } - void cameraCaptureSessionCaptureStarted (bool isPreview, jobject session, jobject request, int64 timestamp, int64 frameNumber) + void cameraCaptureSessionCaptureStarted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + [[maybe_unused]] int64 timestamp, + [[maybe_unused]] int64 frameNumber) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureStarted()"); - - ignoreUnused (isPreview, session, request, timestamp, frameNumber); } //============================================================================== - static void cameraCaptureSessionCaptureCompletedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) + static void cameraCaptureSessionCaptureCompletedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - LocalRef request (getEnv()->NewLocalRef(rawRequest)); - LocalRef result (getEnv()->NewLocalRef(rawResult)); + LocalRef session (env->NewLocalRef (rawSession)); + LocalRef request (env->NewLocalRef (rawRequest)); + LocalRef result (env->NewLocalRef (rawResult)); - myself->cameraCaptureSessionCaptureCompleted (isPreview != 0, session, request, result); - } + t.cameraCaptureSessionCaptureCompleted (isPreview != 0, session, request, result); } - static void cameraCaptureSessionCaptureFailedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) + static void cameraCaptureSessionCaptureFailedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - LocalRef request (getEnv()->NewLocalRef(rawRequest)); - LocalRef result (getEnv()->NewLocalRef(rawResult)); + LocalRef session (env->NewLocalRef (rawSession)); + LocalRef request (env->NewLocalRef (rawRequest)); + LocalRef result (env->NewLocalRef (rawResult)); - myself->cameraCaptureSessionCaptureFailed (isPreview != 0, session, request, result); - } + t.cameraCaptureSessionCaptureFailed (isPreview != 0, session, request, result); } - static void cameraCaptureSessionCaptureProgressedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) + static void cameraCaptureSessionCaptureProgressedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jobject rawRequest, jobject rawResult) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - LocalRef request (getEnv()->NewLocalRef(rawRequest)); - LocalRef result (getEnv()->NewLocalRef(rawResult)); + LocalRef session (env->NewLocalRef (rawSession)); + LocalRef request (env->NewLocalRef (rawRequest)); + LocalRef result (env->NewLocalRef (rawResult)); - myself->cameraCaptureSessionCaptureProgressed (isPreview != 0, session, request, result); - } + t.cameraCaptureSessionCaptureProgressed (isPreview != 0, session, request, result); } - static void cameraCaptureSessionCaptureSequenceAbortedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jint sequenceId) + static void cameraCaptureSessionCaptureSequenceAbortedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jint sequenceId) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); + LocalRef session (env->NewLocalRef (rawSession)); - myself->cameraCaptureSessionCaptureSequenceAborted (isPreview != 0, session, sequenceId); - } + t.cameraCaptureSessionCaptureSequenceAborted (isPreview != 0, session, sequenceId); } - static void cameraCaptureSessionCaptureSequenceCompletedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jint sequenceId, jlong frameNumber) + static void cameraCaptureSessionCaptureSequenceCompletedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jint sequenceId, jlong frameNumber) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); + LocalRef session (env->NewLocalRef (rawSession)); - myself->cameraCaptureSessionCaptureSequenceCompleted (isPreview != 0, session, sequenceId, frameNumber); - } + t.cameraCaptureSessionCaptureSequenceCompleted (isPreview != 0, session, sequenceId, frameNumber); } - static void cameraCaptureSessionCaptureStartedCallback (JNIEnv*, jobject /*object*/, jlong host, jboolean isPreview, jobject rawSession, jobject rawRequest, jlong timestamp, jlong frameNumber) + static void cameraCaptureSessionCaptureStartedCallback (JNIEnv* env, StillPictureTaker& t, jboolean isPreview, jobject rawSession, jobject rawRequest, jlong timestamp, jlong frameNumber) { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - LocalRef request (getEnv()->NewLocalRef(rawRequest)); + LocalRef session (env->NewLocalRef (rawSession)); + LocalRef request (env->NewLocalRef (rawRequest)); - myself->cameraCaptureSessionCaptureStarted (isPreview != 0, session, request, timestamp, frameNumber); - } + t.cameraCaptureSessionCaptureStarted (isPreview != 0, session, request, timestamp, frameNumber); } }; @@ -2120,11 +2096,11 @@ private: //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ - CALLBACK(cameraCaptureSessionActiveCallback, "cameraCaptureSessionActive", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ - CALLBACK(cameraCaptureSessionClosedCallback, "cameraCaptureSessionClosed", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ - CALLBACK(cameraCaptureSessionConfigureFailedCallback, "cameraCaptureSessionConfigureFailed", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ - CALLBACK(cameraCaptureSessionConfiguredCallback, "cameraCaptureSessionConfigured", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ - CALLBACK(cameraCaptureSessionReadyCallback, "cameraCaptureSessionReady", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") + CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionActiveCallback>, "cameraCaptureSessionActive", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ + CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionClosedCallback>, "cameraCaptureSessionClosed", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ + CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionConfigureFailedCallback>, "cameraCaptureSessionConfigureFailed", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ + CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionConfiguredCallback>, "cameraCaptureSessionConfigured", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \ + CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionReadyCallback>, "cameraCaptureSessionReady", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCaptureSessionStateCallback, "com/rmsl/juce/CameraCaptureSessionStateCallback", 21) #undef JNI_CLASS_MEMBERS @@ -2166,126 +2142,81 @@ private: env->CallVoidMethod (captureRequestBuilder, CaptureRequestBuilder.set, jKey.get(), jValue.get()); } - void cameraCaptureSessionActive (jobject session) + //============================================================================== + static void cameraCaptureSessionActiveCallback ([[maybe_unused]] JNIEnv* env, + [[maybe_unused]] CaptureSession& t, + [[maybe_unused]] jobject rawSession) { JUCE_CAMERA_LOG ("cameraCaptureSessionActive()"); - ignoreUnused (session); } - void cameraCaptureSessionClosed (jobject session) + static void cameraCaptureSessionClosedCallback ([[maybe_unused]] JNIEnv* env, + CaptureSession& t, + [[maybe_unused]] jobject rawSession) { JUCE_CAMERA_LOG ("cameraCaptureSessionClosed()"); - ignoreUnused (session); - closedEvent.signal(); + t.closedEvent.signal(); } - void cameraCaptureSessionConfigureFailed (jobject session) + static void cameraCaptureSessionConfigureFailedCallback ([[maybe_unused]] JNIEnv* env, + CaptureSession& t, + [[maybe_unused]] jobject rawSession) { JUCE_CAMERA_LOG ("cameraCaptureSessionConfigureFailed()"); - ignoreUnused (session); - MessageManager::callAsync ([weakRef = WeakReference { this }] - { - if (weakRef != nullptr) - weakRef->configuredCallback.captureSessionConfigured (nullptr); - }); + MessageManager::callAsync ([weakRef = WeakReference { &t }] + { + if (weakRef != nullptr) + weakRef->configuredCallback.captureSessionConfigured (nullptr); + }); } - void cameraCaptureSessionConfigured (const LocalRef& session) + static void cameraCaptureSessionConfiguredCallback (JNIEnv* env, CaptureSession& t, jobject rawSession) { + LocalRef session (env->NewLocalRef (rawSession)); JUCE_CAMERA_LOG ("cameraCaptureSessionConfigured()"); - if (pendingClose.get() == 1) + if (t.pendingClose.get() == 1) { // Already closing, bailout. - closedEvent.signal(); + t.closedEvent.signal(); GlobalRef s (session); MessageManager::callAsync ([s]() - { - getEnv()->CallVoidMethod (s, CameraCaptureSession.close); - }); + { + getEnv()->CallVoidMethod (s, CameraCaptureSession.close); + }); return; } { - const ScopedLock lock (captureSessionLock); - captureSession = GlobalRef (session); + const ScopedLock lock (t.captureSessionLock); + t.captureSession = GlobalRef (session); } - MessageManager::callAsync ([weakRef = WeakReference { this }] - { - if (weakRef == nullptr) - return; + MessageManager::callAsync ([weakRef = WeakReference { &t }] + { + if (weakRef == nullptr) + return; - weakRef->stillPictureTaker.reset (new StillPictureTaker (weakRef->captureSession, - weakRef->captureRequestBuilder, - weakRef->previewCaptureRequest, - weakRef->handler, - weakRef->autoFocusMode)); + weakRef->stillPictureTaker.reset (new StillPictureTaker (weakRef->captureSession, + weakRef->captureRequestBuilder, + weakRef->previewCaptureRequest, + weakRef->handler, + weakRef->autoFocusMode)); - weakRef->configuredCallback.captureSessionConfigured (weakRef.get()); - }); + weakRef->configuredCallback.captureSessionConfigured (weakRef.get()); + }); } - void cameraCaptureSessionReady (const LocalRef& session) + static void cameraCaptureSessionReadyCallback ([[maybe_unused]] JNIEnv* env, + [[maybe_unused]] CaptureSession& t, + [[maybe_unused]] jobject rawSession) { JUCE_CAMERA_LOG ("cameraCaptureSessionReady()"); - ignoreUnused (session); - } - - //============================================================================== - static void cameraCaptureSessionActiveCallback (JNIEnv*, jobject, jlong host, jobject rawSession) - { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - - myself->cameraCaptureSessionActive (session); - } - } - - static void cameraCaptureSessionClosedCallback (JNIEnv*, jobject, jlong host, jobject rawSession) - { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - - myself->cameraCaptureSessionClosed (session); - } - } - - static void cameraCaptureSessionConfigureFailedCallback (JNIEnv*, jobject, jlong host, jobject rawSession) - { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - - myself->cameraCaptureSessionConfigureFailed (session); - } - } - - static void cameraCaptureSessionConfiguredCallback (JNIEnv*, jobject, jlong host, jobject rawSession) - { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - - myself->cameraCaptureSessionConfigured (session); - } - } - - static void cameraCaptureSessionReadyCallback (JNIEnv*, jobject, jlong host, jobject rawSession) - { - if (auto* myself = reinterpret_cast (host)) - { - LocalRef session (getEnv()->NewLocalRef(rawSession)); - - myself->cameraCaptureSessionReady (session); - } } //============================================================================== @@ -2383,10 +2314,10 @@ private: //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ - CALLBACK (cameraDeviceStateClosedCallback, "cameraDeviceStateClosed", "(JLandroid/hardware/camera2/CameraDevice;)V") \ - CALLBACK (cameraDeviceStateDisconnectedCallback, "cameraDeviceStateDisconnected", "(JLandroid/hardware/camera2/CameraDevice;)V") \ - CALLBACK (cameraDeviceStateErrorCallback, "cameraDeviceStateError", "(JLandroid/hardware/camera2/CameraDevice;I)V") \ - CALLBACK (cameraDeviceStateOpenedCallback, "cameraDeviceStateOpened", "(JLandroid/hardware/camera2/CameraDevice;)V") + CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateClosedCallback>, "cameraDeviceStateClosed", "(JLandroid/hardware/camera2/CameraDevice;)V") \ + CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateDisconnectedCallback>, "cameraDeviceStateDisconnected", "(JLandroid/hardware/camera2/CameraDevice;)V") \ + CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateErrorCallback>, "cameraDeviceStateError", "(JLandroid/hardware/camera2/CameraDevice;I)V") \ + CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateOpenedCallback>, "cameraDeviceStateOpened", "(JLandroid/hardware/camera2/CameraDevice;)V") DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraDeviceStateCallback, "com/rmsl/juce/CameraDeviceStateCallback", 21) #undef JNI_CLASS_MEMBERS @@ -2399,92 +2330,66 @@ private: } //============================================================================== - void cameraDeviceStateClosed() + void notifyOpenResult() + { + MessageManager::callAsync ([this]() { owner.cameraOpenFinished (openError); }); + } + + //============================================================================== + static void cameraDeviceStateClosedCallback (JNIEnv*, ScopedCameraDevice& s, jobject) { JUCE_CAMERA_LOG ("cameraDeviceStateClosed()"); - closedEvent.signal(); + s.closedEvent.signal(); } - void cameraDeviceStateDisconnected() + static void cameraDeviceStateDisconnectedCallback (JNIEnv*, ScopedCameraDevice& s, jobject) { JUCE_CAMERA_LOG ("cameraDeviceStateDisconnected()"); - if (pendingOpen.compareAndSetBool (0, 1)) + if (s.pendingOpen.compareAndSetBool (0, 1)) { - openError = "Device disconnected"; + s.openError = "Device disconnected"; - notifyOpenResult(); + s.notifyOpenResult(); } - MessageManager::callAsync ([this]() { close(); }); + MessageManager::callAsync ([&s] { s.close(); }); } - void cameraDeviceStateError (int errorCode) + static void cameraDeviceStateErrorCallback (JNIEnv*, ScopedCameraDevice& s, jobject, jint errorCode) { - String error = cameraErrorCodeToString (errorCode); + auto error = cameraErrorCodeToString (errorCode); JUCE_CAMERA_LOG ("cameraDeviceStateError(), error: " + error); - if (pendingOpen.compareAndSetBool (0, 1)) + if (s.pendingOpen.compareAndSetBool (0, 1)) { - openError = error; + s.openError = error; - notifyOpenResult(); + s.notifyOpenResult(); } - fatalErrorOccurred.set (1); + s.fatalErrorOccurred.set (1); - MessageManager::callAsync ([this, error]() + MessageManager::callAsync ([&s, error]() { - owner.cameraDeviceError (error); - close(); + s.owner.cameraDeviceError (error); + s.close(); }); } - void cameraDeviceStateOpened (const LocalRef& cameraDeviceToUse) + static void cameraDeviceStateOpenedCallback (JNIEnv* env, ScopedCameraDevice& s, jobject cameraDeviceToUse) { JUCE_CAMERA_LOG ("cameraDeviceStateOpened()"); - pendingOpen.set (0); - - cameraDevice = GlobalRef (cameraDeviceToUse); - - notifyOpenResult(); - } - - void notifyOpenResult() - { - MessageManager::callAsync ([this]() { owner.cameraOpenFinished (openError); }); - } - - //============================================================================== - static void JNICALL cameraDeviceStateClosedCallback (JNIEnv*, jobject, jlong host, jobject) - { - if (auto* myself = reinterpret_cast(host)) - myself->cameraDeviceStateClosed(); - } + LocalRef camera (env->NewLocalRef (cameraDeviceToUse)); - static void JNICALL cameraDeviceStateDisconnectedCallback (JNIEnv*, jobject, jlong host, jobject) - { - if (auto* myself = reinterpret_cast(host)) - myself->cameraDeviceStateDisconnected(); - } - - static void JNICALL cameraDeviceStateErrorCallback (JNIEnv*, jobject, jlong host, jobject, jint error) - { - if (auto* myself = reinterpret_cast(host)) - myself->cameraDeviceStateError (error); - } + s.pendingOpen.set (0); - static void JNICALL cameraDeviceStateOpenedCallback (JNIEnv*, jobject, jlong host, jobject rawCamera) - { - if (auto* myself = reinterpret_cast(host)) - { - LocalRef camera(getEnv()->NewLocalRef(rawCamera)); + s.cameraDevice = GlobalRef (camera); - myself->cameraDeviceStateOpened (camera); - } + s.notifyOpenResult(); } }; @@ -2824,7 +2729,7 @@ private: METHOD (constructor, "", "(JLandroid/content/Context;I)V") \ METHOD (disable, "disable", "()V") \ METHOD (enable, "enable", "()V") \ - CALLBACK (deviceOrientationChanged, "deviceOrientationChanged", "(JI)V") + CALLBACK (generatedCallback<&DeviceOrientationChangeListener::orientationChanged>, "deviceOrientationChanged", "(JI)V") DECLARE_JNI_CLASS_WITH_MIN_SDK (OrientationEventListener, "com/rmsl/juce/JuceOrientationEventListener", 21) #undef JNI_CLASS_MEMBERS @@ -2839,7 +2744,7 @@ private: } //============================================================================== - void orientationChanged (int orientation) + static void orientationChanged (JNIEnv*, DeviceOrientationChangeListener& t, jint orientation) { jassert (orientation < 360); @@ -2847,25 +2752,31 @@ private: if (orientation < 0) return; - auto oldOrientation = deviceOrientation; + const auto oldOrientation = t.deviceOrientation; + + t.deviceOrientation = [orientation] + { + if (orientation > (360 - 45) || orientation < 45) + return Desktop::upright; + + if (orientation < 135) + return Desktop::rotatedClockwise; + + if (orientation < 225) + return Desktop::upsideDown; + + return Desktop::rotatedAntiClockwise; + }(); // NB: this assumes natural position to be portrait always, but some devices may be landscape... - if (orientation > (360 - 45) || orientation < 45) - deviceOrientation = Desktop::upright; - else if (orientation < 135) - deviceOrientation = Desktop::rotatedClockwise; - else if (orientation < 225) - deviceOrientation = Desktop::upsideDown; - else - deviceOrientation = Desktop::rotatedAntiClockwise; - if (oldOrientation != deviceOrientation) + if (oldOrientation != t.deviceOrientation) { - lastKnownScreenOrientation = Desktop::getInstance().getCurrentOrientation(); + t.lastKnownScreenOrientation = Desktop::getInstance().getCurrentOrientation(); // Need to update preview transform, but screen orientation will change slightly // later than sensor orientation. - startTimer (500); + t.startTimer (500); } } @@ -2890,12 +2801,6 @@ private: numChecksForOrientationChange = 10; } } - - static void deviceOrientationChanged (JNIEnv*, jobject /*obj*/, jlong host, jint orientation) - { - if (auto* myself = reinterpret_cast (host)) - myself->orientationChanged (orientation); - } }; //============================================================================== @@ -3189,7 +3094,7 @@ private: { auto* env = getEnv(); - auto quitSafelyMethod = env->GetMethodID(AndroidHandlerThread, "quitSafely", "()Z"); + auto quitSafelyMethod = env->GetMethodID (AndroidHandlerThread, "quitSafely", "()Z"); // this code will only run on SDK >= 21 jassert(quitSafelyMethod != nullptr); @@ -3277,9 +3182,3 @@ String CameraDevice::getFileExtension() { return ".mp4"; } - -//============================================================================== -CameraDevice::Pimpl::ScopedCameraDevice::CaptureSession::StillPictureTaker::CameraCaptureSessionCaptureCallback_Class CameraDevice::Pimpl::ScopedCameraDevice::CaptureSession::StillPictureTaker::CameraCaptureSessionCaptureCallback; -CameraDevice::Pimpl::ScopedCameraDevice::CameraDeviceStateCallback_Class CameraDevice::Pimpl::ScopedCameraDevice::CameraDeviceStateCallback; -CameraDevice::Pimpl::ScopedCameraDevice::CaptureSession::CameraCaptureSessionStateCallback_Class CameraDevice::Pimpl::ScopedCameraDevice::CaptureSession::CameraCaptureSessionStateCallback; -CameraDevice::Pimpl::DeviceOrientationChangeListener::OrientationEventListener_Class CameraDevice::Pimpl::DeviceOrientationChangeListener::OrientationEventListener; diff --git a/modules/juce_video/native/juce_android_Video.h b/modules/juce_video/native/juce_android_Video.h index 101bf958..56d94bbb 100644 --- a/modules/juce_video/native/juce_android_Video.h +++ b/modules/juce_video/native/juce_android_Video.h @@ -32,7 +32,7 @@ // // files with min sdk version 21 // See juce_core/native/java/README.txt on how to generate this byte-code. -static const unsigned char MediaSessionByteCode[] = +static const uint8 MediaSessionByteCode[] = { 31,139,8,8,247,108,161,94,0,3,77,101,100,105,97,83,101,115,115,105,111,110,66,121,116,101,67,111,100,101,46,100,101,120,0,149, 152,127,108,28,71,21,199,223,236,253,180,207,190,95,254,221,186,169,211,56,137,19,234,220,145,26,226,228,28,99,199,216,196,233, 249,71,125,182,107,76,168,187,246,109,236,77,238,118,143,221,189,171,45,132,168,170,32,21,209,63,144,74,165,170,82,81,144,64, @@ -757,12 +757,12 @@ private: //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ - CALLBACK (audioInfoChanged, "mediaControllerAudioInfoChanged", "(JLandroid/media/session/MediaController$PlaybackInfo;)V") \ - CALLBACK (metadataChanged, "mediaControllerMetadataChanged", "(JLandroid/media/MediaMetadata;)V") \ - CALLBACK (playbackStateChanged, "mediaControllerPlaybackStateChanged", "(JLandroid/media/session/PlaybackState;)V") \ - CALLBACK (sessionDestroyed, "mediaControllerSessionDestroyed", "(J)V") + CALLBACK (generatedCallback<&Controller::audioInfoChanged>, "mediaControllerAudioInfoChanged", "(JLandroid/media/session/MediaController$PlaybackInfo;)V") \ + CALLBACK (generatedCallback<&Controller::metadataChanged>, "mediaControllerMetadataChanged", "(JLandroid/media/MediaMetadata;)V") \ + CALLBACK (generatedCallback<&Controller::playbackStateChanged>, "mediaControllerPlaybackStateChanged", "(JLandroid/media/session/PlaybackState;)V") \ + CALLBACK (generatedCallback<&Controller::sessionDestroyed>, "mediaControllerSessionDestroyed", "(J)V") - DECLARE_JNI_CLASS_WITH_BYTECODE (AndroidMediaControllerCallback, "com/rmsl/juce/MediaControllerCallback", 21, MediaSessionByteCode, sizeof (MediaSessionByteCode)) + DECLARE_JNI_CLASS_WITH_BYTECODE (AndroidMediaControllerCallback, "com/rmsl/juce/MediaControllerCallback", 21, MediaSessionByteCode) #undef JNI_CLASS_MEMBERS LocalRef createControllerCallbacks() @@ -774,34 +774,24 @@ private: //============================================================================== // MediaSessionController callbacks - static void audioInfoChanged (JNIEnv*, jobject, jlong host, jobject playbackInfo) + static void audioInfoChanged (JNIEnv*, [[maybe_unused]] Controller& t, [[maybe_unused]] jobject playbackInfo) { - if (auto* myself = reinterpret_cast (host)) - { - ignoreUnused (playbackInfo); - JUCE_VIDEO_LOG ("MediaSessionController::audioInfoChanged()"); - } + JUCE_VIDEO_LOG ("MediaSessionController::audioInfoChanged()"); } - static void metadataChanged (JNIEnv*, jobject, jlong host, jobject metadata) + static void metadataChanged (JNIEnv*, [[maybe_unused]] Controller&, [[maybe_unused]] jobject metadata) { - if (auto* myself = reinterpret_cast (host)) - { - ignoreUnused (metadata); - JUCE_VIDEO_LOG ("MediaSessionController::metadataChanged()"); - } + JUCE_VIDEO_LOG ("MediaSessionController::metadataChanged()"); } - static void playbackStateChanged (JNIEnv*, jobject, jlong host, jobject state) + static void playbackStateChanged (JNIEnv*, Controller& t, [[maybe_unused]] jobject state) { - if (auto* myself = reinterpret_cast (host)) - myself->stateChanged (state); + t.stateChanged (state); } - static void sessionDestroyed (JNIEnv*, jobject, jlong host) + static void sessionDestroyed (JNIEnv*, [[maybe_unused]] Controller& t) { - if (auto* myself = reinterpret_cast (host)) - JUCE_VIDEO_LOG ("MediaSessionController::sessionDestroyed()"); + JUCE_VIDEO_LOG ("MediaSessionController::sessionDestroyed()"); } }; @@ -835,10 +825,8 @@ private: getEnv()->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.setDisplay, videoSurfaceHolder.get()); } - void load (const LocalRef& mediaId, const LocalRef& extras) + void load (const LocalRef& mediaId, [[maybe_unused]] const LocalRef& extras) { - ignoreUnused (extras); - closeVideo(); auto* env = getEnv(); @@ -1114,39 +1102,31 @@ private: State currentState = State::idle; //============================================================================== - void onPrepared (LocalRef& mediaPlayer) override + void onPrepared ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onPrepared()"); - ignoreUnused (mediaPlayer); - currentState = State::prepared; owner.playerPrepared(); } - void onBufferingUpdate (LocalRef& mediaPlayer, int progress) override + void onBufferingUpdate ([[maybe_unused]] LocalRef& mediaPlayer, int progress) override { - ignoreUnused (mediaPlayer); - owner.playerBufferingUpdated (progress); } - void onSeekComplete (LocalRef& mediaPlayer) override + void onSeekComplete ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onSeekComplete()"); - ignoreUnused (mediaPlayer); - owner.playerSeekCompleted(); } - void onCompletion (LocalRef& mediaPlayer) override + void onCompletion ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onCompletion()"); - ignoreUnused (mediaPlayer); - currentState = State::complete; owner.playerPlaybackCompleted(); @@ -1169,13 +1149,11 @@ private: MEDIA_INFO_SUBTITLE_TIMED_OUT = 902 }; - bool onInfo (LocalRef& mediaPlayer, int what, int extra) override + bool onInfo ([[maybe_unused]] LocalRef& mediaPlayer, int what, [[maybe_unused]] int extra) override { JUCE_VIDEO_LOG ("MediaPlayer::onInfo(), infoCode: " + String (what) + " (" + infoCodeToString (what) + ")" + ", extraCode: " + String (extra)); - ignoreUnused (mediaPlayer, extra); - if (what == MEDIA_INFO_BUFFERING_START) owner.playerBufferingStarted(); else if (what == MEDIA_INFO_BUFFERING_END) @@ -1205,7 +1183,7 @@ private: } } - bool onError (LocalRef& mediaPlayer, int what, int extra) override + bool onError ([[maybe_unused]] LocalRef& mediaPlayer, int what, int extra) override { auto errorMessage = errorCodeToString (what); auto extraMessage = errorCodeToString (extra); @@ -1216,8 +1194,6 @@ private: JUCE_VIDEO_LOG ("MediaPlayer::onError(), errorCode: " + String (what) + " (" + errorMessage + ")" + ", extraCode: " + String (extra) + " (" + extraMessage + ")"); - ignoreUnused (mediaPlayer); - currentState = State::error; owner.errorOccurred (errorMessage); @@ -1295,11 +1271,11 @@ private: //============================================================================== #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(J)V") \ - CALLBACK (pauseCallback, "mediaSessionPause", "(J)V") \ - CALLBACK (playCallback, "mediaSessionPlay", "(J)V") \ - CALLBACK (playFromMediaIdCallback, "mediaSessionPlayFromMediaId", "(JLjava/lang/String;Landroid/os/Bundle;)V") \ - CALLBACK (seekToCallback, "mediaSessionSeekTo", "(JJ)V") \ - CALLBACK (stopCallback, "mediaSessionStop", "(J)V") + CALLBACK (generatedCallback<&MediaSession::pauseCallback>, "mediaSessionPause", "(J)V") \ + CALLBACK (generatedCallback<&MediaSession::playCallback>, "mediaSessionPlay", "(J)V") \ + CALLBACK (generatedCallback<&MediaSession::playFromMediaIdCallback>, "mediaSessionPlayFromMediaId", "(JLjava/lang/String;Landroid/os/Bundle;)V") \ + CALLBACK (generatedCallback<&MediaSession::seekToCallback>, "mediaSessionSeekTo", "(JJ)V") \ + CALLBACK (generatedCallback<&MediaSession::stopCallback>, "mediaSessionStop", "(J)V") DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaSessionCallback, "com/rmsl/juce/MediaSessionCallback", 21) #undef JNI_CLASS_MEMBERS @@ -1313,78 +1289,62 @@ private: //============================================================================== // MediaSession callbacks - static void pauseCallback (JNIEnv*, jobject, jlong host) + static void pauseCallback (JNIEnv*, MediaSession& t) { - if (auto* myself = reinterpret_cast (host)) - { - JUCE_VIDEO_LOG ("MediaSession::pauseCallback()"); - myself->player.pause(); - myself->updatePlaybackState(); - - myself->abandonAudioFocus(); - } + JUCE_VIDEO_LOG ("MediaSession::pauseCallback()"); + t.player.pause(); + t.updatePlaybackState(); + t.abandonAudioFocus(); } - static void playCallback (JNIEnv*, jobject, jlong host) + static void playCallback (JNIEnv* env, MediaSession& t) { - if (auto* myself = reinterpret_cast (host)) - { - JUCE_VIDEO_LOG ("MediaSession::playCallback()"); + JUCE_VIDEO_LOG ("MediaSession::playCallback()"); - myself->requestAudioFocus(); + t.requestAudioFocus(); - if (! myself->hasAudioFocus) - { - myself->errorOccurred ("Application has been denied audio focus. Try again later."); - return; - } + if (! t.hasAudioFocus) + { + t.errorOccurred ("Application has been denied audio focus. Try again later."); + return; + } - getEnv()->CallVoidMethod (myself->nativeMediaSession, AndroidMediaSession.setActive, true); + env->CallVoidMethod (t.nativeMediaSession, AndroidMediaSession.setActive, true); - myself->player.play(); - myself->setSpeed (myself->playSpeedMult); - myself->updatePlaybackState(); - } + t.player.play(); + t.setSpeed (t.playSpeedMult); + t.updatePlaybackState(); } - static void playFromMediaIdCallback (JNIEnv* env, jobject, jlong host, jstring mediaId, jobject extras) + static void playFromMediaIdCallback (JNIEnv* env, MediaSession& t, jstring mediaId, jobject extras) { - if (auto* myself = reinterpret_cast (host)) - { - JUCE_VIDEO_LOG ("MediaSession::playFromMediaIdCallback()"); + JUCE_VIDEO_LOG ("MediaSession::playFromMediaIdCallback()"); - myself->player.load (LocalRef ((jstring) env->NewLocalRef(mediaId)), LocalRef (env->NewLocalRef(extras))); - myself->updatePlaybackState(); - } + t.player.load (LocalRef ((jstring) env->NewLocalRef (mediaId)), LocalRef (env->NewLocalRef (extras))); + t.updatePlaybackState(); } - static void seekToCallback (JNIEnv* /*env*/, jobject, jlong host, jlong pos) + static void seekToCallback (JNIEnv*, MediaSession& t, jlong pos) { - if (auto* myself = reinterpret_cast (host)) - { - JUCE_VIDEO_LOG ("MediaSession::seekToCallback()"); + JUCE_VIDEO_LOG ("MediaSession::seekToCallback()"); - myself->pendingSeekRequest = true; - myself->player.setPlayPosition ((jint) pos); - myself->updatePlaybackState(); - } + t.pendingSeekRequest = true; + t.player.setPlayPosition ((jint) pos); + t.updatePlaybackState(); } - static void stopCallback(JNIEnv* env, jobject, jlong host) + static void stopCallback (JNIEnv* env, MediaSession& t) { - if (auto* myself = reinterpret_cast (host)) - { - JUCE_VIDEO_LOG ("MediaSession::stopCallback()"); + JUCE_VIDEO_LOG ("MediaSession::stopCallback()"); - env->CallVoidMethod (myself->nativeMediaSession, AndroidMediaSession.setActive, false); + env->CallVoidMethod (t.nativeMediaSession, AndroidMediaSession.setActive, false); - myself->player.closeVideo(); - myself->updatePlaybackState(); + t.player.closeVideo(); + t.updatePlaybackState(); - myself->abandonAudioFocus(); + t.abandonAudioFocus(); - myself->owner.closeVideoFinished(); - } + t.owner.closeVideoFinished(); } //============================================================================== @@ -1689,7 +1649,7 @@ private: #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \ METHOD (constructor, "", "(Landroid/app/Activity;J)V") \ METHOD (setEnabled, "setEnabled", "(Z)V") \ - CALLBACK (systemVolumeChangedCallback, "mediaSessionSystemVolumeChanged", "(J)V") + CALLBACK (generatedCallback<&SystemVolumeListener::systemVolumeChanged>, "mediaSessionSystemVolumeChanged", "(J)V") DECLARE_JNI_CLASS_WITH_MIN_SDK (SystemVolumeObserver, "com/rmsl/juce/SystemVolumeObserver", 21) #undef JNI_CLASS_MEMBERS @@ -1709,14 +1669,14 @@ private: // Send first notification instantly to ensure sync. if (shouldBeEnabled) - systemVolumeChanged(); + systemVolumeChanged (getEnv(), *this); } private: //============================================================================== - void systemVolumeChanged() + static void systemVolumeChanged (JNIEnv*, SystemVolumeListener& t) { - MessageManager::callAsync ([weakThis = WeakReference { this }]() mutable + MessageManager::callAsync ([weakThis = WeakReference { &t }] { if (weakThis == nullptr) return; @@ -1727,13 +1687,6 @@ private: } - //============================================================================== - static void systemVolumeChangedCallback (JNIEnv*, jobject, jlong host) - { - if (auto* myself = reinterpret_cast (host)) - myself->systemVolumeChanged(); - } - JUCE_DECLARE_WEAK_REFERENCEABLE (SystemVolumeListener) }; @@ -1845,8 +1798,3 @@ private: //============================================================================== constexpr VideoComponent::Pimpl::MediaSession::Player::StateInfo VideoComponent::Pimpl::MediaSession::Player::stateInfos[]; - -//============================================================================== -VideoComponent::Pimpl::MediaSession::AndroidMediaSessionCallback_Class VideoComponent::Pimpl::MediaSession::AndroidMediaSessionCallback; -VideoComponent::Pimpl::MediaSession::Controller::AndroidMediaControllerCallback_Class VideoComponent::Pimpl::MediaSession::Controller::AndroidMediaControllerCallback; -VideoComponent::Pimpl::SystemVolumeListener::SystemVolumeObserver_Class VideoComponent::Pimpl::SystemVolumeListener::SystemVolumeObserver; diff --git a/modules/juce_video/native/juce_ios_CameraDevice.h b/modules/juce_video/native/juce_ios_CameraDevice.h index 97a48c5a..d5b81872 100644 --- a/modules/juce_video/native/juce_ios_CameraDevice.h +++ b/modules/juce_video/native/juce_ios_CameraDevice.h @@ -524,23 +524,19 @@ private: private: //============================================================================== - static void started (id self, SEL, NSNotification* notification) + static void started (id self, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - ignoreUnused (notification); - dispatch_async (dispatch_get_main_queue(), ^{ getOwner (self).cameraSessionStarted(); }); } - static void stopped (id, SEL, NSNotification* notification) + static void stopped (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } static void runtimeError (id self, SEL, NSNotification* notification) @@ -555,18 +551,14 @@ private: }); } - static void interrupted (id, SEL, NSNotification* notification) + static void interrupted (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } - static void interruptionEnded (id, SEL, NSNotification* notification) + static void interruptionEnded (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } }; @@ -788,8 +780,7 @@ private: static void didFinishCaptureForSettings (id, SEL, AVCapturePhotoOutput*, AVCaptureResolvedPhotoSettings*, NSError* error) { - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishCaptureForSettings(), error = " + errorString); } @@ -799,8 +790,7 @@ private: { getOwner (self).takingPicture = false; - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishProcessingPhoto(), error = " + errorString); @@ -904,8 +894,7 @@ private: { getOwner (self).takingPicture = false; - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishProcessingPhotoSampleBuffer(), error = " + errorString); @@ -1019,10 +1008,8 @@ private: } private: - static void printVideoOutputDebugInfo (AVCaptureMovieFileOutput* output) + static void printVideoOutputDebugInfo ([[maybe_unused]] AVCaptureMovieFileOutput* output) { - ignoreUnused (output); - JUCE_CAMERA_LOG ("Available video codec types:"); #if JUCE_CAMERA_LOG_ENABLED diff --git a/modules/juce_video/native/juce_mac_CameraDevice.h b/modules/juce_video/native/juce_mac_CameraDevice.h index 28748f8d..6280e56f 100644 --- a/modules/juce_video/native/juce_mac_CameraDevice.h +++ b/modules/juce_video/native/juce_mac_CameraDevice.h @@ -306,8 +306,7 @@ private: { if (error != nil) { - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("Still picture capture failed, error: " + errorString); jassertfalse; diff --git a/modules/juce_video/native/juce_win32_CameraDevice.h b/modules/juce_video/native/juce_win32_CameraDevice.h index 9ba11f4e..535c6a3d 100644 --- a/modules/juce_video/native/juce_win32_CameraDevice.h +++ b/modules/juce_video/native/juce_win32_CameraDevice.h @@ -479,7 +479,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster auto context = [] { IBindCtx* ptr = nullptr; - ignoreUnused (CreateBindCtx (0, &ptr)); + [[maybe_unused]] const auto result = CreateBindCtx (0, &ptr); return ContextPtr (ptr); }(); diff --git a/modules/juce_video/native/juce_win32_Video.h b/modules/juce_video/native/juce_win32_Video.h index 6279cd18..263b47e1 100644 --- a/modules/juce_video/native/juce_win32_Video.h +++ b/modules/juce_video/native/juce_win32_Video.h @@ -395,7 +395,7 @@ private: { DirectShowContext (Pimpl& c) : component (c) { - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); } ~DirectShowContext() override diff --git a/modules/juce_video/playback/juce_VideoComponent.cpp b/modules/juce_video/playback/juce_VideoComponent.cpp index 3eb62862..10c4138a 100644 --- a/modules/juce_video/playback/juce_VideoComponent.cpp +++ b/modules/juce_video/playback/juce_VideoComponent.cpp @@ -145,7 +145,6 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync) { #if JUCE_ANDROID || JUCE_IOS ignoreUnused (fileOrUrl, loadAsync); - // You need to use loadAsync on Android & iOS. jassertfalse; return Result::fail ("load() is not supported on this platform. Use loadAsync() instead."); @@ -155,7 +154,7 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync) if (loadAsync) startTimer (50); else - resized(); + resized(); return result; #endif