From b59c67d14a0b8f8db36bef6f214f31ebe3a5a592 Mon Sep 17 00:00:00 2001 From: =?utf8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Wed, 30 Nov 2022 13:10:17 +0100 Subject: [PATCH] New upstream version 7.0.3~ds0 --- BREAKING-CHANGES.txt | 226 ++ CMakeLists.txt | 13 +- ChangeList.txt | 9 + README.md | 8 +- docs/ARA.md | 4 +- docs/Accessibility.md | 5 +- docs/doxygen/Doxyfile | 2 +- examples/Assets/AudioLiveScrollingDisplay.h | 8 +- examples/Audio/AudioLatencyDemo.h | 7 +- examples/Audio/AudioPlaybackDemo.h | 2 +- examples/Audio/AudioRecordingDemo.h | 8 +- examples/Audio/MPEDemo.h | 8 +- .../Builds/Android/app/CMakeLists.txt | 26 +- .../Builds/Android/app/build.gradle | 19 +- .../Android/app/src/main/AndroidManifest.xml | 5 +- .../main/assets/AudioLiveScrollingDisplay.h | 8 +- .../DemoRunner/Builds/Android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../DemoRunner/Builds/LinuxMakefile/Makefile | 8 +- .../DemoRunner.xcodeproj/project.pbxproj | 24 +- .../DemoRunner/Builds/MacOSX/Info-App.plist | 4 +- .../VisualStudio2017/DemoRunner_App.vcxproj | 19 +- .../DemoRunner_App.vcxproj.filters | 15 +- .../Builds/VisualStudio2017/resources.rc | 6 +- .../VisualStudio2019/DemoRunner_App.vcxproj | 19 +- .../DemoRunner_App.vcxproj.filters | 15 +- .../Builds/VisualStudio2019/resources.rc | 6 +- .../VisualStudio2022/DemoRunner_App.vcxproj | 19 +- .../DemoRunner_App.vcxproj.filters | 15 +- .../Builds/VisualStudio2022/resources.rc | 6 +- .../iOS/DemoRunner.xcodeproj/project.pbxproj | 24 +- examples/DemoRunner/Builds/iOS/Info-App.plist | 4 +- examples/DemoRunner/DemoRunner.jucer | 5 +- .../DemoRunner/JuceLibraryCode/JuceHeader.h | 4 +- examples/GUI/AnimationAppDemo.h | 2 +- examples/GUI/ImagesDemo.h | 2 +- examples/GUI/VideoDemo.h | 2 +- examples/Plugins/ARAPluginDemo.h | 1155 ++++++++-- examples/Plugins/DSPModulePluginDemo.h | 3 +- examples/Plugins/MultiOutSynthPluginDemo.h | 2 +- examples/Plugins/SamplerPluginDemo.h | 2 +- examples/Utilities/InAppPurchasesDemo.h | 8 +- examples/Utilities/MultithreadingDemo.h | 4 +- examples/Utilities/SystemInfoDemo.h | 1 + .../Builds/Android/app/CMakeLists.txt | 24 +- .../Builds/Android/app/build.gradle | 19 +- .../Android/app/src/main/AndroidManifest.xml | 5 +- .../Builds/Android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../Builds/LinuxMakefile/Makefile | 8 +- .../project.pbxproj | 16 +- .../AudioPerformanceTest_App.vcxproj | 19 +- .../AudioPerformanceTest_App.vcxproj.filters | 15 +- .../project.pbxproj | 16 +- .../Builds/Android/app/CMakeLists.txt | 24 +- .../Builds/Android/app/build.gradle | 19 +- .../Android/app/src/main/AndroidManifest.xml | 5 +- .../main/assets/AudioLiveScrollingDisplay.h | 8 +- .../Builds/Android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../Builds/LinuxMakefile/Makefile | 8 +- .../AudioPluginHost.xcodeproj/project.pbxproj | 16 +- .../AudioPluginHost_App.vcxproj | 19 +- .../AudioPluginHost_App.vcxproj.filters | 15 +- .../AudioPluginHost_App.vcxproj | 19 +- .../AudioPluginHost_App.vcxproj.filters | 15 +- .../AudioPluginHost_App.vcxproj | 19 +- .../AudioPluginHost_App.vcxproj.filters | 15 +- .../AudioPluginHost.xcodeproj/project.pbxproj | 16 +- .../AudioPluginHost/Source/UI/PluginWindow.h | 10 +- .../Builds/LinuxMakefile/Makefile | 8 +- .../BinaryBuilder.xcodeproj/project.pbxproj | 16 +- .../BinaryBuilder_ConsoleApp.vcxproj | 13 +- .../BinaryBuilder_ConsoleApp.vcxproj.filters | 3 + extras/Build/CMake/JUCECheckAtomic.cmake | 6 +- extras/Build/CMake/JUCEModuleSupport.cmake | 5 +- extras/Build/CMake/JUCEUtils.cmake | 109 +- .../Build/juce_build_tools/juce_build_tools.h | 2 +- extras/Build/juceaide/CMakeLists.txt | 44 +- extras/Build/juceaide/Main.cpp | 2 +- .../Builds/Android/app/CMakeLists.txt | 24 +- .../Builds/Android/app/build.gradle | 19 +- .../Android/app/src/main/AndroidManifest.xml | 5 +- .../Builds/Android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../Builds/LinuxMakefile/Makefile | 8 +- .../project.pbxproj | 16 +- .../NetworkGraphicsDemo_App.vcxproj | 19 +- .../NetworkGraphicsDemo_App.vcxproj.filters | 15 +- .../project.pbxproj | 16 +- .../NetworkGraphicsDemo.jucer | 10 +- extras/Projucer/Builds/LinuxMakefile/Makefile | 8 +- extras/Projucer/Builds/MacOSX/Info-App.plist | 4 +- .../MacOSX/Projucer.xcodeproj/project.pbxproj | 24 +- .../VisualStudio2017/Projucer_App.vcxproj | 18 +- .../Projucer_App.vcxproj.filters | 12 + .../Builds/VisualStudio2017/resources.rc | 6 +- .../VisualStudio2019/Projucer_App.vcxproj | 18 +- .../Projucer_App.vcxproj.filters | 12 + .../Builds/VisualStudio2019/resources.rc | 6 +- .../VisualStudio2022/Projucer_App.vcxproj | 18 +- .../Projucer_App.vcxproj.filters | 12 + .../Builds/VisualStudio2022/resources.rc | 6 +- extras/Projucer/CMakeLists.txt | 4 - extras/Projucer/JuceLibraryCode/JuceHeader.h | 4 +- extras/Projucer/Projucer.jucer | 6 +- .../Source/Application/jucer_AutoUpdater.cpp | 4 +- .../PaintElements/jucer_PaintElementPath.cpp | 16 +- .../PaintElements/jucer_PaintElementPath.h | 18 +- .../ComponentEditor/jucer_ComponentLayout.h | 6 +- .../ComponentEditor/jucer_PaintRoutine.h | 22 +- .../Source/Project/UI/Sidebar/jucer_Sidebar.h | 2 +- .../Projucer/Source/Project/jucer_Project.cpp | 17 +- .../Projucer/Source/Project/jucer_Project.h | 4 +- .../jucer_ProjectExport_Android.h | 101 +- .../jucer_ProjectExport_CodeBlocks.h | 6 +- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 92 +- .../ProjectSaving/jucer_ProjectExport_Make.h | 101 +- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 69 +- .../ProjectSaving/jucer_ProjectExporter.cpp | 71 +- .../ProjectSaving/jucer_ProjectExporter.h | 15 +- .../Utility/UI/jucer_JucerTreeViewBase.h | 1 - .../Utility/UI/jucer_SlidingPanelComponent.h | 1 - .../Builds/LinuxMakefile/Makefile | 8 +- .../UnitTestRunner.xcodeproj/project.pbxproj | 16 +- .../UnitTestRunner_ConsoleApp.vcxproj | 19 +- .../UnitTestRunner_ConsoleApp.vcxproj.filters | 15 +- .../UnitTestRunner_ConsoleApp.vcxproj | 19 +- .../UnitTestRunner_ConsoleApp.vcxproj.filters | 15 +- .../UnitTestRunner_ConsoleApp.vcxproj | 19 +- .../UnitTestRunner_ConsoleApp.vcxproj.filters | 15 +- extras/UnitTestRunner/UnitTestRunner.jucer | 8 +- .../WindowsDLL_StaticLibrary.vcxproj | 19 +- .../WindowsDLL_StaticLibrary.vcxproj.filters | 15 +- modules/CMakeLists.txt | 2 - modules/juce_analytics/juce_analytics.h | 4 +- .../audio_play_head/juce_AudioPlayHead.h | 6 +- .../buffers/juce_AudioDataConverters.h | 5 +- .../buffers/juce_AudioSampleBuffer.h | 10 +- .../buffers/juce_FloatVectorOperations.cpp | 51 +- .../buffers/juce_FloatVectorOperations.h | 2 +- modules/juce_audio_basics/juce_audio_basics.h | 4 +- .../juce_audio_basics/midi/ump/juce_UMPView.h | 2 +- .../midi/ump/juce_UMP_test.cpp | 2 +- .../midi/ump/juce_UMPacket.h | 10 +- .../mpe/juce_MPESynthesiser.cpp | 33 +- .../mpe/juce_MPESynthesiser.h | 2 + .../synthesisers/juce_Synthesiser.cpp | 37 +- .../synthesisers/juce_Synthesiser.h | 2 + .../utilities/juce_GenericInterpolator.h | 275 +-- .../utilities/juce_SmoothedValue.h | 64 +- .../audio_io/juce_AudioDeviceManager.cpp | 118 +- .../audio_io/juce_AudioDeviceManager.h | 4 +- .../audio_io/juce_AudioIODevice.h | 25 +- .../juce_audio_devices/juce_audio_devices.h | 4 +- .../midi_io/juce_MidiDevices.cpp | 2 +- .../native/juce_android_Audio.cpp | 2 +- .../native/juce_android_Oboe.cpp | 4 +- .../native/juce_ios_Audio.cpp | 4 +- .../native/juce_linux_ALSA.cpp | 2 +- .../native/juce_linux_JackAudio.cpp | 2 +- .../native/juce_mac_CoreAudio.cpp | 1866 ++++++++-------- .../native/juce_mac_CoreMidi.mm | 22 +- .../native/juce_win32_ASIO.cpp | 6 +- .../native/juce_win32_DirectSound.cpp | 2 +- .../native/juce_win32_Midi.cpp | 140 +- .../native/juce_win32_WASAPI.cpp | 139 +- .../sources/juce_AudioSourcePlayer.cpp | 13 +- .../sources/juce_AudioSourcePlayer.h | 13 +- .../codecs/juce_AiffAudioFormat.cpp | 4 +- .../codecs/juce_CoreAudioFormat.cpp | 2 +- .../codecs/juce_FlacAudioFormat.cpp | 24 +- .../codecs/juce_MP3AudioFormat.cpp | 4 +- .../codecs/juce_OggVorbisAudioFormat.cpp | 2 +- .../codecs/juce_WavAudioFormat.cpp | 4 +- .../codecs/juce_WindowsMediaAudioFormat.cpp | 2 +- .../format/juce_ARAAudioReaders.cpp | 4 +- .../format/juce_ARAAudioReaders.h | 4 +- .../format/juce_AudioFormatReader.cpp | 2 +- .../format/juce_AudioFormatReader.h | 4 +- .../format/juce_AudioSubsectionReader.cpp | 2 +- .../format/juce_AudioSubsectionReader.h | 2 +- .../juce_BufferingAudioFormatReader.cpp | 8 +- .../format/juce_BufferingAudioFormatReader.h | 2 +- .../juce_audio_formats/juce_audio_formats.h | 4 +- .../AAX/juce_AAX_Wrapper.cpp | 54 +- .../ARA/juce_ARA_Wrapper.cpp | 1 + .../juce_audio_plugin_client/AUResources.r | 150 -- .../juce_audio_plugin_client/CMakeLists.txt | 29 - .../LV2/juce_LV2TurtleDumpProgram.cpp | 30 +- .../LV2/juce_LV2_Client.cpp | 17 +- .../Standalone/juce_StandaloneFilterWindow.h | 10 +- .../Unity/juce_Unity_Wrapper.cpp | 159 +- .../VST/juce_VST_Wrapper.cpp | 15 +- .../VST3/juce_VST3_Wrapper.cpp | 200 +- .../juce_audio_plugin_client.h | 4 +- .../juce_audio_plugin_client_AU.r | 50 - .../juce_audio_plugin_client_AU_2.mm | 51 +- .../utility/juce_LinuxMessageThread.h | 64 +- .../format_types/LV2_SDK/juce_lv2_config.h | 2 +- .../juce_AudioUnitPluginFormat.mm | 110 +- .../format_types/juce_LV2PluginFormat.cpp | 56 +- .../format_types/juce_LV2SupportLibs.cpp | 16 + .../format_types/juce_VST3Common.h | 2 +- .../format_types/juce_VST3Headers.h | 1 + .../format_types/juce_VST3PluginFormat.cpp | 39 +- .../format_types/juce_VSTPluginFormat.cpp | 58 +- .../juce_audio_processors.h | 4 +- .../processors/juce_AudioProcessor.h | 6 +- .../processors/juce_AudioProcessorGraph.cpp | 1909 ++++++++++------- .../processors/juce_AudioProcessorGraph.h | 182 +- .../processors/juce_AudioProcessorListener.h | 8 +- .../ARA/juce_ARADocumentController.h | 2 +- .../ARA/juce_ARAPlugInInstanceRoles.h | 4 +- .../juce_AudioProcessorParameterWithID.h | 20 +- .../juce_AudioProcessorValueTreeState.cpp | 2 +- .../juce_AudioProcessorValueTreeState.h | 34 +- .../utilities/juce_RangedAudioParameter.h | 20 +- .../audio_cd/juce_AudioCDReader.h | 2 +- .../gui/juce_AudioThumbnail.cpp | 70 + .../gui/juce_AudioThumbnail.h | 12 + .../gui/juce_AudioThumbnailCache.cpp | 2 +- .../gui/juce_AudioVisualiserComponent.cpp | 2 +- .../gui/juce_AudioVisualiserComponent.h | 2 +- .../gui/juce_MPEKeyboardComponent.h | 6 +- modules/juce_audio_utils/juce_audio_utils.h | 4 +- .../native/juce_linux_AudioCDReader.cpp | 2 +- .../native/juce_mac_AudioCDReader.mm | 2 +- .../native/juce_win32_AudioCDReader.cpp | 2 +- .../players/juce_AudioProcessorPlayer.cpp | 17 +- .../players/juce_AudioProcessorPlayer.h | 2 +- .../players/juce_SoundPlayer.cpp | 17 +- .../players/juce_SoundPlayer.h | 2 +- modules/juce_box2d/juce_box2d.h | 4 +- modules/juce_core/containers/juce_Array.h | 2 +- .../juce_core/containers/juce_ArrayBase.cpp | 4 +- modules/juce_core/containers/juce_ArrayBase.h | 237 +- modules/juce_core/containers/juce_Optional.h | 370 +--- .../containers/juce_Optional_test.cpp | 11 +- .../juce_core/files/juce_FileSearchPath.cpp | 9 +- modules/juce_core/files/juce_FileSearchPath.h | 3 + .../juce_core/files/juce_common_MimeTypes.cpp | 1381 ++++++------ .../juce_core/files/juce_common_MimeTypes.h | 11 +- modules/juce_core/juce_core.cpp | 1 + modules/juce_core/juce_core.h | 4 +- modules/juce_core/maths/juce_BigInteger.cpp | 31 +- modules/juce_core/maths/juce_BigInteger.h | 16 +- modules/juce_core/maths/juce_MathsFunctions.h | 11 +- modules/juce_core/maths/juce_Range.h | 24 +- modules/juce_core/memory/juce_HeapBlock.h | 12 +- modules/juce_core/memory/juce_Memory.h | 6 +- modules/juce_core/memory/juce_WeakReference.h | 3 - modules/juce_core/misc/juce_Functional.h | 69 +- .../native/juce_BasicNativeHeaders.h | 12 +- .../native/juce_android_JNIHelpers.cpp | 6 +- .../native/juce_android_SystemStats.cpp | 25 + .../juce_core/native/juce_android_Threads.cpp | 85 +- .../native/juce_linux_SystemStats.cpp | 58 + .../juce_core/native/juce_linux_Threads.cpp | 54 +- modules/juce_core/native/juce_mac_CFHelpers.h | 2 +- .../juce_core/native/juce_mac_ObjCHelpers.h | 28 +- .../juce_core/native/juce_mac_SystemStats.mm | 33 +- modules/juce_core/native/juce_mac_Threads.mm | 132 +- .../native/juce_native_ThreadPriorities.h | 109 + .../juce_core/native/juce_posix_SharedCode.h | 345 +-- .../native/juce_win32_SystemStats.cpp | 183 +- .../juce_core/native/juce_win32_Threads.cpp | 129 +- modules/juce_core/network/juce_URL.cpp | 33 +- modules/juce_core/network/juce_URL.h | 52 +- .../streams/juce_MemoryOutputStream.cpp | 4 +- .../juce_core/system/juce_CompilerSupport.h | 17 +- .../juce_core/system/juce_StandardHeader.h | 6 +- modules/juce_core/system/juce_SystemStats.cpp | 21 + modules/juce_core/system/juce_SystemStats.h | 11 +- .../juce_core/system/juce_TargetPlatform.h | 12 +- .../juce_core/text/juce_CharacterFunctions.h | 4 +- .../juce_core/threads/juce_CriticalSection.h | 4 +- .../threads/juce_HighResolutionTimer.cpp | 95 +- .../threads/juce_HighResolutionTimer.h | 2 +- modules/juce_core/threads/juce_Process.h | 2 +- modules/juce_core/threads/juce_Thread.cpp | 138 +- modules/juce_core/threads/juce_Thread.h | 203 +- modules/juce_core/threads/juce_ThreadPool.cpp | 34 +- modules/juce_core/threads/juce_ThreadPool.h | 11 +- .../threads/juce_TimeSliceThread.cpp | 7 + .../juce_core/threads/juce_TimeSliceThread.h | 3 + .../unit_tests/juce_UnitTestCategories.h | 1 - modules/juce_core/xml/juce_XmlElement.h | 4 +- modules/juce_cryptography/juce_cryptography.h | 4 +- .../juce_data_structures.h | 4 +- modules/juce_dsp/containers/juce_AudioBlock.h | 22 +- .../containers/juce_AudioBlock_test.cpp | 168 +- .../containers/juce_FixedSizeFunction.h | 20 +- .../juce_dsp/containers/juce_SIMDRegister.h | 2 +- .../containers/juce_SIMDRegister_test.cpp | 30 +- modules/juce_dsp/frequency/juce_Convolution.h | 2 +- .../frequency/juce_Convolution_test.cpp | 2 +- modules/juce_dsp/juce_dsp.cpp | 4 +- modules/juce_dsp/juce_dsp.h | 10 +- .../native/juce_fallback_SIMDNativeOps.h | 8 +- .../native/juce_neon_SIMDNativeOps.cpp | 5 + .../juce_dsp/native/juce_neon_SIMDNativeOps.h | 117 +- modules/juce_dsp/processors/juce_DelayLine.h | 168 +- modules/juce_dsp/processors/juce_FIRFilter.h | 2 +- .../juce_dsp/processors/juce_IIRFilter_Impl.h | 2 +- .../juce_dsp/processors/juce_ProcessorChain.h | 41 +- .../processors/juce_StateVariableFilter.h | 2 +- modules/juce_dsp/widgets/juce_WaveShaper.h | 2 +- .../juce_ConnectedChildProcess.cpp | 2 +- .../juce_NetworkServiceDiscovery.cpp | 4 +- modules/juce_events/juce_events.h | 4 +- .../native/juce_win32_WinRTWrapper.cpp | 2 +- modules/juce_events/timers/juce_Timer.cpp | 2 +- modules/juce_graphics/colour/juce_Colour.h | 34 +- .../contexts/juce_GraphicsContext.cpp | 6 +- .../contexts/juce_LowLevelGraphicsContext.h | 1 + modules/juce_graphics/fonts/juce_Font.h | 16 +- modules/juce_graphics/fonts/juce_TextLayout.h | 2 +- modules/juce_graphics/geometry/juce_Point.h | 6 +- .../juce_graphics/geometry/juce_Rectangle.h | 42 +- modules/juce_graphics/juce_graphics.h | 4 +- .../native/juce_freetype_Fonts.cpp | 67 +- .../juce_graphics/native/juce_linux_Fonts.cpp | 92 +- .../native/juce_mac_CoreGraphicsContext.h | 7 + .../native/juce_mac_CoreGraphicsContext.mm | 29 +- .../accessibility/juce_AccessibilityState.h | 26 +- .../components/juce_Component.cpp | 237 +- .../juce_gui_basics/desktop/juce_Displays.h | 6 + .../juce_DirectoryContentsList.cpp | 40 +- .../filebrowser/juce_FileBrowserComponent.cpp | 5 +- .../filebrowser/juce_FileChooser.cpp | 7 + .../filebrowser/juce_FileChooser.h | 13 + .../filebrowser/juce_FileChooserDialogBox.h | 2 +- .../filebrowser/juce_FileListComponent.cpp | 17 +- .../filebrowser/juce_FileListComponent.h | 4 +- .../filebrowser/juce_FileTreeComponent.cpp | 67 +- modules/juce_gui_basics/juce_gui_basics.cpp | 16 +- modules/juce_gui_basics/juce_gui_basics.h | 5 +- .../keyboard/juce_KeyListener.h | 2 +- .../keyboard/juce_ModifierKeys.h | 8 +- modules/juce_gui_basics/layout/juce_Grid.cpp | 2 +- .../juce_gui_basics/menus/juce_PopupMenu.h | 26 +- .../juce_gui_basics/mouse/juce_PointerState.h | 14 +- .../accessibility/juce_ios_Accessibility.mm | 2 +- .../juce_win32_Accessibility.cpp | 20 +- .../juce_win32_AccessibilityElement.cpp | 96 +- .../juce_win32_AccessibilityElement.h | 3 - .../accessibility/juce_win32_ComInterfaces.h | 66 + .../juce_win32_UIAExpandCollapseProvider.h | 6 +- .../juce_win32_UIAInvokeProvider.h | 4 +- .../juce_win32_UIASelectionProvider.h | 4 +- .../juce_win32_UIATextProvider.h | 6 +- .../app/com/rmsl/juce/ComponentPeerView.java | 18 +- .../native/juce_android_FileChooser.cpp | 6 + .../native/juce_android_Windowing.cpp | 204 +- .../native/juce_ios_FileChooser.mm | 431 ++-- .../native/juce_ios_UIViewComponentPeer.mm | 57 +- .../native/juce_linux_Windowing.cpp | 66 +- .../native/juce_mac_NSViewComponentPeer.mm | 157 +- .../native/juce_mac_PerScreenDisplayLinks.h | 304 +++ .../native/juce_win32_Windowing.cpp | 84 +- .../native/x11/juce_linux_XWindowSystem.cpp | 22 + .../juce_gui_basics/widgets/juce_ComboBox.cpp | 3 + .../juce_gui_basics/widgets/juce_ListBox.cpp | 2 +- .../juce_gui_basics/widgets/juce_Slider.cpp | 49 +- .../widgets/juce_TextEditor.cpp | 65 +- .../juce_gui_basics/widgets/juce_TextEditor.h | 17 +- .../juce_gui_basics/widgets/juce_TreeView.cpp | 29 +- .../juce_gui_basics/widgets/juce_TreeView.h | 2 +- .../windows/juce_ComponentPeer.h | 29 + .../windows/juce_MessageBoxOptions.h | 10 +- .../windows/juce_ThreadWithProgressWindow.cpp | 8 +- .../windows/juce_ThreadWithProgressWindow.h | 8 +- .../windows/juce_TopLevelWindow.cpp | 15 +- .../windows/juce_VBlankAttachement.cpp | 113 + .../windows/juce_VBlankAttachement.h | 73 + .../embedding/juce_ActiveXControlComponent.h | 5 + .../embedding/juce_NSViewComponent.h | 6 + modules/juce_gui_extra/juce_gui_extra.cpp | 8 - modules/juce_gui_extra/juce_gui_extra.h | 4 +- .../misc/juce_AnimatedAppComponent.cpp | 34 +- .../misc/juce_AnimatedAppComponent.h | 14 +- .../misc/juce_WebBrowserComponent.h | 264 +-- .../juce_android_WebBrowserComponent.cpp | 19 +- .../juce_linux_X11_WebBrowserComponent.cpp | 81 +- .../native/juce_mac_NSViewComponent.mm | 6 + .../native/juce_mac_PushNotifications.cpp | 92 +- .../native/juce_mac_WebBrowserComponent.mm | 55 +- .../native/juce_win32_ActiveXComponent.cpp | 47 + .../native/juce_win32_WebBrowserComponent.cpp | 231 +- modules/juce_opengl/juce_opengl.cpp | 18 + modules/juce_opengl/juce_opengl.h | 4 +- .../juce_opengl/native/juce_OpenGL_android.h | 155 +- modules/juce_opengl/native/juce_OpenGL_ios.h | 61 +- .../native/juce_OpenGL_linux_X11.h | 95 +- modules/juce_opengl/native/juce_OpenGL_osx.h | 93 +- .../juce_opengl/native/juce_OpenGL_win32.h | 109 +- .../juce_opengl/opengl/juce_OpenGLContext.cpp | 741 ++++--- .../juce_opengl/opengl/juce_OpenGLContext.h | 13 +- .../opengl/juce_OpenGLGraphicsContext.cpp | 28 +- modules/juce_osc/juce_osc.h | 4 +- .../juce_product_unlocking.h | 4 +- .../marketplace/juce_OnlineUnlockForm.cpp | 2 +- .../marketplace/juce_OnlineUnlockStatus.cpp | 34 +- .../marketplace/juce_OnlineUnlockStatus.h | 8 + modules/juce_video/juce_video.h | 4 +- 406 files changed, 11519 insertions(+), 7901 deletions(-) delete mode 100644 modules/juce_audio_plugin_client/AUResources.r delete mode 100644 modules/juce_audio_plugin_client/CMakeLists.txt delete mode 100644 modules/juce_audio_plugin_client/juce_audio_plugin_client_AU.r create mode 100644 modules/juce_core/native/juce_native_ThreadPriorities.h create mode 100644 modules/juce_gui_basics/native/juce_mac_PerScreenDisplayLinks.h create mode 100644 modules/juce_gui_basics/windows/juce_VBlankAttachement.cpp create mode 100644 modules/juce_gui_basics/windows/juce_VBlankAttachement.h diff --git a/BREAKING-CHANGES.txt b/BREAKING-CHANGES.txt index 000e4d36..5d8cb457 100644 --- a/BREAKING-CHANGES.txt +++ b/BREAKING-CHANGES.txt @@ -1,6 +1,232 @@ JUCE breaking changes ===================== +Version 7.0.2 +============= + +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..b10f454e 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.3 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,9 @@ 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() + install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") + install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") +endif() + diff --git a/ChangeList.txt b/ChangeList.txt index 43cd12a5..de903b0d 100644 --- a/ChangeList.txt +++ b/ChangeList.txt @@ -3,6 +3,15 @@ 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.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..bd662d25 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -849,7 +849,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 \ 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/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..54cbbcc4 100644 --- a/examples/Audio/AudioPlaybackDemo.h +++ b/examples/Audio/AudioPlaybackDemo.h @@ -325,7 +325,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..8f539503 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.3]] [[-DJUCE_APP_VERSION_HEX=0x70003]]) 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=0x70003]] [[-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.3]] [[-DJUCE_APP_VERSION_HEX=0x70003]] [[-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=0x70003]] [[-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.3]] [[-DJUCE_APP_VERSION_HEX=0x70003]] [[-DNDEBUG=1]]) else() message( FATAL_ERROR "No matching build-configuration found." ) endif() @@ -372,7 +374,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" @@ -1046,6 +1047,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" @@ -1761,6 +1763,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 +1848,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" @@ -2344,7 +2349,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" @@ -3018,6 +3022,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" @@ -3733,6 +3738,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 +3823,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" @@ -3971,14 +3979,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..359f6b00 100644 --- a/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml +++ b/examples/DemoRunner/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + @@ -16,7 +15,7 @@ - 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/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..e9567f81 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=0x70003" "-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.3" "-DJUCE_APP_VERSION_HEX=0x70003" $(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=0x70003" "-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.3" "-DJUCE_APP_VERSION_HEX=0x70003" $(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..470a7d82 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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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..4fd55db1 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.3 CFBundleVersion - 7.0.2 + 7.0.3 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..13aa9ac3 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -2456,6 +2456,9 @@ true + + true + true @@ -2848,7 +2851,6 @@ - @@ -3235,6 +3237,7 @@ + @@ -3596,6 +3599,7 @@ + @@ -3639,6 +3643,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters index 8ab0de03..08bf3a8e 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters @@ -3127,6 +3127,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3942,9 +3945,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 +5103,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6186,6 +6189,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6321,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..c612927c 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,3,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.3\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\0" END END diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj index 7bb91c62..c52380d1 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -2456,6 +2456,9 @@ true + + true + true @@ -2848,7 +2851,6 @@ - @@ -3235,6 +3237,7 @@ + @@ -3596,6 +3599,7 @@ + @@ -3639,6 +3643,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters index 453ecdeb..4f1ee801 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters @@ -3127,6 +3127,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3942,9 +3945,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 +5103,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6186,6 +6189,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6321,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..c612927c 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,3,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.3\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\0" END END diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj index 7028be67..863f6283 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -2456,6 +2456,9 @@ true + + true + true @@ -2848,7 +2851,6 @@ - @@ -3235,6 +3237,7 @@ + @@ -3596,6 +3599,7 @@ + @@ -3639,6 +3643,7 @@ + diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters index 5a417351..03330a3d 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters @@ -3127,6 +3127,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3942,9 +3945,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 +5103,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -6186,6 +6189,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -6315,6 +6321,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..c612927c 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,3,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.3\0" VALUE "ProductName", "DemoRunner\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\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..e730f99c 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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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..7f7a3e28 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.3 CFBundleVersion - 7.0.2 + 7.0.3 NSHumanReadableCopyright Copyright (c) 2020 - Raw Material Software Limited NSHighResolutionCapable diff --git a/examples/DemoRunner/DemoRunner.jucer b/examples/DemoRunner/DemoRunner.jucer index 7bb3ab6c..3345ee05 100644 --- a/examples/DemoRunner/DemoRunner.jucer +++ b/examples/DemoRunner/DemoRunner.jucer @@ -1,7 +1,7 @@ + smallIcon="YyqWd2" bigIcon="YyqWd2" cameraPermissionNeeded="1"> diff --git a/examples/DemoRunner/JuceLibraryCode/JuceHeader.h b/examples/DemoRunner/JuceLibraryCode/JuceHeader.h index 7b3ed11a..678a2081 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.3"; + const int versionNumber = 0x70003; } #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/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..89f7d1bd 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 } }; @@ -110,7 +132,10 @@ public: void writeInto (AudioBuffer& buffer) { if (loopRange.getLength() == 0) + { buffer.clear(); + return; + } const auto numChannelsToCopy = std::min (inputBuffer->getNumChannels(), buffer.getNumChannels()); @@ -140,38 +165,18 @@ private: 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 +186,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 +210,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 +375,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 +417,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 +448,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(); @@ -519,8 +536,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,6 +558,7 @@ public: { lastPreviewTime = previewTime; lastPlaybackRegion = previewedRegion; + lastPreviewDimmed = previewDimmed; previewLooper = Looper (previewBuffer.get(), *rangeInOutput); } } @@ -576,12 +598,13 @@ private: AsyncConfigurationCallback asyncConfigCallback { [this] { configure(); } }; double lastPreviewTime = 0.0; ARAPlaybackRegion* lastPlaybackRegion = nullptr; + bool lastPreviewDimmed = false; std::unique_ptr> previewBuffer; Looper previewLooper; double sampleRate = 48000.0; SharedResourcePointer timeSliceThread; - std::map> audioSourceReaders; + std::map> audioSourceReaders; std::set regionSequences; }; @@ -595,6 +618,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 +640,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 +759,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 +785,7 @@ public: ScopedNoDenormals noDenormals; auto* audioPlayHead = getPlayHead(); - playHeadState.update (audioPlayHead); + playHeadState.update (audioPlayHead->getPosition()); if (! processBlockForARA (buffer, isRealtime(), audioPlayHead)) processBlockBypassed (buffer, midiMessages); @@ -693,7 +797,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 +831,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 +1218,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 +1259,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 +1267,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 +1287,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 +1359,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 +1430,14 @@ public: createAndAddPlaybackRegionView (playbackRegion); updatePlaybackDuration(); + + timeToViewScaling.addListener (this); } ~RegionSequenceView() override { + timeToViewScaling.removeListener (this); + regionSequence.removeListener (this); for (const auto& it : playbackRegionViews) @@ -862,6 +1446,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 +1479,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 +1496,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 +1506,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 +1529,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 +1564,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->position <= quarterPosition && it != end) + ++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 +1699,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 +1753,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 +1780,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 +1861,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 +1902,39 @@ 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*) override + { + selectMusicalContext (nullptr); + } + void didReorderRegionSequencesInDocument (ARADocument*) override { invalidateRegionSequenceViews(); @@ -1203,12 +1964,35 @@ 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 no context is used yet and the selection does not yield a new one, the DocumentView + // uses the first musical context in the document. + + 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 +2004,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 +2044,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 +2085,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 +2099,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 +2145,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 +2154,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 +2190,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..e44d4969 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=0x70003]] [[-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=0x70003]] [[-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() @@ -344,7 +346,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" @@ -922,6 +923,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" @@ -1538,6 +1540,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 +1625,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" @@ -2014,7 +2019,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" @@ -2592,6 +2596,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" @@ -3208,6 +3213,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 +3298,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" @@ -3361,14 +3369,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..e11b635d 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/AudioPerformanceTest/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + @@ -13,7 +12,7 @@ - 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..d6737d55 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=0x70003" "-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=0x70003" "-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..f8e50a10 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=0x70003", "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=0x70003", "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..052ce4cf 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2167,6 +2167,9 @@ true + + true + true @@ -2449,7 +2452,6 @@ - @@ -2788,6 +2790,7 @@ + @@ -3095,6 +3098,7 @@ + @@ -3138,6 +3142,7 @@ + diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters index d8d4fa21..5fec3578 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters @@ -2701,6 +2701,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3363,9 +3366,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 +4380,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5301,6 +5304,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5430,6 +5436,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..3366c6d0 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=0x70003", "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=0x70003", "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/AudioPluginHost/Builds/Android/app/CMakeLists.txt b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt index ced17566..34879e65 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=0x70003]] [[-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=0x70003]] [[-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") @@ -377,7 +379,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" @@ -955,6 +956,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" @@ -1670,6 +1672,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 +1757,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" @@ -2202,7 +2207,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" @@ -2780,6 +2784,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" @@ -3495,6 +3500,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 +3585,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" @@ -3687,14 +3695,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..e623d1a8 100644 --- a/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/AudioPluginHost/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + @@ -15,7 +14,7 @@ - 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/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..0231f77b 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=0x70003" "-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=0x70003" "-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..df72b0ff 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=0x70003", "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=0x70003", "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..363bf73b 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2304,6 +2304,9 @@ true + + true + true @@ -2632,7 +2635,6 @@ - @@ -2971,6 +2973,7 @@ + @@ -3332,6 +3335,7 @@ + @@ -3375,6 +3379,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters index 71f69c73..3bd2b5f3 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters @@ -2911,6 +2911,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3642,9 +3645,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 +4659,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5742,6 +5745,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5877,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..a4c96d59 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2304,6 +2304,9 @@ true + + true + true @@ -2632,7 +2635,6 @@ - @@ -2971,6 +2973,7 @@ + @@ -3332,6 +3335,7 @@ + @@ -3375,6 +3379,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters index 5c056fd7..c3f40dbd 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters @@ -2911,6 +2911,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3642,9 +3645,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 +4659,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5742,6 +5745,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5877,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..cc0d648a 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2304,6 +2304,9 @@ true + + true + true @@ -2632,7 +2635,6 @@ - @@ -2971,6 +2973,7 @@ + @@ -3332,6 +3335,7 @@ + @@ -3375,6 +3379,7 @@ + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters index 46ac0640..6f2efc47 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters @@ -2911,6 +2911,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3642,9 +3645,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 +4659,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5742,6 +5745,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5871,6 +5877,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..991397e2 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=0x70003", "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=0x70003", "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..80280639 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 diff --git a/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile b/extras/BinaryBuilder/Builds/LinuxMakefile/Makefile index 58dd5d45..798fe975 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=0x70003" "-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=0x70003" "-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..7e6a1404 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=0x70003", "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=0x70003", "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..6ede8280 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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..d86ce8a9 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,22 @@ endfunction() # ================================================================================================== +function(_juce_add_lv2_manifest_helper_target) + if(TARGET juce_lv2_helper) + 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_14) + set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) + target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS}) +endfunction() + +# ================================================================================================== + function(_juce_set_plugin_target_properties shared_code_target kind) set(target_name ${shared_code_target}_${kind}) @@ -906,7 +861,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 +987,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 +1236,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..54b4156e 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.3 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..dd9a16d9 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=0x70003]] [[-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=0x70003]] [[-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() @@ -348,7 +350,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" @@ -926,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" @@ -1557,6 +1559,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 +1644,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" @@ -2098,7 +2103,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" @@ -2676,6 +2680,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" @@ -3307,6 +3312,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 +3397,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" @@ -3517,14 +3525,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..f6b609a8 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml +++ b/extras/NetworkGraphicsDemo/Builds/Android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + @@ -14,7 +13,7 @@ - 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..2222e3db 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=0x70003" "-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=0x70003" "-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..4e036e84 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=0x70003", "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=0x70003", "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..c3d567af 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2188,6 +2188,9 @@ true + + true + true @@ -2540,7 +2543,6 @@ - @@ -2879,6 +2881,7 @@ + @@ -3193,6 +3196,7 @@ + @@ -3236,6 +3240,7 @@ + diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters index 44a2998b..4364fbae 100644 --- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters +++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters @@ -2755,6 +2755,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3504,9 +3507,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 +4521,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5463,6 +5466,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5592,6 +5598,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..ae653aec 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=0x70003", "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=0x70003", "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/Projucer/Builds/LinuxMakefile/Makefile b/extras/Projucer/Builds/LinuxMakefile/Makefile index a0f93a7f..fc90aee1 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=0x70003" "-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.3" "-DJUCE_APP_VERSION_HEX=0x70003" $(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=0x70003" "-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.3" "-DJUCE_APP_VERSION_HEX=0x70003" $(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..e33f9971 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.3 CFBundleVersion - 7.0.2 + 7.0.3 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..ca542304 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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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=0x70003", "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.3", + "JUCE_APP_VERSION_HEX=0x70003", "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..8537ed39 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -1427,6 +1427,9 @@ true + + true + true @@ -1771,6 +1774,7 @@ + @@ -2085,6 +2089,7 @@ + @@ -2128,6 +2133,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 748c79a5..696ac002 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -1780,6 +1780,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2634,6 +2637,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3576,6 +3582,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3714,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..789264c7 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,3,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.3\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\0" END END diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj index ba0a4ff2..c9891796 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -1427,6 +1427,9 @@ true + + true + true @@ -1771,6 +1774,7 @@ + @@ -2085,6 +2089,7 @@ + @@ -2128,6 +2133,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters index c3b4cd56..6dc8cae7 100644 --- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters @@ -1780,6 +1780,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2634,6 +2637,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3576,6 +3582,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3714,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..789264c7 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,3,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.3\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\0" END END diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj index 6a8f866d..5b17c2ec 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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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=0x70003;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.3;JUCE_APP_VERSION_HEX=0x70003;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 @@ -1427,6 +1427,9 @@ true + + true + true @@ -1771,6 +1774,7 @@ + @@ -2085,6 +2089,7 @@ + @@ -2128,6 +2133,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters index dcac9aae..db5808cb 100644 --- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters @@ -1780,6 +1780,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -2634,6 +2637,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -3576,6 +3582,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -3705,6 +3714,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..789264c7 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,3,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.3\0" VALUE "ProductName", "Projucer\0" - VALUE "ProductVersion", "7.0.2\0" + VALUE "ProductVersion", "7.0.3\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..4ebb05cf 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.3"; + const int versionNumber = 0x70003; } #endif diff --git a/extras/Projucer/Projucer.jucer b/extras/Projucer/Projucer.jucer index d27c80ca..b268a4a1 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/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_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..d585bfe6 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -116,7 +116,7 @@ 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()), @@ -137,9 +137,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(); @@ -348,12 +348,14 @@ private: { 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 +407,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 +450,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 +538,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 +642,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 +682,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; @@ -1376,8 +1374,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 +1402,7 @@ private: } else { - auto extraFlags = compilerFlagSchemesMap[projectItem.getCompilerFlagSchemeString()].get().toString(); + auto extraFlags = getCompilerFlagsForProjectItem (projectItem); if (extraFlags.isNotEmpty()) extraCompilerFlags.add ({ file, extraFlags }); @@ -1410,7 +1410,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 +1458,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 +1642,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; } @@ -1734,7 +1734,6 @@ 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"); 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..a84cdc93 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -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) $(abspath $(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,18 +933,20 @@ 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; @@ -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..c21e817c 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp @@ -507,6 +507,14 @@ String ProjectExporter::replacePreprocessorTokens (const ProjectExporter::BuildC sourceString); } +String ProjectExporter::getCompilerFlagsForProjectItem (const Project::Item& projectItem) const +{ + if (auto buildConfigurationForFile = getBuildConfigurationWithName (projectItem.getCompilerFlagSchemeString())) + return buildConfigurationForFile->getAllCompilerFlagsString(); + + return {}; +} + void ProjectExporter::copyMainGroupFromProject() { jassert (itemGroups.size() == 0); @@ -761,14 +769,26 @@ ProjectExporter::BuildConfiguration::Ptr ProjectExporter::getConfiguration (int return createBuildConfig (getConfigurations().getChild (index)); } -bool ProjectExporter::hasConfigurationNamed (const String& nameToFind) const +std::optional ProjectExporter::getConfigurationWithName (const String& nameToFind) const { auto configs = getConfigurations(); for (int i = configs.getNumChildren(); --i >= 0;) - if (configs.getChild(i) [Ids::name].toString() == nameToFind) - return true; + { + auto config = configs.getChild (i); - return false; + if (config[Ids::name].toString() == nameToFind) + return config; + } + + return {}; +} + +ProjectExporter::BuildConfiguration::Ptr ProjectExporter::getBuildConfigurationWithName (const String& nameToFind) const +{ + if (auto config = getConfigurationWithName (nameToFind)) + return createBuildConfig (*config); + + return nullptr; } String ProjectExporter::getUniqueConfigName (String nm) const @@ -780,7 +800,7 @@ String ProjectExporter::getUniqueConfigName (String nm) const nameRoot = nameRoot.trim(); int suffix = 2; - while (hasConfigurationNamed (name)) + while (getConfigurationWithName (name).has_value()) nm = nameRoot + " " + String (suffix++); return nm; @@ -894,33 +914,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 +1016,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."); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index a29ef6d4..34d7c9a3 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; @@ -267,6 +262,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 +309,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,7 +319,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; @@ -363,6 +360,8 @@ public: int getNumConfigurations() const; BuildConfiguration::Ptr getConfiguration (int index) const; + std::optional getConfigurationWithName (const String& nameToFind) const; + BuildConfiguration::Ptr getBuildConfigurationWithName (const String& nameToFind) const; ValueTree getConfigurations() const; virtual void createDefaultConfigs(); @@ -403,6 +402,8 @@ public: return false; } + String getCompilerFlagsForProjectItem (const Project::Item& projectItem) const; + protected: //============================================================================== String name; 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..e044c6aa 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=0x70003" "-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=0x70003" "-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..299fd409 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=0x70003", "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=0x70003", "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..b3a2f0b6 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2312,6 +2312,9 @@ true + + true + true @@ -2698,7 +2701,6 @@ - @@ -3037,6 +3039,7 @@ + @@ -3398,6 +3401,7 @@ + @@ -3441,6 +3445,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters index aaaf298f..c3f821af 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -2935,6 +2935,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3732,9 +3735,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 +4749,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5832,6 +5835,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5967,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..f6788fdf 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2312,6 +2312,9 @@ true + + true + true @@ -2698,7 +2701,6 @@ - @@ -3037,6 +3039,7 @@ + @@ -3398,6 +3401,7 @@ + @@ -3441,6 +3445,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters index a60b3465..15c6a1a4 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -2935,6 +2935,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3732,9 +3735,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 +4749,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5832,6 +5835,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5967,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..7482b348 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2312,6 +2312,9 @@ true + + true + true @@ -2698,7 +2701,6 @@ - @@ -3037,6 +3039,7 @@ + @@ -3398,6 +3401,7 @@ + @@ -3441,6 +3445,7 @@ + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters index dfe10afe..e7e3721e 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -2935,6 +2935,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3732,9 +3735,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 +4749,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5832,6 +5835,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5961,6 +5967,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..851c0fad 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=0x70003;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=0x70003;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=0x70003;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=0x70003;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 @@ -2187,6 +2187,9 @@ true + + true + true @@ -2516,7 +2519,6 @@ - @@ -2855,6 +2857,7 @@ + @@ -3169,6 +3172,7 @@ + @@ -3212,6 +3216,7 @@ + diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters index 473d86c6..c7f9e9e0 100644 --- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters +++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters @@ -2752,6 +2752,9 @@ JUCE Modules\juce_gui_basics\windows + + JUCE Modules\juce_gui_basics\windows + JUCE Modules\juce_gui_basics @@ -3471,9 +3474,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 +4488,9 @@ JUCE Modules\juce_core\native + + JUCE Modules\juce_core\native + JUCE Modules\juce_core\native @@ -5430,6 +5433,9 @@ JUCE Modules\juce_gui_basics\native + + JUCE Modules\juce_gui_basics\native + JUCE Modules\juce_gui_basics\native @@ -5559,6 +5565,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..06a0b107 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.3 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.h b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h index 51907c32..21222b7f 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 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..251a4a04 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) { @@ -1177,7 +1177,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..d65a8f25 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -1430,34 +1430,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 { - #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 +1476,18 @@ 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 + ignoreUnused (fpsr); + #endif } void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (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,7 +1495,7 @@ 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); @@ -1493,7 +1504,7 @@ void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnab void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (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*/ @@ -1504,7 +1515,7 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool #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 +1523,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 +1538,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 +1552,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..cf7ae84a 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.h @@ -261,7 +261,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.h b/modules/juce_audio_basics/juce_audio_basics.h index 46d5883a..664d98e9 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.3 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 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_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/synthesisers/juce_Synthesiser.cpp b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp index c407911f..cfeb6a09 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) @@ -514,9 +525,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 +539,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 +548,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 +568,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.h b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h index 8864ffd7..086054f7 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,30 +90,17 @@ 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); + ignoreUnused (inputChannelData, numInputChannels, outputChannelData, numOutputChannels, numSamples, context); } /** Called to indicate that the device is about to start calling back. diff --git a/modules/juce_audio_devices/juce_audio_devices.h b/modules/juce_audio_devices/juce_audio_devices.h index 6695c0ac..7452a511 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.3 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..47b7fae7 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp @@ -87,7 +87,7 @@ void MidiOutput::clearAllPendingMessages() void MidiOutput::startBackgroundThread() { - startThread (9); + startThread (Priority::high); } void MidiOutput::stopBackgroundThread() 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_Oboe.cpp b/modules/juce_audio_devices/native/juce_android_Oboe.cpp index 105a182a..5bedb179 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)) { diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 12c8b338..6fa620f2 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -892,8 +892,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) { 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..c1be61a3 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, diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index b9dfa3e9..370874d3 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) + { + 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 (outputDeviceID != kAudioObjectUnknown && canSetVolume()) + if constexpr (std::is_same_v) { - Float32 newVolume = gain; - UInt32 size = sizeof (newVolume); + UInt32 size{}; - return AudioObjectSetPropertyData (outputDeviceID, &addr, 0, nullptr, size, &newVolume) == noErr; + if (auto status = AudioObjectGetPropertyDataSize (objectID, &address, 0, nullptr, &size); status != noErr) + { + onError (status); + return Result{}; + } + + 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 {}; - return muted != 0; + UInt32 size{}; + + 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 canSetVolume() const noexcept + bool isMuted() const noexcept + { + return audioObjectGetProperty (outputDeviceID, addr).value_or (0) != 0; + } + + 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"; + + if (bufferSizes.size() == 0) + return "Device has no available buffer-sizes"; - callbacksAllowed = true; - return error; + 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); + } -private: + 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; } - StringArray getInputChannelNames() override - { - StringArray names; - - for (auto* d : devices) - names.addArray (d->getInputChannelNames()); + auto getDeviceWrappers() { return std::array< DeviceWrapper*, 2> { { &inputWrapper, &outputWrapper } }; } + auto getDeviceWrappers() const { return std::array { { &inputWrapper, &outputWrapper } }; } - 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(); @@ -1485,62 +1628,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 +1649,20 @@ public: if (shouldStart) { stop(); - fifos.clear(); + fifo.clear(); + reset(); - for (auto* d : devices) - d->start(); + { + ScopedErrorForwarder forwarder (*this, newCallback); + + 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 +1676,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 +1692,15 @@ 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 }; 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,133 @@ 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); - - 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); + auto& writePos = inputWrapper.sampleTime; - 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(); - if (--numReadAttemptsRemaining == 0) - break; + writePos.compare_exchange_strong (currentWritePos, currentWritePos + static_cast (n)); - wait (jmax (1, roundToInt (waitTime))); - waitTime *= 2.0f; + if (currentWritePos == invalidSampleTime) + return; + + const auto readPos = outputWrapper.sampleTime.load(); + + // 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); + }); } - 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; + accessFifo (currentReadPos, numChannels, n, [&] (const auto& args) + { + FloatVectorOperations::copy (channels[args.channel] + args.inputPos, + fifo.getReadPointer (args.channel, args.fifoPos), + args.nItems); + }); - wait (blockSizeMs); - } + // use compare exchange here as we need to avoid the case + // where we overwrite readPos being equal to invalidSampleTime + readPos.compare_exchange_strong (currentReadPos, currentReadPos + static_cast (n)); + } + + void xrun() noexcept + { + for (auto& d : getDeviceWrappers()) + d->sampleTime.store (invalidSampleTime); + + ++xruns; } void handleAudioDeviceAboutToStart (AudioIODevice* device) @@ -1802,7 +1891,7 @@ private: currentSampleRate = newSampleRate; bool anySampleRateChanges = false; - for (auto* d : devices) + for (auto& d : getDeviceWrappers()) { if (d->getCurrentSampleRate() != currentSampleRate) { @@ -1822,215 +1911,155 @@ 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) + DeviceWrapper (AudioIODeviceCombiner& cd, std::unique_ptr d, bool shouldBeInput) : owner (cd), device (std::move (d)), - useInputs (useIns), useOutputs (useOuts) + 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) * owner.currentSampleRate * 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.fifo.clear(); } - 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 +2102,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 +2147,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 +2174,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 +2215,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 +2240,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..7e1511de 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm +++ b/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm @@ -661,11 +661,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 +695,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 +725,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 +768,7 @@ namespace CoreMidiHelpers } template - void handlePackets (const EventList& list) + void handlePackets (const EventList* list) { const auto time = Time::getMillisecondCounterHiRes() * 0.001; @@ -885,7 +885,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 +928,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..23980401 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -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..d20b6e02 100644 --- a/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp +++ b/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp @@ -430,21 +430,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 +461,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 +535,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 +629,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 +714,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 +743,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 +753,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 +779,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 +889,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 +1306,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 +1317,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 +1387,7 @@ public: shouldShutdown = false; deviceSampleRateChanged = false; - startThread (8); + startThread (Priority::high); Thread::sleep (5); if (inputDevice != nullptr && inputDevice->client != nullptr) @@ -1515,7 +1552,7 @@ public: const ScopedTryLock sl (startStopLock); if (sl.isLocked() && isStarted) - callback->audioDeviceIOCallbackWithContext (const_cast (inputBuffers), + callback->audioDeviceIOCallbackWithContext (inputBuffers, numInputBuffers, outputBuffers, numOutputBuffers, @@ -1529,7 +1566,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..586f2849 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -56,12 +56,15 @@ 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, + const AudioIODeviceCallbackContext& context) { + ignoreUnused (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..2d1ed970 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, @@ -829,7 +829,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..66783df8 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) 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..8ce23321 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) diff --git a/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp b/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp index e02ab8f7..d3b0f205 100644 --- a/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp +++ b/modules/juce_audio_formats/format/juce_ARAAudioReaders.cpp @@ -115,7 +115,7 @@ 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; @@ -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..ee4bcab3 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.3 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..9e2bc3f0 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 @@ -1139,7 +1140,7 @@ 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)); return info; } @@ -1162,18 +1163,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) @@ -2064,6 +2056,40 @@ 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; 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..1e4a4bc1 100644 --- a/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp +++ b/modules/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp @@ -23,18 +23,36 @@ ============================================================================== */ +#include +#include + #ifdef _WIN32 #include + #include HMODULE dlopen (const char* 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 ("%s", messageBuffer); + } enum { RTLD_LAZY = 0 }; #else #include + void printError() { printf ("%s\n", dlerror()); } #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. @@ -67,12 +85,18 @@ 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); + } + 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..c27d3a71 100644 --- a/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp +++ b/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp @@ -484,7 +484,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;) @@ -799,20 +799,19 @@ struct RecallFeature const auto processor = LV2PluginInstance::createProcessorInstance(); const File absolutePath { CharPointer_UTF8 { libraryPath } }; - processor->enableAllBuses(); + 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: diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 05842cc5..884f7d40 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -425,7 +425,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 +448,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 +600,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..74b5ec56 100644 --- a/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp @@ -510,9 +510,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 +541,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 +555,58 @@ 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); - static int UNITY_INTERFACE_API setFloatParameterCallback (UnityAudioEffectState* state, int index, float value) + 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; + }; + + 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 +614,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 +643,7 @@ namespace UnityCallbacks return 0; } - else if (nameStr == "Size") + else if (kindStr == StringRef ("Size")) { auto* pluginInstance = state->getEffectData(); @@ -613,87 +658,31 @@ 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) + static std::once_flag flag; + std::call_once (flag, [] { juce::PluginHostType::jucePlugInClientCurrentWrapperType = juce::AudioProcessor::wrapperType_Unity; juce::juce_createUnityPeerFn = juce::createUnityPeer; + }); - hasInitialised = true; - } - - auto* definition = new UnityAudioEffectDefinition(); - juce::declareEffect (*definition); - - *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..1cee5c00 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", @@ -1018,7 +1019,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 +1223,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 @@ -2012,7 +2013,7 @@ private: return 0; } - pointer_sized_int handleSetContentScaleFactor (float scale) + pointer_sized_int handleSetContentScaleFactor (float scale, bool force = false) { checkWhetherMessageThreadIsCorrect(); #if JUCE_LINUX || JUCE_BSD @@ -2022,7 +2023,7 @@ private: #endif #if ! JUCE_MAC - if (! approximatelyEqual (scale, editorScaleFactor)) + if (force || ! approximatelyEqual (scale, editorScaleFactor)) { editorScaleFactor = scale; @@ -2031,7 +2032,7 @@ private: } #else - ignoreUnused (scale); + ignoreUnused (scale, force); #endif return 1; 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..5e2c9749 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; } //============================================================================== @@ -1127,18 +1129,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 +1736,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 +1783,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,35 +1991,28 @@ private: return kResultFalse; } - tresult PLUGIN_API setContentScaleFactor (Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override + tresult PLUGIN_API setContentScaleFactor (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 @@ -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; @@ -3246,25 +3281,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 < numIns; ++i) + result.getChannelSet (true, i) = getChannelSetForSpeakerArrangement (inputs[i]); - for (int i = 0; i < numOuts; ++i) - requested.getChannelSet (false, i) = getChannelSetForSpeakerArrangement (outputs[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 +3401,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); + } } } } 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..c355cade 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.3 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/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_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..359c238f 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -1137,24 +1137,20 @@ public: return false; // did anything actually change - if (layoutHasChanged) - { - bool success = (AudioUnitInitialize (audioUnit) == noErr); + if (! layoutHasChanged) + return true; - // Some plug-ins require the LayoutTag to be set after initialization - if (success) - success = syncBusLayouts (layouts, true, layoutHasChanged); + // Some plug-ins require the LayoutTag to be set after initialization + const auto success = (AudioUnitInitialize (audioUnit) == noErr) + && syncBusLayouts (layouts, true, layoutHasChanged); - AudioUnitUninitialize (audioUnit); + AudioUnitUninitialize (audioUnit); - if (! success) - // make sure that the layout is back to it's original state - syncBusLayouts (getBusesLayout(), false, layoutHasChanged); - - 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 +2293,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)(); - setIfNotNull (outCurrentBeat, 0); - setIfNotNull (outCurrentTempo, 120.0); + return {}; + } + + 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 +2337,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); - - if (outTransportStateChanged != nullptr) - { - *outTransportStateChanged = result.isPlaying != wasPlaying; - wasPlaying = 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)); - setIfNotNull (outCurrentSampleInTimeLine, result.timeInSamples); - setIfNotNull (outIsCycling, result.isLooping); - setIfNotNull (outCycleStartBeat, result.ppqLoopStart); - setIfNotNull (outCycleEndBeat, result.ppqLoopEnd); - return noErr; - } - } + const auto loopPoints = getFromPlayHead (&AudioPlayHead::PositionInfo::getLoopPoints).orFallback (AudioPlayHead::LoopPoints{}); + setIfNotNull (outCycleStartBeat, loopPoints.ppqStart); + setIfNotNull (outCycleEndBeat, loopPoints.ppqEnd); - setIfNotNull (outIsPlaying, false); - setIfNotNull (outTransportStateChanged, false); - setIfNotNull (outCurrentSampleInTimeLine, 0); - setIfNotNull (outIsCycling, false); - setIfNotNull (outCycleStartBeat, 0.0); - setIfNotNull (outCycleEndBeat, 0.0); return noErr; } diff --git a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp index 9ac149d7..933bad1d 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)) {} @@ -1840,7 +1841,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 +2513,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 +2555,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); @@ -3656,8 +3663,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) {} @@ -5187,7 +5194,7 @@ class LV2PluginFormat::Pimpl public: Pimpl() { - world->loadAll(); + loadAllPluginsFromPaths (getDefaultLocationsToSearch()); const auto tempFile = lv2ResourceFolder.getFile(); @@ -5250,9 +5257,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 +5269,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 +5485,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..5d651d06 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; } diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h index 297776b3..0acdc860 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", diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index cfa7b3cf..43ec4476 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -762,9 +762,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; } @@ -2511,6 +2511,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 +2570,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 @@ -3104,6 +3097,22 @@ public: } 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; diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index fbbc1a4f..f4bf5f79 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); } //============================================================================== @@ -3110,10 +3136,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 +3179,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 +3249,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 @@ -3418,8 +3444,10 @@ AudioProcessorEditor* VSTPluginInstance::createEditor() bool VSTPluginInstance::updateSizeFromEditor (int w, 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.h b/modules/juce_audio_processors/juce_audio_processors.h index bf9b568d..2403f0da 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.3 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.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index 36e9769f..2ea13dc9 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. @@ -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_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp index ea943564..218b4ac9 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp @@ -23,23 +23,428 @@ ============================================================================== */ +// 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; + FloatType* const* audioBuffers; MidiBuffer* midiBuffers; AudioPlayHead* audioPlayHead; int numSamples; @@ -81,8 +486,8 @@ struct GraphRenderSequence { const Context context { renderingBuffer.getArrayOfWritePointers(), midiBuffers.begin(), audioPlayHead, numSamples }; - for (auto* op : renderOps) - op->perform (context); + for (const auto& op : renderOps) + op (context); } for (int i = 0; i < buffer.getNumChannels(); ++i) @@ -95,48 +500,45 @@ struct GraphRenderSequence void addClearChannelOp (int index) { - createOp ([=] (const Context& c) { FloatVectorOperations::clear (c.audioBuffers[index], c.numSamples); }); + renderOps.push_back ([=] (const Context& c) { FloatVectorOperations::clear (c.audioBuffers[index], c.numSamples); }); } void addCopyChannelOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { FloatVectorOperations::copy (c.audioBuffers[dstIndex], - c.audioBuffers[srcIndex], - c.numSamples); }); + renderOps.push_back ([=] (const Context& c) { FloatVectorOperations::copy (c.audioBuffers[dstIndex], c.audioBuffers[srcIndex], c.numSamples); }); } void addAddChannelOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { FloatVectorOperations::add (c.audioBuffers[dstIndex], - c.audioBuffers[srcIndex], - c.numSamples); }); + renderOps.push_back ([=] (const Context& c) { FloatVectorOperations::add (c.audioBuffers[dstIndex], c.audioBuffers[srcIndex], c.numSamples); }); } void addClearMidiBufferOp (int index) { - createOp ([=] (const Context& c) { c.midiBuffers[index].clear(); }); + renderOps.push_back ([=] (const Context& c) { c.midiBuffers[index].clear(); }); } void addCopyMidiBufferOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { c.midiBuffers[dstIndex] = c.midiBuffers[srcIndex]; }); + renderOps.push_back ([=] (const Context& c) { c.midiBuffers[dstIndex] = c.midiBuffers[srcIndex]; }); } void addAddMidiBufferOp (int srcIndex, int dstIndex) { - createOp ([=] (const Context& c) { c.midiBuffers[dstIndex].addEvents (c.midiBuffers[srcIndex], - 0, c.numSamples, 0); }); + renderOps.push_back ([=] (const Context& c) { c.midiBuffers[dstIndex].addEvents (c.midiBuffers[srcIndex], 0, c.numSamples, 0); }); } void addDelayChannelOp (int chan, int delaySize) { - renderOps.add (new DelayChannelOp (chan, delaySize)); + renderOps.push_back (DelayChannelOp { 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 (ProcessOp { node, audioChannelsUsed, totalNumChans, midiBuffer }); } void prepareBuffers (int blockSize) @@ -184,89 +586,59 @@ 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))); - } + std::vector> renderOps; //============================================================================== - struct DelayChannelOp : public RenderingOp + struct DelayChannelOp { DelayChannelOp (int chan, int delaySize) - : channel (chan), - bufferSize (delaySize + 1), + : buffer ((size_t) (delaySize + 1), (FloatType) 0), + channel (chan), writeIndex (delaySize) { - buffer.calloc ((size_t) bufferSize); } - void perform (const Context& c) override + void operator() (const Context& c) { auto* data = c.audioBuffers[channel]; for (int i = c.numSamples; --i >= 0;) { - buffer[writeIndex] = *data; - *data++ = buffer[readIndex]; + buffer[(size_t) writeIndex] = *data; + *data++ = buffer[(size_t) readIndex]; - if (++readIndex >= bufferSize) readIndex = 0; - if (++writeIndex >= bufferSize) writeIndex = 0; + if (++readIndex >= (int) buffer.size()) readIndex = 0; + if (++writeIndex >= (int) buffer.size()) writeIndex = 0; } } - HeapBlock buffer; - const int channel, bufferSize; + std::vector buffer; + const int channel; int readIndex = 0, writeIndex; - - JUCE_DECLARE_NON_COPYABLE (DelayChannelOp) }; //============================================================================== - struct ProcessOp : public RenderingOp + struct ProcessOp { - ProcessOp (const AudioProcessorGraph::Node::Ptr& n, + ProcessOp (const Node::Ptr& n, const Array& audioChannelsUsed, int totalNumChans, int midiBuffer) : node (n), processor (*n->getProcessor()), audioChannelsToUse (audioChannelsUsed), - totalChans (jmax (1, totalNumChans)), + audioChannels ((size_t) jmax (1, totalNumChans), nullptr), midiBufferToUse (midiBuffer) { - 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 operator() (const Context& c) { processor.setPlayHead (c.audioPlayHead); - for (int i = 0; i < totalChans; ++i) - audioChannels[i] = c.audioBuffers[audioChannelsToUse.getUnchecked (i)]; + for (size_t i = 0; i < audioChannels.size(); ++i) + audioChannels[i] = c.audioBuffers[audioChannelsToUse.getUnchecked ((int) i)]; auto numAudioChannels = [this] { @@ -274,10 +646,10 @@ 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()); @@ -287,98 +659,86 @@ private: callProcess (buffer, c.midiBuffers[midiBufferToUse]); } - 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; Array audioChannelsToUse; - HeapBlock audioChannels; + std::vector audioChannels; AudioBuffer tempBufferFloat, tempBufferDouble; - const int totalChans, midiBufferToUse; - - JUCE_DECLARE_NON_COPYABLE (ProcessOp) + const int midiBufferToUse; }; }; //============================================================================== -//============================================================================== -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 +760,6 @@ struct RenderSequenceBuilder enum { readOnlyEmptyBufferIndex = 0 }; - struct Delay - { - NodeID nodeID; - int delay; - }; - HashMap delays; int totalLatency = 0; @@ -414,32 +768,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 +798,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 +858,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 +869,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 +890,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); + + 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; - auto nodeDelay = getNodeDelay (src.nodeID); + auto nodeDelay = getNodeDelay (src.nodeID); - if (nodeDelay < maxLatency) - sequence.addDelayChannelOp (bufIndex, maxLatency - nodeDelay); + if (nodeDelay < maxLatency) + sequence.addDelayChannelOp (bufIndex, maxLatency - nodeDelay); - break; + break; + } + + ++i; } } @@ -561,7 +922,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 +930,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 +997,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 +1024,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 +1049,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 +1059,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 +1090,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 +1118,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 +1132,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 +1142,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 +1157,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 +1177,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 +1196,505 @@ struct RenderSequenceBuilder return false; } - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RenderSequenceBuilder) + template + RenderSequenceBuilder (const Nodes& n, const Connections& c, RenderSequence& sequence) + : orderedNodes (createOrderedNodeList (n, c)) + { + audioBuffers.add (AssignedBuffer::createReadOnlyEmpty()); // first buffer is read-only zeros + midiBuffers .add (AssignedBuffer::createReadOnlyEmpty()); + + for (int i = 0; i < orderedNodes.size(); ++i) + { + createRenderingOpsForNode (c, sequence, *orderedNodes.getUnchecked (i), i); + markAnyUnusedBuffersAsFree (c, audioBuffers, i); + markAnyUnusedBuffersAsFree (c, midiBuffers, i); + } + + sequence.numBuffersNeeded = audioBuffers.size(); + sequence.numMidiBuffersNeeded = midiBuffers.size(); + } }; //============================================================================== -AudioProcessorGraph::Connection::Connection (NodeAndChannel src, NodeAndChannel dst) noexcept - : source (src), destination (dst) +/* A full graph of audio processors, ready to process at a particular sample rate, block size, + and precision. + + Instances of this class will be created on the main thread, and then passed over to the audio + thread for processing. +*/ +class RenderSequence { -} +public: + using AudioGraphIOProcessor = AudioProcessorGraph::AudioGraphIOProcessor; -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) + RenderSequence (PrepareSettings s, const Nodes& n, const Connections& c) + : RenderSequence (s, + RenderSequenceBuilder::build> (n, c), + RenderSequenceBuilder::build> (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; } -} -void AudioProcessorGraph::Node::unprepare() -{ - const ScopedLock lock (processorLock); - - if (isPrepared) + void process (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) { - isPrepared = false; - processor->releaseResources(); + renderSequenceF.perform (audio, midi, playHead); } -} -void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph) const -{ - const ScopedLock lock (processorLock); - - if (auto* ioProc = dynamic_cast (processor.get())) - ioProc->setParentGraph (graph); -} + void process (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) + { + renderSequenceD.perform (audio, midi, playHead); + } -bool AudioProcessorGraph::Node::Connection::operator== (const Connection& other) const noexcept -{ - return otherNode == other.otherNode - && thisChannel == other.thisChannel - && otherChannel == other.otherChannel; -} + void processIO (AudioGraphIOProcessor& io, AudioBuffer& audio, MidiBuffer& midi) + { + processIOBlock (io, renderSequenceF, audio, midi); + } -//============================================================================== -bool AudioProcessorGraph::Node::isBypassed() const noexcept -{ - if (processor != nullptr) + void processIO (AudioGraphIOProcessor& io, AudioBuffer& audio, MidiBuffer& midi) { - if (auto* bypassParam = processor->getBypassParameter()) - return (bypassParam->getValue() != 0.0f); + processIOBlock (io, renderSequenceD, audio, midi); } - return bypassed; -} + int getLatencySamples() const { return latencySamples; } + PrepareSettings getSettings() const { return settings; } -void AudioProcessorGraph::Node::setBypassed (bool shouldBeBypassed) noexcept -{ - if (processor != nullptr) +private: + template + static void processIOBlock (AudioGraphIOProcessor& io, + SequenceType& sequence, + AudioBuffer& buffer, + MidiBuffer& midiMessages) { - if (auto* bypassParam = processor->getBypassParameter()) - bypassParam->setValueNotifyingHost (shouldBeBypassed ? 1.0f : 0.0f); - } + switch (io.getType()) + { + case AudioGraphIOProcessor::audioOutputNode: + { + auto&& currentAudioOutputBuffer = sequence.currentAudioOutputBuffer; - bypassed = shouldBeBypassed; -} + for (int i = jmin (currentAudioOutputBuffer.getNumChannels(), buffer.getNumChannels()); --i >= 0;) + currentAudioOutputBuffer.addFrom (i, 0, buffer, i, 0, buffer.getNumSamples()); -//============================================================================== -struct AudioProcessorGraph::RenderSequenceFloat : public GraphRenderSequence {}; -struct AudioProcessorGraph::RenderSequenceDouble : public GraphRenderSequence {}; + break; + } -//============================================================================== -AudioProcessorGraph::AudioProcessorGraph() -{ -} + case AudioGraphIOProcessor::audioInputNode: + { + auto* currentInputBuffer = sequence.currentAudioInputBuffer; -AudioProcessorGraph::~AudioProcessorGraph() -{ - cancelPendingUpdate(); - clearRenderingSequence(); - clear(); -} + for (int i = jmin (currentInputBuffer->getNumChannels(), buffer.getNumChannels()); --i >= 0;) + buffer.copyFrom (i, 0, *currentInputBuffer, i, 0, buffer.getNumSamples()); -const String AudioProcessorGraph::getName() const -{ - return "Audio Graph"; -} + break; + } -//============================================================================== -void AudioProcessorGraph::topologyChanged() -{ - sendChangeMessage(); + case AudioGraphIOProcessor::midiOutputNode: + sequence.currentMidiOutputBuffer.addEvents (midiMessages, 0, buffer.getNumSamples(), 0); + break; - if (isPrepared) - updateOnMessageThread (*this); -} + case AudioGraphIOProcessor::midiInputNode: + midiMessages.addEvents (*sequence.currentMidiInputBuffer, 0, buffer.getNumSamples(), 0); + break; -void AudioProcessorGraph::clear() -{ - const ScopedLock sl (getCallbackLock()); + default: + break; + } + } - if (nodes.isEmpty()) - return; + 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); - nodes.clear(); - topologyChanged(); -} + renderSequenceF.prepareBuffers (settings.blockSize); + renderSequenceD.prepareBuffers (settings.blockSize); + } -AudioProcessorGraph::Node* AudioProcessorGraph::getNodeForId (NodeID nodeID) const -{ - for (auto* n : nodes) - if (n->nodeID == nodeID) - return n; + PrepareSettings settings; + GraphRenderSequence renderSequenceF; + GraphRenderSequence renderSequenceD; + int latencySamples = 0; +}; - return {}; -} +//============================================================================== +/* Facilitates wait-free render-sequence updates. -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr newProcessor, NodeID nodeID) + 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 (newProcessor == nullptr || newProcessor.get() == this) +public: + RenderSequenceExchange() { - jassertfalse; - return {}; + startTimer (500); } - if (nodeID == NodeID()) - nodeID.uid = ++(lastNodeID.uid); - - for (auto* n : nodes) + ~RenderSequenceExchange() override { - if (n->getProcessor() == newProcessor.get() || n->nodeID == nodeID) - { - jassertfalse; // Cannot add two copies of the same processor, or duplicate node IDs! - return {}; - } + stopTimer(); } - if (lastNodeID < nodeID) - lastNodeID = nodeID; - - newProcessor->setPlayHead (getPlayHead()); - - Node::Ptr n (new Node (nodeID, std::move (newProcessor))); - + void set (std::unique_ptr&& next) { - const ScopedLock sl (getCallbackLock()); - nodes.add (n.get()); + const SpinLock::ScopedLockType lock (mutex); + mainThreadState = std::move (next); + isNew = true; } - n->setParentGraph (this); - topologyChanged(); - return n; -} - -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (NodeID nodeId) -{ - const ScopedLock sl (getCallbackLock()); - - for (int i = nodes.size(); --i >= 0;) + /** Call from the audio thread only. */ + void updateAudioThreadState() { - if (nodes.getUnchecked (i)->nodeID == nodeId) + const SpinLock::ScopedTryLockType lock (mutex); + + if (lock.isLocked() && isNew) { - disconnectNode (nodeId); - auto node = nodes.removeAndReturn (i); - topologyChanged(); - return node; + // Swap pointers rather than assigning to avoid calling delete here + std::swap (mainThreadState, audioThreadState); + isNew = false; } } - return {}; -} + /** Call from the audio thread only. */ + RenderSequence* getAudioThreadState() const { return audioThreadState.get(); } -AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (Node* node) -{ - if (node != nullptr) - return removeNode (node->nodeID); +private: + void timerCallback() override + { + const SpinLock::ScopedLockType lock (mutex); - jassertfalse; - return {}; -} + if (! isNew) + mainThreadState.reset(); + } + + SpinLock mutex; + std::unique_ptr mainThreadState, audioThreadState; + bool isNew = false; +}; //============================================================================== -void AudioProcessorGraph::getNodeConnections (Node& node, std::vector& connections) +AudioProcessorGraph::Connection::Connection (NodeAndChannel src, NodeAndChannel dst) noexcept + : source (src), destination (dst) { - 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 +bool AudioProcessorGraph::Connection::operator== (const Connection& other) const noexcept { - 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; + return source == other.source && destination == other.destination; } -bool AudioProcessorGraph::isConnected (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept +bool AudioProcessorGraph::Connection::operator!= (const Connection& c) const noexcept { - for (auto& o : source->outputs) - if (o.otherNode == dest && o.thisChannel == sourceChannel && o.otherChannel == destChannel) - return true; - - return false; + return ! operator== (c); } -bool AudioProcessorGraph::isConnected (const Connection& c) const noexcept +bool AudioProcessorGraph::Connection::operator< (const Connection& other) 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; + 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::isConnected (NodeID srcID, NodeID destID) const noexcept +//============================================================================== +class AudioProcessorGraph::Pimpl : private AsyncUpdater { - if (auto* source = getNodeForId (srcID)) - if (auto* dest = getNodeForId (destID)) - for (auto& out : source->outputs) - if (out.otherNode == dest) - return true; - - return false; -} +public: + explicit Pimpl (AudioProcessorGraph& o) : owner (&o) {} -bool AudioProcessorGraph::isAnInputTo (Node& src, Node& dst) const noexcept -{ - jassert (nodes.contains (&src)); - jassert (nodes.contains (&dst)); + ~Pimpl() override + { + cancelPendingUpdate(); + clear (UpdateKind::sync); + } - return isAnInputTo (src, dst, nodes.size()); -} + const auto& getNodes() const { return nodes.getNodes(); } -bool AudioProcessorGraph::isAnInputTo (Node& src, Node& dst, int recursionCheck) const noexcept -{ - for (auto&& i : dst.inputs) - if (i.otherNode == &src) - return true; + void clear (UpdateKind updateKind) + { + if (getNodes().isEmpty()) + return; - if (recursionCheck > 0) - for (auto&& i : dst.inputs) - if (isAnInputTo (src, *i.otherNode, recursionCheck - 1)) - return true; + nodes = Nodes{}; + connections = Connections{}; + topologyChanged (updateKind); + } - return false; -} + auto getNodeForId (NodeID nodeID) const + { + return nodes.getNodeForId (nodeID); + } -bool AudioProcessorGraph::canConnect (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept -{ - bool sourceIsMIDI = sourceChannel == midiChannelIndex; - bool destIsMIDI = destChannel == midiChannelIndex; + Node::Ptr addNode (std::unique_ptr newProcessor, + const NodeID nodeID, + UpdateKind updateKind) + { + if (newProcessor.get() == owner) + { + jassertfalse; + return nullptr; + } - if (sourceChannel < 0 - || destChannel < 0 - || source == dest - || sourceIsMIDI != destIsMIDI) - return false; + const auto idToUse = nodeID == NodeID() ? NodeID { ++(lastNodeID.uid) } : nodeID; - if (source == nullptr - || (! sourceIsMIDI && sourceChannel >= source->processor->getTotalNumOutputChannels()) - || (sourceIsMIDI && ! source->processor->producesMidi())) - return false; + auto added = nodes.addNode (std::move (newProcessor), idToUse); - if (dest == nullptr - || (! destIsMIDI && destChannel >= dest->processor->getTotalNumInputChannels()) - || (destIsMIDI && ! dest->processor->acceptsMidi())) - return false; + if (added == nullptr) + return nullptr; - return ! isConnected (source, sourceChannel, dest, destChannel); -} + if (lastNodeID < idToUse) + lastNodeID = idToUse; -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); + if (auto* ioProc = dynamic_cast (added->getProcessor())) + ioProc->setParentGraph (owner); - return false; -} + topologyChanged (updateKind); + return added; + } -bool AudioProcessorGraph::addConnection (const Connection& c) -{ - if (auto* source = getNodeForId (c.source.nodeID)) + Node::Ptr removeNode (NodeID nodeID, UpdateKind updateKind) { - if (auto* dest = getNodeForId (c.destination.nodeID)) - { - auto sourceChan = c.source.channelIndex; - auto destChan = c.destination.channelIndex; - - if (canConnect (source, sourceChan, dest, destChan)) - { - source->outputs.add ({ dest, destChan, sourceChan }); - dest->inputs.add ({ source, sourceChan, destChan }); - jassert (isConnected (c)); - topologyChanged(); - return true; - } - } + connections.disconnectNode (nodeID); + auto result = nodes.removeNode (nodeID); + topologyChanged (updateKind); + return result; } - return false; -} - -bool AudioProcessorGraph::removeConnection (const Connection& c) -{ - if (auto* source = getNodeForId (c.source.nodeID)) + std::vector getConnections() const { - if (auto* dest = getNodeForId (c.destination.nodeID)) - { - auto sourceChan = c.source.channelIndex; - auto destChan = c.destination.channelIndex; - - if (isConnected (source, sourceChan, dest, destChan)) - { - source->outputs.removeAllInstancesOf ({ dest, destChan, sourceChan }); - dest->inputs.removeAllInstancesOf ({ source, sourceChan, destChan }); - topologyChanged(); - return true; - } - } + return connections.getConnections(); } - return false; -} - -bool AudioProcessorGraph::disconnectNode (NodeID nodeID) -{ - if (auto* node = getNodeForId (nodeID)) + bool isConnected (const Connection& c) const { - std::vector connections; - getNodeConnections (*node, connections); - - if (! connections.empty()) - { - for (auto c : connections) - removeConnection (c); + return connections.isConnected (c); + } - return true; - } + bool isConnected (NodeID srcID, NodeID destID) const + { + return connections.isConnected (srcID, destID); } - return false; -} + bool isAnInputTo (const Node& src, const Node& dst) const + { + return isAnInputTo (src.nodeID, dst.nodeID); + } -bool AudioProcessorGraph::isLegal (Node* source, int sourceChannel, Node* dest, int destChannel) const noexcept -{ - return (sourceChannel == midiChannelIndex ? source->processor->producesMidi() - : isPositiveAndBelow (sourceChannel, source->processor->getTotalNumOutputChannels())) - && (destChannel == midiChannelIndex ? dest->processor->acceptsMidi() - : isPositiveAndBelow (destChannel, dest->processor->getTotalNumInputChannels())); -} + bool isAnInputTo (NodeID src, NodeID dst) const + { + return connections.isAnInputTo (src, dst); + } -bool AudioProcessorGraph::isConnectionLegal (const Connection& c) const -{ - if (auto* source = getNodeForId (c.source.nodeID)) - if (auto* dest = getNodeForId (c.destination.nodeID)) - return isLegal (source, c.source.channelIndex, dest, c.destination.channelIndex); + bool canConnect (const Connection& c) const + { + return connections.canConnect (nodes, c); + } - return false; -} + bool addConnection (const Connection& c, UpdateKind updateKind) + { + if (! connections.addConnection (nodes, c)) + return false; -bool AudioProcessorGraph::removeIllegalConnections() -{ - bool anyRemoved = false; + jassert (isConnected (c)); + topologyChanged (updateKind); + return true; + } - for (auto* node : nodes) + bool removeConnection (const Connection& c, UpdateKind updateKind) { - std::vector connections; - getNodeConnections (*node, connections); + if (! connections.removeConnection (c)) + return false; - for (auto c : connections) - if (! isConnectionLegal (c)) - anyRemoved = removeConnection (c) || anyRemoved; + topologyChanged (updateKind); + return true; } - return anyRemoved; -} + bool disconnectNode (NodeID nodeID, UpdateKind updateKind) + { + if (! connections.disconnectNode (nodeID)) + return false; -//============================================================================== -void AudioProcessorGraph::clearRenderingSequence() -{ - std::unique_ptr oldSequenceF; - std::unique_ptr oldSequenceD; + topologyChanged (updateKind); + return true; + } + bool isConnectionLegal (const Connection& c) const { - const ScopedLock sl (getCallbackLock()); - std::swap (renderSequenceFloat, oldSequenceF); - std::swap (renderSequenceDouble, oldSequenceD); + return connections.isConnectionLegal (nodes, c); } -} -bool AudioProcessorGraph::anyNodesNeedPreparing() const noexcept -{ - for (auto* node : nodes) - if (! node->isPrepared) - return true; + bool removeIllegalConnections (UpdateKind updateKind) + { + const auto result = connections.removeIllegalConnections (nodes); + topologyChanged (updateKind); + return result; + } - return false; -} + //============================================================================== + void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) + { + owner->setRateAndBufferSizeDetails (sampleRate, estimatedSamplesPerBlock); -void AudioProcessorGraph::buildRenderingSequence() -{ - auto newSequenceF = std::make_unique(); - auto newSequenceD = std::make_unique(); + PrepareSettings settings; + settings.precision = owner->getProcessingPrecision(); + settings.sampleRate = sampleRate; + settings.blockSize = estimatedSamplesPerBlock; - RenderSequenceBuilder builderF (*this, *newSequenceF); - RenderSequenceBuilder builderD (*this, *newSequenceD); + nodeStates.setState (settings); - const ScopedLock sl (getCallbackLock()); + topologyChanged (UpdateKind::sync); + } - const auto currentBlockSize = getBlockSize(); - newSequenceF->prepareBuffers (currentBlockSize); - newSequenceD->prepareBuffers (currentBlockSize); + void releaseResources() + { + nodeStates.setState (nullopt); + topologyChanged (UpdateKind::sync); + } - if (anyNodesNeedPreparing()) + void reset() { - renderSequenceFloat.reset(); - renderSequenceDouble.reset(); + for (auto* n : getNodes()) + n->getProcessor()->reset(); + } - for (auto* node : nodes) - node->prepare (getSampleRate(), currentBlockSize, this, getProcessingPrecision()); + void setNonRealtime (bool isProcessingNonRealtime) + { + for (auto* n : getNodes()) + n->getProcessor()->setNonRealtime (isProcessingNonRealtime); } - isPrepared = 1; + template + void processBlock (AudioBuffer& audio, MidiBuffer& midi, AudioPlayHead* playHead) + { + renderSequenceExchange.updateAudioThreadState(); - std::swap (renderSequenceFloat, newSequenceF); - std::swap (renderSequenceDouble, newSequenceD); -} + if (renderSequenceExchange.getAudioThreadState() == nullptr && MessageManager::getInstance()->isThisTheMessageThread()) + handleAsyncUpdate(); -void AudioProcessorGraph::handleAsyncUpdate() -{ - buildRenderingSequence(); -} + if (owner->isNonRealtime()) + { + while (renderSequenceExchange.getAudioThreadState() == nullptr) + { + Thread::sleep (1); + renderSequenceExchange.updateAudioThreadState(); + } + } -//============================================================================== -void AudioProcessorGraph::prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) -{ - { - const ScopedLock sl (getCallbackLock()); - setRateAndBufferSizeDetails (sampleRate, estimatedSamplesPerBlock); + auto* state = renderSequenceExchange.getAudioThreadState(); - const auto newPrepareSettings = [&] + // Only process if the graph has the correct blockSize, sampleRate etc. + if (state != nullptr && state->getSettings() == nodeStates.getLastRequestedSettings()) { - PrepareSettings settings; - settings.precision = getProcessingPrecision(); - settings.sampleRate = sampleRate; - settings.blockSize = estimatedSamplesPerBlock; - settings.valid = true; - return settings; - }(); - - if (prepareSettings != newPrepareSettings) + state->process (audio, midi, playHead); + } + else { - unprepare(); - prepareSettings = newPrepareSettings; + audio.clear(); + midi.clear(); } } - clearRenderingSequence(); - - updateOnMessageThread (*this); -} - -bool AudioProcessorGraph::supportsDoublePrecisionProcessing() const -{ - return true; -} - -void AudioProcessorGraph::unprepare() -{ - prepareSettings.valid = false; - - isPrepared = 0; - - for (auto* n : nodes) - n->unprepare(); -} - -void AudioProcessorGraph::releaseResources() -{ - const ScopedLock sl (getCallbackLock()); - - cancelPendingUpdate(); - - unprepare(); - - if (renderSequenceFloat != nullptr) - renderSequenceFloat->releaseBuffers(); + /* Call from the audio thread only. */ + auto* getAudioThreadState() const { return renderSequenceExchange.getAudioThreadState(); } - if (renderSequenceDouble != nullptr) - renderSequenceDouble->releaseBuffers(); -} - -void AudioProcessorGraph::reset() -{ - const ScopedLock sl (getCallbackLock()); +private: + void topologyChanged (UpdateKind updateKind) + { + owner->sendChangeMessage(); - for (auto* n : nodes) - n->getProcessor()->reset(); -} + if (updateKind == UpdateKind::sync && MessageManager::getInstance()->isThisTheMessageThread()) + handleAsyncUpdate(); + else + triggerAsyncUpdate(); + } -void AudioProcessorGraph::setNonRealtime (bool isProcessingNonRealtime) noexcept -{ - const ScopedLock sl (getCallbackLock()); + void handleAsyncUpdate() override + { + if (const auto newSettings = nodeStates.applySettings (nodes)) + { + auto sequence = std::make_unique (*newSettings, nodes, connections); + owner->setLatencySamples (sequence->getLatencySamples()); + renderSequenceExchange.set (std::move (sequence)); + } + else + { + renderSequenceExchange.set (nullptr); + } + } - AudioProcessor::setNonRealtime (isProcessingNonRealtime); + AudioProcessorGraph* owner = nullptr; + Nodes nodes; + Connections connections; + NodeStates nodeStates; + RenderSequenceExchange renderSequenceExchange; + NodeID lastNodeID; +}; - for (auto* n : nodes) - n->getProcessor()->setNonRealtime (isProcessingNonRealtime); -} +//============================================================================== +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) {} -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); - - const ScopedLock sl (graph.getCallbackLock()); - - if (renderSequence != nullptr) - renderSequence->perform (buffer, midiMessages, graph.getPlayHead()); - } - else - { - const ScopedLock sl (graph.getCallbackLock()); - - if (isPrepared) - { - if (renderSequence != nullptr) - renderSequence->perform (buffer, midiMessages, graph.getPlayHead()); - } - else - { - buffer.clear(); - midiMessages.clear(); - } - } +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 +1703,7 @@ AudioProcessorGraph::AudioGraphIOProcessor::AudioGraphIOProcessor (const IODevic { } -AudioProcessorGraph::AudioGraphIOProcessor::~AudioGraphIOProcessor() -{ -} +AudioProcessorGraph::AudioGraphIOProcessor::~AudioGraphIOProcessor() = default; const String AudioProcessorGraph::AudioGraphIOProcessor::getName() const { @@ -1499,55 +1755,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 +1817,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/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_ARAPlugInInstanceRoles.h b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h index e23aeded..4306d922 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h @@ -204,7 +204,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. @@ -244,7 +244,7 @@ public: /** Called when the editor view's selection changes. @param viewSelection The current selection state */ - virtual void onNewSelection (const ARA::PlugIn::ViewSelection& viewSelection) + virtual void onNewSelection (const ARAViewSelection& viewSelection) { ignoreUnused (viewSelection); } 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..0b90483f 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; @@ -498,7 +498,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 +515,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_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_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_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/juce_audio_utils.h b/modules/juce_audio_utils/juce_audio_utils.h index 6d0c1a72..d9f41d7a 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.3 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..381c98fc 100644 --- a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm +++ b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm @@ -178,7 +178,7 @@ void AudioCDReader::refreshTrackLengths() } } -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..3b6bf308 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.3 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..d80046b0 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) 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..af0d1be3 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,99 +443,99 @@ 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)); + } } //============================================================================== @@ -569,19 +554,17 @@ private: } //============================================================================== - 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_Optional.h b/modules/juce_core/containers/juce_Optional.h index 6e2333ce..63bcbd9f 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; } + 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/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/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..1920c0d4 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.3 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_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_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..05eaca51 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 (fn != nullptr) - fn (std::forward (args)...); + if constexpr (detail::equalityComparableToNullptr) + { + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Waddress") - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - } + if (fn != nullptr) + fn (std::forward (args)...); - 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,41 @@ 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; + } // namespace juce 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_JNIHelpers.cpp b/modules/juce_core/native/juce_android_JNIHelpers.cpp index 972c6e1d..eb2c3838 100644 --- a/modules/juce_core/native/juce_android_JNIHelpers.cpp +++ b/modules/juce_core/native/juce_android_JNIHelpers.cpp @@ -650,8 +650,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 +668,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_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..e69b3bd9 100644 --- a/modules/juce_core/native/juce_android_Threads.cpp +++ b/modules/juce_core/native/juce_android_Threads.cpp @@ -344,36 +344,79 @@ 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) +#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 + +#if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE +pthread_t juce_createRealtimeAudioThread (void* (*entry) (void*), void* userPtr); +#endif + +extern JavaVM* androidJNIJavaVM; + +bool Thread::createNativeThread (Priority) { - // TODO + if (isRealtime()) + { + #if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE + threadHandle = (void*) juce_createRealtimeAudioThread (threadEntryProc, this); + threadId = (ThreadID) threadHandle.get(); + return threadId != nullptr; + #else + jassertfalse; + #endif + } - struct sched_param param; - int policy, maxp, minp; + PosixThreadAttribute attr { threadStackSize }; + threadId = threadHandle = makeThreadHandle (attr, this, [] (void* userData) -> void* + { + auto* myself = static_cast (userData); - const int p = (int) prior; + juce_threadEntryPoint (myself); - if (p <= 1) - policy = SCHED_OTHER; - else - policy = SCHED_RR; + if (androidJNIJavaVM != nullptr) + { + void* env = nullptr; + androidJNIJavaVM->GetEnv (&env, JNI_VERSION_1_2); - minp = sched_get_priority_min (policy); - maxp = sched_get_priority_max (policy); + // only detach if we have actually been attached + if (env != nullptr) + androidJNIJavaVM->DetachCurrentThread(); + } - 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); + return nullptr; + }); - 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) +{ + jassert (Thread::getCurrentThreadId() == getThreadId()); + + if (isRealtime()) + return false; + + return setpriority (PRIO_PROCESS, (id_t) gettid(), ThreadPriorities::getNativePriority (priority)) == 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_ObjCHelpers.h b/modules/juce_core/native/juce_mac_ObjCHelpers.h index 8995472d..ac67c4d7 100644 --- a/modules/juce_core/native/juce_mac_ObjCHelpers.h +++ b/modules/juce_core/native/juce_mac_ObjCHelpers.h @@ -492,13 +492,31 @@ Class* getJuceClassFromNSObject (NSObject* obj) return obj != nullptr ? getIvar (obj, "cppObject") : nullptr; } -template -ReturnT (^CreateObjCBlock(Class* object, ReturnT (Class::*fn)(Params...))) (Params...) +namespace detail +{ +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{}; } + +template +auto createObjCBlockImpl (Class* object, Fn func, Signature) { - __block Class* _this = object; - __block ReturnT (Class::*_fn)(Params...) = fn; + __block auto _this = object; + __block auto _func = func; - return [[^ReturnT (Params... params) { return (_this->*_fn) (params...); } copy] autorelease]; + 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 diff --git a/modules/juce_core/native/juce_mac_SystemStats.mm b/modules/juce_core/native/juce_mac_SystemStats.mm index 077cce68..32c02312 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 } @@ -351,4 +352,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_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 66ff9669..dee843cb 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -851,98 +851,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 +996,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(); @@ -1262,145 +1260,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_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 2fa3befb..64b03b62 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 @@ -441,11 +493,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 +523,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 +660,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..478978cb 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,31 +64,72 @@ 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 } } @@ -129,23 +169,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 +240,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 +550,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_URL.cpp b/modules/juce_core/network/juce_URL.cpp index ce9c5030..f2133077 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 {}; } @@ -861,6 +882,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/streams/juce_MemoryOutputStream.cpp b/modules/juce_core/streams/juce_MemoryOutputStream.cpp index e43b8465..2ca69dc6 100644 --- a/modules/juce_core/streams/juce_MemoryOutputStream.cpp +++ b/modules/juce_core/streams/juce_MemoryOutputStream.cpp @@ -172,7 +172,7 @@ 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) { @@ -180,7 +180,7 @@ int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNu maxNumBytesToWrite = availableData; if (blockToUse != nullptr) - preallocate (blockToUse->getSize() + (size_t) maxNumBytesToWrite); + preallocate (position + (size_t) availableData); } 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..8b466006 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 3 /** Current JUCE version number. @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -63,15 +64,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/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..e0f00e24 100644 --- a/modules/juce_core/threads/juce_HighResolutionTimer.cpp +++ b/modules/juce_core/threads/juce_HighResolutionTimer.cpp @@ -23,13 +23,96 @@ namespace juce { -HighResolutionTimer::HighResolutionTimer() : pimpl (new Pimpl (*this)) {} -HighResolutionTimer::~HighResolutionTimer() { stopTimer(); } +class HighResolutionTimer::Pimpl : private 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); + } + + 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 }; + + if (waitEvent.wait_until (lk, nextTickTime, [this] { return periodMillis == 0; })) + break; -void HighResolutionTimer::startTimer (int periodMs) { pimpl->start (jmax (1, periodMs)); } -void HighResolutionTimer::stopTimer() { pimpl->stop(); } + 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..2c970bd2 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) { } @@ -81,12 +81,18 @@ void Thread::threadEntryPoint() const CurrentThreadHolder::Ptr currentThreadHolder (getCurrentThreadHolder()); currentThreadHolder->value = this; + #if JUCE_ANDROID + setPriority (priority); + #endif + 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 +125,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 satsify + // later queries, otherwise we get inconsistent results across + // platforms. + #if 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 +193,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 +278,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 +288,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 +302,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 +315,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) +{ + return launch (Priority::normal, std::move (functionToRun)); +} + +bool Thread::launch (Priority priority, std::function functionToRun) { - auto anon = new LambdaThread (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 +354,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..37fd6bf5 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/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/juce_cryptography.h b/modules/juce_cryptography/juce_cryptography.h index 77fa22af..cfce3db6 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.3 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.h b/modules/juce_data_structures/juce_data_structures.h index 3ed772b8..cb4f8b9f 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.3 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_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..234c4aa9 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)...); } @@ -102,16 +102,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 +149,7 @@ public: } /** Converting constructor from smaller FixedSizeFunctions. */ - template ::type = 0> + template = 0> FixedSizeFunction (FixedSizeFunction&& other) noexcept : vtable (other.vtable) { @@ -172,7 +172,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_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..f4d2591b 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.3 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 @@ -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..1a988592 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.3 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/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/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/juce_graphics.h b/modules/juce_graphics/juce_graphics.h index d10c3cee..187e2002 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.3 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_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..3ed50b82 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,51 +120,19 @@ 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()) + auto* parent = checker.nearestNonNullParent(); + + if (parent == nullptr) return; - if (auto* list = comp.mouseListeners.get()) + if (auto* list = parent->mouseListeners.get()) { for (int i = list->listeners.size(); --i >= 0;) { - (list->listeners.getUnchecked(i)->*eventMethod) (params...); + (list->listeners.getUnchecked (i)->*eventMethod) (checker.eventWithNearestParent(), params...); if (checker.shouldBailOut()) return; @@ -128,19 +141,22 @@ public: } } - for (Component* p = comp.parentComponent; p != nullptr; p = p->parentComponent) + for (Component* p = checker.nearestNonNullParent()->parentComponent; p != nullptr; p = p->parentComponent) { if (auto* list = p->mouseListeners.get()) { if (list->numDeepMouseListeners > 0) { - BailOutChecker2 checker2 (checker, p); + const auto shouldBailOut = [&checker, safePointer = WeakReference { p }] + { + return checker.shouldBailOut() || safePointer == nullptr; + }; for (int i = list->numDeepMouseListeners; --i >= 0;) { - (list->listeners.getUnchecked(i)->*eventMethod) (params...); + (list->listeners.getUnchecked(i)->*eventMethod) (checker.eventWithNearestParent(), params...); - if (checker2.shouldBailOut()) + if (shouldBailOut()) return; i = jmin (i, list->numDeepMouseListeners); @@ -154,25 +170,6 @@ 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 +1766,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 +1775,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 +2419,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 +2429,8 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati time, 0, false); + + HierarchyChecker checker (this, me); mouseEnter (me); flags.cachedMouseInsideComponent = true; @@ -2433,8 +2439,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 +2456,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 +2467,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 +2507,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 +2536,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 +2551,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 +2561,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 +2583,13 @@ void Component::internalMouseUp (MouseInputSource source, const PointerState& re // check for double-click if (me.getNumberOfClicks() >= 2) { - mouseDoubleClick (me); + 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 +2597,6 @@ void Component::internalMouseDrag (MouseInputSource source, const PointerState& { if (! isCurrentlyBlockedByAnotherModalComponent()) { - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, relativePointerState, source.getCurrentModifiers(), @@ -2614,14 +2607,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 +2631,6 @@ void Component::internalMouseMove (MouseInputSource source, Point relativ } else { - BailOutChecker checker (this); - const auto me = makeMouseEvent (source, PointerState().withPosition (relativePos), source.getCurrentModifiers(), @@ -2648,14 +2641,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 +2658,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 +2670,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 +2684,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 +2695,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 +2707,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 +2721,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/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_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..15593e6c 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); } 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..4ba17166 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" diff --git a/modules/juce_gui_basics/juce_gui_basics.h b/modules/juce_gui_basics/juce_gui_basics.h index ff32e26f..843a3d81 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.3 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/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/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/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/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..48ae16e2 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 @@ -35,6 +35,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.os.Bundle; import android.text.InputType; +import android.view.Choreographer; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@ -53,7 +54,7 @@ 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) { @@ -111,6 +112,8 @@ public final class ComponentPeerView extends ViewGroup { } } + + Choreographer.getInstance().postFrameCallback (this); } public void clear () @@ -130,6 +133,19 @@ public final class ComponentPeerView extends ViewGroup handlePaint (host, canvas, paint); } + private native void handleDoFrame (long host, long frameTimeNanos); + + @Override + public void doFrame (long frameTimeNanos) + { + if (host == 0) + return; + + handleDoFrame (host, frameTimeNanos); + + Choreographer.getInstance().postFrameCallback (this); + } + @Override public boolean isOpaque () { 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..e3ade3c6 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -28,101 +28,106 @@ 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 }; +{ 31,139,8,8,136,16,72,99,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,220,85,149,199,207,253,255,255,51,147,76,38,201,100,242,108,155,180,147,52,208,36,52,201,36,233,35,33,45,180,77,90,154,52,109,98,51,13,52, + 97,23,38,201,36,153,118,242,159,233,204,36,77,4,165,101,89,169,110,113,1,43,139,80,21,177,160,235,11,84,240,193,178,187,40,42,174,136,128,143,69,87,101,169,139,90,21,92,20,20,151,5,187,191,115,239,157,201,164,15,89,119,147,207,119,206,185,231,62,254, + 247,113,238,185,247,159,199,120,120,206,29,104,91,75,23,61,245,207,167,202,99,239,248,192,190,187,191,252,216,84,255,10,199,175,90,191,95,180,235,111,191,112,251,209,245,68,113,34,154,27,90,227,35,253,245,240,58,162,181,66,217,59,65,183,131,104,27,100, + 192,73,180,156,203,230,18,93,15,57,229,38,114,112,186,128,40,85,71,84,81,72,244,53,20,248,58,120,28,124,27,124,15,252,24,156,4,191,1,111,128,194,21,68,171,64,19,104,1,107,193,70,176,9,116,131,237,96,7,232,7,54,184,17,188,11,188,27,220,10,110,3,119,130, + 187,192,61,224,31,193,203,160,192,79,84,15,186,193,56,184,1,220,7,254,5,252,4,188,10,242,171,137,58,192,229,32,14,142,130,207,131,111,130,159,129,229,53,68,151,130,4,184,23,60,11,10,86,162,143,32,4,110,6,79,131,37,181,68,65,112,16,188,31,124,9,156,4, + 214,5,68,43,193,70,48,0,82,224,14,112,31,248,54,248,25,112,92,136,250,96,59,24,7,215,128,163,224,3,224,4,248,12,120,16,60,10,158,6,223,3,63,2,207,129,83,224,215,224,119,224,53,64,171,208,30,200,5,5,160,24,84,128,229,160,6,52,128,70,208,10,218,193,70, + 208,13,122,193,46,48,8,70,192,40,152,0,251,192,219,193,123,192,7,193,199,193,231,193,163,224,73,240,67,240,115,240,50,56,13,60,88,247,101,160,5,116,128,109,96,0,236,7,179,96,30,28,5,199,192,113,112,2,124,18,60,0,190,4,190,5,158,5,191,7,142,122,140,1, + 148,130,86,208,14,54,131,110,176,3,76,131,57,112,29,184,9,220,1,62,6,30,3,63,5,47,1,209,128,241,131,85,160,5,108,4,59,192,16,216,15,230,192,77,224,78,112,47,248,60,248,42,248,22,120,6,60,15,126,15,156,23,97,92,160,1,92,12,174,0,127,9,198,193,36,56,12, + 110,5,39,192,231,192,87,193,119,193,73,240,42,200,89,141,53,6,117,96,45,232,5,65,48,13,14,130,183,129,67,224,40,184,5,220,13,62,13,190,12,158,0,63,4,63,5,47,130,255,2,102,35,214,20,212,131,86,176,3,12,131,16,136,131,89,240,118,240,14,240,78,240,183,224, + 118,112,55,184,31,124,1,252,19,248,10,120,6,188,0,254,8,138,154,176,15,193,102,16,4,211,96,6,220,0,142,129,187,193,39,193,195,224,171,224,73,240,44,120,1,188,2,222,0,174,102,172,27,88,10,234,65,0,244,131,81,16,6,54,184,21,220,9,238,1,143,130,111,128, + 39,193,191,131,23,129,51,64,84,6,106,193,37,96,15,72,128,235,192,187,193,29,224,99,224,11,224,49,240,12,248,25,160,22,212,5,30,80,2,42,65,13,88,5,26,193,122,112,49,216,12,122,193,0,8,129,40,120,59,184,9,188,15,28,7,31,4,31,6,31,1,31,7,247,129,207,130, + 60,60,6,33,142,138,64,37,168,34,21,7,17,114,8,33,133,16,54,8,97,130,16,22,8,33,128,176,197,73,111,77,130,91,19,220,146,224,82,4,183,32,44,37,97,218,9,211,70,205,28,83,213,16,168,21,180,129,53,96,45,64,8,38,132,102,106,7,29,224,98,29,139,55,128,141,224, + 18,112,41,216,4,54,131,45,160,139,99,53,216,74,42,94,95,6,182,131,30,208,11,118,128,62,176,11,188,5,140,3,27,196,72,197,250,3,164,198,154,254,242,104,233,173,82,227,23,233,180,214,217,206,115,98,104,187,79,235,21,176,151,66,58,181,189,2,228,240,92,105, + 123,129,182,151,234,182,210,122,73,150,94,174,245,50,176,68,63,107,137,214,235,116,59,75,179,218,231,53,9,84,41,157,215,162,93,151,169,207,106,103,181,110,167,92,235,155,170,84,27,172,111,135,190,76,175,203,128,110,135,245,43,116,59,1,221,14,151,225, + 181,186,90,247,135,215,107,170,74,205,231,90,93,38,168,117,126,214,30,173,199,161,15,105,157,159,123,185,214,175,133,126,133,214,143,66,223,171,245,219,161,15,107,253,4,244,17,173,127,2,250,149,90,255,2,244,191,208,250,35,208,175,210,250,215,179,236, + 79,101,233,223,135,30,210,250,115,89,246,23,178,244,87,178,244,215,179,218,180,150,47,216,61,89,122,9,244,171,181,94,153,101,127,189,114,65,231,181,248,75,173,111,207,106,179,54,171,60,207,243,168,214,87,195,62,166,245,53,89,101,186,179,244,190,229,202, + 127,215,233,57,15,107,61,8,251,132,214,175,204,210,167,160,79,106,61,5,125,74,235,215,66,143,104,253,8,244,253,90,63,6,125,159,214,143,103,217,217,247,162,90,63,1,251,180,214,31,200,42,255,200,114,222,59,130,254,154,148,172,22,28,55,234,232,58,82,242, + 235,82,10,122,92,203,39,180,252,150,150,79,106,249,148,46,255,67,226,88,83,67,203,133,146,171,4,199,157,117,244,111,196,178,154,86,8,142,65,42,191,90,231,87,35,167,65,240,94,168,160,183,17,75,131,254,69,202,106,250,129,148,43,232,121,41,215,209,107,82, + 230,209,27,196,49,44,32,247,45,75,151,148,235,200,173,211,249,82,10,218,173,211,131,188,86,216,97,253,196,247,192,11,201,33,120,207,59,233,46,98,89,70,247,67,230,98,135,89,82,174,39,55,242,221,136,132,156,206,211,246,60,60,37,79,240,60,169,180,23,37, + 63,34,101,35,25,130,227,139,65,31,32,150,229,244,33,82,233,191,215,242,211,196,49,71,229,179,252,160,148,22,157,208,233,143,75,105,210,39,72,197,166,79,106,249,41,41,5,125,78,203,207,179,31,163,252,61,82,94,68,15,18,239,249,85,178,63,165,136,182,175, + 72,185,129,126,39,101,37,253,129,56,134,4,232,176,150,57,130,227,69,7,253,43,113,76,200,167,159,74,137,241,8,142,47,106,92,203,16,237,89,46,71,196,126,76,202,213,84,32,88,110,161,10,185,174,109,50,127,5,102,226,22,41,151,208,109,58,253,119,82,118,210, + 105,185,222,45,178,156,31,237,254,150,120,157,85,189,106,216,19,90,38,165,244,82,74,202,165,180,68,40,185,84,250,67,157,44,95,131,21,155,145,178,149,102,165,236,166,131,82,150,208,156,150,243,82,118,209,91,165,92,74,55,104,249,78,41,47,166,119,75,89, + 69,239,145,114,37,189,79,202,98,58,46,101,1,189,95,74,39,125,88,251,223,61,58,255,94,41,219,233,163,82,186,233,62,237,127,159,209,229,62,43,101,14,61,32,165,90,15,120,55,125,81,63,239,33,45,255,65,203,135,181,95,255,163,148,126,250,39,237,223,255,172, + 243,31,209,245,191,164,229,151,181,124,84,202,26,250,138,148,151,208,87,165,236,160,239,105,249,140,148,23,208,41,41,107,233,23,90,254,82,203,95,233,252,23,116,250,69,45,127,45,101,33,253,167,148,245,244,146,148,205,244,27,41,55,211,203,82,42,191,170, + 209,126,197,233,223,235,253,248,170,148,202,207,184,252,127,73,121,41,9,185,126,107,201,163,101,190,148,77,228,149,114,25,249,164,92,67,197,58,93,162,203,149,106,89,166,243,203,133,154,151,58,193,251,88,249,103,61,60,248,99,82,110,165,239,202,125,109, + 208,183,165,244,209,133,130,207,66,85,174,9,59,239,110,226,243,208,164,119,73,105,208,179,196,103,98,41,125,135,248,14,179,84,251,177,58,219,211,103,52,94,25,233,1,156,9,87,235,67,210,175,237,124,198,242,89,193,249,223,132,188,78,231,87,235,250,77,89, + 245,127,132,252,91,117,62,159,241,69,164,206,102,171,74,229,191,128,252,135,116,254,74,157,159,174,159,163,229,189,8,208,187,215,170,123,202,27,56,188,173,181,234,46,83,160,109,43,33,27,128,169,243,215,64,191,68,151,185,76,218,77,169,127,174,69,181,57, + 34,220,20,247,242,211,70,140,60,248,124,14,90,225,119,226,47,181,168,187,159,79,4,71,221,116,192,187,14,246,60,163,12,83,211,98,24,86,135,97,145,203,91,68,193,209,60,58,224,175,198,206,245,16,151,11,142,169,178,38,229,89,7,6,218,105,203,140,219,232,48, + 94,60,109,123,121,188,46,111,221,207,45,253,252,103,90,212,253,170,6,51,30,247,30,150,163,229,103,115,191,79,182,168,51,242,124,207,54,169,72,248,124,109,171,150,156,253,204,64,7,109,113,120,176,55,95,194,51,121,223,187,133,237,175,71,44,247,136,186, + 159,157,93,250,98,89,186,238,23,28,199,45,217,159,87,91,212,221,56,24,87,229,56,167,204,144,119,92,163,3,101,124,216,23,193,3,238,236,124,67,220,32,222,235,186,247,160,179,19,35,115,83,221,75,38,250,203,99,180,90,213,186,142,248,242,49,198,107,97,243, + 209,149,94,143,188,63,230,32,197,99,205,111,85,247,164,98,103,9,213,24,30,148,227,89,8,38,243,41,216,86,64,182,247,50,148,242,136,14,177,97,193,230,223,1,239,88,40,209,141,18,110,115,55,46,238,187,47,16,244,233,224,45,100,90,107,175,94,74,123,146,152, + 7,179,140,124,230,149,208,210,229,131,169,124,244,187,21,35,241,88,220,127,75,206,195,122,234,114,112,249,14,211,69,235,175,118,144,175,152,235,240,179,150,192,147,109,111,5,143,236,140,103,212,125,139,215,146,125,174,29,99,40,148,227,44,208,227,228, + 40,22,247,55,98,7,140,120,65,113,161,190,127,11,57,47,219,81,158,247,88,220,203,111,12,5,25,251,64,198,190,70,218,13,125,99,191,162,85,249,115,208,91,40,247,4,123,16,63,247,234,86,117,199,15,250,11,209,71,126,83,192,56,171,189,232,245,114,60,185,32,83, + 110,242,188,229,86,200,114,5,240,120,30,137,141,114,28,51,124,46,95,89,220,191,20,231,116,141,149,135,222,56,209,171,145,99,101,72,85,83,28,47,135,199,114,71,142,21,35,181,2,169,58,153,42,65,187,93,88,107,143,181,212,113,45,218,197,10,66,95,97,85,160, + 94,17,85,90,14,216,230,113,174,187,173,118,107,156,86,184,57,141,119,66,26,62,238,131,150,194,73,117,229,157,165,208,166,113,151,179,253,182,252,140,225,60,170,65,155,113,47,143,189,216,42,161,149,155,215,35,150,241,109,219,246,91,232,121,144,251,228, + 192,254,245,59,136,91,116,225,169,62,211,246,190,77,247,164,80,248,46,92,57,209,129,241,140,230,84,209,206,28,167,203,87,94,153,147,39,53,59,48,71,65,167,199,108,55,75,200,103,248,106,87,118,95,76,62,199,1,239,53,152,7,143,115,167,211,114,248,74,125, + 82,218,129,67,244,30,235,128,244,100,143,101,251,221,116,140,61,195,203,190,206,99,84,99,57,70,117,119,228,91,117,47,130,95,129,95,128,239,128,167,225,40,153,247,34,245,117,232,82,250,179,210,103,126,169,124,190,131,151,97,111,242,30,247,242,58,155,23, + 221,37,26,62,32,90,142,11,163,249,132,104,188,91,144,142,52,68,63,214,254,51,232,247,201,152,108,201,40,72,244,124,218,223,2,131,84,109,22,96,255,59,100,236,123,177,85,253,92,48,190,39,74,213,93,110,233,219,233,58,175,165,243,2,91,81,199,35,253,49,157, + 103,182,165,243,54,103,242,92,242,70,137,153,211,121,179,206,43,100,148,224,54,29,58,6,44,107,83,251,103,112,147,47,43,214,152,152,101,182,196,3,253,184,137,213,189,182,48,158,149,186,45,126,39,28,198,152,10,116,31,248,171,190,77,157,3,62,236,149,28, + 216,184,92,91,155,42,59,56,112,86,251,176,196,47,31,32,71,72,175,47,241,250,14,80,221,203,233,189,119,73,91,122,239,149,232,119,101,101,239,214,246,61,222,82,217,119,67,239,225,222,54,146,247,109,219,219,35,199,41,99,38,250,226,163,186,63,154,186,143, + 3,109,250,204,146,245,212,219,247,112,150,205,169,207,129,209,55,153,151,157,122,94,210,229,163,111,82,126,87,102,30,85,63,102,207,209,143,67,231,176,29,201,178,89,250,89,55,183,169,51,222,39,248,134,48,18,48,72,73,147,246,182,32,126,190,180,55,224,162, + 189,1,167,182,230,98,15,192,11,188,123,3,22,242,115,228,237,38,30,168,37,191,40,210,227,229,117,250,96,155,58,243,207,221,255,224,150,50,138,239,190,156,172,183,212,253,129,253,202,148,190,251,247,231,173,211,182,245,244,105,57,238,77,155,200,10,113, + 29,55,158,195,103,254,231,218,212,253,35,120,168,8,235,228,39,206,105,71,79,7,15,35,26,121,249,13,198,141,40,82,194,210,178,177,190,144,14,27,167,125,46,229,57,93,135,102,115,250,180,127,241,154,186,241,44,246,239,71,219,212,187,163,207,59,152,64,79, + 248,172,22,56,171,133,58,49,87,231,240,207,55,56,199,246,22,232,246,242,89,58,93,7,196,13,179,206,183,96,126,235,94,140,5,150,209,141,185,56,65,79,217,222,13,24,97,29,191,224,25,106,156,252,243,140,37,90,22,107,60,250,204,62,217,166,126,246,228,163,193, + 235,241,108,167,124,182,179,67,152,120,114,71,110,46,158,153,135,72,225,22,190,154,214,106,23,197,54,85,210,237,15,225,41,191,181,113,22,231,225,116,109,23,124,67,81,186,237,127,59,251,173,131,91,226,62,230,113,31,15,139,99,170,143,62,111,221,51,106, + 238,121,189,78,183,169,251,219,226,185,87,35,102,27,143,213,73,110,35,190,123,55,86,13,117,127,71,58,26,224,220,95,179,224,83,185,58,238,84,173,81,107,25,187,162,138,130,179,217,173,182,227,153,202,135,103,225,195,92,167,80,175,101,19,234,84,162,161, + 193,167,81,218,228,145,11,83,206,186,40,20,182,151,207,93,119,46,175,93,1,229,185,190,119,203,105,186,72,252,94,122,109,221,111,6,191,237,131,180,253,197,184,239,240,58,151,112,89,7,175,119,1,143,249,233,217,156,32,143,184,168,238,71,111,94,114,72,149, + 124,236,205,75,238,65,73,219,203,49,203,157,231,43,90,191,172,129,124,213,43,43,219,17,119,182,209,19,228,91,186,246,161,106,226,86,184,141,79,113,27,254,50,150,194,231,232,118,120,28,215,239,249,90,169,237,47,87,150,178,110,167,199,121,253,196,215,202, + 210,237,126,223,237,22,117,207,161,31,127,133,55,7,188,108,62,120,203,73,183,200,233,112,87,208,255,118,4,245,52,113,58,187,63,255,151,158,112,75,117,63,252,243,123,16,212,61,184,224,255,221,131,160,236,1,150,89,184,164,175,177,111,113,28,106,214,146, + 227,23,191,155,38,165,239,25,242,238,115,207,26,245,174,129,62,226,254,224,34,143,177,212,196,45,187,100,101,55,238,15,142,81,39,238,15,242,46,48,71,173,22,223,71,93,232,119,62,246,63,120,221,231,91,89,131,219,131,201,183,135,28,220,9,118,90,134,201, + 183,134,3,70,221,175,243,141,186,23,192,47,193,41,246,247,34,244,109,153,220,187,136,122,70,115,89,99,133,121,81,93,195,106,254,85,71,38,222,62,157,181,55,76,109,253,193,26,117,151,110,55,92,196,51,146,64,137,2,242,109,170,251,111,30,159,138,201,255, + 177,70,197,1,190,139,241,173,121,169,241,180,188,139,85,227,105,43,48,239,237,136,30,182,247,58,236,80,183,216,40,138,49,219,118,96,21,5,48,226,94,89,222,14,92,72,94,43,216,82,140,27,114,64,182,159,206,241,25,118,224,2,242,26,42,175,133,231,247,183,11, + 247,217,63,172,73,223,91,175,149,189,230,223,35,242,87,250,231,205,60,182,90,216,86,107,123,250,171,253,140,244,246,51,210,92,191,76,175,87,49,158,80,168,109,105,106,180,204,33,117,230,151,232,254,84,106,123,181,150,134,166,70,207,101,19,93,44,237,1, + 109,15,224,148,86,82,200,113,8,253,237,160,133,243,222,208,253,72,159,243,86,70,23,186,125,67,231,187,228,207,224,149,109,157,44,107,102,234,231,103,234,178,116,234,60,39,173,147,249,108,115,105,153,171,165,71,215,45,144,189,163,204,28,20,103,198,188, + 78,143,173,70,218,249,12,114,72,153,30,133,42,191,94,203,118,93,79,232,187,23,203,124,221,15,214,139,50,249,69,89,99,204,207,140,125,73,166,63,170,109,159,126,94,77,166,36,233,159,79,169,210,130,212,190,18,117,228,104,105,10,52,97,20,27,200,185,33,98, + 71,82,151,144,113,73,39,21,108,30,24,232,235,233,218,28,236,233,223,117,85,79,55,185,183,236,233,233,235,190,42,184,119,96,43,121,183,204,68,162,227,93,49,123,34,50,217,180,47,52,27,162,178,174,216,116,60,102,135,237,212,64,56,156,24,138,132,15,42,187, + 163,123,235,150,61,151,145,216,70,198,182,30,114,110,235,219,60,212,191,155,68,15,25,61,245,0,119,177,94,50,122,251,168,170,119,102,44,188,121,108,44,156,76,70,70,35,209,72,106,126,87,108,60,60,144,136,205,70,198,195,9,42,223,17,158,31,141,133,18,227, + 221,145,228,116,36,153,236,139,36,83,97,27,25,162,143,140,62,180,214,135,102,250,250,200,236,67,2,31,189,252,209,71,101,125,33,123,60,17,139,140,55,135,226,241,230,205,99,169,200,44,90,238,164,53,139,237,241,120,52,50,22,74,69,98,118,109,186,76,95,100, + 34,60,54,63,22,13,119,133,162,209,209,208,216,254,100,39,45,57,95,173,236,172,177,152,141,158,165,154,187,88,206,165,178,179,38,19,161,248,84,100,44,217,220,21,178,103,67,104,112,249,57,178,98,209,88,98,91,36,154,10,39,206,159,191,51,148,74,68,230,58, + 169,254,79,230,47,106,170,226,236,162,3,161,136,141,254,149,159,157,179,59,60,134,140,226,76,70,44,217,188,101,198,30,143,134,59,169,36,219,216,179,37,98,143,115,235,13,25,235,44,86,190,185,107,42,150,8,199,100,115,225,68,237,182,68,104,58,51,141,157, + 84,249,39,202,102,247,70,230,98,217,183,206,134,185,155,75,23,103,236,140,241,196,235,188,250,197,121,236,125,181,253,246,182,216,216,76,178,107,42,100,79,134,211,238,146,61,168,76,209,236,201,201,24,47,75,196,102,226,157,180,238,236,156,96,34,28,238, + 31,77,134,19,179,24,91,191,125,89,52,54,26,138,246,133,230,99,51,169,133,199,172,248,211,245,58,169,101,113,129,80,182,231,55,47,218,7,59,67,118,104,146,171,180,254,175,171,240,214,233,177,39,98,103,245,255,77,234,164,183,91,39,53,45,174,23,177,227,51, + 169,233,112,106,42,54,222,188,37,148,68,227,72,195,195,109,56,138,244,255,11,206,95,126,235,120,36,21,75,168,238,52,156,191,216,89,77,54,190,73,217,157,82,207,204,206,165,125,99,177,233,230,196,116,50,218,188,15,161,164,249,172,120,84,251,39,35,76,39, + 109,123,211,6,206,19,131,106,23,175,108,199,255,181,157,78,170,126,179,170,157,84,43,139,192,217,18,144,241,144,61,223,60,59,26,13,217,251,155,179,34,114,39,213,244,141,135,162,179,145,253,205,33,219,142,165,100,140,106,222,106,143,69,99,201,136,61,217, + 21,13,37,101,240,57,187,76,15,166,63,161,243,171,207,145,191,51,60,61,170,11,132,81,164,234,28,69,6,35,147,118,40,53,147,8,243,182,226,35,160,25,221,155,196,54,15,37,6,195,7,102,194,246,24,114,138,178,115,212,227,106,178,76,61,209,104,120,50,20,85,139, + 181,117,110,44,28,87,46,81,123,142,50,137,201,153,105,204,80,86,169,226,236,82,8,194,147,106,106,23,140,187,98,131,51,99,83,202,127,178,234,249,178,138,244,143,238,147,49,176,42,203,54,24,30,155,73,192,109,206,83,101,16,49,215,158,100,191,93,176,37,194, + 19,81,180,131,110,204,198,212,81,17,12,37,38,195,217,189,93,122,142,226,170,107,157,84,170,242,102,82,145,104,243,230,68,34,52,207,174,210,73,133,89,102,182,144,247,12,67,39,89,242,152,246,100,123,38,137,33,242,12,109,221,61,200,231,121,87,127,247,214, + 133,212,174,205,59,183,146,49,212,67,142,161,30,124,65,237,37,231,80,111,207,182,109,189,100,65,114,70,47,103,152,67,189,210,194,39,237,80,239,48,10,178,194,167,237,144,52,245,13,35,183,111,24,103,241,208,48,90,24,150,173,137,97,50,161,145,133,143,62, + 86,251,200,49,220,203,186,5,129,243,123,152,173,56,183,157,195,125,210,236,96,9,251,8,46,13,35,61,228,27,57,219,91,138,71,206,177,88,110,21,222,106,3,129,64,70,111,201,210,91,179,244,182,44,125,77,150,190,54,75,95,151,165,175,207,210,219,161,231,41,125, + 91,52,52,153,164,252,69,113,149,74,66,231,136,223,228,12,201,192,198,53,89,246,133,70,195,81,202,9,233,251,6,45,9,141,143,159,251,52,161,220,144,118,242,36,137,81,42,226,99,116,203,76,42,21,179,7,18,120,76,120,156,156,163,49,36,167,33,229,41,77,206,49, + 121,193,32,215,152,60,253,198,201,129,139,76,40,65,121,99,28,241,98,56,246,55,167,56,145,185,42,80,129,76,4,19,33,59,57,17,75,76,83,25,162,75,83,86,148,105,82,81,134,242,249,122,131,123,67,82,182,130,7,168,91,14,30,16,155,65,122,217,88,34,28,74,157,29, + 101,57,250,147,53,30,153,152,32,215,120,76,94,8,72,132,201,17,230,243,155,252,19,184,70,156,179,78,114,203,124,144,155,207,229,18,242,60,39,199,132,20,158,137,133,211,125,156,242,100,138,35,100,207,56,21,76,112,251,193,200,116,120,87,200,142,37,105,25, + 54,220,162,214,183,101,21,174,60,51,115,209,181,51,87,230,202,101,43,204,168,59,67,201,253,120,102,41,27,22,238,128,250,190,71,249,48,115,176,195,194,134,19,73,202,225,36,251,44,185,89,211,133,60,28,3,120,236,220,75,249,148,237,225,200,228,84,138,138, + 161,202,211,45,187,143,121,210,152,76,133,16,59,101,137,62,29,76,250,237,65,76,120,216,150,237,33,104,132,6,17,132,85,123,42,132,200,94,203,165,66,212,150,43,228,89,48,160,101,23,82,187,67,7,175,72,43,123,229,179,118,199,98,41,126,52,121,145,24,156,135, + 23,78,15,34,132,68,240,244,2,88,246,216,17,246,35,30,164,236,205,153,151,27,57,5,67,145,204,118,224,58,151,99,253,98,7,131,177,253,232,108,101,38,45,11,69,195,56,7,227,209,208,188,114,11,11,185,87,200,207,189,36,166,168,2,43,12,151,94,180,68,219,99,252, + 148,66,157,19,143,15,132,102,120,23,120,51,134,221,225,36,246,75,198,178,37,179,97,40,95,89,186,181,15,234,36,14,228,238,216,65,108,205,76,114,79,156,74,50,9,121,88,111,143,140,143,163,243,250,169,59,99,120,164,172,179,200,144,8,77,166,219,148,6,52,163, + 219,148,151,109,42,214,137,112,130,119,153,246,172,156,169,80,82,249,118,249,20,188,110,48,54,161,93,32,17,155,86,243,132,34,168,45,119,130,53,21,67,192,23,17,114,195,115,250,229,25,146,36,51,50,61,77,133,252,234,22,9,69,187,66,241,228,78,172,15,229, + 107,195,96,56,186,213,30,207,228,35,9,55,73,96,83,201,43,85,112,62,30,38,143,84,175,82,215,43,202,193,195,134,66,209,25,4,146,8,14,174,253,97,60,44,153,113,192,156,72,178,63,30,194,73,78,75,34,201,96,12,39,233,214,185,56,130,135,244,200,173,118,8,11, + 58,142,182,147,122,113,201,181,63,60,223,197,253,41,223,127,158,119,184,252,116,198,224,20,207,168,35,42,67,99,62,92,34,156,224,238,237,194,29,136,172,104,120,34,69,206,104,216,158,76,77,145,83,119,85,216,100,217,188,146,46,59,124,112,23,43,57,118,58, + 222,120,236,236,173,236,140,141,114,224,34,43,22,29,159,146,159,7,169,40,102,167,223,247,186,100,224,26,167,226,5,83,119,56,153,74,196,230,217,143,22,140,218,215,178,106,166,157,109,217,130,105,48,52,27,78,207,151,218,146,89,229,229,228,47,110,98,48, + 21,139,199,97,42,71,24,145,253,56,227,50,140,206,219,240,173,131,148,31,203,126,171,161,130,216,162,3,131,60,49,91,238,13,25,90,40,55,102,167,29,59,95,170,59,103,162,169,72,156,151,68,38,225,156,57,124,14,201,170,40,49,24,121,107,56,29,80,209,146,90, + 90,217,146,51,166,22,220,165,228,85,168,55,131,35,36,133,248,230,136,75,199,118,199,67,9,148,148,81,35,63,190,200,189,29,113,121,84,84,197,99,241,153,232,121,15,135,162,56,252,122,209,155,34,137,4,185,18,234,37,156,106,18,225,73,118,151,196,249,223,207, + 185,48,78,185,36,92,64,43,87,81,101,34,60,141,9,81,147,212,111,159,113,174,58,18,50,230,154,201,112,138,10,146,28,157,51,47,204,228,65,90,78,53,251,51,149,103,167,122,212,212,200,61,198,213,178,222,70,100,181,190,180,223,82,5,82,231,124,15,165,210,100, + 58,178,238,137,100,133,202,101,231,52,243,107,64,8,7,118,82,197,90,233,230,249,201,69,49,214,157,78,70,85,159,46,143,68,163,187,98,41,233,52,158,36,182,85,58,140,161,34,82,153,24,131,194,236,142,170,95,184,190,34,27,190,184,144,172,72,170,222,244,44, + 60,75,143,212,146,7,153,149,154,138,36,201,201,159,181,1,45,91,96,229,99,205,68,75,80,121,34,114,102,82,19,237,242,192,16,179,228,152,149,177,197,37,69,255,4,89,252,126,71,133,252,153,237,130,185,108,8,198,246,96,65,189,179,103,29,49,179,145,68,106,38, + 20,213,39,164,123,118,97,42,196,65,18,115,100,204,5,64,11,104,5,109,96,13,137,121,122,208,50,232,99,134,171,96,184,145,30,182,196,39,12,87,149,145,247,180,49,87,181,207,164,231,197,210,159,236,160,39,44,227,253,6,236,5,244,29,75,188,79,184,170,30,55, + 222,90,245,91,147,238,20,141,141,183,58,136,126,98,153,159,48,174,251,43,225,42,120,116,5,189,108,8,66,91,27,232,53,131,92,171,71,76,227,6,35,255,157,166,56,45,74,155,230,94,53,233,61,194,216,183,65,20,21,69,54,24,201,42,7,109,16,121,78,52,96,168,30, + 24,235,246,26,59,14,54,210,191,27,226,126,126,220,153,242,20,154,44,120,128,94,84,98,163,121,179,120,93,124,67,184,86,27,207,81,167,241,71,113,208,120,74,28,156,51,190,115,205,115,71,132,225,112,111,110,220,208,180,97,195,37,35,38,29,21,238,107,77,113, + 147,104,223,112,111,181,105,62,39,218,68,121,105,96,185,105,252,88,24,162,168,194,97,204,25,253,232,139,67,56,76,167,219,184,232,132,195,237,36,167,112,26,78,179,161,193,152,93,237,48,26,140,228,106,106,87,125,104,55,238,55,62,45,21,139,149,207,24,159, + 93,108,205,40,142,116,246,3,156,188,147,251,252,174,74,154,135,216,65,175,152,198,125,198,131,108,191,73,136,227,152,184,163,75,71,232,55,22,242,232,118,158,62,250,165,201,159,119,88,198,97,113,35,178,233,152,37,14,179,252,163,41,37,26,186,71,89,254, + 166,146,222,157,41,117,151,46,117,68,203,15,153,226,13,44,215,142,29,141,195,59,134,155,232,122,33,142,168,202,143,152,198,61,198,99,92,125,89,35,189,42,196,109,80,143,136,178,66,63,157,48,140,31,112,178,234,70,163,180,202,152,174,50,10,59,155,118,132, + 141,153,222,43,141,249,94,250,134,97,254,64,220,34,243,141,162,119,24,137,170,219,70,246,29,49,29,168,212,28,190,148,30,209,117,11,110,244,87,222,70,95,52,29,239,20,207,138,187,141,119,25,239,224,206,220,111,90,159,50,190,40,78,137,159,35,181,241,198, + 97,250,168,122,238,141,198,215,169,202,120,232,186,170,29,102,238,117,70,159,233,250,144,97,26,143,210,94,99,211,106,81,92,24,80,120,251,204,188,147,194,216,184,193,244,28,54,58,54,10,97,186,31,23,70,163,168,204,191,212,225,118,120,90,28,121,251,156, + 238,38,81,92,102,92,211,185,193,233,217,40,170,74,217,190,216,104,108,19,85,5,244,164,41,62,137,153,247,155,226,184,209,38,124,101,134,103,53,198,185,194,164,247,138,192,114,7,73,165,105,165,131,78,6,26,232,113,83,252,7,247,253,63,77,113,3,100,164,146, + 142,24,226,195,168,253,21,147,158,16,43,154,246,237,152,187,122,201,141,228,228,197,50,106,197,61,70,69,141,113,129,113,141,229,59,41,202,139,141,85,48,84,186,202,69,121,79,121,97,249,206,114,179,188,181,220,161,74,85,203,82,6,74,13,100,202,151,24,23, + 114,121,81,225,87,138,81,177,162,162,218,89,126,211,122,167,88,177,222,37,44,81,110,144,33,44,247,205,126,225,171,59,124,200,122,106,121,189,120,105,185,16,79,173,16,226,5,112,202,143,108,225,49,196,205,254,198,67,135,172,7,170,155,196,247,171,201,116, + 82,1,215,16,190,102,212,57,190,82,28,241,127,147,63,158,231,143,215,87,10,227,88,173,48,30,174,37,231,146,202,34,31,182,131,79,125,175,69,225,231,107,81,228,225,58,124,124,151,63,94,224,143,35,245,248,56,193,31,143,212,59,174,55,72,0,11,184,180,254,231, + 80,2,220,96,131,248,81,189,16,71,27,132,248,40,120,184,193,20,127,104,40,23,55,95,132,52,248,38,120,14,188,2,78,172,22,226,187,224,20,120,29,220,220,40,196,243,224,246,38,148,3,119,53,99,55,5,132,56,214,34,172,167,192,243,45,200,107,117,136,231,214,97, + 138,214,27,226,80,187,33,78,180,59,73,80,249,18,145,249,62,200,19,211,81,148,245,123,156,180,76,255,95,26,255,14,33,253,191,105,252,187,133,244,255,167,169,191,177,85,255,163,198,191,87,72,255,159,154,147,22,254,87,205,244,42,157,127,207,36,252,234,255, + 47,6,160,59,253,170,62,255,157,162,240,42,59,255,109,162,225,87,207,229,255,109,51,117,121,254,251,63,203,175,126,119,196,127,39,232,240,171,254,241,223,22,242,31,55,114,251,242,111,29,189,202,206,255,83,247,63,73,81,207,80,140,55,0,0,0,0 }; //============================================================================== #if JUCE_PUSH_NOTIFICATIONS && JUCE_MODULE_AVAILABLE_juce_gui_extra @@ -1033,6 +1038,11 @@ public: } //============================================================================== + void handleDoFrameCallback ([[maybe_unused]] int64 frameTimeNanos) + { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + } + void handlePaintCallback (jobject canvas, jobject paint) { auto* env = getEnv(); @@ -1143,7 +1153,8 @@ private: METHOD (isVisible, "isVisible", "()Z") \ METHOD (containsPoint, "containsPoint", "(II)Z") \ METHOD (showKeyboard, "showKeyboard", "(Ljava/lang/String;)V") \ - METHOD (setSystemUiVisibilityCompat, "setSystemUiVisibilityCompat", "(I)V") \ + METHOD (setSystemUiVisibilityCompat, "setSystemUiVisibilityCompat", "(I)V") \ + CALLBACK (handleDoFrameJni, "handleDoFrame", "(JJ)V") \ CALLBACK (handlePaintJni, "handlePaint", "(JLandroid/graphics/Canvas;Landroid/graphics/Paint;)V") \ CALLBACK (handleMouseDownJni, "handleMouseDown", "(JIFFJ)V") \ CALLBACK (handleMouseDragJni, "handleMouseDrag", "(JIFFJ)V") \ @@ -1165,6 +1176,7 @@ private: DECLARE_JNI_CLASS_WITH_BYTECODE (ComponentPeerView, "com/rmsl/juce/ComponentPeerView", 16, javaComponentPeerView, sizeof (javaComponentPeerView)) #undef JNI_CLASS_MEMBERS + static void JNICALL handleDoFrameJni (JNIEnv*, jobject /*view*/, jlong host, jlong frameTimeNanos) { if (auto* myself = reinterpret_cast (host)) myself->handleDoFrameCallback (frameTimeNanos); } 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); } diff --git a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm index 5da0b68e..3f33a8b7 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,160 @@ 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) + { + 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)); + } + + 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 +228,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 +275,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 +348,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 +371,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 +379,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..aad028da 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -87,7 +87,7 @@ static UIInterfaceOrientation getWindowOrientation() JUCE_END_IGNORE_WARNINGS_GCC_LIKE } -namespace Orientations +struct Orientations { static Desktop::DisplayOrientation convertToJuce (UIInterfaceOrientation orientation) { @@ -119,8 +119,7 @@ namespace Orientations return UIInterfaceOrientationPortrait; } - - static NSUInteger getSupportedOrientations() + static UIInterfaceOrientationMask getSupportedOrientations() { NSUInteger allowed = 0; auto& d = Desktop::getInstance(); @@ -132,7 +131,7 @@ namespace Orientations return allowed; } -} +}; enum class MouseEventFlags { @@ -351,7 +350,7 @@ struct UIViewPeerControllerReceiver //============================================================================== class UIViewComponentPeer : public ComponentPeer, - private UIViewPeerControllerReceiver + public UIViewPeerControllerReceiver { public: UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo); @@ -920,7 +919,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 (""); } @@ -1309,6 +1311,11 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; return UITextAutocorrectionTypeNo; } +- (UITextSpellCheckingType) spellCheckingType +{ + return UITextSpellCheckingTypeNo; +} + - (BOOL) canBecomeFirstResponder { return YES; @@ -1754,8 +1761,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); } @@ -1849,6 +1858,8 @@ BOOL UIViewComponentPeer::textViewReplaceCharacters (Range range, const Str //============================================================================== void UIViewComponentPeer::displayLinkCallback() { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + if (deferredRepaints.isEmpty()) return; @@ -1913,6 +1924,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_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index 7eb7176e..29d702f4 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -369,6 +369,8 @@ public: bounds = parentWindow == 0 ? Desktop::getInstance().getDisplays().physicalToLogical (physicalBounds) : physicalBounds / currentScaleFactor; + + updateVBlankTimer(); } void updateBorderSize() @@ -396,7 +398,7 @@ public: private: //============================================================================== - class LinuxRepaintManager : public Timer + class LinuxRepaintManager { public: LinuxRepaintManager (LinuxComponentPeer& p) @@ -405,7 +407,7 @@ private: { } - void timerCallback() override + void dispatchDeferredRepaints() { XWindowSystem::getInstance()->processPendingPaintsForWindow (peer.windowH); @@ -413,32 +415,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 +463,6 @@ private: } } - startTimer (repaintTimerPeriod); - RectangleList adjustedList (originalRepaintRegion); adjustedList.offsetAll (-totalArea.getX(), -totalArea.getY()); @@ -495,12 +483,9 @@ private: } lastTimeImageUsed = Time::getApproximateMillisecondCounter(); - startTimer (repaintTimerPeriod); } private: - enum { repaintTimerPeriod = 1000 / 100 }; - LinuxComponentPeer& peer; const bool isSemiTransparentWindow; Image image; @@ -512,6 +497,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 +559,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)) + { + if (display->verticalFrequencyHz) + { + const auto newIntFrequencyHz = roundToInt (*display->verticalFrequencyHz); + + if (vBlankManager.getTimerInterval() != newIntFrequencyHz) + vBlankManager.startTimerHz (newIntFrequencyHz); + } + } + } + //============================================================================== std::unique_ptr repainter; + LinuxVBlankManager vBlankManager { [this]() { onVBlank(); } }; ::Window windowH = {}, parentWindow = {}; Rectangle bounds; diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 2047f6f9..65b588f9 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -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); @@ -1028,6 +1024,12 @@ public: return areAnyWindowsInLiveResize(); } + void onVBlank() + { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); + setNeedsDisplayRectangles(); + } + void setNeedsDisplayRectangles() { if (deferredRepaints.isEmpty()) @@ -1200,11 +1202,6 @@ public: setNeedsDisplayRectangles(); } - void windowDidChangeScreen() - { - updateCVDisplayLinkScreen(); - } - void viewMovedToWindow() { if (isSharedWindow) @@ -1224,9 +1221,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 +1324,9 @@ public: if (auto keyCode = getKeyCodeFromEvent (ev)) { if (isKeyDown) - keysCurrentlyDown.addIfNotAlreadyThere (keyCode); + keysCurrentlyDown.insert (keyCode); else - keysCurrentlyDown.removeFirstMatchingValue (keyCode); + keysCurrentlyDown.erase (keyCode); } } @@ -1596,7 +1590,7 @@ public: #else bool usingCoreGraphics = false; #endif - bool isZooming = false, isFirstLiveResize = false, textWasInserted = false; + bool textWasInserted = false, isFirstLiveResize = false; bool isStretchingTop = false, isStretchingLeft = false, isStretchingBottom = false, isStretchingRight = false; bool windowRepresentsFile = false; bool isAlwaysOnTop = false, wasAlwaysOnTop = false; @@ -1607,7 +1601,7 @@ public: uint32 lastRepaintTime; static ComponentPeer* currentlyFocusedPeer; - static Array keysCurrentlyDown; + static std::set keysCurrentlyDown; static int insideToFrontCall; static const SEL dismissModalsSelector; @@ -1618,6 +1612,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 +1837,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 +1980,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) @@ -2002,15 +2007,14 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper> { if (auto* owner = getOwner (self)) { - auto* target = owner->findCurrentTextInputTarget(); owner->textWasInserted = false; - if (target != nullptr) + if (auto* target = owner->findCurrentTextInputTarget()) [(NSView*) self interpretKeyEvents: [NSArray arrayWithObject: ev]]; else owner->stringBeingComposed.clear(); - if (! (owner->textWasInserted || owner->redirectKeyDown (ev))) + if (! (owner->textWasInserted || owner->stringBeingComposed.isNotEmpty() || owner->redirectKeyDown (ev))) sendSuperclassMessage (self, @selector (keyDown:), ev); } }); @@ -2362,7 +2366,7 @@ struct JuceNSWindowClass : public NSViewComponentPeerWrapperisZooming) + if (owner == nullptr) return proposedFrameSize; NSRect frameRect = flippedScreenRect ([(NSWindow*) self frame]); @@ -2551,20 +2555,25 @@ NSWindow* NSViewComponentPeer::createWindowInstance() //============================================================================== ComponentPeer* NSViewComponentPeer::currentlyFocusedPeer = nullptr; -Array 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_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index cb247722..9f97d077 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1113,6 +1113,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 +1388,7 @@ static HMONITOR getMonitorFromOutput (ComSmartPtr output) : desc.Monitor; } -struct VBlankListener -{ - virtual void onVBlank() = 0; -}; +using VBlankListener = ComponentPeer::VBlankListener; //============================================================================== class VSyncThread : private Thread, @@ -1399,7 +1403,7 @@ public: monitor (mon) { listeners.push_back (listener); - startThread (10); + startThread (Priority::highest); } ~VSyncThread() override @@ -1675,9 +1679,6 @@ public: callFunctionIfNotLocked (&destroyWindowCallback, (void*) hwnd); - if (currentWindowIcon != nullptr) - DestroyIcon (currentWindowIcon); - if (dropTarget != nullptr) { dropTarget->peerIsDeleted = true; @@ -2072,6 +2073,7 @@ public: //============================================================================== void onVBlank() override { + vBlankListeners.call ([] (auto& l) { l.onVBlank(); }); dispatchDeferredRepaints(); } @@ -2315,7 +2317,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 +2379,6 @@ private: TCHAR moduleFile[1024] = {}; GetModuleFileName (moduleHandle, moduleFile, 1024); - WORD iconNum = 0; WNDCLASSEX wcex = {}; wcex.cbSize = sizeof (wcex); @@ -2386,9 +2387,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 +2488,8 @@ private: return false; } + IconConverters::IconPtr iconBig, iconSmall; + JUCE_DECLARE_NON_COPYABLE (WindowClassHolder) }; @@ -2668,15 +2675,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); } } @@ -2811,7 +2814,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)) @@ -5367,27 +5370,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 (auto icon = extractFileHICON (file)) - { - image = IconConverters::createImageFromHICON (icon); - DestroyIcon (icon); - } + if (const auto icon = extractFileHICON (file)) + return IconConverters::createImageFromHICON (icon.get()); - return image; + return {}; } //============================================================================== @@ -5435,12 +5434,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 +5444,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 +5459,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_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index da1a2730..ec79806e 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -2565,6 +2565,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)) @@ -3129,6 +3145,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/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..082cff66 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() 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_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index 10a09d3a..18b35fe0 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -944,14 +944,10 @@ TextEditor::TextEditor (const String& name, juce_wchar passwordChar) setWantsKeyboardFocus (true); recreateCaret(); - - juce::Desktop::getInstance().addGlobalMouseListener (this); } TextEditor::~TextEditor() { - juce::Desktop::getInstance().removeGlobalMouseListener (this); - textValue.removeListener (textHolder); textValue.referTo (Value()); @@ -1046,7 +1042,7 @@ bool TextEditor::isReadOnly() const noexcept bool TextEditor::isTextInputActive() const { - return ! isReadOnly() && (! clicksOutsideDismissVirtualKeyboard || mouseDownInEditor); + return ! isReadOnly() && (! clicksOutsideDismissVirtualKeyboard || globalMouseListener.lastMouseDownInEditor()); } void TextEditor::setReturnKeyStartsNewLine (bool shouldStartNewLine) @@ -1654,15 +1650,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 +1843,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 +1880,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 +1887,6 @@ void TextEditor::mouseDrag (const MouseEvent& e) void TextEditor::mouseUp (const MouseEvent& e) { - if (! mouseDownInEditor) - return; - newTransaction(); textHolder->restartTimer(); @@ -1918,9 +1899,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 +1965,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 +2011,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 +2264,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 +2289,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; @@ -2614,9 +2595,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..c48425d4 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.h +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.h @@ -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.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..b0d6ed05 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/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..173cd09b 100644 --- a/modules/juce_gui_extra/juce_gui_extra.cpp +++ b/modules/juce_gui_extra/juce_gui_extra.cpp @@ -185,11 +185,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..9402907e 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.3 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..ef1e87fb 100644 --- a/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h +++ b/modules/juce_gui_extra/misc/juce_AnimatedAppComponent.h @@ -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_WebBrowserComponent.h b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h index 3ecdc5a6..e65fbea5 100644 --- a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h +++ b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h @@ -46,6 +46,136 @@ 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(). @@ -56,11 +186,15 @@ public: 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. @@ -141,17 +275,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; @@ -165,123 +288,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_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp index 35adf391..462bc439 100644 --- a/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp @@ -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()); @@ -582,13 +586,13 @@ 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()); } @@ -719,6 +723,11 @@ void WebBrowserComponent::clearCookies() } } +bool WebBrowserComponent::areOptionsSupported (const Options& options) +{ + return (options.getBackend() == Options::Backend::defaultBackend); +} + WebBrowserComponent::Pimpl::JuceWebViewClient16_Class WebBrowserComponent::Pimpl::JuceWebViewClient16; WebBrowserComponent::Pimpl::JuceWebViewClient21_Class WebBrowserComponent::Pimpl::JuceWebViewClient21; WebBrowserComponent::Pimpl::JuceWebChromeClient_Class WebBrowserComponent::Pimpl::JuceWebChromeClient; 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..287131b5 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); @@ -598,6 +613,7 @@ private: int outChannel = 0; CommandReceiver receiver; + String userAgent; WebKitWebView* webview = nullptr; Array decisions; }; @@ -607,8 +623,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(); } @@ -768,7 +784,6 @@ private: close (inPipe[0]); close (outPipe[1]); - HeapBlock argv (5); StringArray arguments; arguments.add (File::getSpecialLocation (File::currentExecutableFile).getFullPathName()); @@ -776,15 +791,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); + + std::vector argv; + argv.reserve (static_cast (arguments.size() + 1)); - argv[4] = nullptr; + 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 +917,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 +927,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 +1031,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_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..2043fbb1 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,7 +424,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] removeDeliveredNotification: nsNotification]; } @@ -439,7 +439,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 +449,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]; } @@ -513,7 +513,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate void didActivateNotification (NSUserNotification* notification) override { - auto n = PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (notification, isEarlierThanMavericks, isEarlierThanYosemite); + auto n = PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (notification); if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) { @@ -521,9 +521,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]) @@ -552,11 +557,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate 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..d5f98f87 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); @@ -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..7e4c168f 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,8 @@ class WebBrowserComponent::Pimpl { public: Pimpl (WebBrowserComponent& owner, - const WebView2Preferences& preferences, - bool useWebView2) + const Options& preferences, + bool useWebView2, const String& userAgent) { if (useWebView2) { @@ -786,7 +832,7 @@ public: ignoreUnused (preferences); if (internal == nullptr) - internal.reset (new Win32WebView (owner)); + internal.reset (new Win32WebView (owner, userAgent)); } InternalWebViewType& getInternalWebView() @@ -799,15 +845,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 +857,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 +1011,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..3ffa2e31 100644 --- a/modules/juce_opengl/juce_opengl.cpp +++ b/modules/juce_opengl/juce_opengl.cpp @@ -215,7 +215,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 +242,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 //============================================================================== diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h index 8cf05c27..8bf45808 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.3 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..4358a6d7 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -124,7 +124,7 @@ DECLARE_JNI_CLASS_WITH_BYTECODE (JuceOpenGLViewSurface, "com/rmsl/juce/JuceOpenG #undef JNI_CLASS_MEMBERS //============================================================================== -class OpenGLContext::NativeContext : private SurfaceHolderCallback +class OpenGLContext::NativeContext : private SurfaceHolderCallback { public: NativeContext (Component& comp, @@ -132,8 +132,7 @@ public: void* /*contextToShareWith*/, bool useMultisamplingIn, OpenGLVersion) - : component (comp), - surface (EGL_NO_SURFACE), context (EGL_NO_CONTEXT) + : component (comp) { auto env = getEnv(); @@ -175,88 +174,45 @@ public: } //============================================================================== - bool initialiseOnRenderThread (OpenGLContext& aContext) + InitResult initialiseOnRenderThread (OpenGLContext& ctx) { - jassert (hasInitialised); + // 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 }; - // 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; - } - - // 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; + const std::lock_guard lock { nativeHandleMutex }; - if (surface == EGL_NO_SURFACE || context == EGL_NO_CONTEXT) - return false; - - if (! eglMakeCurrent (display, surface, surface, context)) - return false; - - 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 +220,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; } @@ -295,11 +251,15 @@ public: 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; @@ -334,6 +294,8 @@ private: void dispatchDraw (jobject /*canvas*/) { + const std::lock_guard lock { nativeHandleMutex }; + if (juceContext != nullptr) juceContext->triggerRepaint(); } @@ -389,15 +351,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,6 +409,9 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeContext) }; +EGLDisplay OpenGLContext::NativeContext::display = EGL_NO_DISPLAY; +EGLDisplay OpenGLContext::NativeContext::config; + //============================================================================== void AndroidGLCallbacks::attachedToWindow (JNIEnv*, jobject /*this*/, jlong host) { diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index c67a19d9..cf29a2a5 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,7 +244,7 @@ private: glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferHandle); - bool ok = [context renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; + bool ok = [context.get() renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; jassert (ok); ignoreUnused (ok); GLint width, height; @@ -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..987d3263 100644 --- a/modules/juce_opengl/native/juce_OpenGL_linux_X11.h +++ b/modules/juce_opengl/native/juce_OpenGL_linux_X11.h @@ -28,6 +28,18 @@ 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); @@ -80,15 +92,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,9 +108,9 @@ 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); @@ -135,19 +147,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 +280,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 +309,22 @@ 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 = {}; 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..9dbe093d 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, @@ -154,67 +159,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 +237,8 @@ public: void triggerRepaint() { - needsUpdate = 1; - repaintEvent.signal(); + state |= (StateFlags::pendingRender | StateFlags::paintComponents); + renderThread->triggerRepaint(); } //============================================================================== @@ -282,89 +281,146 @@ 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; + + #if JUCE_IOS + if (backgroundProcessCheck.isBackgroundProcess()) + return RenderStatus::noWork; + #endif - NativeContext::Locker locker (*nativeContext); + std::optional scopedLock; + ScopedContextActivator contextActivator; - JUCE_CHECK_OPENGL_ERROR + const auto stateToUse = state.fetch_and (StateFlags::persistent); - doWorkWhileWaitingForLock (true); + if (! isFlagSet (stateToUse, StateFlags::pendingRender) && ! context.continuousRepaint) + return RenderStatus::noWork; - const auto currentAreaAndScale = areaAndScale.get(); - const auto viewportArea = currentAreaAndScale.area; + const auto isUpdating = isFlagSet (stateToUse, StateFlags::paintComponents); - if (context.renderer != nullptr) + 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 +433,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 +461,7 @@ public: (float) newArea.getHeight() / (float) localBounds.getHeight()); nativeContext->updateWindowPosition (peer->getAreaCoveredBy (component)); - - if (canTriggerUpdate) - invalidateAll(); + invalidateAll(); }); } } @@ -420,7 +479,7 @@ public: if (lastScreenBounds != screenBounds) { - updateViewportSize (true); + updateViewportSize(); lastScreenBounds = screenBounds; } } @@ -461,10 +520,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 +530,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 +582,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 +606,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 +623,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 +654,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 +717,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 +741,7 @@ public: OpenGLContext::AsyncWorker::Ptr worker (*blocker); workQueue.add (worker); - messageManagerLock.abort(); + renderThread->abortLock(); context.triggerRepaint(); blocker->block(); @@ -752,7 +750,7 @@ public: { workQueue.add (std::move (workerToUse)); - messageManagerLock.abort(); + renderThread->abortLock(); context.triggerRepaint(); } } @@ -768,6 +766,156 @@ 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)) {} + } }; + }; + //============================================================================== friend class NativeContext; std::unique_ptr nativeContext; @@ -775,6 +923,8 @@ public: OpenGLContext& context; Component& component; + SharedResourcePointer renderThread; + OpenGLFrameBuffer cachedImageFrameBuffer; RectangleList validArea; Rectangle lastScreenBounds; @@ -785,102 +935,97 @@ 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); - } + JUCE_ASSERT_MESSAGE_THREAD; - double getNominalVideoRefreshPeriodS() const - { - const auto nominalVideoRefreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod (displayLink); + if (auto* window = getCurrentWindow()) + return [window screen]; - if ((nominalVideoRefreshPeriod.flags & kCVTimeIsIndefinite) == 0) - return (double) nominalVideoRefreshPeriod.timeValue / (double) nominalVideoRefreshPeriod.timeScale; + return nullptr; + } - return 0.0; - } + void updateScreen() + { + const auto screen = getCurrentScreen(); + const auto display = ScopedDisplayLink::getDisplayIdForScreen (screen); - /* Returns true if updated, or false otherwise. */ - bool updateActiveDisplay() - { - auto* oldScreen = std::exchange (currentScreen, cachedImage.getCurrentScreen()); + if (lastDisplay.exchange (display) == display) + return; - if (oldScreen == currentScreen) - return false; + const auto newRefreshPeriod = sharedDisplayLinks->getNominalVideoRefreshPeriodSForScreen (display); - for (NSScreen* screen in [NSScreen screens]) - if (screen == currentScreen) - if (NSNumber* number = [[screen deviceDescription] objectForKey: @"NSScreenNumber"]) - CVDisplayLinkSetCurrentCGDisplay (displayLink, [number unsignedIntValue]); + if (newRefreshPeriod != 0.0 && std::exchange (refreshPeriod, newRefreshPeriod) != newRefreshPeriod) + nativeContext->setNominalVideoRefreshPeriodS (newRefreshPeriod); - return true; - } + updateColourSpace(); + } - ~CVDisplayLinkWrapper() - { - CVDisplayLinkStop (displayLink); - CVDisplayLinkRelease (displayLink); - } + void updateColourSpace() + { + if (auto* view = nativeContext->getNSView()) + if (auto* window = [view window]) + [window setColorSpace: [NSColorSpace sRGBColorSpace]]; + } - static CVReturn displayLinkCallback (CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, - CVOptionFlags, CVOptionFlags*, void* displayLinkContext) - { - auto* self = reinterpret_cast (displayLinkContext); + std::atomic lastDisplay { 0 }; + double refreshPeriod = 0.0; - if (self->continuousRepaint) - self->cachedImage.repaintEvent.signal(); + FunctionNotificationCenterObserver observer { NSWindowDidChangeScreenNotification, + getCurrentWindow(), + [this] { updateScreen(); } }; - return kCVReturnSuccess; - } + // Note: the NSViewComponentPeer also has a SharedResourcePointer to + // avoid unnecessarily duplicating display-link threads. + SharedResourcePointer sharedDisplayLinks; + #endif - CachedImage& cachedImage; - const bool continuousRepaint; - CVDisplayLinkRef displayLink; - NSScreen* currentScreen = nullptr; - }; + enum StateFlags + { + pendingRender = 1 << 0, + paintComponents = 1 << 1, + pendingDestruction = 1 << 2, + initialised = 1 << 3, - std::unique_ptr cvDisplayLinkWrapper; - #endif + // Flags that may change state after each frame + transient = pendingRender | paintComponents, - std::unique_ptr renderThread; + // 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 +1116,6 @@ public: } #endif - void update() - { - auto& comp = *getComponent(); - - if (canBeAttached (comp)) - start(); - else - stop(); - } - private: OpenGLContext& context; @@ -1037,7 +1172,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); } @@ -1351,7 +1486,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 +1504,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 +1523,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 +1531,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, "gl_FragColor = texture2D (imageTexture, texturePos);" "}")); - prog.link(); + link(); } }; @@ -1424,8 +1560,7 @@ void OpenGLContext::copyTexture (const Rectangle& targetClipArea, OpenGLShaderProgram::Uniform screenSize, imageTexture, textureBounds, vOffsetAndScale; }; - OpenGLShaderProgram program; - ProgramBuilder builder; + BuiltProgram program; Params params; }; @@ -1471,40 +1606,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..499accd6 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.3 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/juce_product_unlocking.h b/modules/juce_product_unlocking/juce_product_unlocking.h index d5726bf1..39de8d87 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.3 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_video/juce_video.h b/modules/juce_video/juce_video.h index d08cc542..80f5a36c 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.3 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 -- 2.30.2