Hi, my issue is basically what the title says. I’m not exactly sure what’s going on, but even though my CMake build is successful, the buffer’s magnitude in processBlock is 0, which is odd since the plugin/standalone app works fine when I build it in vs2022. The odd thing is that the settings page in the standalone app does detect the input, its just the main area that doesn’t work. I’m a bit new to CMake with JUCE, maybe there’s something wrong in my CMakeLists? Here it is:
# To get started on a new plugin, copy this entire folder (containing this file and C++ sources) to
# a convenient location, and then start making modifications.
# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks
# that the installed CMake will be able to understand the following CMakeLists, and ensures that
# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more
# information can be found in the CMake docs.
cmake_minimum_required(VERSION 3.22)
# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the
# `project()` command. `project()` sets up some helpful variables that describe source/binary
# directories, and the current project version. This is a standard CMake command.
project(Waveshaper_vstplugin VERSION 0.0.1)
set(CPM_DOWNLOAD_VERSION 0.34.0)
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
if (NOT EXISTS ${CPM_DOWNLOAD_LOCATION})
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
endif ()
include(${CPM_DOWNLOAD_LOCATION})
# Bring in JUCE locally
CPMAddPackage(
NAME juce
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG origin/master
)
# If you've installed JUCE somehow (via a package manager, or directly using the CMake install
# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
# include that subdirectory as part of the build.
# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
# or
# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE
# If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your
# system. This setup should be done before calling `juce_add_plugin`.
# juce_set_vst2_sdk_path(...)
# juce_set_aax_sdk_path(...)
# `juce_add_plugin` adds a static library target with the name passed as the first argument
# (AudioPluginExample here). This target is a normal CMake target, but has a lot of extra properties set
# up by default. As well as this shared code static library, this function adds targets for each of
# the formats specified by the FORMATS arguments. This function accepts many optional arguments.
# Check the readme at `docs/CMake API.md` in the JUCE repo for the full list.
juce_add_plugin(${PROJECT_NAME}
COMPANY_NAME waveshaper
# VERSION ... # Set this if the plugin version is different to the project version
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
# ICON_SMALL ...
# COMPANY_NAME ... # Specify the name of the plugin's author
IS_SYNTH FALSE # Is this a synth or an effect?
NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input?
NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output?
IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect?
EDITOR_WANTS_KEYBOARD_FOCUS FALSE # Does the editor need keyboard focus?
COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building?
PLUGIN_MANUFACTURER_CODE Juce # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE Dem0 # A unique four-character plugin id with exactly one upper-case character
# GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case
FORMATS VST3 AU Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PRODUCT_NAME "Waveshaper AI") # The name of the final executable, which can differ from the target name
# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated
# into your build tree. This should be included with `#include <JuceHeader.h>`. The include path for
# this header will be automatically added to the target. The main function of the JuceHeader is to
# include all your JUCE module headers; if you're happy to include module headers directly, you
# probably don't need to call this.
juce_generate_juce_header(${PROJECT_NAME})
# `target_sources` adds source files to a target. We pass the target that needs the sources as the
# first argument, then a visibility parameter for the sources which should normally be PRIVATE.
# Finally, we supply a list of source files that will be built into the target. This is a standard
# CMake command.
target_sources(${PROJECT_NAME} PRIVATE
Source/Dial.cpp
Source/JsonConfigRead.cpp
Source/MainPage.cpp
Source/PluginEditor.cpp
Source/PluginProcessor.cpp
Source/WSLookAndFeel.cpp
Source/WSVUMeter.cpp
Source/Dial.hpp
Source/JsonConfigRead.h
Source/MainPage.hpp
Source/PluginEditor.h
Source/PluginProcessor.h
Source/WSLookAndFeel.hpp
Source/WSVUMeter.hpp
)
# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
# of compile definitions to switch certain features on/off, so if there's a particular feature you
# need that's not on by default, check the module header for the correct flag to set here. These
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.
target_compile_definitions(${PROJECT_NAME}
PUBLIC
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0)
# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
# the SOURCES argument should be followed by a list of source files that should be built into the
# static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
# Conversion to binary-data will happen when your target is built.
# Embed Resources
file(GLOB_RECURSE RESOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/Resources/*"
)
juce_add_binary_data(WaveshaperResources
SOURCES
${RESOURCE_FILES}
)
# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
# we're linking our executable target to the `juce::juce_audio_utils` module. Inter-module
# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.
target_link_libraries(${PROJECT_NAME} PRIVATE WaveshaperResources)
# Include paths
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Source
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-ai/include
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-util/include
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-ai/include/windows
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-util/include/windows
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(STATUS "Linking to: ${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-ai/lib/WSai.lib")
target_link_libraries(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-ai/lib/WSai.lib
${CMAKE_CURRENT_SOURCE_DIR}/libs/lib-util/lib/WSutil.lib
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libs/linux/libWSai.so
${CMAKE_CURRENT_SOURCE_DIR}/libs/linux/libWSutil.so
)
endif()
# Link external libraries (adjust names/paths as needed)
# Assumes WSai.lib and WSutil.lib are located in the libs directories used above
# JUCE libraries to bring into our project
target_link_libraries(${PROJECT_NAME} PUBLIC
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_audio_plugin_client
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_core
juce::juce_data_structures
juce::juce_dsp
juce::juce_events
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
# juce::juce_recommended_config_flags
# juce::juce_recommended_lto_flags
# juce::juce_recommended_warning_flags
)
It’s a mixture of templates and other things
