diff --git a/.gitignore b/.gitignore index 5fb95eb..de73544 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build +vst3sdk Makefile CMakeCache.txt CMakeFiles diff --git a/CMakeLists.txt b/CMakeLists.txt index 533907a..a9f96c8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_COLOR_MAKEFILE ON) project(Fogpad) set(PROJECT_VERSION 1) set(target fogpad) -set(copyright "igorski.nl 2019-2023") +set(copyright "igorski.nl 2019-2024") set(major_version 1) set(minor_version 0) set(release_number 3) @@ -64,24 +64,23 @@ endif() list(APPEND CMAKE_MODULE_PATH "${VST3_SDK_ROOT}/cmake/modules") -include(SMTG_Global) +# include(SMTG_AAXSupport) include(SMTG_AddVST3Library) +include(SMTG_AddVST3Options) include(SMTG_Bundle) +include(SMTG_CoreAudioSupport) include(SMTG_ExportedSymbols) -include(SMTG_PrefixHeader) +include(SMTG_Global) include(SMTG_PlatformIOS) include(SMTG_PlatformToolset) -include(SMTG_CoreAudioSupport) -include(SMTG_AAXSupport) -include(SMTG_VstGuiSupport) +include(SMTG_PrefixHeader) include(SMTG_UniversalBinary) -include(SMTG_AddVST3Options) +include(SMTG_VstGuiSupport) ######################### # Steinberg VST sources # ######################### -set(VSTSDK_INCLUDE_DIR ${VST3_SDK_ROOT}) set(VSTSDK_PLUGIN_SOURCE ${VST3_SDK_ROOT}/public.sdk/source/common/commoniids.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/vstaudioeffect.cpp @@ -152,67 +151,23 @@ if(SMTG_CREATE_VST2_VERSION) endif() endif() - set(vst_resources "resource/background.png" "resource/version.png" ) set(vst_ui_descr "resource/plugin.uidesc") -############## -# Audio Unit # -############## - -if (JAMBA_ENABLE_AUDIO_UNIT) - set(JAMBA_TEST_CASES_DIR "${JAMBA_ROOT}/test/cpp") - set(JAMBA_TEST_CASES_SOURCES - ${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Collection/test-CircularBuffer.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Concurrent/test-concurrent.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Concurrent/test-concurrent_lockfree.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/test-Lerp.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/test-StringUtils.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Params/test-GUIParameters.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Params/test-ParamAware.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Views/test-CustomViewCreator.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Views/test-SelfContainedViewListener.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-AudioBuffers.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-AudioUtils.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-ParamConverters.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-SampleRateBasedClock.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-Utils.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-FastWriteMemoryStream.cpp - ${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-ReadOnlyMemoryStream.cpp - ) - - include(jamba.cmake) - set(CPP_SOURCES src) - - configure_file(${CPP_SOURCES}/version.h ${CMAKE_BINARY_DIR}/generated/version.h) - include_directories(${CMAKE_BINARY_DIR}/generated/) - - jamba_add_vst_plugin( - TARGET "${target}" - RELEASE_FILENAME "${target}.component" - TARGETS_PREFIX "jmb_" - VST_SOURCES "${vst_sources}" - UIDESC "${vst_ui_descr}" - RESOURCES "${vst_resources}" - TEST_CASE_SOURCES "${JAMBA_TEST_CASES_SOURCES}" - TEST_LINK_LIBRARIES "jamba" - ) - -else() - ####### # VST # ####### smtg_add_vst3plugin(${target} ${vst_sources}) +smtg_target_configure_version_file(${target}) ## include Steinberg libraries -set(steinberg_libs "base" "pluginterfaces" "sdk" "vstgui_support" "vstgui_uidescription" "vstgui") -include_directories(${VSTSDK_INCLUDE_DIR}) +set(steinberg_libs "base" "pluginterfaces" "sdk" "vstgui" "vstgui_support" "vstgui_uidescription") +include_directories(${VST3_SDK_ROOT}) foreach(lib IN ITEMS ${steinberg_libs}) if(UNIX) target_link_libraries(${target} PRIVATE ${VST3_SDK_ROOT}/build/lib/Release/lib${lib}.a) @@ -235,32 +190,9 @@ target_sources(${target} PRIVATE IF (APPLE) target_sources (${target} PRIVATE ${VST3_SDK_ROOT}/public.sdk/source/main/macmain.cpp - ${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_mac.mm ) if(XCODE) - if(SMTG_IOS_DEVELOPMENT_TEAM) - ## iOS plugin - set(target ${target}_ios) - smtg_add_ios_vst3plugin("${SMTG_CODE_SIGN_IDENTITY_IOS}" ${target} "${target}" "${vst_sources}") - set_target_properties(${target} PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER}) - target_link_libraries(${target} PRIVATE - base_ios - sdk_ios - "-framework UIKit" - "-framework CoreGraphics" - "-framework QuartzCore" - "-framework CoreText" - "-framework Accelerate" - "-framework ImageIO" - "-framework MobileCoreServices" - ) - target_sources(${target} PRIVATE - ${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_ios.mm - ) - else() - ## macOS plugin - target_link_libraries(${target} PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon") - endif() + target_link_libraries(${target} PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon") else() find_library(COREFOUNDATION_FRAMEWORK CoreFoundation) find_library(COCOA_FRAMEWORK Cocoa) @@ -322,7 +254,7 @@ endif() ## Include Windows specific libraries if(WIN) - target_sources (${target} PRIVATE + target_sources(${target} PRIVATE ${VST3_SDK_ROOT}/public.sdk/source/main/dllmain.cpp # ${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_win32.cpp ) @@ -335,9 +267,36 @@ smtg_target_add_plugin_resources(${target} ) if(APPLE) - smtg_target_set_bundle(${target} INFOPLIST "${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist" PREPROCESS) - # adding PkgInfo at root level makes plugin appear as a file instead of folder - smtg_target_add_plugin_resources(${target} RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" OUTPUT_SUBDIRECTORY "../") + ############## + # Audio Unit # + ############## + if (XCODE AND SMTG_CREATE_AU_VERSION) + message(STATUS "SMTG_CREATE_AU_VERSION is set. An Audio Unit version of the plug-in will be created.") + set(public_sdk_SOURCE_DIR ${VST3_SDK_ROOT}/public.sdk) + set(SMTG_ENABLE_AUV2_BUILDS true) + include(SMTG_AddVST3AuV2) + smtg_target_add_auv2(${target}-au + BUNDLE_NAME fogpad + BUNDLE_IDENTIFIER nl.igorski.fogpad.audiounit + INFO_PLIST_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/mac/au-info.plist + VST3_PLUGIN_TARGET fogpad + ) + # exposes Steinberg libs to the Audio Unit target + target_link_directories(${target}-au PRIVATE "${VST3_SDK_ROOT}/build/lib") + target_link_libraries(${target}-au + PUBLIC + ${steinberg_libs} + sdk_common + ) + else() + smtg_target_set_bundle(${target} INFOPLIST "${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist" PREPROCESS) + # adding PkgInfo at root level makes plugin appear as a file instead of folder + smtg_target_add_plugin_resources(${target} RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" OUTPUT_SUBDIRECTORY "../") + endif() + smtg_target_set_bundle(${target} + BUNDLE_IDENTIFIER "nl.igorski.${target}" + COMPANY_NAME "igorski.nl" + ) elseif(WIN) target_sources(${target} PRIVATE resource/plugin.rc) endif() @@ -353,26 +312,24 @@ if (SMTG_CREATE_VST2_VERSION) endif() endif() -endif() - ###################### # Installation paths # ###################### if(APPLE) - install(TARGETS ${target} - DESTINATION "$ENV{HOME}/Library/Audio/Plug-Ins/VST" - ) + install(TARGETS ${target} + DESTINATION "$ENV{HOME}/Library/Audio/Plug-Ins/VST" + ) elseif(WIN32) - install(TARGETS ${target} - DESTINATION "C:/Program Files (x86)/Common Files/VST3/" - ) + install(TARGETS ${target} + DESTINATION "C:/Program Files (x86)/Common Files/VST3/" + ) elseif(WIN) - install(TARGETS ${target} - DESTINATION "C:/Program Files/Common Files/VST3/" - ) + install(TARGETS ${target} + DESTINATION "C:/Program Files/Common Files/VST3/" + ) elseif(LINUX) - install(TARGETS ${target} - DESTINATION "/usr/lib/lxvst" - ) + install(TARGETS ${target} + DESTINATION "/usr/lib/lxvst" + ) endif() diff --git a/README.md b/README.md index aaa48e2..6e38f42 100644 --- a/README.md +++ b/README.md @@ -4,83 +4,60 @@ FogPad is a VST/AU plug-in which provides a reverb effect in which the reflectio If you require some inspiration, it is used pretty much all over the [Moult](https://songwhip.com/drosophelia/moult) EP by Drosophelia. Alternatively, you can [read what others say](https://bedroomproducersblog.com/2019/11/18/igorski-fogpad/). -## On compatibility - -### Build as VST 2.4 - -VST3 is great and all, but support across DAW's is poor (looking at a certain popular German product). You can however build as a VST2.4 plugin and enjoy it on a wider range of host platforms. - -However: as of SDK 3.6.11, Steinberg no longer packages the required _./pluginterfaces/vst2.x_-folder inside the vst3sdk folder. -If you wish to build a VST2 plugin, copying the folder from an older SDK version _could_ work (verified 3.6.9. _vst2.x_ folders to work with SDK 3.7.6), though be aware -that you _need a license to target VST2_. You can view [Steinbergs rationale on this decision here](https://www.steinberg.net/en/newsandevents/news/newsdetail/article/vst-2-coming-to-an-end-4727.html). +## Build instructions -Once your SDK is "setup" for VST2, simply uncomment the following line in _CMakeLists.txt_: +The project uses [CMake](https://cmake.org) to generate the Makefiles and has been built and tested on macOS, Windows 10 and Linux (Ubuntu). -``` -set(SMTG_CREATE_VST2_VERSION "Use VST2" ON) -``` +### Environment setup -And rename the generated plugin extension from _.vst3_ to _.vst_ (or _.dll_ on Windows). -Alternatively, pass "vst2" as an argument to the build.sh and build.bat files without having to edit the make file or rename the generated VST manually. E.g.: +Apart from requiring _CMake_ and a C(++) compiler such as _Clang_ or _MSVC_, the only other dependency is the [VST SDK from Steinberg](https://www.steinberg.net/en/company/developers.html) (the projects latest update requires SDK version 3.7.11). -``` -sh build.sh vst2 -``` +Be aware that prior to building the plugin, the Steinberg SDK needs to be built from source as well. -### Compiling for both 32-bit and 64-bit architectures +#### The simple way : installing a plugin-local version of the Steinberg SDK -Depending on your host software having 32-bit or 64-bit support (either Intel or M1), you can best compile for a wider range of architectures. To do so, -replace all invocations of _cmake_ in this README with the following: +You can instantly retrieve and build the SDK using the following commands. -**macOS:** +##### Installation on Unix: ``` -cmake -"DCMAKE_OSX_ARCHITECTURES=x86_64;arm64;i1386" .. +sh setup.sh --platform PLATFORM ``` -Which will allow you to compile a single, "fat" binary that supports all architectures (Intel, M1 and legacy 32-bit Intel). +Where optional flag _--platform_ can be either `mac` or `linux` (defaults to linux). -**Windows:** +##### Installation on Windows: ``` -cmake.exe -G "Visual Studio 16 2019" -A Win64 -S .. -B "build64" -cmake.exe --build build64 --config Release - -cmake.exe -G "Visual Studio 16 2019" -A Win32 -S .. -B "build32" -cmake.exe --build build32 --config Release +setup.bat ``` -Which is a little more cumbersome as you compile separate binaries for the separate architectures. - -Note that the above also needs to be done when building the Steinberg SDK (which for the Windows build implies that a separate build is created for each architecture). - -While macOS has been fully 64-bit for the past versions, building for 32-bit provides the best backward -compatibility for older OS versions. And musicians are known to keep working systems at the cost of not -running an up to date system... +This will create a (Git ignored) subfolder in this repository folder with a prebuilt Steinberg SDK. -## Build instructions +#### The flexible way : pointing towards an external SDK build / supporting VST2 -The project uses [CMake](https://cmake.org) to generate the Makefiles and has been built and tested on macOS, Windows 10 and Linux (Ubuntu). +If you wish to use a different SDK version (for instance to reuse an existing build elsewhere on your computer, for instance to +target VST2.4 builds), you can invoke all build scripts by providing the `VST3_SDK_ROOT` environment variable, like so: -### Environment setup - -Apart from requiring _CMake_ and a C(++) compiler such as _Clang_ or _MSVC_, the only other dependency is the [VST SDK from Steinberg](https://www.steinberg.net/en/company/developers.html) (the projects latest update requires SDK version 3.7.10+). +``` +VST3_SDK_ROOT=/path/to/prebuilt/VST3_SDK sh build.sh +``` -Be aware that prior to building the plugin, the Steinberg SDK needs to be built from source as well. Following Steinbergs guidelines, the build target should be a _/build_-subfolder of the _/vst3sdk_-folder. -To generate a release build of the library, execute the following commands from the root of the Steinberg SDK folder: +To first generate a release build of the SDK, execute the following commands from the root of the Steinberg SDK folder: ``` cd vst3sdk mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. -cmake --build . +cmake --build . --config Release ``` -The result being that _{VST3_SDK_ROOT}/build/lib/Release/_ will contain the Steinberg VST libraries required to build the plugin. -NOTE: Windows users need to append _--config Release_ to the last cmake (build) call as the build type must be defined during this step. +The result being that `{VST3_SDK_ROOT}/build/lib/Release/` will contain the Steinberg VST libraries required to build the plugin. + +In case you intend to build VST2 versions as well keep in mind that as of SDK 3.6.11, Steinberg no longer packages the required `/pluginterfaces/vst2.x`-folder inside the vst3sdk folder. If you wish to build a VST2 plugin, copying the folder from an older SDK version _could_ work (verified 3.6.9. `vst2.x` folders to work with SDK 3.7.11), though be aware that you _need a license to target VST2_. You can view [Steinbergs rationale on this decision here](https://helpcenter.steinberg.de/hc/en-us/articles/4409561018258-VST-2-Discontinued). -If you intend to build VST2 versions as well, run the following from the root of the Steinberg SDK folder (run the _.bat_ version instead of the _.sh_ version on Windows) prior to building the library: +To prepare for building VST2 versions of the plugin, run the following from the root of the Steinberg SDK folder (run the _.bat_ version instead of the _.sh_ version on Windows) prior to building the library: ``` ./copy_vst2_to_vst3_sdk.sh @@ -94,34 +71,83 @@ And if you are running Linux, you can easily resolve all dependencies by first r ### Building the plugin -Run CMake to generate the Makefile for your environment, after which you can compile the plugin using make. The build output will be stored in _./build/VST3/fogpad.vst3_ as well as symbolically linked to your systems VST-plugin folder (on Unix). +See the provided shell scripts. The build output will be stored in _./build/VST3/fogpad.vst3_ as well as symbolically linked to your systems VST-plugin folder (on Unix). -You must provide the path to the Steinberg SDK by providing _VST3_SDK_ROOT_ to CMake like so: +#### Compiling on Unix systems: ``` -cmake -DVST3_SDK_ROOT=/path/to/VST_SDK/vst3sdk/ .. +sh build.sh --type TYPE ``` -#### Compiling on Unix systems: +Where optional flag _--type_ can be either `vst3`, `vst2` or `au` (defaults to vst3)*. + +#### Compiling on Windows: + +Assuming the Visual Studio Build Tools have been installed: ``` -mkdir build -cd build -cmake -DVST3_SDK_ROOT=/path/to/VST_SDK/vst3sdk/ .. -make . +build.bat ``` -#### Compiling on Windows: +Where you can optionally append `vst2` to the command to build a VST 2* plugin. -Assuming the Visual Studio Build Tools have been installed: +_*As mentioned in the "setup" section, VST2 builds are not supported out-of-the-box._ + +## On compatibility + +### Compiling for both 32-bit and 64-bit architectures + +Depending on your host software having 32-bit or 64-bit support (the latter for either Intel or ARM), you can best compile for a wider range of architectures. To do so, updating the build shell scripts/batch files to contain the following: + +**macOS:** ``` -mkdir build -cd build -cmake.exe -G"Visual Studio 16 2019" -DVST3_SDK_ROOT=/path/to/VST_SDK/vst3sdk/ .. -cmake.exe --build . +cmake -"DCMAKE_OSX_ARCHITECTURES=x86_64;arm64;i1386" .. +``` + +Which will allow you to compile a single, "fat" binary that supports all architectures (Intel, ARM and legacy 32-bit Intel). Note +that by default compilation is for 64-bit architecture for both Intel and ARM CPU's, _you can likely ignore this section_. + +**Windows:** + +``` +cmake.exe -G "Visual Studio 16 2019" -A Win64 -S .. -B "build64" +cmake.exe --build build64 --config Release + +cmake.exe -G "Visual Studio 16 2019" -A Win32 -S .. -B "build32" +cmake.exe --build build32 --config Release +``` + +Which is a little more cumbersome as you compile separate binaries for the separate architectures. + +Note that the above also needs to be done when building the Steinberg SDK (which for the Windows build implies that a separate build is created for each architecture). + +While macOS has been fully 64-bit for the past versions, building for 32-bit provides the best backward +compatibility for older OS versions. And musicians are known to keep working systems at the cost of not +running an up to date system... _still, you can likely ignore this section_. + +### Build as Audio Unit (macOS only) + +For this you will need a little extra preparation while building Steinberg SDK as you will need the +"[CoreAudio SDK](https://developer.apple.com/library/archive/samplecode/CoreAudioUtilityClasses/Introduction/Intro.html)" and XCode. Execute the following instructions to build the SDK with Audio Unit support, +replace the value for `SMTG_COREAUDIO_SDK_PATH` with the actual installation location of the CoreAudio SDK: + +``` +sh setup.sh --platform mac --coresdk /path/to/CoreAudioUtilityClasses/CoreAudio ``` +After which you can run the build script like so: + +``` +sh build.sh --type au --coresdk /path/to/CoreAudioUtilityClasses/CoreAudio +``` + +The Audio Unit component will be located in `~/Library/Audio/Plug-Ins/Components/fogpad.component` + +You can validate the Audio Unit using Apple's _auval_ utility, by running _auval -v aufx rvb2 IGOR_ on the command line. Note that there is the curious behaviour that you might need to reboot before the plugin shows up, though you can force a flush of the Audio Unit cache at runtime by running _killall -9 AudioComponentRegistrar_. + +In case of errors you can look for instances of [kAudioUnitErr](https://www.osstatus.com/search/results?platform=all&framework=all&search=kaudiouniterr) + ### Running the plugin You can copy the build output into your system VST(3) folder and run it directly in a VST host / DAW of your choice. @@ -133,19 +159,16 @@ When debugging, you can also choose to run the plugin against Steinbergs validat {VST3_SDK_ROOT}/build/bin/editorhost build/VST3/fogpad.vst3 ``` -### Build as Audio Unit (macOS only) - -Is aided by the excellent [Jamba framework](https://github.com/pongasoft/jamba) by Pongasoft, which provides a toolchain around Steinbergs SDK. Execute the following instructions to build Fogpad as an Audio Unit: +### Signing the plugin on macOS -* Build the AUWrapper Project in the Steinberg SDK folder -* Create a Release build of the Xcode project generated in step 1, this creates _VST3_SDK/public.sdk/source/vst/auwrapper/build/lib/Release/libauwrapper.a_ -* Run _sh build_au.sh_ from the repository root, providing the path to _VST3_SDK_ROOT_ as before: +You will need to have your code signing set up appropriately. Assuming you have set up your Apple Developer account appropriately, you can find your sign identity like so: ``` -VST3_SDK_ROOT=/path/to/VST_SDK/vst3sdk sh build_au.sh +security find-identity -p codesigning -v ``` -The subsequent Audio Unit component will be located in _./build/VST3/fogpad.component_ as well as linked -in _~/Library/Audio/Plug-Ins/Components/_ +From which you can take your name and team id and pass them to the build script like so: -You can validate the Audio Unit using Apple's _auval_ utility, by running _auval -v aufx frmt IGOR_ on the command line. Note that there is the curious behaviour that you might need to reboot before the plugin shows up, though you can force a flush of the Audio Unit cache at runtime by running _killall -9 AudioComponentRegistrar_. +``` +sh build.sh --team_id TEAM_ID --identity "YOUR_NAME" +``` diff --git a/audio-unit/Info.plist b/audio-unit/Info.plist deleted file mode 100644 index 021366d..0000000 --- a/audio-unit/Info.plist +++ /dev/null @@ -1,109 +0,0 @@ -//----------------------------------------------------------------------------- -// LICENSE -// (c) 2018, Steinberg Media Technologies GmbH, All Rights Reserved -//----------------------------------------------------------------------------- -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Steinberg Media Technologies nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -// OF THE POSSIBILITY OF SUCH DAMAGE. -//----------------------------------------------------------------------------- - -#include "audiounitconfig.h" - - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - kAudioUnitBundleIdentifier - CFBundleName - $(PRODUCT_NAME) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - CSResourcesFileMapped - yes - - /* - The "AudioUnit SupportedNumChannels" key is only necessary if you build an effect not an instrument. - You should describe all supported channel configurations. - This example says that it supports Stereo/Stereo or Mono/Mono. - */ - - AudioUnit SupportedNumChannels - - - Outputs - 2 - Inputs - 2 - - - Outputs - 0 - Inputs - 1 - - - Outputs - 1 - Inputs - 1 - - - - AudioUnit Version - kAudioUnitVersion - - /* - Support for the new AUPlugIn model in Mac OS X 10.7 - */ - AudioComponents - - - description - kAUPluginDescription - factoryFunction - AUWrapperFactory - manufacturer - kAUPluginManufacturer - name - kAUPluginName - subtype - kAUPluginSubType - type - kAUPluginType - version - kAudioUnitVersion - - - - - \ No newline at end of file diff --git a/audio-unit/audiounitconfig.h b/audio-unit/audiounitconfig.h deleted file mode 100644 index 0e1454c..0000000 --- a/audio-unit/audiounitconfig.h +++ /dev/null @@ -1,39 +0,0 @@ -#define PLATFORM_64 true - -#include "version.h" - -// Check https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/AudioUnit.html for various types - -/* Bundle Identifier */ -#define kAudioUnitBundleIdentifier nl.igorski.vst.fogpad.audiounit - -/* Version Number (needs to be in hex) */ -#define kAudioUnitVersion 0x00010000 - -/* Company Name + Effect Name */ -#define kAUPluginName igorski: FogPad - -/* A product name for the audio unit, such as TremoloUnit */ -#define kAUPluginDescription FogPad - -/* - The specific variant of the Audio Unit. The four possible types and their values are: - Effect (aufx), Generator (augn), Instrument (aumu), and Music Effect (aufm). - */ -#define kAUPluginType aufx - -/* A subtype code for the audio unit, such as tmlo. This value must be exactly 4 alphanumeric characters. */ -#define kAUPluginSubType rvb2 - -/* A manufacturer code for the audio unit, such as Aaud. This value must be exactly 4 alphanumeric characters. - * Manufacturer OSType should have at least one non-lower case character */ -#define kAUPluginManufacturer IGOR - -// Definitions for the resource file -#define kAudioUnitName "igorski: FogPad" // same as kAUPluginName -#define kAudioUnitDescription "FogPad" // same as kAUPluginDescription -#define kAudioUnitType 'aufx' // same as kAUPluginType -#define kAudioUnitComponentSubType 'rvb2' // same as kAUPluginSubType -#define kAudioUnitComponentManuf 'IGOR' // same as kAUPluginManufacturer - -#define kAudioUnitCarbonView 1 // if 0 no Carbon view support will be added diff --git a/build.sh b/build.sh index 8e88e46..0c1e51a 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,16 @@ #!/usr/bin/env bash clear + +# get current working directory + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +SOURCE="$(readlink "$SOURCE")" +[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + echo "Flushing build caches and output folders" rm -rf build echo "Creating build folders" @@ -11,23 +22,70 @@ echo "----------------" # env variable for VST3_SDK_ROOT set ? pass it to CMake configuration if [ -n "${VST3_SDK_ROOT}" ]; then - DVST3_SDK_ROOT="-DVST3_SDK_ROOT=${VST3_SDK_ROOT}" + DVST3_SDK_ROOT=${VST3_SDK_ROOT} +else + DVST3_SDK_ROOT="${BASEDIR}/vst3sdk" fi +echo "Building using VST3 SDK located at ${DVST3_SDK_ROOT}" + +type="vst3" + +# Parse arguments + +while [[ "$#" -gt 0 ]]; do + case $1 in + --type) type="$2"; shift ;; + --team_id) team_id="$2"; shift ;; + --identity) identity="$2"; shift ;; + --coresdk) coresdk="$2"; shift ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift +done + # flag to build as VST2 supplied ? pass it to CMake configuration -if [ "$1" == "vst2" ]; then - SMTG_CREATE_VST2_VERSION="-DSMTG_CREATE_VST2_VERSION=ON" +if [ "$type" == "vst2" ]; then + FLAGS="-DSMTG_CREATE_VST2_VERSION=ON" +elif [ "$type" == "au" ]; then + if [ -z "$coresdk" ]; then + echo "Path to CoreAudio SDK not supplied, usage: build.sh --type au --coresdk PATH_TO_CORE_AUDIO_SDK" + exit 1 + fi + FLAGS="-GXcode -DSMTG_CREATE_AU_VERSION=ON -DSMTG_COREAUDIO_SDK_PATH=$coresdk" fi -cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" ${SMTG_CREATE_VST2_VERSION} ${DVST3_SDK_ROOT} .. -make +if [ -z "$identity" ]; then + cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DVST3_SDK_ROOT=${DVST3_SDK_ROOT} ${FLAGS} .. +else + echo "Plugin will be signed using ${identity}" + cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DVST3_SDK_ROOT=${DVST3_SDK_ROOT} ${FLAGS} -DSMTG_IOS_DEVELOPMENT_TEAM=${team_id} "-DSMTG_CODE_SIGN_IDENTITY_MAC=${identity}" .. +fi +cmake --build . --config Release buildStatus=$? if [ $buildStatus -eq 0 ]; then - if [ "$1" == "vst2" ]; then - mv ./VST3/fogpad.vst3 ./VST3/fogpad.vst + FILE="./VST3/fogpad.vst3" + + # code signing (macOS) + + if [ "$identity" ]; then + if [ "$type" == "au" ]; then + FILE="~/Library/Audio/Plug-Ins/Components/fogpad.component" + fi + codesign -s "${identity}" "${FILE}" --timestamp --deep --strict --options=runtime --force + codesign --verify --deep --verbose "${FILE}" + fi + + # VST2/AU specific operations + + if [ "$type" == "vst2" ]; then + mv "${FILE}" ./VST3/fogpad.vst + elif [ "$type" == "au" ]; then + killall -9 AudioComponentRegistrar + auval -v aufx rvb2 IGOR fi echo "Plugin built successfully" else diff --git a/build_au.sh b/build_au.sh deleted file mode 100644 index eaa0844..0000000 --- a/build_au.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -clear -echo "Flushing build caches and output folders" -rm -rf build -echo "Building project" -echo "----------------" - -# from http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" -done -BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -mkdir -p build -cd build - -if [ -n "${VST3_SDK_ROOT}" ]; then - DVST3_SDK_ROOT="-DVST3_SDK_ROOT=${VST3_SDK_ROOT}" -fi - -cmake -GXcode ${DVST3_SDK_ROOT} -DJAMBA_ENABLE_AUDIO_UNIT=ON ${BASEDIR} - -# build Audio Unit using Jamba in Release mode - -sh jamba.sh build-au -r -sh jamba.sh install-au - -cd .. diff --git a/mac/au-info.plist b/mac/au-info.plist new file mode 100644 index 0000000..76bd2f0 --- /dev/null +++ b/mac/au-info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleName + $(PRODUCT_NAME) + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + AudioComponents + + + factoryFunction + AUWrapperFactory + description + $(PRODUCT_NAME) + manufacturer + IGOR + name + igorski: Fogpad + subtype + rvb2 + type + aufx + version + 65539 + + + AudioUnit SupportedNumChannels + + + Outputs + 2 + Inputs + 2 + + + Outputs + 0 + Inputs + 1 + + + Outputs + 1 + Inputs + 1 + + + + diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..fc4bda0 --- /dev/null +++ b/setup.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +clear + +echo "Retrieving Steinberg VST3 SDK..." +git clone --recursive https://github.com/steinbergmedia/vst3sdk.git --branch v3.7.11_build_10 + +echo "--------------------------------" +echo "Setting up Steinberg VST3 SDK..." + +cd vst3sdk +rm -rf build +mkdir build +cd build + +echo "---------------------" + +# Parse arguments + +while [[ "$#" -gt 0 ]]; do + case $1 in + --platform) platform="$2"; shift ;; + --coresdk) coresdk="$2"; shift ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift +done + +if [ "$platform" == "mac" ]; then + echo "Building for macOS..." + if [ "$coresdk" ]; then + echo "Building with CoreAudio support. Library specified to be at $coresdk" + FLAGS="-DSMTG_COREAUDIO_SDK_PATH=$coresdk" + fi + cmake -GXcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ${FLAGS} .. +else + echo "Building for Linux..." + make +fi + +cmake --build . --config Release