diff --git a/.gitmodules b/.gitmodules index decca8f..e32b60d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,9 @@ [submodule "modules/hilbert-iir"] path = modules/hilbert-iir url = https://github.com/Signalsmith-Audio/hilbert-iir.git +[submodule "clap/modules/linear"] + path = modules/linear + url = https://github.com/Signalsmith-Audio/linear.git +[submodule "modules/linear"] + path = modules/linear + url = https://github.com/Signalsmith-Audio/linear.git diff --git a/analyser.h b/analyser.h new file mode 100644 index 0000000..aedb097 --- /dev/null +++ b/analyser.h @@ -0,0 +1,48 @@ +/* Copyright 2022 Signalsmith Audio Ltd. / Geraint Luff +Released under the Boost Software License (see LICENSE.txt) */ +#pragma once + +#include "stfx/stfx-library.h" + +namespace signalsmith { namespace basics { + +template +struct AnalyserSTFX; + +using AnalyserFloat = stfx::LibraryEffect; +using AnalyserDouble = stfx::LibraryEffect; + +template +struct AnalyserSTFX : public BaseEffect { + using typename BaseEffect::Sample; + using typename BaseEffect::ParamRange; + using typename BaseEffect::ParamStepped; + + template + void state(Storage &storage) { + storage.info("[Basics] Analyser", "A Bark-scale spectrum analyser"); + storage.version(0); + } + + template + void configureSTFX(Config &config) { + config.outputChannels = config.inputChannels; + config.auxInputs = config.auxOutputs = {}; + } + + void reset() {} + + template + void processSTFX(Io &io, Config &config, Block &block) { + for (size_t c = 0; c < config.inputChannels; ++c) { + auto &input = io.input[c]; + auto &output = io.output[c]; + for (size_t i = 0; i < block.length; ++i) { + output[i] = input[i]; + } + } + + } +}; + +}} // namespace diff --git a/clap/CMakeLists.txt b/clap/CMakeLists.txt index e0c4627..b64f579 100644 --- a/clap/CMakeLists.txt +++ b/clap/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required(VERSION 3.28) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) + project(plugins VERSION 1.0.0) -set(NAME basics) ################ boilerplate config @@ -57,17 +59,16 @@ FetchContent_MakeAvailable(clap-helpers) ################ The actual plugin(s) +add_subdirectory(../ signalsmith-basics/) # need explicit path since it's not a subdir + +set(NAME basics) add_library(${NAME}_static STATIC) target_link_libraries(${NAME}_static PUBLIC clap - clap-helpers -) -target_include_directories(${NAME}_static PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/../include - ${CMAKE_CURRENT_SOURCE_DIR}/../modules + signalsmith-basics ) target_sources(${NAME}_static PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/source/${NAME}.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/basics.cpp ) make_clapfirst_plugins( diff --git a/clap/REAPER/basics/basics.RPP b/clap/REAPER/basics/basics.RPP index 4c68497..03033a6 100644 --- a/clap/REAPER/basics/basics.RPP +++ b/clap/REAPER/basics/basics.RPP @@ -1,4 +1,4 @@ - RIPPLE 0 @@ -101,7 +101,7 @@ BAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAAArAAAAAEAAAAAABAA AQAAAAIAAAABAAAAZGVmYXVsdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxMjcuMC4wLjEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - AAAQAAAA + AFByb2dyYW0gMQAQAAAA > FLOATPOS 0 0 0 0 FXID {11A0D811-6420-CB40-95D6-F9D12E45C862} @@ -125,54 +125,8 @@ > - - - > - FLOATPOS 0 0 0 0 - FXID {1F02CE63-5B2C-DD40-B8DA-6796E8E4CD70} - WAK 0 0 - > - > - - > - > - - - FLOATPOS 0 0 0 0 - FXID {6A5C4484-079E-F34D-8A18-CB456B094205} - WAK 0 0 - BYPASS 0 0 0 - "" - cWVlcu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAAagAAAAEAAAAAABAA - IQAAAAIAAAAEAAAAAQAAAMS7LCro8zZAAAAAAAAA8D9GtvP91Hj1PwEDAAAAAQAAAHj7zCB2ucJAdouc1Fqk9D8QWDm0yHbyPwEBAAAAAQAAAAAAAAAAAPA/AAAAAEAC - AABrAQAAAgAAAA== - AAAQAAAA - > - FLOATPOS 0 0 0 0 - FXID {5262179C-F519-424F-8C34-4765E9AE04E7} - WAK 0 0 - > - - > - > - "" - cWVlcu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAAagAAAAEAAAAAABAA - IQAAAAIAAAADAAAAAQAAAJ0Q6aODFJFAAAAAAAAA8D+amZmZmZnpPwEEAAAAAQAAADNAfmGLZFZANFOMBg1H7z9/arx0kxjsPwEBAAAAAQAAAModDNkGk/o/AAAAAEAC - AABrAQAAAgAAAA== - AAAQAAAA - > - FLOATPOS 0 0 0 0 - FXID {4CCB9CFD-8185-AE45-8B5D-ADB8ED3C4344} - WAK 0 0 - > - > > > diff --git a/clap/source/basics.cpp b/clap/source/basics.cpp index 941740b..6b03e0c 100644 --- a/clap/source/basics.cpp +++ b/clap/source/basics.cpp @@ -3,6 +3,7 @@ # define LOG_EXPR(expr) std::cout << #expr " = " << (expr) << std::endl; #endif +#include "signalsmith-basics/analyser.h" #include "signalsmith-basics/crunch.h" #include "signalsmith-basics/limiter.h" #include "signalsmith-basics/reverb.h" @@ -24,7 +25,7 @@ bool clap_init(const char *path) { CLAP_PLUGIN_FEATURE_AUDIO_EFFECT, CLAP_PLUGIN_FEATURE_DISTORTION, }); - + plugins.add({ .clap_version = CLAP_VERSION, .id = "uk.co.signalsmith.basics.limiter", @@ -38,7 +39,7 @@ bool clap_init(const char *path) { CLAP_PLUGIN_FEATURE_AUDIO_EFFECT, CLAP_PLUGIN_FEATURE_LIMITER, }); - + plugins.add({ .clap_version = CLAP_VERSION, .id = "uk.co.signalsmith.basics.reverb", @@ -52,6 +53,21 @@ bool clap_init(const char *path) { CLAP_PLUGIN_FEATURE_AUDIO_EFFECT, CLAP_PLUGIN_FEATURE_REVERB, }); + + plugins.add({ + .clap_version = CLAP_VERSION, + .id = "uk.co.signalsmith.basics.analyser", + .name = "[Basics] Analyser", + .vendor = "Signalsmith Audio", + .url = "", + .manual_url = "", + .support_url = "", + .version = "1.0.0" + }, { + CLAP_PLUGIN_FEATURE_AUDIO_EFFECT, + CLAP_PLUGIN_FEATURE_DISTORTION, + }); + return plugins.clap_init(path); } void clap_deinit() { diff --git a/clap/source/clap_entry.cpp b/clap/source/clap_entry.cpp index 4871811..c025876 100644 --- a/clap/source/clap_entry.cpp +++ b/clap/source/clap_entry.cpp @@ -1,8 +1,34 @@ #include "clap/entry.h" +/* +#include "../../stfx/clap/stfx-clap.h" -extern bool clap_init(const char *); +stfx::clap::Plugins stfxPlugins; +extern void addAnalyser(); +extern void addCrunch(); +extern void addLimiter(); +extern void addReverb(); + +bool clap_init(const char *path) { + static bool added = false; + if (!added) { + addAnalyser(); + addCrunch(); + addLimiter(); + addReverb(); + } + return added = stfxPlugins.clap_init(path); +} +void clap_deinit() { + stfxPlugins.clap_deinit(); +} +const void * clap_get_factory(const char *id) { + return stfxPlugins.clap_get_factory(id); +} +*/ + +extern bool clap_init(const char *path); extern void clap_deinit(); -extern const void * clap_get_factory(const char *); +extern const void * clap_get_factory(const char *id); extern "C" { const CLAP_EXPORT clap_plugin_entry clap_entry{ diff --git a/include/signalsmith-basics/analyser.h b/include/signalsmith-basics/analyser.h new file mode 100644 index 0000000..eee9d00 --- /dev/null +++ b/include/signalsmith-basics/analyser.h @@ -0,0 +1 @@ +#include "../../analyser.h" diff --git a/modules/linear b/modules/linear new file mode 160000 index 0000000..157b448 --- /dev/null +++ b/modules/linear @@ -0,0 +1 @@ +Subproject commit 157b448e390663e78d845ca9f8dad65140f686ad diff --git a/stfx/clap/stfx-clap.h b/stfx/clap/stfx-clap.h index 7592445..59bed02 100644 --- a/stfx/clap/stfx-clap.h +++ b/stfx/clap/stfx-clap.h @@ -20,7 +20,7 @@ struct Plugin; // A helper to make a CLAP plugin factory from STFX templates struct Plugins { template class EffectSTFX, class ...Args> - void add(clap_plugin_descriptor desc, std::initializer_list features, Args ...args) { + size_t add(clap_plugin_descriptor desc, std::initializer_list features, Args ...args) { size_t index = featureLists.size(); featureLists.emplace_back(features); @@ -31,6 +31,7 @@ struct Plugins { creates.push_back([=](const clap_host *host){ return new Plugin(*this, &descriptors[index], host, args...); }); + return index; } bool clap_init(const char *path) { @@ -651,3 +652,5 @@ struct Plugin : public clap_plugin { }; }} // namespace + +extern stfx::clap::Plugins stfxPlugins; diff --git a/stfx/storage/stfx-storage.h b/stfx/storage/stfx-storage.h index f9f347e..f695d31 100644 --- a/stfx/storage/stfx-storage.h +++ b/stfx/storage/stfx-storage.h @@ -1,6 +1,7 @@ #pragma once #include "./storage.h" +#include "../stfx-library.h" // for the ...ParamIgnore classes namespace stfx { namespace storage { diff --git a/stfx/ui/web-ui.h b/stfx/ui/web-ui.h index 262970e..e72b68b 100644 --- a/stfx/ui/web-ui.h +++ b/stfx/ui/web-ui.h @@ -9,6 +9,7 @@ #include #include #include +#include // we log to stderr if our queue gets full namespace stfx { namespace web {