diff --git a/src/.vst3_tutorials/README.md b/src/.vst3_tutorials/README.md index a035a4aa..8e011a66 100644 --- a/src/.vst3_tutorials/README.md +++ b/src/.vst3_tutorials/README.md @@ -5,6 +5,7 @@ Here, you will find VST 3 tutorial projects You can find the tutorials in the Readme files of the following sub-directories: - [Advanced Techniques Tutorial](advanced-techniques-tutorial/) +- [Audio Unit Tutorial](audiounit-tutorial/) - [Data Exchange Tutorial](dataexchange-tutorial/) ---- diff --git a/src/.vst3_tutorials/advanced-techniques-tutorial/CMakeLists.txt b/src/.vst3_tutorials/advanced-techniques-tutorial/CMakeLists.txt index 9e6ab2df..991314c6 100644 --- a/src/.vst3_tutorials/advanced-techniques-tutorial/CMakeLists.txt +++ b/src/.vst3_tutorials/advanced-techniques-tutorial/CMakeLists.txt @@ -10,7 +10,7 @@ project(advanced-techniques-tutorial # Version number symbols usable in C++ can be found in # source/version.h and ${PROJECT_BINARY_DIR}/projectversion.h. VERSION 1.0.0.0 - DESCRIPTION "advanced-techniques-tutorial VST 3 Plug-in" + DESCRIPTION "advanced-techniques-tutorial VST 3 plug-in" ) set(SMTG_ENABLE_VST3_HOSTING_EXAMPLES 0) diff --git a/src/.vst3_tutorials/audiounit-tutorial/.gitignore b/src/.vst3_tutorials/audiounit-tutorial/.gitignore new file mode 100644 index 00000000..567609b1 --- /dev/null +++ b/src/.vst3_tutorials/audiounit-tutorial/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/src/.vst3_tutorials/audiounit-tutorial/CMakeLists.txt b/src/.vst3_tutorials/audiounit-tutorial/CMakeLists.txt new file mode 100644 index 00000000..a743863d --- /dev/null +++ b/src/.vst3_tutorials/audiounit-tutorial/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required(VERSION 3.14.0) + +option(SMTG_ENABLE_VST3_PLUGIN_EXAMPLES "Enable VST 3 Plug-in Examples" OFF) +option(SMTG_ENABLE_VST3_HOSTING_EXAMPLES "Enable VST 3 Hosting Examples" OFF) + +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "") + +set(vst3sdk_SOURCE_DIR "../../") +if(NOT vst3sdk_SOURCE_DIR) + message(FATAL_ERROR "Path to VST3 SDK is empty!") +endif() + +project(VST3_AU_PlugIn + # This is your plug-in version number. Change it here only. + # Version number symbols usable in C++ can be found in + # source/version.h and ${PROJECT_BINARY_DIR}/projectversion.h. + VERSION 1.2.1.8 + DESCRIPTION "VST3_AU_PlugIn VST 3 Plug-in" +) + +# -- AudioUnitSDK -- +include(FetchContent) +FetchContent_Declare( + AudioUnitSDK + GIT_REPOSITORY https://github.com/apple/AudioUnitSDK.git + GIT_TAG HEAD +) +FetchContent_MakeAvailable(AudioUnitSDK) +FetchContent_GetProperties( + AudioUnitSDK + SOURCE_DIR SMTG_AUDIOUNIT_SDK_PATH +) +# ------------------- + +set(SMTG_VSTGUI_ROOT "${vst3sdk_SOURCE_DIR}") + +add_subdirectory(${vst3sdk_SOURCE_DIR} ${PROJECT_BINARY_DIR}/vst3sdk) +smtg_enable_vst3_sdk() + +smtg_add_vst3plugin(VST3_AU_PlugIn + source/version.h + source/cids.h + source/processor.h + source/processor.cpp + source/controller.h + source/controller.cpp + source/entry.cpp +) + +#- VSTGUI Wanted ---- +if(SMTG_ENABLE_VSTGUI_SUPPORT) + target_sources(VST3_AU_PlugIn + PRIVATE + resource/editor.uidesc + ) + target_link_libraries(VST3_AU_PlugIn + PRIVATE + vstgui_support + ) + smtg_target_add_plugin_resources(VST3_AU_PlugIn + RESOURCES + "resource/editor.uidesc" + ) +endif(SMTG_ENABLE_VSTGUI_SUPPORT) +# ------------------- + +smtg_target_add_plugin_snapshots (VST3_AU_PlugIn + RESOURCES + resource/301DF339AFA3533FB5053B1B41367137_snapshot.png + resource/301DF339AFA3533FB5053B1B41367137_snapshot_2.0x.png +) + +target_link_libraries(VST3_AU_PlugIn + PRIVATE + sdk +) + +smtg_target_configure_version_file(VST3_AU_PlugIn) + +if(SMTG_MAC) + smtg_target_set_bundle(VST3_AU_PlugIn + BUNDLE_IDENTIFIER com.steinberg.vst3sdk.audiounit-tutorial + COMPANY_NAME "Steinberg Media Technologies" + ) + smtg_target_set_debug_executable(VST3_AU_PlugIn + "/Applications/VST3PluginTestHost.app" + "--pluginfolder;$(BUILT_PRODUCTS_DIR)" + ) +elseif(SMTG_WIN) + target_sources(VST3_AU_PlugIn PRIVATE + resource/win32resource.rc + ) + if(MSVC) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT VST3_AU_PlugIn) + + smtg_target_set_debug_executable(VST3_AU_PlugIn + "$(ProgramW6432)/Steinberg/VST3PluginTestHost/VST3PluginTestHost.exe" + "--pluginfolder \"$(OutDir)/\"" + ) + endif() +endif(SMTG_MAC) + +# -- Add the AUv2 target +if (SMTG_MAC AND XCODE AND SMTG_ENABLE_AUV2_BUILDS) + list(APPEND CMAKE_MODULE_PATH "${vst3sdk_SOURCE_DIR}/cmake/modules") + include(SMTG_AddVST3AuV2) + smtg_target_add_auv2(VST3_AU_PlugIn_AU + BUNDLE_NAME audiounit_tutorial + BUNDLE_IDENTIFIER com.steinberg.vst3sdk.audiounit_tutorial.audiounit + INFO_PLIST_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/resource/au-info.plist + VST3_PLUGIN_TARGET VST3_AU_PlugIn) + smtg_target_set_debug_executable(VST3_AU_PlugIn_AU "/Applications/Reaper.app") +endif(SMTG_MAC AND XCODE AND SMTG_ENABLE_AUV2_BUILDS) + diff --git a/src/.vst3_tutorials/audiounit-tutorial/README.md b/src/.vst3_tutorials/audiounit-tutorial/README.md new file mode 100644 index 00000000..6b1b263f --- /dev/null +++ b/src/.vst3_tutorials/audiounit-tutorial/README.md @@ -0,0 +1,140 @@ +# AudioUnit Version 2 Tutorial + +In this tutorial you will learn how to add AudioUnit Version 2 support to your **VST 3** plug-in. + +First of all, you need a **VST 3** plug-in project. For this tutorial we have generated one via the [VST 3 Project Generator](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Project+Generator.html) from the SDK. + +# Adding the AudioUnit Version 2 Target + +## Obtaining the required AudioUnit SDK + +The *AudioUnit Version 2* target needs the official *AudioUnit SDK* from Apple. +As of this writing you can find it on GitHub: [https://github.com/apple/AudioUnitSDK](https://github.com/apple/AudioUnitSDK) + +How you obtain and store the SDK is up to you, for the reproducibility of this tutorial, we will download it via *CMake* when generating the project. +So we add the following text to the *CMakeLists.txt* directly before we include the **VST 3 SDK**. + +``` +include(FetchContent) +FetchContent_Declare( + AudioUnitSDK + GIT_REPOSITORY https://github.com/apple/AudioUnitSDK.git + GIT_TAG HEAD +) +FetchContent_MakeAvailable(AudioUnitSDK) +FetchContent_GetProperties( + AudioUnitSDK + SOURCE_DIR SMTG_AUDIOUNIT_SDK_PATH +) +``` + +It is important to set the `SMTG_AUDIOUNIT_SDK_PATH` variable to tell the **VST 3 SDK** where to find the AudioUnit SDK. + +## Creating the property list + +For *AudioUnit Version 2* you need a manufacturer OSType registered with Apple. +How to do this is out of the scope for this tutorial, please search the web on how this is done. + +Besides the manufacturer OSType you also need a subtype OSType which you can choose by yourself. +Both the manufacturer and subtype account for the uniqueness of your *AudioUnit Version 2*. + +Now you can generate the required property list file: + +``` + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleName + $(PRODUCT_NAME) + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CSResourcesFileMapped + yes + AudioComponents + + + factoryFunction + AUWrapperFactory + description + AudioUnit Tutorial + manufacturer + Stgb + name + Steinberg: AudioUnit Tutorial + subtype + 0002 + type + aufx + version + 1 + + + + +``` + +Make sure to change the strings for `description`, `manufacturer`, `name`, `subtype` and `type`. +The type must be one of: +- aufx (Audio Effect) +- aumu (Instrument) +- aumf (Audio Effect with MIDI Input/Output) + +If you build an audio effect you also need to add the supported channel layouts to the list: + +``` +AudioUnit SupportedNumChannels + + + Outputs + 2 + Inputs + 2 + + + Outputs + 2 + Inputs + 1 + + + Outputs + 1 + Inputs + 1 + + +``` + +Save it to a file called `au-info.plist` inside the resource directory. + +## Adding the AudioUnit Version 2 Target + +Now you can add the AudioUnit target to the end of your *CMakeLists.txt* file: + +``` +if (SMTG_MAC AND XCODE AND SMTG_COREAUDIO_SDK_PATH) + list(APPEND CMAKE_MODULE_PATH "${vst3sdk_SOURCE_DIR}/cmake/modules") + include(SMTG_AddVST3AuV2) + smtg_target_add_auv2(VST3_AU_PlugIn_AU + BUNDLE_NAME audiounit_tutorial + BUNDLE_IDENTIFIER com.steinberg.vst3sdk.audiounit_tutorial.audiounit + INFO_PLIST_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/resource/au-info.plist + VST3_PLUGIN_TARGET VST3_AU_PlugIn) + smtg_target_set_debug_executable(VST3_AU_PlugIn_AU "/Applications/Reaper.app") +endif(SMTG_MAC AND XCODE AND SMTG_COREAUDIO_SDK_PATH) +``` + +Now after generating and building the project the "audiounit_tutorial" plug-in should be available in any AudioUnit host. diff --git a/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot.png b/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot.png new file mode 100644 index 00000000..76d08453 Binary files /dev/null and b/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot.png differ diff --git a/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot_2.0x.png b/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot_2.0x.png new file mode 100644 index 00000000..5d62236e Binary files /dev/null and b/src/.vst3_tutorials/audiounit-tutorial/resource/301DF339AFA3533FB5053B1B41367137_snapshot_2.0x.png differ diff --git a/src/.vst3_tutorials/audiounit-tutorial/resource/au-info.plist b/src/.vst3_tutorials/audiounit-tutorial/resource/au-info.plist new file mode 100644 index 00000000..a274374c --- /dev/null +++ b/src/.vst3_tutorials/audiounit-tutorial/resource/au-info.plist @@ -0,0 +1,64 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleName + $(PRODUCT_NAME) + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CSResourcesFileMapped + yes + AudioComponents + + + factoryFunction + AUWrapperFactory + description + AudioUnit Tutorial + manufacturer + Stgb + name + Steinberg: AudioUnit Tutorial + subtype + 0002 + type + aufx + version + 1 + + + AudioUnit SupportedNumChannels + + + Outputs + 2 + Inputs + 2 + + + Outputs + 2 + Inputs + 1 + + + Outputs + 1 + Inputs + 1 + + + + diff --git a/src/.vst3_tutorials/audiounit-tutorial/resource/editor.uidesc b/src/.vst3_tutorials/audiounit-tutorial/resource/editor.uidesc new file mode 100644 index 00000000..060e064c --- /dev/null +++ b/src/.vst3_tutorials/audiounit-tutorial/resource/editor.uidesc @@ -0,0 +1,9 @@ + + + + + + +