From c1154028ee0e020ef5b25be4fc61740fb702b067 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 19 Aug 2024 12:27:54 -0400 Subject: [PATCH] Juce plugin out of the repo (#1155) It's still in history, but we are definitely wrapper committed at this point. Onwards! --- .github/workflows/build-release.yml | 8 +- CMakeLists.txt | 2 - clients/CMakeLists.txt | 36 +-- clients/clap-first/CMakeLists.txt | 1 + clients/juce-plugin/CMakeLists.txt | 102 ------- clients/juce-plugin/SCXTPluginEditor.cpp | 53 ---- clients/juce-plugin/SCXTPluginEditor.h | 58 ---- clients/juce-plugin/SCXTProcessor.cpp | 345 ----------------------- clients/juce-plugin/SCXTProcessor.h | 81 ------ libs/CMakeLists.txt | 34 +-- 10 files changed, 18 insertions(+), 702 deletions(-) delete mode 100644 clients/juce-plugin/CMakeLists.txt delete mode 100644 clients/juce-plugin/SCXTPluginEditor.cpp delete mode 100644 clients/juce-plugin/SCXTPluginEditor.h delete mode 100644 clients/juce-plugin/SCXTProcessor.cpp delete mode 100644 clients/juce-plugin/SCXTProcessor.h diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 6a94565d..0e9c4c31 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -70,13 +70,7 @@ jobs: matrix: include: - name: Clap First - juce_style: FALSE - installer_name: "" installer_dir: clapfirst - #- name: Juce Style - # juce_style: TRUE - # installer_name: "OldJuceStyle-" - # installer_dir: jucestyle steps: - name: Checkout code @@ -89,7 +83,7 @@ jobs: with: username: ${{ github.actor }} token: ${{ secrets.GITHUB_TOKEN }} - cmakeArgs: -DSCXT_JUCE_CLASSIC_STYLE=${{ matrix.juce_style }} -DSCXT_EXTRA_INSTALLER_NAME="${{matrix.installer_name }}" -DCMAKE_BUILD_TYPE=Release -GNinja + cmakeArgs: -DCMAKE_BUILD_TYPE=Release -GNinja target: shortcircuit-installer diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e66c2b8..77a4ba69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,6 @@ math(EXPR PART1 "${DAY_OF_YEAR} + 1") project(ShortcircuitXT VERSION 0.${PART0}.${PART1}.0 LANGUAGES C CXX ASM) set(ShortcircuitXT_VERSION ${PROJECT_VERSION}) -option(SCXT_JUCE_CLASSIC_STYLE "Use juse classic vs clap-first style" OFF) - if (APPLE) enable_language(OBJC) enable_language(OBJCXX) diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt index 5811bffa..861a7c09 100644 --- a/clients/CMakeLists.txt +++ b/clients/CMakeLists.txt @@ -1,38 +1,4 @@ project(scxt-clients LANGUAGES CXX) - -if (${SCXT_JUCE_CLASSIC_STYLE}) - message(STATUS "Building JUCE_CLASSIC style plugins") - add_subdirectory(juce-plugin) - - if(DEFINED ENV{ASIOSDK_DIR} OR BUILD_USING_MY_ASIO_LICENSE) - if(BUILD_USING_MY_ASIO_LICENSE) - message(STATUS "** BUILD USING OWN ASIO LICENSE **") - message(STATUS "The resulting Shortcircuit XT standalone executable is not licensed for distribution!") - message(STATUS "Fetching ASIO SDK...") - - set(ASIOSDK_DIR ${CMAKE_BINARY_DIR}/asio/asiosdk) - add_custom_target(scxt-get-local-asio) - add_custom_command( - TARGET scxt-get-local-asio - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/asio - COMMAND ${CMAKE_COMMAND} -D ASIO_SDK_DESTINATION=${CMAKE_BINARY_DIR}/asio -P ../cmake/get-asio.cmake - ) - add_dependencies(scxt_plugin scxt-get-local-asio) - else() - file(TO_CMAKE_PATH "$ENV{ASIOSDK_DIR}" ASIOSDK_DIR) - message(STATUS "ASIO SDK found at ${ASIOSDK_DIR}") - message(STATUS "The resulting Shortcircuit XT standalone executable is not licensed for distribution!") - endif() - - target_compile_definitions(scxt_plugin INTERFACE JUCE_ASIO=1) - target_include_directories(scxt_plugin INTERFACE ${ASIOSDK_DIR}/common) - set(JUCE_ASIO_SUPPORT TRUE) - endif() -else() - message(STATUS "Building clap-first / wrapper plugins") - add_subdirectory(clap-first) -endif() - +add_subdirectory(clap-first) add_subdirectory(sfz-token-dump) diff --git a/clients/clap-first/CMakeLists.txt b/clients/clap-first/CMakeLists.txt index 0432f9ac..ec63e81d 100644 --- a/clients/clap-first/CMakeLists.txt +++ b/clients/clap-first/CMakeLists.txt @@ -1,5 +1,6 @@ project(scxt_clapfirst) +message(STATUS "Shortcircuit XT building clap-first wrappers") set(name "Shortcircuit XT") set(IMPL_TARGET ${PROJECT_NAME}_impl) add_library(${IMPL_TARGET} STATIC clap-config.cpp diff --git a/clients/juce-plugin/CMakeLists.txt b/clients/juce-plugin/CMakeLists.txt deleted file mode 100644 index 25d3ea1a..00000000 --- a/clients/juce-plugin/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ - -project(scxt_plugin VERSION ${ShortcircuitXT_VERSION} LANGUAGES CXX) - -message(STATUS "Plugin Version number is ${PROJECT_VERSION}") - -if (SCXT_BUILD_VST3) - list(APPEND SCXT_FORMATS VST3) -endif () -if (SCXT_BUILD_AU AND APPLE AND NOT CMAKE_CROSSCOMPILING) - list(APPEND SCXT_FORMATS AU) -endif () -if (SCXT_BUILD_STANDALONE) - list(APPEND SCXT_FORMATS Standalone) -endif () - -message(STATUS "JUCE plugin layer building ${SCXT_FORMATS}") - -juce_add_plugin(${PROJECT_NAME} - PRODUCT_NAME "Shortcircuit XT" - COMPANY_NAME "Surge Synth Team" - BUNDLE_ID "org.surge-synth-team.shortcircuit-xt" - PLUGIN_MANUFACTURER_CODE VmbA - PLUGIN_CODE ScXT - - IS_SYNTH TRUE - NEEDS_MIDI_INPUT TRUE - NEEDS_MIDI_OUTPUT FALSE - IS_MIDI_EFFECT FALSE - - ICON_BIG "${CMAKE_SOURCE_DIR}/resources/images/SCAppIcon.png" - - FORMATS ${SCXT_FORMATS} - - VST3_AUTO_MANIFEST FALSE - - COPY_PLUGIN_AFTER_BUILD ${SCXT_COPY_PLUGIN_AFTER_BUILD} - ) - -if (SCXT_BUILD_CLAP) - clap_juce_extensions_plugin(TARGET ${PROJECT_NAME} - CLAP_ID "org.surge-synth-team.shortcircuit-xt" - CLAP_FEATURES instrument sampler) - - add_dependencies( - ${PROJECT_NAME}_All - ${PROJECT_NAME}_CLAP) - - list( - APPEND - active_plugin_targets - ${PROJECT_NAME}_CLAP) -endif () - -if (JUCE_ASIO_SUPPORT) - target_compile_definitions(${PROJECT_NAME} PUBLIC JUCE_ASIO=1) -endif () - -target_include_directories(${PROJECT_NAME} - PRIVATE - . - ) - -target_sources(${PROJECT_NAME} PRIVATE - SCXTProcessor.cpp SCXTPluginEditor.cpp) - -target_compile_definitions(${PROJECT_NAME} PUBLIC - JUCE_ALLOW_STATIC_NULL_VARIABLES=0 - JUCE_STRICT_REFCOUNTEDPOINTER=1 - - JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_USE_CURL=0 - JUCE_WEB_BROWSER=0 - JUUCE_USE_CAMERA=disabled - - JUCE_MODAL_LOOPS_PERMITTED=0 - JUCE_COREGRAPHICS_DRAW_ASYNC=1 - JUCE_DISPLAY_SPLASH_SCREEN=0 - JUCE_REPORT_APP_USAGE=0 - - JUCE_ALSA=$,1,0> - JUCE_JACK=$,1,0> - - JUCE_USE_FLAC=0 # we get FLAC through xiph directly in the pre-juce CORE - - JUCE_WASAPI=$,1,0> - JUCE_DIRECTSOUND=$,1,0> - - JUCE_CATCH_UNHANDLED_EXCEPTIONS=0 - ) - -target_link_libraries(${PROJECT_NAME} PUBLIC - juce::juce_graphics - juce::juce_audio_processors - juce::juce_audio_utils - juce::juce_audio_devices - - scxt-core - scxt-ui - - sst-plugininfra - ) - diff --git a/clients/juce-plugin/SCXTPluginEditor.cpp b/clients/juce-plugin/SCXTPluginEditor.cpp deleted file mode 100644 index d043877a..00000000 --- a/clients/juce-plugin/SCXTPluginEditor.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Shortcircuit XT - a Surge Synth Team product - * - * A fully featured creative sampler, available as a standalone - * and plugin for multiple platforms. - * - * Copyright 2019 - 2024, Various authors, as described in the github - * transaction log. - * - * ShortcircuitXT is released under the Gnu General Public Licence - * V3 or later (GPL-3.0-or-later). The license is found in the file - * "LICENSE" in the root of this repository or at - * https://www.gnu.org/licenses/gpl-3.0.en.html - * - * Individual sections of code which comprises ShortcircuitXT in this - * repository may also be used under an MIT license. Please see the - * section "Licensing" in "README.md" for details. - * - * ShortcircuitXT is inspired by, and shares code with, the - * commercial product Shortcircuit 1 and 2, released by VemberTech - * in the mid 2000s. The code for Shortcircuit 2 was opensourced in - * 2020 at the outset of this project. - * - * All source for ShortcircuitXT is available at - * https://github.com/surge-synthesizer/shortcircuit-xt - */ - -#include "SCXTProcessor.h" -#include "SCXTPluginEditor.h" -#include "app/SCXTEditor.h" -#include "engine/engine.h" - -//============================================================================== -SCXTPluginEditor::SCXTPluginEditor(SCXTProcessor &p, scxt::messaging::MessageController &mc, - scxt::infrastructure::DefaultsProvider &d, - const scxt::sample::SampleManager &s, - const scxt::browser::Browser &br, - const scxt::engine::Engine::SharedUIMemoryState &st) - : juce::AudioProcessorEditor(&p) -{ - ed = std::make_unique(mc, d, s, br, st); - ed->onZoomChanged = [this](auto f) { - setSize(scxt::ui::app::SCXTEditor::edWidth * f, scxt::ui::app::SCXTEditor::edHeight * f); - }; - addAndMakeVisible(*ed); - setSize(scxt::ui::app::SCXTEditor::edWidth, scxt::ui::app::SCXTEditor::edHeight); - ed->setBounds(0, 0, getWidth(), getHeight()); - setResizable(false, false); -} - -SCXTPluginEditor::~SCXTPluginEditor() {} - -void SCXTPluginEditor::resized() {} diff --git a/clients/juce-plugin/SCXTPluginEditor.h b/clients/juce-plugin/SCXTPluginEditor.h deleted file mode 100644 index 8564cd6f..00000000 --- a/clients/juce-plugin/SCXTPluginEditor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Shortcircuit XT - a Surge Synth Team product - * - * A fully featured creative sampler, available as a standalone - * and plugin for multiple platforms. - * - * Copyright 2019 - 2024, Various authors, as described in the github - * transaction log. - * - * ShortcircuitXT is released under the Gnu General Public Licence - * V3 or later (GPL-3.0-or-later). The license is found in the file - * "LICENSE" in the root of this repository or at - * https://www.gnu.org/licenses/gpl-3.0.en.html - * - * Individual sections of code which comprises ShortcircuitXT in this - * repository may also be used under an MIT license. Please see the - * section "Licensing" in "README.md" for details. - * - * ShortcircuitXT is inspired by, and shares code with, the - * commercial product Shortcircuit 1 and 2, released by VemberTech - * in the mid 2000s. The code for Shortcircuit 2 was opensourced in - * 2020 at the outset of this project. - * - * All source for ShortcircuitXT is available at - * https://github.com/surge-synthesizer/shortcircuit-xt - */ -#ifndef CLIENTS_JUCE_PLUGIN_SCXTPLUGINEDITOR_H -#define CLIENTS_JUCE_PLUGIN_SCXTPLUGINEDITOR_H - -#include -#include "SCXTProcessor.h" -#include "engine/engine.h" -#include "messaging/messaging.h" -#include "app/SCXTEditor.h" -#include "browser/browser.h" - -//============================================================================== -/** - */ -class SCXTPluginEditor : public juce::AudioProcessorEditor -{ - public: - SCXTPluginEditor(SCXTProcessor &p, scxt::messaging::MessageController &, - scxt::infrastructure::DefaultsProvider &, const scxt::sample::SampleManager &, - const scxt::browser::Browser &, - const scxt::engine::Engine::SharedUIMemoryState &); - ~SCXTPluginEditor(); - - //============================================================================== - void resized() override; - - private: - std::unique_ptr ed; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SCXTPluginEditor) -}; - -#endif // CLIENTS_JUCE-PLUGIN_SCXTPLUGINEDITOR_H diff --git a/clients/juce-plugin/SCXTProcessor.cpp b/clients/juce-plugin/SCXTProcessor.cpp deleted file mode 100644 index e8bb8c14..00000000 --- a/clients/juce-plugin/SCXTProcessor.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Shortcircuit XT - a Surge Synth Team product - * - * A fully featured creative sampler, available as a standalone - * and plugin for multiple platforms. - * - * Copyright 2019 - 2024, Various authors, as described in the github - * transaction log. - * - * ShortcircuitXT is released under the Gnu General Public Licence - * V3 or later (GPL-3.0-or-later). The license is found in the file - * "LICENSE" in the root of this repository or at - * https://www.gnu.org/licenses/gpl-3.0.en.html - * - * Individual sections of code which comprises ShortcircuitXT in this - * repository may also be used under an MIT license. Please see the - * section "Licensing" in "README.md" for details. - * - * ShortcircuitXT is inspired by, and shares code with, the - * commercial product Shortcircuit 1 and 2, released by VemberTech - * in the mid 2000s. The code for Shortcircuit 2 was opensourced in - * 2020 at the outset of this project. - * - * All source for ShortcircuitXT is available at - * https://github.com/surge-synthesizer/shortcircuit-xt - */ - -#include "SCXTProcessor.h" -#include "SCXTPluginEditor.h" -#include "sst/plugininfra/cpufeatures.h" -#include "sst/voicemanager/midi1_to_voicemanager.h" -#include "messaging/client/client_messages.h" - -//============================================================================== -SCXTProcessor::SCXTProcessor() - : juce::AudioProcessor(juce::AudioProcessor::BusesProperties() - .withOutput("Main Out", juce::AudioChannelSet::stereo(), true) - .withOutput("Out 2", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 3", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 4", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 5", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 6", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 7", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 8", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 9", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 10", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 11", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 12", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 13", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 14", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 15", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 16", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 17", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 18", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 19", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 20", juce::AudioChannelSet::stereo(), false) - .withOutput("Out 21", juce::AudioChannelSet::stereo(), false)), - blockPos(0) -{ - engine = std::make_unique(); - - std::string wrapperTypeString = getWrapperTypeDescription(wrapperType); - if (wrapperType == wrapperType_Undefined && is_clap) - wrapperTypeString = std::string("CLAP"); - - std::string phd = juce::PluginHostType().getHostDescription(); - if (phd != "Unknown") - { - wrapperTypeString += std::string(" in ") + juce::PluginHostType().getHostDescription(); - } - engine->runningEnvironment = std::string("JUCE Style ") + wrapperTypeString; -} - -SCXTProcessor::~SCXTProcessor() -{ - if (wrapperType == juce::AudioProcessor::wrapperType_Standalone) - { - // explicitly memory check on exit in the standalone - engine.reset(nullptr); - - scxt::showLeakLog(); - } -} - -//============================================================================== -const juce::String SCXTProcessor::getName() const { return JucePlugin_Name; } - -bool SCXTProcessor::acceptsMidi() const { return true; } - -bool SCXTProcessor::producesMidi() const { return false; } - -bool SCXTProcessor::isMidiEffect() const { return false; } - -double SCXTProcessor::getTailLengthSeconds() const -{ - // TODO FixMe - return 0.0; -} - -int SCXTProcessor::getNumPrograms() -{ - return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs, - // so this should be at least 1, even if you're not really implementing programs. -} - -int SCXTProcessor::getCurrentProgram() { return 0; } - -void SCXTProcessor::setCurrentProgram(int index) {} - -const juce::String SCXTProcessor::getProgramName(int index) { return {}; } - -void SCXTProcessor::changeProgramName(int index, const juce::String &newName) {} - -//============================================================================== -void SCXTProcessor::prepareToPlay(double sampleRate, int samplesPerBlock) -{ - engine->prepareToPlay(sampleRate); -} - -void SCXTProcessor::releaseResources() {} - -bool SCXTProcessor::isBusesLayoutSupported(const BusesLayout &layouts) const -{ - if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo()) - return false; - - // OK three cases we support. 1 out, 17 out (stereo + parts) or 21 out (stereo + parts + aux) - bool oneOut = true, partsOut = true, partsAndAuxOut = true; - for (int i = 0; i < scxt::maxOutputs; ++i) - { - auto co = layouts.getNumChannels(false, i); - auto isSt = (co == 2); - auto isOf = (co == 0); - oneOut = oneOut & (i == 0 ? isSt : isOf); - partsOut = partsOut & (i < scxt::numParts + 1 ? isSt : isOf); - partsAndAuxOut = partsAndAuxOut & isSt; - } - - return oneOut || partsOut || partsAndAuxOut; -} - -void SCXTProcessor::processBlock(juce::AudioBuffer &buffer, juce::MidiBuffer &midiMessages) -{ - auto ftzGuard = sst::plugininfra::cpufeatures::FPUStateGuard(); - - auto playhead = getPlayHead(); - if (playhead) - { - auto posinfo = playhead->getPosition(); - engine->transport.tempo = posinfo->getBpm().orFallback(120); - - // isRecording should always imply isPlaying but better safe than sorry - if (posinfo->getIsPlaying()) - { - engine->transport.hostTimeInBeats = - posinfo->getPpqPosition().orFallback(engine->transport.timeInBeats); - engine->transport.timeInBeats = engine->transport.hostTimeInBeats; - engine->transport.lastBarStartInBeats = - posinfo->getPpqPositionOfLastBarStart().orFallback( - engine->transport.lastBarStartInBeats); - } - - engine->transport.status = scxt::engine::Transport::Status::STOPPED; - if (posinfo->getIsPlaying()) - engine->transport.status &= scxt::engine::Transport::Status::PLAYING; - if (posinfo->getIsRecording()) - engine->transport.status &= scxt::engine::Transport::Status::RECORDING; - if (posinfo->getIsLooping()) - engine->transport.status &= scxt::engine::Transport::Status::LOOPING; - - auto ts = posinfo->getTimeSignature().orFallback(juce::AudioPlayHead::TimeSignature()); - engine->transport.signature.numerator = ts.numerator; - engine->transport.signature.denominator = ts.denominator; - engine->onTransportUpdated(); - } - else - { - engine->transport.tempo = 120; - engine->transport.signature.numerator = 4; - engine->transport.signature.denominator = 4; - engine->onTransportUpdated(); - } - - auto midiIt = midiMessages.findNextSamplePosition(0); - int nextMidi = -1; - if (midiIt != midiMessages.cend()) - { - nextMidi = (*midiIt).samplePosition; - } - - int activeBusCount = 0; - for (int i = 0; i < scxt::maxOutputs; ++i) - { - auto iob = getBusBuffer(buffer, false, i); - if (iob.getNumChannels() != 2) - { - break; - } - - auto outL = iob.getWritePointer(0, 0); - auto outR = iob.getWritePointer(1, 0); - if (!(outL && outR)) - { - break; - } - activeBusCount++; - } - - // TODO FIX ME obviously - if (activeBusCount == 0) - return; - - for (int i = 0; i < buffer.getNumSamples(); i++) - { - while (i == nextMidi) - { - applyMidi(*midiIt); - midiIt++; - if (midiIt == midiMessages.cend()) - { - nextMidi = -1; - } - else - { - nextMidi = (*midiIt).samplePosition; - } - } - - if (blockPos == 0) - engine->processAudio(); - - { - auto iob = getBusBuffer(buffer, false, 0); - - auto outL = iob.getWritePointer(0, i); - auto outR = iob.getWritePointer(1, i); - - if (outL && outR) - { - *outL = engine->getPatch()->busses.mainBus.output[0][blockPos]; - *outR = engine->getPatch()->busses.mainBus.output[1][blockPos]; - } - } - for (int bus = 1; bus < activeBusCount; bus++) - { - auto iob = getBusBuffer(buffer, false, bus); - - auto outL = iob.getWritePointer(0, i); - auto outR = iob.getWritePointer(1, i); - - if (outL && outR) - { - if (!engine->getPatch()->usesOutputBus(bus)) - { - *outL = 0.f; - *outR = 0.f; - } - else - { - *outL = engine->getPatch()->busses.pluginNonMainOutputs[bus - 1][0][blockPos]; - *outR = engine->getPatch()->busses.pluginNonMainOutputs[bus - 1][1][blockPos]; - } - } - } - - blockPos++; - - if (blockPos >= scxt::BLOCK_SIZE) - { - blockPos = 0; - engine->transport.timeInBeats += (double)scxt::blockSize * engine->transport.tempo * - engine->getSampleRateInv() / 60.f; - } - } - - // This should, in theory, never happen, but better safe than sorry - while (midiIt != midiMessages.cend()) - { - applyMidi(*midiIt); - midiIt++; - } -} - -void SCXTProcessor::applyMidi(const juce::MidiMessageMetadata &msg) -{ - // TODO: A clap version with note ids - auto m = msg.getMessage(); - - uint8_t data[3]{0, 0, 0}; - if (m.getRawDataSize() <= 3) - { - memcpy(data, m.getRawData(), std::max(m.getRawDataSize(), 3)); - sst::voicemanager::applyMidi1Message(engine->voiceManager, 0, data); - } - else - { - // What to do with these sysex and other messages? For now drop them - // since eventually we will clap first this sucker anyway - } -} - -//============================================================================== -bool SCXTProcessor::hasEditor() const -{ - return true; // (change this to false if you choose to not supply an editor) -} - -juce::AudioProcessorEditor *SCXTProcessor::createEditor() -{ - return new SCXTPluginEditor(*this, *(engine->getMessageController()), *(engine->defaults), - *(engine->getSampleManager()), *(engine->getBrowser()), - engine->sharedUIMemoryState); -} - -//============================================================================== -void SCXTProcessor::getStateInformation(juce::MemoryBlock &destData) -{ - engine->getSampleManager()->purgeUnreferencedSamples(); - try - { - auto sg = scxt::engine::Engine::StreamGuard(scxt::engine::Engine::FOR_DAW); - auto xml = scxt::json::streamEngineState(*engine); - SCLOG("Streaming State Information: " << xml.size() << " bytes"); - destData.replaceAll(xml.c_str(), xml.size() + 1); - } - catch (const std::runtime_error &err) - { - SCLOG("Unable to stream [" << err.what() << "]"); - } -} - -void SCXTProcessor::setStateInformation(const void *data, int sizeInBytes) -{ - const char *cd = (const char *)data; - assert(cd[sizeInBytes - 1] == '\0'); - - auto xml = std::string(cd); - - scxt::messaging::client::clientSendToSerialization( - scxt::messaging::client::UnstreamIntoEngine{xml}, *engine->getMessageController()); -} - -//============================================================================== -// This creates new instances of the plugin.. -juce::AudioProcessor *JUCE_CALLTYPE createPluginFilter() { return new SCXTProcessor(); } diff --git a/clients/juce-plugin/SCXTProcessor.h b/clients/juce-plugin/SCXTProcessor.h deleted file mode 100644 index 6fe8c708..00000000 --- a/clients/juce-plugin/SCXTProcessor.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Shortcircuit XT - a Surge Synth Team product - * - * A fully featured creative sampler, available as a standalone - * and plugin for multiple platforms. - * - * Copyright 2019 - 2024, Various authors, as described in the github - * transaction log. - * - * ShortcircuitXT is released under the Gnu General Public Licence - * V3 or later (GPL-3.0-or-later). The license is found in the file - * "LICENSE" in the root of this repository or at - * https://www.gnu.org/licenses/gpl-3.0.en.html - * - * Individual sections of code which comprises ShortcircuitXT in this - * repository may also be used under an MIT license. Please see the - * section "Licensing" in "README.md" for details. - * - * ShortcircuitXT is inspired by, and shares code with, the - * commercial product Shortcircuit 1 and 2, released by VemberTech - * in the mid 2000s. The code for Shortcircuit 2 was opensourced in - * 2020 at the outset of this project. - * - * All source for ShortcircuitXT is available at - * https://github.com/surge-synthesizer/shortcircuit-xt - */ -#ifndef CLIENTS_JUCE_PLUGIN_SCXTPROCESSOR_H -#define CLIENTS_JUCE_PLUGIN_SCXTPROCESSOR_H - -#include -#include -#include "clap-juce-extensions/clap-juce-extensions.h" - -class SCXTProcessor : public juce::AudioProcessor, public clap_juce_extensions::clap_properties -{ - public: - //============================================================================== - SCXTProcessor(); - ~SCXTProcessor(); - - //============================================================================== - void prepareToPlay(double sampleRate, int samplesPerBlock) override; - void releaseResources() override; - - bool isBusesLayoutSupported(const BusesLayout &layouts) const override; - - void processBlock(juce::AudioBuffer &, juce::MidiBuffer &) override; - - //============================================================================== - juce::AudioProcessorEditor *createEditor() override; - bool hasEditor() const override; - - //============================================================================== - const juce::String getName() const override; - - bool acceptsMidi() const override; - bool producesMidi() const override; - bool isMidiEffect() const override; - double getTailLengthSeconds() const override; - - //============================================================================== - int getNumPrograms() override; - int getCurrentProgram() override; - void setCurrentProgram(int index) override; - const juce::String getProgramName(int index) override; - void changeProgramName(int index, const juce::String &newName) override; - - //============================================================================== - void getStateInformation(juce::MemoryBlock &destData) override; - void setStateInformation(const void *data, int sizeInBytes) override; - - private: - std::unique_ptr engine; - size_t blockPos{0}; - - void applyMidi(const juce::MidiMessageMetadata &msg); - //============================================================================== - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SCXTProcessor) -}; - -#endif // CLIENTS_JUCE-PLUGIN_SCXTPROCESSOR_H diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 94b33c00..014b3ac3 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -4,28 +4,24 @@ add_library(simde INTERFACE) target_include_directories(simde INTERFACE simde) add_library(shortcircuit::simde ALIAS simde) -if (${SCXT_JUCE_CLASSIC_STYLE}) - add_subdirectory(JUCE) - add_subdirectory(clap/clap-juce-extensions clap-extensions EXCLUDE_FROM_ALL) -else() - add_subdirectory(clap/clap) - add_subdirectory(clap/clap-helpers) +add_subdirectory(clap/clap) +add_subdirectory(clap/clap-helpers) - set(CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES TRUE CACHE BOOL "Get em") - set(CLAP_WRAPPER_DONT_ADD_TARGETS TRUE CACHE BOOL "I'll targetize") - set(CLAP_WRAPPER_BUILD_AUV2 TRUE CACHE BOOL "It's only logical") - if (APPLE) - # BaconPaul has jack kinda installed - set(RTAUDIO_API_JACK FALSE CACHE BOOL "Not on apple") - endif() - add_subdirectory(clap/clap-wrapper) +set(CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES TRUE CACHE BOOL "Get em") +set(CLAP_WRAPPER_DONT_ADD_TARGETS TRUE CACHE BOOL "I'll targetize") +set(CLAP_WRAPPER_BUILD_AUV2 TRUE CACHE BOOL "It's only logical") +if (APPLE) + # BaconPaul has jack kinda installed + set(RTAUDIO_API_JACK FALSE CACHE BOOL "Not on apple") +endif() +add_subdirectory(clap/clap-wrapper) - add_subdirectory(sst/sst-clap-helpers) - if (NOT DEFINED JUCE_PATH) - set(JUCE_PATH "${CMAKE_SOURCE_DIR}/libs/JUCE") - endif() - add_clap_juce_shim(JUCE_PATH ${JUCE_PATH}) +add_subdirectory(sst/sst-clap-helpers) +if (NOT DEFINED JUCE_PATH) + set(JUCE_PATH "${CMAKE_SOURCE_DIR}/libs/JUCE") endif() +add_clap_juce_shim(JUCE_PATH ${JUCE_PATH}) + add_subdirectory(fmt) # Modify this basedon the outcome of https://github.com/taocpp/PEGTL/issues/347