git subrepo clone https://github.com/free-audio/clap-juce-extensions deps/clap-juce-extensions
subrepo: subdir: "deps/clap-juce-extensions" merged: "6489846d0" upstream: origin: "https://github.com/free-audio/clap-juce-extensions" branch: "main" commit: "6489846d0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
This commit is contained in:
parent
345d5a1d9f
commit
bd701cb5f2
59
deps/clap-juce-extensions/.clang-format
vendored
Normal file
59
deps/clap-juce-extensions/.clang-format
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
AlignAfterOpenBracket: Align
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
ColumnLimit: 100
|
||||
SortIncludes: false
|
||||
---
|
||||
Language: ObjC
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
AlignAfterOpenBracket: Align
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
ColumnLimit: 100
|
||||
SortIncludes: false
|
||||
---
|
||||
|
6
deps/clap-juce-extensions/.gitmodules
vendored
Normal file
6
deps/clap-juce-extensions/.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[submodule "clap-libs/clap"]
|
||||
path = clap-libs/clap
|
||||
url = https://github.com/free-audio/clap.git
|
||||
[submodule "clap-libs/clap-helpers"]
|
||||
path = clap-libs/clap-helpers
|
||||
url = https://github.com/free-audio/clap-helpers.git
|
12
deps/clap-juce-extensions/.gitrepo
vendored
Normal file
12
deps/clap-juce-extensions/.gitrepo
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = https://github.com/free-audio/clap-juce-extensions
|
||||
branch = main
|
||||
commit = 6489846d05a3bc0b743c5c0f301ad1858b4dc919
|
||||
parent = 345d5a1d9f1c12303202574c23520c8d1780dd6f
|
||||
method = merge
|
||||
cmdver = 0.4.3
|
138
deps/clap-juce-extensions/CMakeLists.txt
vendored
Normal file
138
deps/clap-juce-extensions/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
# CMAKE Support for out of tree clap plugin extensions to Juce 6
|
||||
#
|
||||
# To use these in your juce6 cmake project
|
||||
# 1. Include this cmake file in your build path
|
||||
# 2. Create your juce plugin as normal with formats VST3 etc...
|
||||
# 3. After that, add the following lines (or similar) to your cmake
|
||||
# clap_juce_extensions_plugin(TARGET my-target
|
||||
# CLAP_ID "com.my-cool-plugs.my-target")
|
||||
# 4. Reload your CMAKe file and my-target_CLAP will be a buildable target
|
||||
|
||||
cmake_minimum_required (VERSION 3.15 FATAL_ERROR)
|
||||
|
||||
project(clap-juce-extensions VERSION 0.1 LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
|
||||
add_subdirectory(clap-libs/clap clapjuceext_clap EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(clap-libs/clap-helpers clapjuceext_claphelpers EXCLUDE_FROM_ALL)
|
||||
|
||||
add_library(clap_juce_extensions STATIC src/extensions/clap-juce-extensions.cpp)
|
||||
set_property(TARGET clap_juce_extensions PROPERTY CXX_STANDARD 14)
|
||||
target_include_directories(clap_juce_extensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_compile_definitions(clap_juce_extensions PUBLIC
|
||||
HAS_CLAP_JUCE_EXTENSIONS=1)
|
||||
target_link_libraries(clap_juce_extensions PUBLIC clap-core clap-helpers)
|
||||
|
||||
set_target_properties(clap_juce_extensions PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
VISIBILITY_INLINES_HIDDEN TRUE
|
||||
C_VISBILITY_PRESET hidden
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
)
|
||||
|
||||
add_library(clap_juce_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/wrapper/clap-juce-wrapper.cpp)
|
||||
set_property(TARGET clap_juce_sources PROPERTY CXX_STANDARD 14)
|
||||
if (APPLE)
|
||||
target_sources(clap_juce_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/wrapper/clap-juce-mac.mm)
|
||||
endif()
|
||||
target_include_directories(clap_juce_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
function(clap_juce_extensions_plugin)
|
||||
set(oneValueArgs TARGET)
|
||||
set(multiValueArgs CLAP_ID CLAP_FEATURES CLAP_MANUAL_URL CLAP_SUPPORT_URL)
|
||||
|
||||
cmake_parse_arguments(CJA "" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN} )
|
||||
set(target ${CJA_TARGET})
|
||||
set(claptarget ${target}_CLAP)
|
||||
|
||||
message(STATUS "Creating CLAP ${claptarget} from ${target}")
|
||||
|
||||
if ("${CJA_CLAP_ID}" STREQUAL "")
|
||||
message(FATAL_ERROR "You must specify CLAP_ID to add a clap" )
|
||||
endif()
|
||||
|
||||
if ("${CJA_CLAP_FEATURES}" STREQUAL "")
|
||||
message(WARNING "No CLAP_FEATURES were specified! Using \"instrument\" by default.")
|
||||
set(CJA_CLAP_FEATURES instrument)
|
||||
endif()
|
||||
|
||||
# we need the list of features as comma separated quoted strings
|
||||
foreach(feature IN LISTS CJA_CLAP_FEATURES)
|
||||
list (APPEND CJA_CLAP_FEATURES_PARSED "\"${feature}\"")
|
||||
endforeach()
|
||||
list (JOIN CJA_CLAP_FEATURES_PARSED ", " CJA_CLAP_FEATURES_PARSED)
|
||||
|
||||
get_property(SRC TARGET clap_juce_sources PROPERTY SOURCES)
|
||||
add_library(${claptarget} MODULE ${SRC})
|
||||
|
||||
set_target_properties(${claptarget} PROPERTIES
|
||||
CXX_STANDARD 14
|
||||
ARCHIVE_OUTPUT_DIRECTORY "$<GENEX_EVAL:$<TARGET_PROPERTY:${target},ARCHIVE_OUTPUT_DIRECTORY>>/CLAP"
|
||||
LIBRARY_OUTPUT_DIRECTORY "$<GENEX_EVAL:$<TARGET_PROPERTY:${target},LIBRARY_OUTPUT_DIRECTORY>>/CLAP"
|
||||
RUNTIME_OUTPUT_DIRECTORY "$<GENEX_EVAL:$<TARGET_PROPERTY:${target},RUNTIME_OUTPUT_DIRECTORY>>/CLAP")
|
||||
|
||||
get_target_property(products_folder ${claptarget} LIBRARY_OUTPUT_DIRECTORY)
|
||||
set(product_name $<TARGET_PROPERTY:${target},JUCE_PRODUCT_NAME>)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set_target_properties(${claptarget} PROPERTIES
|
||||
BUNDLE True
|
||||
BUNDLE_EXTENSION clap
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "${product_name}"
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
else()
|
||||
set_target_properties(${claptarget} PROPERTIES
|
||||
PREFIX ""
|
||||
SUFFIX ".clap"
|
||||
OUTPUT_NAME "${product_name}"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(${claptarget} PRIVATE
|
||||
$<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>)
|
||||
|
||||
target_compile_definitions(${claptarget} PRIVATE
|
||||
CLAP_ID="${CJA_CLAP_ID}"
|
||||
CLAP_FEATURES=${CJA_CLAP_FEATURES_PARSED}
|
||||
CLAP_MANUAL_URL="${CJA_CLAP_MANUAL_URL}"
|
||||
CLAP_SUPPORT_URL="${CJA_CLAP_SUPPORT_URL}")
|
||||
|
||||
target_link_libraries(${target} PUBLIC clap_juce_extensions)
|
||||
|
||||
target_link_libraries(${claptarget} PUBLIC clap-core clap-helpers clap_juce_sources ${target})
|
||||
set_property(TARGET ${claptarget} PROPERTY C_VISIBILITY_PRESET hidden)
|
||||
set_property(TARGET ${claptarget} PROPERTY VISIBILITY_INLINES_HIDDEN ON)
|
||||
|
||||
set_target_properties(${claptarget} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
VISIBILITY_INLINES_HIDDEN TRUE
|
||||
C_VISBILITY_PRESET hidden
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
)
|
||||
|
||||
get_target_property(docopy "${target}" JUCE_COPY_PLUGIN_AFTER_BUILD)
|
||||
|
||||
if(docopy)
|
||||
message(STATUS "Copy After Build" )
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
add_custom_command(TARGET ${claptarget} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Installing ${products_folder}/${product_name}.clap to ~/Library/Audio/Plug-Ins/CLAP/"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "~/Library/Audio/Plug-Ins/CLAP"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${products_folder}/${product_name}.clap" "~/Library/Audio/Plug-Ins/CLAP/${product_name}.clap"
|
||||
)
|
||||
endif()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
add_custom_command(TARGET ${claptarget} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Installing ${products_folder}/${product_name}.clap"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "~/.clap"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${products_folder}/${product_name}.clap" "~/.clap/"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
9
deps/clap-juce-extensions/LICENSE.md
vendored
Normal file
9
deps/clap-juce-extensions/LICENSE.md
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
Copyright 2019-2020, Paul Walker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
171
deps/clap-juce-extensions/README.md
vendored
Normal file
171
deps/clap-juce-extensions/README.md
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
# JUCE6 and 7 Unofficial CMake Clap Plugin Support
|
||||
|
||||
This is a set of code which, combined with a JUCE6 or JUCE 7 CMake plugin project, allows you to build a CLAP plugin. It
|
||||
is licensed under the MIT license, and can be used for both open and closed source projects.
|
||||
|
||||
We are labeling it 'unofficial' for four reasons
|
||||
|
||||
1. It is not supported by the JUCE team,
|
||||
2. There are some JUCE features which we have not translated to CLAP yet,
|
||||
3. It presents a set of completely optional extensions which break JUCE abstractions to allow extended CLAP feature
|
||||
support and
|
||||
4. It does not support JUCE-based CLAP hosting
|
||||
|
||||
Despite those caveats, the basic use of this library has allowed a wide variety
|
||||
of synths and effects to generate a CLAP from their JUCE program, including Surge, B-Step,
|
||||
Monique, several ChowDSP plugins, Dexed and more.
|
||||
|
||||
By far the best solution for CLAP in JUCE would be full native support by the JUCE team. Until such a time as that
|
||||
happens (and it may never happen), this code may help you if you have a JUCE plugin and want to generate a CLAP. We are
|
||||
happy to merge changes and answer questions as you try to use it. Please feel free to raise github issues in this repo.
|
||||
|
||||
This version is based off of CLAP 1.0 and generates plugins which work in BWS 4.3beta5 and later, as well as
|
||||
other CLAP 1.0 DAWs such as MultitrackStudio.
|
||||
|
||||
## Basics: Using these extensions to build a CLAP
|
||||
|
||||
Given a starting point of a JUCE plugin using CMake which can build a VST3, AU, Standalone and so forth with
|
||||
`juce_plugin`, building a CLAP is a simple exercise of checking out this CLAP extension code
|
||||
somewhere in your dev environment, setting a few CMake variables, and adding a couple of lines to your CMake file.
|
||||
|
||||
The instructions are as follows:
|
||||
|
||||
1. Add `https://github.com/free-audio/clap-juce-extensions.git` as a submodule of your project, or otherwise make the
|
||||
source available to your cmake (CPM, side by side check out in CI, etc...).
|
||||
2. Load the `clap-juce-extension` in your CMake after you have loaded JUCE. For instance, you could do
|
||||
|
||||
```cmake
|
||||
add_subdirectory(libs/JUCE) # this is however you load juce
|
||||
add_subdirectory(libs/clap-juce-extensions EXCLUDE_FROM_ALL)
|
||||
```
|
||||
|
||||
3. Create your JUCE plugin as normal with flags and formats using the `juce_plugin` CMake function
|
||||
4. After your `juce_plugin` code, add the following lines (or similar)
|
||||
to your CMake (a list of pre-defined CLAP
|
||||
features can be found [here](https://github.com/free-audio/clap/blob/main/include/clap/plugin-features.h)):
|
||||
|
||||
```cmake
|
||||
clap_juce_extensions_plugin(TARGET my-target
|
||||
CLAP_ID "com.my-cool-plugs.my-target"
|
||||
CLAP_FEATURES instrument "virtual analog" gritty basses leads pads)
|
||||
```
|
||||
|
||||
5. Reload your CMake file and you will have a new target `my-target_CLAP` which will build a CLAP and leave
|
||||
it side-by-side with your AU, Standalone, VST3, and so forth. Load that CLAP into a DAW and give it a whirl!
|
||||
|
||||
## Risks of using this library
|
||||
|
||||
Using this library is, of course, not without risks. There could easily be bugs we haven't found and there are
|
||||
APIs we don't cover. We are happy to discuss, investigate, and work to fix any of those.
|
||||
|
||||
The biggest risk, though, involves JUCE team providing official support in a way which is fundamentally incompatible
|
||||
with these wrappers. As of this writing, the JUCE team has not committed to supporting CLAP in JUCE 7 or any future
|
||||
version, although they are aware of the project. But if the JUCE team did provide official future support, it is not
|
||||
clear that your CLAP plugin which resulted from their official support would work in the same way as the plugin
|
||||
generated by this library would.
|
||||
|
||||
There are a couple of mitigants to that risk.
|
||||
|
||||
Most importantly, in the three critical places a DAW interacts with a plugin - CLAP ID, parameter IDs, and state streaming -
|
||||
we have endeavoured to write in as JUCE-natural a way as possible.
|
||||
|
||||
1. The CLAP ID is just a CMake parameter, as we expect it would be in an official build.
|
||||
2. The parameter IDs we use uses the [internal JUCE hashing mechanism to generate
|
||||
our `uint32_t`](https://github.com/free-audio/clap-juce-extensions/blob/85bc0d56dc784a5f1271602db46f0748954b180e/src/wrapper/clap-juce-wrapper.cpp#L198)
|
||||
just like
|
||||
the [current VST3 wrapper does](https://github.com/juce-framework/JUCE/blob/2f980209cc4091a4490bb1bafc5d530f16834e58/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp#L585).
|
||||
3. Our stream implementation
|
||||
transparently [calls `AudioProcessor::setStateInformation` and `AudioProcessor::getStateInformation`](https://github.com/free-audio/clap-juce-extensions/blob/85bc0d56dc784a5f1271602db46f0748954b180e/src/wrapper/clap-juce-wrapper.cpp#L930)
|
||||
with no intervening
|
||||
modification of the stream.
|
||||
|
||||
While there is no guarantee that an official JUCE implementation, if it were to exist, would make these choices,
|
||||
it seems quite natural that it would, and in that case, your plugin would continue to work.
|
||||
|
||||
If, however, you use the extensions detailed below - which allows features outside of JUCE like note expressions,
|
||||
sample accurate automation, and polyphonic and non-destructive modulation - there is very little assurance we can
|
||||
give you that an official JUCE implementation, if it were to exist, would work with your code without modification,
|
||||
or even that it would support those features at all. That would leave such a synth (of which Surge is the primary
|
||||
example today) relying on these wrappers still.
|
||||
|
||||
## Major Missing API points
|
||||
|
||||
1. We have not tested any JUCE version earlier than 6.0.7, and plugins which use deprecated APIs may not work
|
||||
2. The [`AudioProcessor::WrapperType`](https://docs.juce.com/master/classAudioProcessor.html#a2e1b21b8831ac529965abffc96223dcf)
|
||||
API doesn't support CLAP. All CLAP plugins will define a `wrapperType` of `wrapperType_Undefined`. We do provide
|
||||
a workaround for using our extensions mechanism, below.
|
||||
3. Several parameter features - including discrete (stepped) parameters - don't translate from JUCE to CLAP
|
||||
in our adapter (although they are supported in the CLAP API of course). We would love a test plugin to help us
|
||||
resolve this.
|
||||
|
||||
## The Extensions API
|
||||
|
||||
There are a set of things which JUCE doesn't support which CLAP does. Rather than not support them in our
|
||||
plugins, we've decided to create an extensions API. These are a set of classes which your AudioProcessor can
|
||||
implement and, if it does, then the CLAP JUCE wrapper will call the associated functions.
|
||||
|
||||
The extension are in "include/clap-juce-extensions.h" and are documented there, but currently have
|
||||
three classes
|
||||
|
||||
- `clap_juce_extensions::clap_properties`
|
||||
- if you subclass this your AudioProcessor will have a collection of members which give you extra CLAP info
|
||||
- Most usefully, you get an `is_clap` member which is false if not a CLAP and true if it is, which works around
|
||||
the fact that our 'forkless' approach doesn't let us add a `AudioProcessor::WrapperType` to the JUCE API
|
||||
- `clap_juce_extensions::clap_extensions`
|
||||
- these are a set of advanced extensions which let you optionally interact more directly with the CLAP API
|
||||
and are mostly useful for advanced features like non-destructive modulation and note expression support
|
||||
- `clap_juce_extensions::clap_param_extensions`
|
||||
- If your AudioProcessorParameter subclass implements this API, you can share extended CLAP information on
|
||||
a parameter by parameter basis
|
||||
|
||||
As an example, here's how to use `clap_properties` to work around `AudioProcessor::WrapperType` being `Undefined` in the forkless
|
||||
CLAP approach
|
||||
|
||||
- `#include "clap-juce-extensions/clap-juce-extensions.h"`
|
||||
- Make your main plugin `juce::AudioProcessor` derive from `clap_juce_extensions::clap_properties`
|
||||
- Use the `is_clap` member variable to figure out the correct wrapper type.
|
||||
|
||||
Here's a minimal example:
|
||||
|
||||
```cpp
|
||||
#include <JuceHeader.h>
|
||||
#include "clap-juce-extensions/clap-juce-extensions.h"
|
||||
|
||||
class MyCoolPlugin : public juce::AudioProcessor,
|
||||
public clap_juce_extensions::clap_properties
|
||||
{
|
||||
String getWrapperTypeString()
|
||||
{
|
||||
if (wrapperType == wrapperType_Undefined && is_clap)
|
||||
return "CLAP";
|
||||
|
||||
return juce::AudioProcessor::getWrapperTypeDescription (wrapperType);
|
||||
}
|
||||
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
If you are interested in using these extensions, please consult the documentation in the
|
||||
[clap-juce-extensions header.](https://github.com/free-audio/clap-juce-extensions/blob/main/include/clap-juce-extensions/clap-juce-extensions.h)
|
||||
The [Surge XT Synthesizer](https://github.com/surge-synthesizer/surge) is a worked example of using many of these.
|
||||
We are also happy to discuss them - reach out in the issues here or in a shared discord server.
|
||||
|
||||
## Technical Detail: The "Forkless" approach
|
||||
|
||||
There's a couple of ways we could have gone adding experimental JUCE support. The way the LV2 extensions to JUCE work
|
||||
requires a forked JUCE which places LV2 support fully inside the JUCE ecosystem at the cost of maintaining a fork (and
|
||||
not allowing folks with their own forks to easily use LV2). We instead chose an 'out-of-JUCE' approach which has the
|
||||
following pros and cons
|
||||
|
||||
Pros:
|
||||
|
||||
* You can use any JUCE 6 or 7 / CMake method you want and don't need to use our branch.
|
||||
* We don't have to update our fork to pull latest JUCE features; you don't have to use our fork and choices to build
|
||||
your plugin.
|
||||
|
||||
Cons:
|
||||
|
||||
* The CMake API is not consistent. Rather than add "CLAP" as a plugin type, you need a couple of extra lines of CMake to
|
||||
activate your CLAP.
|
||||
* We cannot support the `AudioProcessor::WrapperType` API, as discussed above.
|
1
deps/clap-juce-extensions/clap-libs/clap
vendored
Submodule
1
deps/clap-juce-extensions/clap-libs/clap
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 84ad6fe9739d3070ed0eb05c24be303a899ab813
|
1
deps/clap-juce-extensions/clap-libs/clap-helpers
vendored
Submodule
1
deps/clap-juce-extensions/clap-libs/clap-helpers
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 2bb43c18788c689708ead6f127a2d75e772ab389
|
133
deps/clap-juce-extensions/include/clap-juce-extensions/clap-juce-extensions.h
vendored
Normal file
133
deps/clap-juce-extensions/include/clap-juce-extensions/clap-juce-extensions.h
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file contains interface extensions which allow your AudioProcessor or
|
||||
* AudioProcessorParameter to implement additional clap-specific API points, and then allows the
|
||||
* CLAP wrapper to detect those implementation points and activate advanced features beyond the base
|
||||
* JUCE model.
|
||||
*/
|
||||
|
||||
#ifndef SURGE_CLAP_JUCE_EXTENSIONS_H
|
||||
#define SURGE_CLAP_JUCE_EXTENSIONS_H
|
||||
|
||||
#include <clap/events.h>
|
||||
#include <clap/plugin.h>
|
||||
#include <clap/helpers/plugin.hh>
|
||||
|
||||
namespace clap_juce_extensions
|
||||
{
|
||||
/*
|
||||
* clap_properties contains simple properties about clap which you may want to use.
|
||||
*/
|
||||
struct clap_properties
|
||||
{
|
||||
clap_properties();
|
||||
virtual ~clap_properties() = default;
|
||||
|
||||
// The three part clap version
|
||||
static uint32_t clap_version_major, clap_version_minor, clap_version_revision;
|
||||
|
||||
// this will be true for the clap instance and false for all other flavors
|
||||
bool is_clap{false};
|
||||
|
||||
// this will be non-null in the process block of a clap where the DAW provides transport
|
||||
const clap_event_transport *clap_transport{nullptr};
|
||||
|
||||
// Internal implementation detail. Please disregard (and FIXME)
|
||||
static bool building_clap;
|
||||
};
|
||||
|
||||
/*
|
||||
* clap_extensions allows you to interact with advanced properties of the CLAP api.
|
||||
* The default implementations here mean if you implement clap_extensions and override
|
||||
* nothing, you get the same behaviour as if you hadn't implemented it.
|
||||
*/
|
||||
struct clap_extensions
|
||||
{
|
||||
/*
|
||||
* In some cases, there is no main input, and input 0 is not main. Allow your plugin
|
||||
* to advertise that. (This case is usually for synths with sidechains).
|
||||
*/
|
||||
virtual bool isInputMain(int input)
|
||||
{
|
||||
if (input == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* If you want to provide information about voice structure, as documented
|
||||
* in the voice-info clap extension.
|
||||
*/
|
||||
virtual bool supportsVoiceInfo() { return false; }
|
||||
virtual bool voiceInfoGet(clap_voice_info * /*info*/) { return false; }
|
||||
|
||||
/*
|
||||
* Do you want to receive note expression messages? Note that if you return true
|
||||
* here and don't implement supportsDirectProcess, the note expression messages will
|
||||
* be received and ignored.
|
||||
*/
|
||||
virtual bool supportsNoteExpressions() { return false; }
|
||||
|
||||
/*
|
||||
* The JUCE process loop makes it difficult to do things like note expressions,
|
||||
* sample accurate parameter automation, and other CLAP features. In most cases that
|
||||
* is fine, but for some use cases, a synth may want the entirety of the JUCE infrastructure
|
||||
* *except* the process loop. (Surge is one such synth).
|
||||
*
|
||||
* In this case, you can implement supportsDirectProcess to return true and then the clap
|
||||
* juce wrapper will skip most parts of the process loop (it will still set up transport
|
||||
* and deal with UI thread -> audio thread change events), and then call clap_direct_process.
|
||||
*
|
||||
* In this mode, it is the synth designer responsibility to implement clap_direct_process
|
||||
* side by side with AudioProcessor::processBlock to use the CLAP api and synth internals
|
||||
* directly.
|
||||
*/
|
||||
virtual bool supportsDirectProcess() { return false; }
|
||||
virtual clap_process_status clap_direct_process(const clap_process * /*process*/) noexcept
|
||||
{
|
||||
return CLAP_PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do I support the CLAP_NOTE_DIALECT_CLAP? And prefer it if so? By default this
|
||||
* is true if I support either note expressions, direct processing, or voice info,
|
||||
* but you can override it for other reasons also, including not liking that default.
|
||||
*
|
||||
* The strictest hosts will not send note expression without this dialect, and so
|
||||
* if you override this to return false, hosts may not give you NE or Voice level
|
||||
* modulators in clap_direct_process.
|
||||
*/
|
||||
virtual bool supportsNoteDialectClap(bool /* isInput */)
|
||||
{
|
||||
return supportsNoteExpressions() || supportsVoiceInfo() || supportsDirectProcess();
|
||||
}
|
||||
|
||||
virtual bool prefersNoteDialectClap(bool isInput) { return supportsNoteDialectClap(isInput); }
|
||||
};
|
||||
|
||||
/*
|
||||
* clap_param_extensions is intended to be applied to AudioParameter subclasses. When
|
||||
* asking your JUCE plugin for parameters, the clap wrapper will check if your parameter
|
||||
* implements the extensions and call the associated functions.
|
||||
*/
|
||||
struct clap_param_extensions
|
||||
{
|
||||
/*
|
||||
* Return true if this parameter should receive non-destructive
|
||||
* monophonic modulation rather than simple setValue when a DAW
|
||||
* initiated modulation changes. Requires you to implement
|
||||
* clap_direct_process
|
||||
*/
|
||||
virtual bool supportsMonophonicModulation() { return false; };
|
||||
|
||||
/*
|
||||
* Return true if this parameter should receive non-destructive
|
||||
* polyphonic modulation. As well as supporting the monophonic case
|
||||
* this also requires your process to return note end events when
|
||||
* voices are terminated.
|
||||
*/
|
||||
virtual bool supportsPolyphonicModulation() { return false; };
|
||||
};
|
||||
} // namespace clap_juce_extensions
|
||||
|
||||
#endif // SURGE_CLAP_JUCE_EXTENSIONS_H
|
15
deps/clap-juce-extensions/src/extensions/clap-juce-extensions.cpp
vendored
Normal file
15
deps/clap-juce-extensions/src/extensions/clap-juce-extensions.cpp
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Paul Walker on 12/19/21.
|
||||
//
|
||||
|
||||
#include "clap-juce-extensions/clap-juce-extensions.h"
|
||||
|
||||
namespace clap_juce_extensions
|
||||
{
|
||||
bool clap_properties::building_clap{false};
|
||||
uint32_t clap_properties::clap_version_major{0}, clap_properties::clap_version_minor{0},
|
||||
clap_properties::clap_version_revision{0};
|
||||
|
||||
clap_properties::clap_properties() : is_clap{building_clap} {}
|
||||
|
||||
} // namespace clap_juce_extensions
|
13
deps/clap-juce-extensions/src/wrapper/clap-juce-mac.mm
vendored
Normal file
13
deps/clap-juce-extensions/src/wrapper/clap-juce-mac.mm
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file allows our CLAP extension to load the objective
|
||||
* C extensions that JUCE uses to create a UI on mac in the
|
||||
* VST3 and VST implementations. Basically it provides the pair
|
||||
* of functions to attach our NSView to the parent window properly
|
||||
* from the juce editor. This code is maintained by the JUCE team
|
||||
* but we need to link it here also, so create this little stub
|
||||
* which (for this one file only) tells JUCE I'm a VST3 and makes
|
||||
* the objective C symbols available.
|
||||
*/
|
||||
|
||||
#define JucePlugin_Build_VST3 1
|
||||
#include "juce_audio_plugin_client/VST/juce_VST_Wrapper.mm"
|
1109
deps/clap-juce-extensions/src/wrapper/clap-juce-wrapper.cpp
vendored
Normal file
1109
deps/clap-juce-extensions/src/wrapper/clap-juce-wrapper.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user