From 2180e2d6e7c89b23cbd406211975eec53ca22a00 Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Thu, 27 Jul 2023 23:34:35 +0200 Subject: [PATCH] Added Vanilla as the most minimal example --- Examples/CMakeLists.txt | 1 + Examples/Vanilla/CMakeLists.txt | 69 +++++++++++++++++++ Examples/Vanilla/Resources/magic.xml | 25 +++++++ Examples/Vanilla/Source/PluginProcessor.cpp | 16 +++++ Examples/Vanilla/Source/PluginProcessor.h | 19 +++++ .../State/foleys_MagicProcessorState.cpp | 5 ++ .../State/foleys_MagicProcessorState.h | 1 + 7 files changed, 136 insertions(+) create mode 100644 Examples/Vanilla/CMakeLists.txt create mode 100644 Examples/Vanilla/Resources/magic.xml create mode 100644 Examples/Vanilla/Source/PluginProcessor.cpp create mode 100644 Examples/Vanilla/Source/PluginProcessor.h diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 125089fb..e9ccb853 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -80,4 +80,5 @@ add_subdirectory(EqualizerExample) add_subdirectory(ExtendingExample) add_subdirectory(FoleysSynth) add_subdirectory(SignalGenerator) +add_subdirectory(Vanilla) add_subdirectory(PlayerExample) diff --git a/Examples/Vanilla/CMakeLists.txt b/Examples/Vanilla/CMakeLists.txt new file mode 100644 index 00000000..c0c61ac7 --- /dev/null +++ b/Examples/Vanilla/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.13.0) + +project("Vanilla" VERSION ${FGM_VERSION}) + +set(${PROJECT_NAME}_sources + Source/PluginProcessor.cpp + Source/PluginProcessor.h) + +# add the plugin targets +juce_add_plugin(${PROJECT_NAME} + VERSION "${version}" + COMPANY_NAME "Foleys Finest Audio" + PLUGIN_MANUFACTURER_CODE "FFAU" + PLUGIN_CODE "PgmV" + IS_SYNTH yes + FORMATS ${FORMATS} + VST3_CATEGORIES "Fx" "Analyser" "EQ" + AAX_CATEGORY "AAX_ePlugInCategory_SWGenerators" + AU_MAIN_TYPE "kAudioUnitType_Generator" + COMPANY_WEBSITE "https://foleysfinest.com" + COMPANY_EMAIL "info@foleysfinest.com" + BUNDLE_ID "com.foleysfinest.Vanilla" + PLUGIN_NAME "PGM-Vanilla" + PRODUCT_NAME "PGM-Vanilla" + NEEDS_WEB_BROWSER FALSE + NEEDS_CURL FALSE) + +juce_add_binary_data(${PROJECT_NAME}_data + SOURCES + Resources/magic.xml) + +juce_generate_juce_header (${PROJECT_NAME}) + +target_sources(${PROJECT_NAME} + PRIVATE + ${${PROJECT_NAME}_sources}) + +# add required flags +target_link_libraries(${PROJECT_NAME} + PRIVATE + ${project_sources} + ${PROJECT_NAME}_data + foleys_gui_magic + juce::juce_audio_basics + juce::juce_audio_plugin_client + juce::juce_audio_processors + juce::juce_audio_utils + juce::juce_dsp + juce::juce_cryptography + juce::juce_gui_extra + juce::juce_recommended_warning_flags + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags) + +target_compile_definitions(${PROJECT_NAME} + PUBLIC + # switch the following off in the product to hide editor + FOLEYS_SHOW_GUI_EDITOR_PALLETTE=0 + FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE=0 + JUCE_VST3_CAN_REPLACE_VST2=0 + JUCE_USE_CURL=0 + JUCE_WEB_BROWSER=0) + +# foreach(FORMAT ${FORMATS}) +# get_target_property(ARTEFACTS_DIR ${PROJECT_NAME}_${FORMAT} LIBRARY_OUTPUT_DIRECTORY) +# add_custom_command(TARGET ${PROJECT_NAME}_${FORMAT} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${ARTEFACTS_DIR} ${COPY_FOLDER}) +# endforeach() + +__pgm_internal_add_pluginval_tests (${PROJECT_NAME}) diff --git a/Examples/Vanilla/Resources/magic.xml b/Examples/Vanilla/Resources/magic.xml new file mode 100644 index 00000000..9d0cbbb9 --- /dev/null +++ b/Examples/Vanilla/Resources/magic.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/Examples/Vanilla/Source/PluginProcessor.cpp b/Examples/Vanilla/Source/PluginProcessor.cpp new file mode 100644 index 00000000..5da01fb2 --- /dev/null +++ b/Examples/Vanilla/Source/PluginProcessor.cpp @@ -0,0 +1,16 @@ + +#include "PluginProcessor.h" + + + +VanillaAudioProcessor::VanillaAudioProcessor() : foleys::MagicProcessor(juce::AudioProcessor::BusesProperties() + .withOutput ("Output", juce::AudioChannelSet::stereo(), true)) +{} + + +//============================================================================== +// This creates new instances of the plugin.. +juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() +{ + return new VanillaAudioProcessor(); +} diff --git a/Examples/Vanilla/Source/PluginProcessor.h b/Examples/Vanilla/Source/PluginProcessor.h new file mode 100644 index 00000000..40d81296 --- /dev/null +++ b/Examples/Vanilla/Source/PluginProcessor.h @@ -0,0 +1,19 @@ + +#pragma once + +#include + +class VanillaAudioProcessor : public foleys::MagicProcessor +{ +public: + VanillaAudioProcessor(); + + void prepareToPlay ([[maybe_unused]]double sampleRate, [[maybe_unused]]int expectedNumSamples) override {} + void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override {} + void releaseResources() override {} + + double getTailLengthSeconds() const override { return 0.0; } + +private: + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VanillaAudioProcessor) +}; diff --git a/modules/foleys_gui_magic/State/foleys_MagicProcessorState.cpp b/modules/foleys_gui_magic/State/foleys_MagicProcessorState.cpp index 386167e4..791d90e9 100644 --- a/modules/foleys_gui_magic/State/foleys_MagicProcessorState.cpp +++ b/modules/foleys_gui_magic/State/foleys_MagicProcessorState.cpp @@ -41,6 +41,11 @@ MagicProcessorState::MagicProcessorState (juce::AudioProcessor& processorToUse) { } +MagicProcessorState::~MagicProcessorState() +{ + stopTimer(); +} + juce::StringArray MagicProcessorState::getParameterNames() const { return parameters.getParameterNames(); diff --git a/modules/foleys_gui_magic/State/foleys_MagicProcessorState.h b/modules/foleys_gui_magic/State/foleys_MagicProcessorState.h index cef4b187..7e96795e 100644 --- a/modules/foleys_gui_magic/State/foleys_MagicProcessorState.h +++ b/modules/foleys_gui_magic/State/foleys_MagicProcessorState.h @@ -53,6 +53,7 @@ class MagicProcessorState : public MagicGUIState, processor and it's internals. */ MagicProcessorState (juce::AudioProcessor& processorToUse); + ~MagicProcessorState() override; /** Returns the IDs of AudioProcessorParameters for selection