From 4a3c920f406046789d50aaec382e8ac429dab0fe Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Wed, 24 Feb 2021 23:40:26 +0100 Subject: [PATCH 01/10] Rename faust files with consistency --- src/sfizz/SfzFilterImpls.hpp | 104 +++++++++--------- src/sfizz/effects/Compressor.cpp | 2 +- src/sfizz/effects/Disto.cpp | 2 +- src/sfizz/effects/Fverb.cpp | 2 +- src/sfizz/effects/Gate.cpp | 2 +- src/sfizz/effects/Limiter.cpp | 2 +- .../gen/{compressor.cxx => compressor.hxx} | 0 .../gen/{disto_stage.cxx => disto_stage.hxx} | 0 .../effects/gen/{fverb.cxx => fverb.hxx} | 0 src/sfizz/effects/gen/{gate.cxx => gate.hxx} | 0 .../effects/gen/{limiter.cpp => limiter.hxx} | 0 .../{sfz2chApf1p.cxx => sfz2chApf1p.hxx} | 0 .../{sfz2chBpf1p.cxx => sfz2chBpf1p.hxx} | 0 .../{sfz2chBpf2p.cxx => sfz2chBpf2p.hxx} | 0 .../{sfz2chBpf2pSv.cxx => sfz2chBpf2pSv.hxx} | 0 .../{sfz2chBpf4p.cxx => sfz2chBpf4p.hxx} | 0 .../{sfz2chBpf6p.cxx => sfz2chBpf6p.hxx} | 0 .../{sfz2chBrf1p.cxx => sfz2chBrf1p.hxx} | 0 .../{sfz2chBrf2p.cxx => sfz2chBrf2p.hxx} | 0 .../{sfz2chBrf2pSv.cxx => sfz2chBrf2pSv.hxx} | 0 ...{sfz2chEqHshelf.cxx => sfz2chEqHshelf.hxx} | 0 ...{sfz2chEqLshelf.cxx => sfz2chEqLshelf.hxx} | 0 .../{sfz2chEqPeak.cxx => sfz2chEqPeak.hxx} | 0 .../{sfz2chHpf1p.cxx => sfz2chHpf1p.hxx} | 0 .../{sfz2chHpf2p.cxx => sfz2chHpf2p.hxx} | 0 .../{sfz2chHpf2pSv.cxx => sfz2chHpf2pSv.hxx} | 0 .../{sfz2chHpf4p.cxx => sfz2chHpf4p.hxx} | 0 .../{sfz2chHpf6p.cxx => sfz2chHpf6p.hxx} | 0 .../filters/{sfz2chHsh.cxx => sfz2chHsh.hxx} | 0 .../{sfz2chLpf1p.cxx => sfz2chLpf1p.hxx} | 0 .../{sfz2chLpf2p.cxx => sfz2chLpf2p.hxx} | 0 .../{sfz2chLpf2pSv.cxx => sfz2chLpf2pSv.hxx} | 0 .../{sfz2chLpf4p.cxx => sfz2chLpf4p.hxx} | 0 .../{sfz2chLpf6p.cxx => sfz2chLpf6p.hxx} | 0 .../filters/{sfz2chLsh.cxx => sfz2chLsh.hxx} | 0 .../filters/{sfz2chPeq.cxx => sfz2chPeq.hxx} | 0 .../{sfz2chPink.cxx => sfz2chPink.hxx} | 0 .../filters/{sfzApf1p.cxx => sfzApf1p.hxx} | 0 .../filters/{sfzBpf1p.cxx => sfzBpf1p.hxx} | 0 .../filters/{sfzBpf2p.cxx => sfzBpf2p.hxx} | 0 .../{sfzBpf2pSv.cxx => sfzBpf2pSv.hxx} | 0 .../filters/{sfzBpf4p.cxx => sfzBpf4p.hxx} | 0 .../filters/{sfzBpf6p.cxx => sfzBpf6p.hxx} | 0 .../filters/{sfzBrf1p.cxx => sfzBrf1p.hxx} | 0 .../filters/{sfzBrf2p.cxx => sfzBrf2p.hxx} | 0 .../{sfzBrf2pSv.cxx => sfzBrf2pSv.hxx} | 0 .../{sfzEqHshelf.cxx => sfzEqHshelf.hxx} | 0 .../{sfzEqLshelf.cxx => sfzEqLshelf.hxx} | 0 .../filters/{sfzEqPeak.cxx => sfzEqPeak.hxx} | 0 .../filters/{sfzHpf1p.cxx => sfzHpf1p.hxx} | 0 .../filters/{sfzHpf2p.cxx => sfzHpf2p.hxx} | 0 .../{sfzHpf2pSv.cxx => sfzHpf2pSv.hxx} | 0 .../filters/{sfzHpf4p.cxx => sfzHpf4p.hxx} | 0 .../filters/{sfzHpf6p.cxx => sfzHpf6p.hxx} | 0 .../gen/filters/{sfzHsh.cxx => sfzHsh.hxx} | 0 .../filters/{sfzLpf1p.cxx => sfzLpf1p.hxx} | 0 .../filters/{sfzLpf2p.cxx => sfzLpf2p.hxx} | 0 .../{sfzLpf2pSv.cxx => sfzLpf2pSv.hxx} | 0 .../filters/{sfzLpf4p.cxx => sfzLpf4p.hxx} | 0 .../filters/{sfzLpf6p.cxx => sfzLpf6p.hxx} | 0 .../gen/filters/{sfzLsh.cxx => sfzLsh.hxx} | 0 .../gen/filters/{sfzPeq.cxx => sfzPeq.hxx} | 0 .../gen/filters/{sfzPink.cxx => sfzPink.hxx} | 0 63 files changed, 57 insertions(+), 57 deletions(-) rename src/sfizz/effects/gen/{compressor.cxx => compressor.hxx} (100%) rename src/sfizz/effects/gen/{disto_stage.cxx => disto_stage.hxx} (100%) rename src/sfizz/effects/gen/{fverb.cxx => fverb.hxx} (100%) rename src/sfizz/effects/gen/{gate.cxx => gate.hxx} (100%) rename src/sfizz/effects/gen/{limiter.cpp => limiter.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chApf1p.cxx => sfz2chApf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBpf1p.cxx => sfz2chBpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBpf2p.cxx => sfz2chBpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBpf2pSv.cxx => sfz2chBpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBpf4p.cxx => sfz2chBpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBpf6p.cxx => sfz2chBpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBrf1p.cxx => sfz2chBrf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBrf2p.cxx => sfz2chBrf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chBrf2pSv.cxx => sfz2chBrf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chEqHshelf.cxx => sfz2chEqHshelf.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chEqLshelf.cxx => sfz2chEqLshelf.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chEqPeak.cxx => sfz2chEqPeak.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHpf1p.cxx => sfz2chHpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHpf2p.cxx => sfz2chHpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHpf2pSv.cxx => sfz2chHpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHpf4p.cxx => sfz2chHpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHpf6p.cxx => sfz2chHpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chHsh.cxx => sfz2chHsh.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLpf1p.cxx => sfz2chLpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLpf2p.cxx => sfz2chLpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLpf2pSv.cxx => sfz2chLpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLpf4p.cxx => sfz2chLpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLpf6p.cxx => sfz2chLpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chLsh.cxx => sfz2chLsh.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chPeq.cxx => sfz2chPeq.hxx} (100%) rename src/sfizz/gen/filters/{sfz2chPink.cxx => sfz2chPink.hxx} (100%) rename src/sfizz/gen/filters/{sfzApf1p.cxx => sfzApf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBpf1p.cxx => sfzBpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBpf2p.cxx => sfzBpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBpf2pSv.cxx => sfzBpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfzBpf4p.cxx => sfzBpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBpf6p.cxx => sfzBpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBrf1p.cxx => sfzBrf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBrf2p.cxx => sfzBrf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfzBrf2pSv.cxx => sfzBrf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfzEqHshelf.cxx => sfzEqHshelf.hxx} (100%) rename src/sfizz/gen/filters/{sfzEqLshelf.cxx => sfzEqLshelf.hxx} (100%) rename src/sfizz/gen/filters/{sfzEqPeak.cxx => sfzEqPeak.hxx} (100%) rename src/sfizz/gen/filters/{sfzHpf1p.cxx => sfzHpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfzHpf2p.cxx => sfzHpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfzHpf2pSv.cxx => sfzHpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfzHpf4p.cxx => sfzHpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfzHpf6p.cxx => sfzHpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfzHsh.cxx => sfzHsh.hxx} (100%) rename src/sfizz/gen/filters/{sfzLpf1p.cxx => sfzLpf1p.hxx} (100%) rename src/sfizz/gen/filters/{sfzLpf2p.cxx => sfzLpf2p.hxx} (100%) rename src/sfizz/gen/filters/{sfzLpf2pSv.cxx => sfzLpf2pSv.hxx} (100%) rename src/sfizz/gen/filters/{sfzLpf4p.cxx => sfzLpf4p.hxx} (100%) rename src/sfizz/gen/filters/{sfzLpf6p.cxx => sfzLpf6p.hxx} (100%) rename src/sfizz/gen/filters/{sfzLsh.cxx => sfzLsh.hxx} (100%) rename src/sfizz/gen/filters/{sfzPeq.cxx => sfzPeq.hxx} (100%) rename src/sfizz/gen/filters/{sfzPink.cxx => sfzPink.hxx} (100%) diff --git a/src/sfizz/SfzFilterImpls.hpp b/src/sfizz/SfzFilterImpls.hpp index 2a670d6d..613a41d5 100644 --- a/src/sfizz/SfzFilterImpls.hpp +++ b/src/sfizz/SfzFilterImpls.hpp @@ -40,59 +40,59 @@ protected: #pragma GCC diagnostic ignored "-Wunused-parameter" #endif -#include "gen/filters/sfzApf1p.cxx" -#include "gen/filters/sfzBpf1p.cxx" -#include "gen/filters/sfzBpf2p.cxx" -#include "gen/filters/sfzBpf4p.cxx" -#include "gen/filters/sfzBpf6p.cxx" -#include "gen/filters/sfzBrf1p.cxx" -#include "gen/filters/sfzBrf2p.cxx" -#include "gen/filters/sfzHpf1p.cxx" -#include "gen/filters/sfzHpf2p.cxx" -#include "gen/filters/sfzHpf4p.cxx" -#include "gen/filters/sfzHpf6p.cxx" -#include "gen/filters/sfzLpf1p.cxx" -#include "gen/filters/sfzLpf2p.cxx" -#include "gen/filters/sfzLpf4p.cxx" -#include "gen/filters/sfzLpf6p.cxx" -#include "gen/filters/sfzPink.cxx" -#include "gen/filters/sfzLpf2pSv.cxx" -#include "gen/filters/sfzHpf2pSv.cxx" -#include "gen/filters/sfzBpf2pSv.cxx" -#include "gen/filters/sfzBrf2pSv.cxx" -#include "gen/filters/sfzLsh.cxx" -#include "gen/filters/sfzHsh.cxx" -#include "gen/filters/sfzPeq.cxx" -#include "gen/filters/sfzEqPeak.cxx" -#include "gen/filters/sfzEqLshelf.cxx" -#include "gen/filters/sfzEqHshelf.cxx" +#include "gen/filters/sfzApf1p.hxx" +#include "gen/filters/sfzBpf1p.hxx" +#include "gen/filters/sfzBpf2p.hxx" +#include "gen/filters/sfzBpf4p.hxx" +#include "gen/filters/sfzBpf6p.hxx" +#include "gen/filters/sfzBrf1p.hxx" +#include "gen/filters/sfzBrf2p.hxx" +#include "gen/filters/sfzHpf1p.hxx" +#include "gen/filters/sfzHpf2p.hxx" +#include "gen/filters/sfzHpf4p.hxx" +#include "gen/filters/sfzHpf6p.hxx" +#include "gen/filters/sfzLpf1p.hxx" +#include "gen/filters/sfzLpf2p.hxx" +#include "gen/filters/sfzLpf4p.hxx" +#include "gen/filters/sfzLpf6p.hxx" +#include "gen/filters/sfzPink.hxx" +#include "gen/filters/sfzLpf2pSv.hxx" +#include "gen/filters/sfzHpf2pSv.hxx" +#include "gen/filters/sfzBpf2pSv.hxx" +#include "gen/filters/sfzBrf2pSv.hxx" +#include "gen/filters/sfzLsh.hxx" +#include "gen/filters/sfzHsh.hxx" +#include "gen/filters/sfzPeq.hxx" +#include "gen/filters/sfzEqPeak.hxx" +#include "gen/filters/sfzEqLshelf.hxx" +#include "gen/filters/sfzEqHshelf.hxx" -#include "gen/filters/sfz2chApf1p.cxx" -#include "gen/filters/sfz2chBpf1p.cxx" -#include "gen/filters/sfz2chBpf2p.cxx" -#include "gen/filters/sfz2chBpf4p.cxx" -#include "gen/filters/sfz2chBpf6p.cxx" -#include "gen/filters/sfz2chBrf1p.cxx" -#include "gen/filters/sfz2chBrf2p.cxx" -#include "gen/filters/sfz2chHpf1p.cxx" -#include "gen/filters/sfz2chHpf2p.cxx" -#include "gen/filters/sfz2chHpf4p.cxx" -#include "gen/filters/sfz2chHpf6p.cxx" -#include "gen/filters/sfz2chLpf1p.cxx" -#include "gen/filters/sfz2chLpf2p.cxx" -#include "gen/filters/sfz2chLpf4p.cxx" -#include "gen/filters/sfz2chLpf6p.cxx" -#include "gen/filters/sfz2chPink.cxx" -#include "gen/filters/sfz2chLpf2pSv.cxx" -#include "gen/filters/sfz2chHpf2pSv.cxx" -#include "gen/filters/sfz2chBpf2pSv.cxx" -#include "gen/filters/sfz2chBrf2pSv.cxx" -#include "gen/filters/sfz2chLsh.cxx" -#include "gen/filters/sfz2chHsh.cxx" -#include "gen/filters/sfz2chPeq.cxx" -#include "gen/filters/sfz2chEqPeak.cxx" -#include "gen/filters/sfz2chEqLshelf.cxx" -#include "gen/filters/sfz2chEqHshelf.cxx" +#include "gen/filters/sfz2chApf1p.hxx" +#include "gen/filters/sfz2chBpf1p.hxx" +#include "gen/filters/sfz2chBpf2p.hxx" +#include "gen/filters/sfz2chBpf4p.hxx" +#include "gen/filters/sfz2chBpf6p.hxx" +#include "gen/filters/sfz2chBrf1p.hxx" +#include "gen/filters/sfz2chBrf2p.hxx" +#include "gen/filters/sfz2chHpf1p.hxx" +#include "gen/filters/sfz2chHpf2p.hxx" +#include "gen/filters/sfz2chHpf4p.hxx" +#include "gen/filters/sfz2chHpf6p.hxx" +#include "gen/filters/sfz2chLpf1p.hxx" +#include "gen/filters/sfz2chLpf2p.hxx" +#include "gen/filters/sfz2chLpf4p.hxx" +#include "gen/filters/sfz2chLpf6p.hxx" +#include "gen/filters/sfz2chPink.hxx" +#include "gen/filters/sfz2chLpf2pSv.hxx" +#include "gen/filters/sfz2chHpf2pSv.hxx" +#include "gen/filters/sfz2chBpf2pSv.hxx" +#include "gen/filters/sfz2chBrf2pSv.hxx" +#include "gen/filters/sfz2chLsh.hxx" +#include "gen/filters/sfz2chHsh.hxx" +#include "gen/filters/sfz2chPeq.hxx" +#include "gen/filters/sfz2chEqPeak.hxx" +#include "gen/filters/sfz2chEqLshelf.hxx" +#include "gen/filters/sfz2chEqHshelf.hxx" #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop diff --git a/src/sfizz/effects/Compressor.cpp b/src/sfizz/effects/Compressor.cpp index e5a0c2e5..f2608531 100644 --- a/src/sfizz/effects/Compressor.cpp +++ b/src/sfizz/effects/Compressor.cpp @@ -25,7 +25,7 @@ static constexpr int _oversampling = 2; #define FAUST_UIMACROS 1 -#include "gen/compressor.cxx" +#include "gen/compressor.hxx" namespace sfz { namespace fx { diff --git a/src/sfizz/effects/Disto.cpp b/src/sfizz/effects/Disto.cpp index 0ee5534e..ed9d3487 100644 --- a/src/sfizz/effects/Disto.cpp +++ b/src/sfizz/effects/Disto.cpp @@ -28,7 +28,7 @@ static constexpr int _oversampling = 8; #define FAUST_UIMACROS 1 -#include "gen/disto_stage.cxx" +#include "gen/disto_stage.hxx" namespace sfz { namespace fx { diff --git a/src/sfizz/effects/Fverb.cpp b/src/sfizz/effects/Fverb.cpp index c8ab7938..f5161533 100644 --- a/src/sfizz/effects/Fverb.cpp +++ b/src/sfizz/effects/Fverb.cpp @@ -12,7 +12,7 @@ #include #include #define FAUST_UIMACROS 1 -#include "gen/fverb.cxx" +#include "gen/fverb.hxx" /** Note(jpc): implementation status diff --git a/src/sfizz/effects/Gate.cpp b/src/sfizz/effects/Gate.cpp index b97ffd4a..bfe8fdfc 100644 --- a/src/sfizz/effects/Gate.cpp +++ b/src/sfizz/effects/Gate.cpp @@ -28,7 +28,7 @@ static constexpr int _oversampling = 2; #define FAUST_UIMACROS 1 -#include "gen/gate.cxx" +#include "gen/gate.hxx" namespace sfz { namespace fx { diff --git a/src/sfizz/effects/Limiter.cpp b/src/sfizz/effects/Limiter.cpp index 4560ebbd..eb5f1c3c 100644 --- a/src/sfizz/effects/Limiter.cpp +++ b/src/sfizz/effects/Limiter.cpp @@ -16,7 +16,7 @@ #include "absl/memory/memory.h" static constexpr int _oversampling = 2; -#include "gen/limiter.cpp" +#include "gen/limiter.hxx" namespace sfz { namespace fx { diff --git a/src/sfizz/effects/gen/compressor.cxx b/src/sfizz/effects/gen/compressor.hxx similarity index 100% rename from src/sfizz/effects/gen/compressor.cxx rename to src/sfizz/effects/gen/compressor.hxx diff --git a/src/sfizz/effects/gen/disto_stage.cxx b/src/sfizz/effects/gen/disto_stage.hxx similarity index 100% rename from src/sfizz/effects/gen/disto_stage.cxx rename to src/sfizz/effects/gen/disto_stage.hxx diff --git a/src/sfizz/effects/gen/fverb.cxx b/src/sfizz/effects/gen/fverb.hxx similarity index 100% rename from src/sfizz/effects/gen/fverb.cxx rename to src/sfizz/effects/gen/fverb.hxx diff --git a/src/sfizz/effects/gen/gate.cxx b/src/sfizz/effects/gen/gate.hxx similarity index 100% rename from src/sfizz/effects/gen/gate.cxx rename to src/sfizz/effects/gen/gate.hxx diff --git a/src/sfizz/effects/gen/limiter.cpp b/src/sfizz/effects/gen/limiter.hxx similarity index 100% rename from src/sfizz/effects/gen/limiter.cpp rename to src/sfizz/effects/gen/limiter.hxx diff --git a/src/sfizz/gen/filters/sfz2chApf1p.cxx b/src/sfizz/gen/filters/sfz2chApf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chApf1p.cxx rename to src/sfizz/gen/filters/sfz2chApf1p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBpf1p.cxx b/src/sfizz/gen/filters/sfz2chBpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBpf1p.cxx rename to src/sfizz/gen/filters/sfz2chBpf1p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBpf2p.cxx b/src/sfizz/gen/filters/sfz2chBpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBpf2p.cxx rename to src/sfizz/gen/filters/sfz2chBpf2p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBpf2pSv.cxx b/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBpf2pSv.cxx rename to src/sfizz/gen/filters/sfz2chBpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfz2chBpf4p.cxx b/src/sfizz/gen/filters/sfz2chBpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBpf4p.cxx rename to src/sfizz/gen/filters/sfz2chBpf4p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBpf6p.cxx b/src/sfizz/gen/filters/sfz2chBpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBpf6p.cxx rename to src/sfizz/gen/filters/sfz2chBpf6p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBrf1p.cxx b/src/sfizz/gen/filters/sfz2chBrf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBrf1p.cxx rename to src/sfizz/gen/filters/sfz2chBrf1p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBrf2p.cxx b/src/sfizz/gen/filters/sfz2chBrf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBrf2p.cxx rename to src/sfizz/gen/filters/sfz2chBrf2p.hxx diff --git a/src/sfizz/gen/filters/sfz2chBrf2pSv.cxx b/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chBrf2pSv.cxx rename to src/sfizz/gen/filters/sfz2chBrf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfz2chEqHshelf.cxx b/src/sfizz/gen/filters/sfz2chEqHshelf.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chEqHshelf.cxx rename to src/sfizz/gen/filters/sfz2chEqHshelf.hxx diff --git a/src/sfizz/gen/filters/sfz2chEqLshelf.cxx b/src/sfizz/gen/filters/sfz2chEqLshelf.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chEqLshelf.cxx rename to src/sfizz/gen/filters/sfz2chEqLshelf.hxx diff --git a/src/sfizz/gen/filters/sfz2chEqPeak.cxx b/src/sfizz/gen/filters/sfz2chEqPeak.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chEqPeak.cxx rename to src/sfizz/gen/filters/sfz2chEqPeak.hxx diff --git a/src/sfizz/gen/filters/sfz2chHpf1p.cxx b/src/sfizz/gen/filters/sfz2chHpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHpf1p.cxx rename to src/sfizz/gen/filters/sfz2chHpf1p.hxx diff --git a/src/sfizz/gen/filters/sfz2chHpf2p.cxx b/src/sfizz/gen/filters/sfz2chHpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHpf2p.cxx rename to src/sfizz/gen/filters/sfz2chHpf2p.hxx diff --git a/src/sfizz/gen/filters/sfz2chHpf2pSv.cxx b/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHpf2pSv.cxx rename to src/sfizz/gen/filters/sfz2chHpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfz2chHpf4p.cxx b/src/sfizz/gen/filters/sfz2chHpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHpf4p.cxx rename to src/sfizz/gen/filters/sfz2chHpf4p.hxx diff --git a/src/sfizz/gen/filters/sfz2chHpf6p.cxx b/src/sfizz/gen/filters/sfz2chHpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHpf6p.cxx rename to src/sfizz/gen/filters/sfz2chHpf6p.hxx diff --git a/src/sfizz/gen/filters/sfz2chHsh.cxx b/src/sfizz/gen/filters/sfz2chHsh.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chHsh.cxx rename to src/sfizz/gen/filters/sfz2chHsh.hxx diff --git a/src/sfizz/gen/filters/sfz2chLpf1p.cxx b/src/sfizz/gen/filters/sfz2chLpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLpf1p.cxx rename to src/sfizz/gen/filters/sfz2chLpf1p.hxx diff --git a/src/sfizz/gen/filters/sfz2chLpf2p.cxx b/src/sfizz/gen/filters/sfz2chLpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLpf2p.cxx rename to src/sfizz/gen/filters/sfz2chLpf2p.hxx diff --git a/src/sfizz/gen/filters/sfz2chLpf2pSv.cxx b/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLpf2pSv.cxx rename to src/sfizz/gen/filters/sfz2chLpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfz2chLpf4p.cxx b/src/sfizz/gen/filters/sfz2chLpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLpf4p.cxx rename to src/sfizz/gen/filters/sfz2chLpf4p.hxx diff --git a/src/sfizz/gen/filters/sfz2chLpf6p.cxx b/src/sfizz/gen/filters/sfz2chLpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLpf6p.cxx rename to src/sfizz/gen/filters/sfz2chLpf6p.hxx diff --git a/src/sfizz/gen/filters/sfz2chLsh.cxx b/src/sfizz/gen/filters/sfz2chLsh.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chLsh.cxx rename to src/sfizz/gen/filters/sfz2chLsh.hxx diff --git a/src/sfizz/gen/filters/sfz2chPeq.cxx b/src/sfizz/gen/filters/sfz2chPeq.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chPeq.cxx rename to src/sfizz/gen/filters/sfz2chPeq.hxx diff --git a/src/sfizz/gen/filters/sfz2chPink.cxx b/src/sfizz/gen/filters/sfz2chPink.hxx similarity index 100% rename from src/sfizz/gen/filters/sfz2chPink.cxx rename to src/sfizz/gen/filters/sfz2chPink.hxx diff --git a/src/sfizz/gen/filters/sfzApf1p.cxx b/src/sfizz/gen/filters/sfzApf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzApf1p.cxx rename to src/sfizz/gen/filters/sfzApf1p.hxx diff --git a/src/sfizz/gen/filters/sfzBpf1p.cxx b/src/sfizz/gen/filters/sfzBpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBpf1p.cxx rename to src/sfizz/gen/filters/sfzBpf1p.hxx diff --git a/src/sfizz/gen/filters/sfzBpf2p.cxx b/src/sfizz/gen/filters/sfzBpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBpf2p.cxx rename to src/sfizz/gen/filters/sfzBpf2p.hxx diff --git a/src/sfizz/gen/filters/sfzBpf2pSv.cxx b/src/sfizz/gen/filters/sfzBpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBpf2pSv.cxx rename to src/sfizz/gen/filters/sfzBpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfzBpf4p.cxx b/src/sfizz/gen/filters/sfzBpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBpf4p.cxx rename to src/sfizz/gen/filters/sfzBpf4p.hxx diff --git a/src/sfizz/gen/filters/sfzBpf6p.cxx b/src/sfizz/gen/filters/sfzBpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBpf6p.cxx rename to src/sfizz/gen/filters/sfzBpf6p.hxx diff --git a/src/sfizz/gen/filters/sfzBrf1p.cxx b/src/sfizz/gen/filters/sfzBrf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBrf1p.cxx rename to src/sfizz/gen/filters/sfzBrf1p.hxx diff --git a/src/sfizz/gen/filters/sfzBrf2p.cxx b/src/sfizz/gen/filters/sfzBrf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBrf2p.cxx rename to src/sfizz/gen/filters/sfzBrf2p.hxx diff --git a/src/sfizz/gen/filters/sfzBrf2pSv.cxx b/src/sfizz/gen/filters/sfzBrf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzBrf2pSv.cxx rename to src/sfizz/gen/filters/sfzBrf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfzEqHshelf.cxx b/src/sfizz/gen/filters/sfzEqHshelf.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzEqHshelf.cxx rename to src/sfizz/gen/filters/sfzEqHshelf.hxx diff --git a/src/sfizz/gen/filters/sfzEqLshelf.cxx b/src/sfizz/gen/filters/sfzEqLshelf.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzEqLshelf.cxx rename to src/sfizz/gen/filters/sfzEqLshelf.hxx diff --git a/src/sfizz/gen/filters/sfzEqPeak.cxx b/src/sfizz/gen/filters/sfzEqPeak.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzEqPeak.cxx rename to src/sfizz/gen/filters/sfzEqPeak.hxx diff --git a/src/sfizz/gen/filters/sfzHpf1p.cxx b/src/sfizz/gen/filters/sfzHpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHpf1p.cxx rename to src/sfizz/gen/filters/sfzHpf1p.hxx diff --git a/src/sfizz/gen/filters/sfzHpf2p.cxx b/src/sfizz/gen/filters/sfzHpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHpf2p.cxx rename to src/sfizz/gen/filters/sfzHpf2p.hxx diff --git a/src/sfizz/gen/filters/sfzHpf2pSv.cxx b/src/sfizz/gen/filters/sfzHpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHpf2pSv.cxx rename to src/sfizz/gen/filters/sfzHpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfzHpf4p.cxx b/src/sfizz/gen/filters/sfzHpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHpf4p.cxx rename to src/sfizz/gen/filters/sfzHpf4p.hxx diff --git a/src/sfizz/gen/filters/sfzHpf6p.cxx b/src/sfizz/gen/filters/sfzHpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHpf6p.cxx rename to src/sfizz/gen/filters/sfzHpf6p.hxx diff --git a/src/sfizz/gen/filters/sfzHsh.cxx b/src/sfizz/gen/filters/sfzHsh.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzHsh.cxx rename to src/sfizz/gen/filters/sfzHsh.hxx diff --git a/src/sfizz/gen/filters/sfzLpf1p.cxx b/src/sfizz/gen/filters/sfzLpf1p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLpf1p.cxx rename to src/sfizz/gen/filters/sfzLpf1p.hxx diff --git a/src/sfizz/gen/filters/sfzLpf2p.cxx b/src/sfizz/gen/filters/sfzLpf2p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLpf2p.cxx rename to src/sfizz/gen/filters/sfzLpf2p.hxx diff --git a/src/sfizz/gen/filters/sfzLpf2pSv.cxx b/src/sfizz/gen/filters/sfzLpf2pSv.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLpf2pSv.cxx rename to src/sfizz/gen/filters/sfzLpf2pSv.hxx diff --git a/src/sfizz/gen/filters/sfzLpf4p.cxx b/src/sfizz/gen/filters/sfzLpf4p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLpf4p.cxx rename to src/sfizz/gen/filters/sfzLpf4p.hxx diff --git a/src/sfizz/gen/filters/sfzLpf6p.cxx b/src/sfizz/gen/filters/sfzLpf6p.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLpf6p.cxx rename to src/sfizz/gen/filters/sfzLpf6p.hxx diff --git a/src/sfizz/gen/filters/sfzLsh.cxx b/src/sfizz/gen/filters/sfzLsh.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzLsh.cxx rename to src/sfizz/gen/filters/sfzLsh.hxx diff --git a/src/sfizz/gen/filters/sfzPeq.cxx b/src/sfizz/gen/filters/sfzPeq.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzPeq.cxx rename to src/sfizz/gen/filters/sfzPeq.hxx diff --git a/src/sfizz/gen/filters/sfzPink.cxx b/src/sfizz/gen/filters/sfzPink.hxx similarity index 100% rename from src/sfizz/gen/filters/sfzPink.cxx rename to src/sfizz/gen/filters/sfzPink.hxx From 9bb633e50dfba47580db76794a57432bd7afff6e Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Wed, 24 Feb 2021 23:54:32 +0100 Subject: [PATCH 02/10] Add the faust helpers for cmake --- CMakeLists.txt | 1 + cmake/SfizzFaust.cmake | 72 +++++++ scripts/faustwrap.d | 393 +++++++++++++++++++++++++++++++++++++ src/sfizz/dsp/platform.lib | 18 ++ 4 files changed, 484 insertions(+) create mode 100644 cmake/SfizzFaust.cmake create mode 100755 scripts/faustwrap.d create mode 100644 src/sfizz/dsp/platform.lib diff --git a/CMakeLists.txt b/CMakeLists.txt index dce2d0da..c4b982fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ option_ex (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF) include (SfizzConfig) include (SfizzDeps) +include (SfizzFaust) # Don't use IPO in non Release builds include (CheckIPO) diff --git a/cmake/SfizzFaust.cmake b/cmake/SfizzFaust.cmake new file mode 100644 index 00000000..a69ee115 --- /dev/null +++ b/cmake/SfizzFaust.cmake @@ -0,0 +1,72 @@ +include(CMakeParseArguments) + +option(SFIZZ_RECOMPILE_FAUST "Recompile faust sources" OFF) + +if(SFIZZ_RECOMPILE_FAUST) + find_program(RDMD "rdmd") + if(NOT RDMD) + message(FATAL_ERROR "rdmd is missing, it is required for regenerating faust sources.") + endif() +endif() + +function(add_faust_command INPUT OUTPUT) + set(_options ONE_SAMPLE DOUBLE IN_PLACE VECTORIZE MATH_APPROXIMATION) + set(_one_args PROCESS_NAME CLASS_NAME SUPERCLASS_NAME) + set(_multi_args IMPORT_DIRS) + cmake_parse_arguments(_FAUST "${_options}" "${_one_args}" "${_multi_args}" ${ARGN}) + if(NOT SFIZZ_RECOMPILE_FAUST) + return() + endif() + if(NOT RDMD) + return() + endif() + if(NOT INPUT) + message(FATAL_ERROR "No input file given.") + endif() + if(NOT OUTPUT) + message(FATAL_ERROR "No output file given.") + endif() + set(_cmd "${RDMD}" "${PROJECT_SOURCE_DIR}/scripts/faustwrap.d") + if(NOT IS_ABSOLUTE "${INPUT}") + set(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}") + endif() + if(NOT IS_ABSOLUTE "${OUTPUT}") + set(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${OUTPUT}") + endif() + get_filename_component(_output_dir "${OUTPUT}" DIRECTORY) + file(MAKE_DIRECTORY "${_output_dir}") + list(APPEND _cmd "-o" "${OUTPUT}" "${INPUT}") + if(_FAUST_ONE_SAMPLE) + list(APPEND _cmd "--os") + endif() + if(_FAUST_DOUBLE) + list(APPEND _cmd "--double") + endif() + if(_FAUST_IN_PLACE) + list(APPEND _cmd "--inpl") + endif() + if(_FAUST_VECTORIZE) + list(APPEND _cmd "--vec") + endif() + if(_FAUST_MATH_APPROXIMATION) + list(APPEND _cmd "--mapp") + endif() + if(_FAUST_PROCESS_NAME) + list(APPEND _cmd "--pn" "${_FAUST_PROCESS_NAME}") + endif() + if(_FAUST_CLASS_NAME) + list(APPEND _cmd "--cn" "${_FAUST_CLASS_NAME}") + endif() + if(_FAUST_SUPERCLASS_NAME) + list(APPEND _cmd "--scn" "${_FAUST_SUPERCLASS_NAME}") + endif() + if (_FAUST_IMPORT_DIRS) + foreach(_dir IN LISTS _FAUST_IMPORT_DIRS) + if(NOT IS_ABSOLUTE "${_dir}") + set(_dir "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}") + endif() + list(APPEND _cmd "--import-dir" "${_dir}") + endforeach() + endif() + add_custom_command(OUTPUT "${OUTPUT}" COMMAND ${_cmd} DEPENDS "${INPUT}") +endfunction() diff --git a/scripts/faustwrap.d b/scripts/faustwrap.d new file mode 100755 index 00000000..aad1e47d --- /dev/null +++ b/scripts/faustwrap.d @@ -0,0 +1,393 @@ +#!/usr/bin/env rdmd + +import std.conv; +import std.algorithm; +import std.getopt; +import std.process; +import std.regex; +import std.uni; +import std.ascii; +import std.string; +import std.array; +import std.stdio; +import core.stdc.stdlib; + +enum string prologue = `#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +`; + +enum string epilogue = ` +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS +`; + +void main(string[] args) +{ + struct Opts { + string outputPath; + string className = "mydsp"; + string superclassName = null; + bool oneSample = false; + bool doublePrecision = false; + bool inPlace = false; + bool vectorize = false; + bool mathApproximation = false; + string processName = null; + string[] importDirs; + } + + Opts opts; + + auto optInfo = getopt(args, + "out|o", "Output path", &opts.outputPath, + "cn", "Class name", &opts.className, + "scn", "Superclass name", &opts.superclassName, + "os", "One sample", &opts.oneSample, + "double", "Double precision", &opts.doublePrecision, + "inpl", "In-place", &opts.inPlace, + "vec", "Vectorization", &opts.vectorize, + "mapp", "Math approximation", &opts.mathApproximation, + "pn", "Process name", &opts.processName, + "import-dir|I", "Import directory", &opts.importDirs); + + if (optInfo.helpWanted) + { + defaultGetoptPrinter("MyFaust", optInfo.options); + return; + } + + if (args.length != 2) + { + writeln("You must indicate exactly 1 input file."); + exit(1); + } + + string[] cmd = [getFaust()]; + cmd ~= "-cn"; + cmd ~= opts.className; + if (opts.superclassName) + { + cmd ~= "-scn"; + cmd ~= opts.superclassName; + } + if (opts.oneSample) + cmd ~= "-os"; + if (opts.doublePrecision) + cmd ~= "-double"; + if (opts.inPlace) + cmd ~= "-inpl"; + if (opts.vectorize) + cmd ~= "-vec"; + if (opts.mathApproximation) + cmd ~= "-mapp"; + if (opts.processName) + { + cmd ~= "-pn"; + cmd ~= opts.processName; + } + foreach (string dir; opts.importDirs) + { + cmd ~= "-I"; + cmd ~= dir; + } + cmd ~= args[1]; + + auto result = execute(cmd, null, Config.stderrPassThrough|Config.suppressConsole); + if (result.status != 0) + exit(1); + + string code = result.output; + Parameter[] params = findParameters(code); + + code = removeVirtualKeyword(code); + foreach (string method; ["metadata", "getInputRate", "getOutputRate", "clone", "buildUserInterface"]) + code = removeMethod(code, method); + foreach (string method; ["getNumInputs", "getNumOutputs"]) + code = makeMethodStaticConstexpr(code, method); + if (!opts.superclassName) + code = removeSuperclass(code); + code = makePointerArgsConst(code, opts.oneSample); + code = addParameters(code, params); + + foreach (string method; ["compute", "classInit", "instanceConstants", "instanceResetUserInterface", "instanceClear", "init", "instanceInit"]) + code = addMethodStartEnd(code, method); + code = addClassStartEnd(code); + + File outFile = stdout; + if (opts.outputPath) + outFile = File(opts.outputPath, "w"); + outFile.writef("%s%s%s", prologue, code, epilogue); + outFile.flush(); +} + +final class Parameter +{ + string name; + string var; + bool readonly; +}; + +Parameter[] findParameters(string code) +{ + Parameter[] params; + + auto expr = regex(`->add(Button|CheckButton|VerticalSlider|HorizontalSlider|NumEntry|HorizontalBargraph|VerticalBargraph)\("([^"]*)", &([a-zA-Z0-9_]+)`); + + foreach (string line; code.lineSplitter) + { + auto match = line.matchFirst(expr); + if (match) + { + Parameter param = new Parameter; + param.name = match[2]; + param.var = match[3]; + param.readonly = ["HorizontalBargraph", "VerticalBargraph"].canFind(match[1]); + params ~= param; + } + } + + return params; +} + +string removeVirtualKeyword(string code) +{ + auto expr = regex(`\bvirtual\s*\b`); + return code.replaceAll(expr, ""); +} + +string removeMethod(string code, string method) +{ + string[] newLines; + newLines.reserve(1024); + + auto expr = regex(`^(\s*).*\b` ~ method.escaper.to!string ~ `\s*\(.*\{\s*$`); + + bool inMethod = false; + string eom = null; + + foreach (string line; code.lineSplitter) + { + if (inMethod) + { + if (line.stripRight == eom) + inMethod = false; + } + else + { + auto match = line.matchFirst(expr); + if (match) + { + inMethod = true; + eom = match[1] ~ '}'; + } + else + newLines ~= line; + } + } + + return newLines.join('\n'); +} + +string makeMethodStaticConstexpr(string code, string method) +{ + string[] newLines; + newLines.reserve(1024); + + auto expr = regex(`^(\s*)(.*\b` ~ method.escaper.to!string ~ `\s*\(.*\{\s*)$`); + + foreach (string line; code.lineSplitter) + { + auto match = line.matchFirst(expr); + if (match) + newLines ~= match[1] ~ "static constexpr " ~ match[2]; + else + newLines ~= line; + } + + return newLines.join('\n'); +} + +string removeSuperclass(string code) +{ + auto expr = regex(`\s*:\s*public\s+dsp\s*`); + return code.replaceFirst(expr, " "); +} + +string makePointerArgsConst(string code, bool oneSample) +{ + if (!oneSample) + { + auto expr = regex(`\bvoid\s+compute\s*\(\s*([^,)]+)\s*,\s*([^,)]+)\s*,\s*([^,)]+)\s*\)`); + auto match = code.matchFirst(expr); + + string arg1 = match[1]; + string arg2 = match[2]; + string arg3 = match[3]; + + auto exprArg = regex(`^FAUSTFLOAT\s*\*\s*\*`); + arg2 = arg2.replaceFirst(exprArg, "FAUSTFLOAT const* const*"); + arg3 = arg3.replaceFirst(exprArg, "FAUSTFLOAT* const*"); + + ulong start = match[0].ptr - code.ptr; + ulong end = start + match[0].length; + code = format("%svoid compute(%s, %s, %s)%s", code[0..start], arg1, arg2, arg3, code[end..$]); + + // + auto exprStmt = regex(`FAUSTFLOAT\s*\*\s*(input\d+)`); + code = code.replaceAll(exprStmt, "FAUSTFLOAT const* $1"); + } + else + { + auto expr = regex(`\bvoid\s+compute\s*\(\s*([^,)]+)\s*,\s*([^,)]+)\s*,\s*([^,)]+)\s*,\s*([^,)]+)\s*\)`); + auto match = code.matchFirst(expr); + + string arg1 = match[1]; + string arg2 = match[2]; + string arg3 = match[3]; + string arg4 = match[4]; + + auto exprArg = regex(`^(FAUSTFLOAT|int)\s*\*`); + arg1 = arg1.replaceFirst(exprArg, "$1 const*"); + arg3 = arg3.replaceFirst(exprArg, "$1 const*"); + arg4 = arg4.replaceFirst(exprArg, "$1 const*"); + + ulong start = match[0].ptr - code.ptr; + ulong end = start + match[0].length; + code = format("%svoid compute(%s, %s, %s, %s)%s", code[0..start], arg1, arg2, arg3, arg4, code[end..$]); + } + + return code; +} + +string addParameters(string code, Parameter[] params) +{ + string[] addedLines; + + foreach (Parameter param; params) + { + string camelName = param.name.camelify; + addedLines ~= ""; + addedLines ~= format(` FAUSTFLOAT get%s() const { return %s; }`, camelName, param.var); + if (!param.readonly) + addedLines ~= format(` void set%s(FAUSTFLOAT value) { %s = value; }`, camelName, param.var); + } + + return addToClass(code, addedLines.join('\n')); +} + +string addMethodStartEnd(string code, string method) +{ + string[] newLines; + newLines.reserve(1024); + + auto expr = regex(`^(\s*).*\b` ~ method.escaper.to!string ~ `\s*\(.*\{\s*$`); + + bool inMethod = false; + string eom = null; + + foreach (string line; code.lineSplitter) + { + if (inMethod) + { + if (line.stripRight == eom) + { + newLines ~= "\t\t//[End:" ~ method ~ "]"; + inMethod = false; + } + newLines ~= line; + } + else + { + newLines ~= line; + auto match = line.matchFirst(expr); + if (match) + { + inMethod = true; + eom = match[1] ~ '}'; + newLines ~= "\t\t//[Begin:" ~ method ~ "]"; + } + } + } + + return newLines.join('\n'); +} + +string addClassStartEnd(string code) +{ + { + auto expr = regex(`^class\b.*$`, "m"); + auto match = code.matchFirst(expr); + ulong start = match[0].ptr - code.ptr; + ulong end = start + match[0].length; + code = code[0..start] ~ "\n//[Before:class]\n" ~ match[0] ~ "\n\t//[Begin:class]\n" ~ code[end..$]; + } + + { + auto expr = regex(`^\};`, "m"); + auto match = code.matchLast(expr); + ulong start = match[0].ptr - code.ptr; + ulong end = start + match[0].length; + code = code[0..start] ~ "\n\t//[End:class]\n" ~ match[0] ~ "\n//[After:class]\n" ~ code[end..$]; + } + + return code; +} + +string addToClass(string code, string addend) +{ + if (addend.empty) + return code; + + auto expr = regex(`^\};`, "m"); + auto match = code.matchLast(expr); + ulong index = match[0].ptr - code.ptr; + return code[0..index] ~ addend ~ '\n' ~ code[index..$]; +} + +string camelify(string name) +{ + dchar[] result; + result.reserve(name.length); + + bool isIdentifierChar(dchar ch) + { + return std.ascii.isAlphaNum(ch) || ch == '_'; + } + + dchar[] temp = name.to!(dchar[]); + + foreach (ref dchar uniChar; temp) + { + uniChar = [uniChar].normalize!NFD[0]; + if (!isIdentifierChar(uniChar)) + uniChar = ' '; + } + + foreach (dchar[] part; temp.split(' ')) + { + if (!part.empty) + part[0] = std.uni.toUpper(part[0]); + result ~= part; + } + + return result.to!string; +} + +Captures!S matchLast(S, R)(S input, R expr) +{ + Captures!S last; + foreach (Captures!S current; input.matchAll(expr)) + last = current; + return last; +} + +string getFaust() +{ + char *env = getenv("FAUST"); + return env ? env.to!string : "faust"; +} diff --git a/src/sfizz/dsp/platform.lib b/src/sfizz/dsp/platform.lib new file mode 100644 index 00000000..9cd53a3f --- /dev/null +++ b/src/sfizz/dsp/platform.lib @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------------- +// A version of platform.lib which does not limit the sample rate. +// This allows use of high oversampling factors. +//----------------------------------------------------------------------------- + +declare name "sfizz Generic Platform Library"; +declare license "BSD-2-Clause"; + +//---------------------------------`(pl.)SR`----------------------------------- +// Current sampling rate (between 1Hz and 192000Hz). Constant during +// program execution. +//----------------------------------------------------------------------------- +SR = fconstant(int fSamplingFreq, ); + +//---------------------------------`(pl.)tablesize`---------------------------- +// Oscillator table size +//----------------------------------------------------------------------------- +tablesize = 1 << 16; From cd43cac59b67fee68205fd0e721f2b2a28459880 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 00:01:56 +0100 Subject: [PATCH 03/10] Faust filters automatically generated --- src/CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ src/sfizz/SfzFilterImpls.hpp | 20 ++++++++++---------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee7dbc3b..cc19c67f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -310,6 +310,36 @@ endif() # Generic library alias add_library(sfizz::sfizz ALIAS sfizz_static) +# Preserve generated files (Faust) +set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE) + +# Faust filters +foreach(filter_type + Lpf1p Lpf2p Lpf4p Lpf6p Hpf1p Hpf2p Hpf4p Hpf6p + Bpf1p Bpf2p Bpf4p Bpf6p Apf1p Brf1p Brf2p + Pink Lpf2pSv Hpf2pSv Bpf2pSv Brf2pSv + Lsh Hsh Peq EqPeak EqLshelf EqHshelf) + add_faust_command( + "sfizz/dsp/filters/sfz_filters.dsp" + "sfizz/gen/filters/sfz${filter_type}.hxx" + DOUBLE IN_PLACE + PROCESS_NAME "sfz${filter_type}" + CLASS_NAME "faust${filter_type}" + SUPERCLASS_NAME "sfzFilterDsp" + IMPORT_DIRS "sfizz/dsp") + add_faust_command( + "sfizz/dsp/filters/sfz_filters.dsp" + "sfizz/gen/filters/sfz2ch${filter_type}.hxx" + DOUBLE IN_PLACE + PROCESS_NAME "sfz2ch${filter_type}" + CLASS_NAME "faust2ch${filter_type}" + SUPERCLASS_NAME "sfzFilterDsp" + IMPORT_DIRS "sfizz/dsp") + target_sources(sfizz_internal PRIVATE + "sfizz/gen/filters/sfz${filter_type}.hxx" + "sfizz/gen/filters/sfz2ch${filter_type}.hxx") +endforeach() + # Windows installer if(WIN32) include(VSTConfig) diff --git a/src/sfizz/SfzFilterImpls.hpp b/src/sfizz/SfzFilterImpls.hpp index 613a41d5..72bb0fb8 100644 --- a/src/sfizz/SfzFilterImpls.hpp +++ b/src/sfizz/SfzFilterImpls.hpp @@ -16,7 +16,7 @@ public: virtual void init(int) = 0; virtual void instanceClear() = 0; - virtual void compute(int, float **, float **) = 0; + virtual void compute(int, const float *const *, float *const *) = 0; virtual void configureStandard(float, float, float) {} virtual void configureEq(float, float, float) {} @@ -105,8 +105,8 @@ protected: template struct sfzFilter : public F { void configureStandard(float cutoff, float q, float pksh) override { - F::fCutoff = cutoff; - F::fQ = q; + this->setCutoff(cutoff); + this->setResonance(q); (void)pksh; } }; @@ -118,7 +118,7 @@ template struct sfzFilter : public F { template struct sfzFilterNoQ : public F { void configureStandard(float cutoff, float q, float pksh) override { - F::fCutoff = cutoff; + this->setCutoff(cutoff); (void)q; (void)pksh; } @@ -144,9 +144,9 @@ template struct sfzFilterNoCutoff : public F { template struct sfzFilterPkSh : public F { void configureStandard(float cutoff, float q, float pksh) override { - F::fCutoff = cutoff; - F::fQ = q; - F::fPkShGain = pksh; + this->setCutoff(cutoff); + this->setResonance(q); + this->setPeakShelfGain(pksh); } }; @@ -157,9 +157,9 @@ template struct sfzFilterPkSh : public F { template struct sfzFilterEq : public F { void configureEq(float cutoff, float bw, float pksh) override { - F::fCutoff = cutoff; - F::fBandwidth = bw; - F::fPkShGain = pksh; + this->setCutoff(cutoff); + this->setBandwidth(bw); + this->setPeakShelfGain(pksh); } }; From 5c5c4342970cb3a3179fec307ac170931215d9fa Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 00:16:24 +0100 Subject: [PATCH 04/10] Update fx with faust helpers, change oversampling strategy --- src/CMakeLists.txt | 38 +++++++++++++++++++++++++++ src/sfizz/effects/Compressor.cpp | 29 ++++++++------------ src/sfizz/effects/Disto.cpp | 17 ++++-------- src/sfizz/effects/Fverb.cpp | 30 +++++++++------------ src/sfizz/effects/Gate.cpp | 29 ++++++++------------ src/sfizz/effects/Limiter.cpp | 6 ++--- src/sfizz/effects/dsp/compressor.dsp | 5 ++-- src/sfizz/effects/dsp/disto_stage.dsp | 4 +-- src/sfizz/effects/dsp/gate.dsp | 7 +++-- src/sfizz/effects/dsp/limiter.dsp | 5 ++-- 10 files changed, 88 insertions(+), 82 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc19c67f..7be3fd64 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -340,6 +340,44 @@ foreach(filter_type "sfizz/gen/filters/sfz2ch${filter_type}.hxx") endforeach() +# Faust effects +add_faust_command( + "sfizz/effects/dsp/compressor.dsp" + "sfizz/effects/gen/compressor.hxx" + IN_PLACE + CLASS_NAME "faustCompressor" + IMPORT_DIRS "sfizz/dsp") +add_faust_command( + "sfizz/effects/dsp/disto_stage.dsp" + "sfizz/effects/gen/disto_stage.hxx" + IN_PLACE + CLASS_NAME "faustDisto" + IMPORT_DIRS "sfizz/dsp") +add_faust_command( + "sfizz/effects/dsp/fverb.dsp" + "sfizz/effects/gen/fverb.hxx" + IN_PLACE + CLASS_NAME "faustFverb" + IMPORT_DIRS "sfizz/dsp") +add_faust_command( + "sfizz/effects/dsp/gate.dsp" + "sfizz/effects/gen/gate.hxx" + IN_PLACE + CLASS_NAME "faustGate" + IMPORT_DIRS "sfizz/dsp") +add_faust_command( + "sfizz/effects/dsp/limiter.dsp" + "sfizz/effects/gen/limiter.hxx" + IN_PLACE + CLASS_NAME "faustLimiter" + IMPORT_DIRS "sfizz/dsp") +target_sources(sfizz_internal PRIVATE + "sfizz/effects/gen/compressor.hxx" + "sfizz/effects/gen/disto_stage.hxx" + "sfizz/effects/gen/fverb.hxx" + "sfizz/effects/gen/gate.hxx" + "sfizz/effects/gen/limiter.hxx") + # Windows installer if(WIN32) include(VSTConfig) diff --git a/src/sfizz/effects/Compressor.cpp b/src/sfizz/effects/Compressor.cpp index f2608531..0cd528dc 100644 --- a/src/sfizz/effects/Compressor.cpp +++ b/src/sfizz/effects/Compressor.cpp @@ -17,6 +17,7 @@ */ #include "Compressor.h" +#include "gen/compressor.hxx" #include "Opcode.h" #include "AudioSpan.h" #include "MathHelpers.h" @@ -24,8 +25,6 @@ #include "absl/memory/memory.h" static constexpr int _oversampling = 2; -#define FAUST_UIMACROS 1 -#include "gen/compressor.hxx" namespace sfz { namespace fx { @@ -38,12 +37,6 @@ namespace fx { AudioBuffer _gain2x { 2, _oversampling * config::defaultSamplesPerBlock }; hiir::Downsampler2x<12> _downsampler2x[EffectChannels]; hiir::Upsampler2x<12> _upsampler2x[EffectChannels]; - - #define DEFINE_SET_GET(type, ident, name, var, def, min, max, step) \ - float get_##ident(size_t i) const noexcept { return _compressor[i].var; } \ - void set_##ident(size_t i, float value) noexcept { _compressor[i].var = value; } - FAUST_LIST_ACTIVES(DEFINE_SET_GET); - #undef DEFINE_SET_GET }; Compressor::Compressor() @@ -62,8 +55,8 @@ namespace fx { { Impl& impl = *_impl; for (faustCompressor& comp : impl._compressor) { - comp.classInit(sampleRate); - comp.instanceConstants(sampleRate); + comp.classInit(_oversampling * sampleRate); + comp.instanceConstants(_oversampling * sampleRate); } for (unsigned c = 0; c < EffectChannels; ++c) { @@ -164,29 +157,29 @@ namespace fx { case hash("comp_attack"): { auto value = opc.read(Default::compAttack); - for (size_t c = 0; c < 2; ++c) - impl.set_Attack(c, value); + for (faustCompressor& comp : impl._compressor) + comp.setAttack(value); } break; case hash("comp_release"): { auto value = opc.read(Default::compRelease); - for (size_t c = 0; c < 2; ++c) - impl.set_Release(c, value); + for (faustCompressor& comp : impl._compressor) + comp.setRelease(value); } break; case hash("comp_threshold"): { auto value = opc.read(Default::compThreshold); - for (size_t c = 0; c < 2; ++c) - impl.set_Threshold(c, value); + for (faustCompressor& comp : impl._compressor) + comp.setThreshold(value); } break; case hash("comp_ratio"): { auto value = opc.read(Default::compRatio); - for (size_t c = 0; c < 2; ++c) - impl.set_Ratio(c, value); + for (faustCompressor& comp : impl._compressor) + comp.setRatio(value); } break; case hash("comp_gain"): diff --git a/src/sfizz/effects/Disto.cpp b/src/sfizz/effects/Disto.cpp index ed9d3487..05ba158c 100644 --- a/src/sfizz/effects/Disto.cpp +++ b/src/sfizz/effects/Disto.cpp @@ -19,6 +19,7 @@ */ #include "Disto.h" +#include "gen/disto_stage.hxx" #include "Opcode.h" #include "Config.h" #include "MathHelpers.h" @@ -27,8 +28,6 @@ #include static constexpr int _oversampling = 8; -#define FAUST_UIMACROS 1 -#include "gen/disto_stage.hxx" namespace sfz { namespace fx { @@ -56,12 +55,6 @@ struct Disto::Impl { float mk = 21.0f + _tone * 1.08f; return 440.0f * std::exp2((mk - 69.0f) * (1.0f / 12.0f)); } - - #define DEFINE_SET_GET(type, ident, name, var, def, min, max, step) \ - float get_##ident(size_t c, size_t s) const noexcept { return _stages[c][s].var; } \ - void set_##ident(size_t c, size_t s, float value) noexcept { _stages[c][s].var = value; } - FAUST_LIST_ACTIVES(DEFINE_SET_GET); - #undef DEFINE_SET_GET }; Disto::Disto() @@ -71,7 +64,7 @@ Disto::Disto() for (unsigned c = 0; c < EffectChannels; ++c) { for (faustDisto& stage : impl._stages[c]) - stage.init(config::defaultSampleRate); + stage.init(_oversampling * config::defaultSampleRate); } } @@ -86,8 +79,8 @@ void Disto::setSampleRate(double sampleRate) for (unsigned c = 0; c < EffectChannels; ++c) { for (faustDisto& stage : impl._stages[c]) { - stage.classInit(sampleRate); - stage.instanceConstants(sampleRate); + stage.classInit(_oversampling * sampleRate); + stage.instanceConstants(_oversampling * sampleRate); } } } @@ -150,7 +143,7 @@ void Disto::process(const float* const inputs[], float* const outputs[], unsigne absl::Span stageInOut = upsamplerOut; for (unsigned s = 0, numStages = impl._numStages; s < numStages; ++s) { // set depth parameter (TODO modulation) - impl.set_Depth(c, s, depth); + impl._stages[c][s].setDepth(depth); // float *faustIn[] = { stageInOut.data() }; float *faustOut[] = { stageInOut.data() }; diff --git a/src/sfizz/effects/Fverb.cpp b/src/sfizz/effects/Fverb.cpp index f5161533..804e12a3 100644 --- a/src/sfizz/effects/Fverb.cpp +++ b/src/sfizz/effects/Fverb.cpp @@ -5,14 +5,13 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #include "Fverb.h" +#include "gen/fverb.hxx" #include "Opcode.h" #include "Config.h" #include "MathHelpers.h" #include #include #include -#define FAUST_UIMACROS 1 -#include "gen/fverb.hxx" /** Note(jpc): implementation status @@ -40,12 +39,6 @@ namespace fx { struct Fverb::Impl { faustFverb dsp; - #define DEFINE_SET_GET(type, ident, name, var, def, min, max, step) \ - float get_##ident() const noexcept { return dsp.var; } \ - void set_##ident(float value) noexcept { dsp.var = value; } - FAUST_LIST_ACTIVES(DEFINE_SET_GET); - #undef DEFINE_SET_GET - struct Profile { float tailDensity; // % float decayAtMaxSize; // % @@ -240,17 +233,18 @@ namespace fx { const float decayMin = decayMax * 0.5f; Impl& impl = *reverb->impl_; - impl.set_Predelay(predelay * 1e3); - impl.set_Tail_density(profile->tailDensity); - impl.set_Decay(decayMax * size * 0.01f + decayMin * (1.0f - size * 0.01f)); - impl.set_Modulator_frequency(profile->modulationFrequency); - impl.set_Modulator_depth(profile->modulationDepth); - impl.set_Dry(profile->dry * dry * 0.01f); - impl.set_Wet(profile->wet * wet * 0.01f); - impl.set_Input_amount(input); - impl.set_Input_low_pass_cutoff(Impl::lpfCutoff(tone)); + faustFverb& dsp = impl.dsp; + dsp.setPredelay(predelay * 1e3); + dsp.setTailDensity(profile->tailDensity); + dsp.setDecay(decayMax * size * 0.01f + decayMin * (1.0f - size * 0.01f)); + dsp.setModulatorFrequency(profile->modulationFrequency); + dsp.setModulatorDepth(profile->modulationDepth); + dsp.setDry(profile->dry * dry * 0.01f); + dsp.setWet(profile->wet * wet * 0.01f); + dsp.setInputAmount(input); + dsp.setInputLowPassCutoff(Impl::lpfCutoff(tone)); // NOTE(jpc): damp formula not well calibrated, but sounds ok-ish - impl.set_Damping(Impl::lpfCutoff(100 - 0.5 * damp)); + dsp.setDamping(Impl::lpfCutoff(100 - 0.5 * damp)); return fx; } diff --git a/src/sfizz/effects/Gate.cpp b/src/sfizz/effects/Gate.cpp index bfe8fdfc..e8852dfb 100644 --- a/src/sfizz/effects/Gate.cpp +++ b/src/sfizz/effects/Gate.cpp @@ -20,6 +20,7 @@ */ #include "Gate.h" +#include "gen/gate.hxx" #include "Opcode.h" #include "AudioSpan.h" #include "MathHelpers.h" @@ -27,8 +28,6 @@ #include "absl/memory/memory.h" static constexpr int _oversampling = 2; -#define FAUST_UIMACROS 1 -#include "gen/gate.hxx" namespace sfz { namespace fx { @@ -41,12 +40,6 @@ namespace fx { AudioBuffer _gain2x { 2, _oversampling * config::defaultSamplesPerBlock }; hiir::Downsampler2x<12> _downsampler2x[EffectChannels]; hiir::Upsampler2x<12> _upsampler2x[EffectChannels]; - - #define DEFINE_SET_GET(type, ident, name, var, def, min, max, step) \ - float get_##ident(size_t i) const noexcept { return _gate[i].var; } \ - void set_##ident(size_t i, float value) noexcept { _gate[i].var = value; } - FAUST_LIST_ACTIVES(DEFINE_SET_GET); - #undef DEFINE_SET_GET }; Gate::Gate() @@ -65,8 +58,8 @@ namespace fx { { Impl& impl = *_impl; for (faustGate& gate : impl._gate) { - gate.classInit(sampleRate); - gate.instanceConstants(sampleRate); + gate.classInit(_oversampling * sampleRate); + gate.instanceConstants(_oversampling * sampleRate); } for (unsigned c = 0; c < EffectChannels; ++c) { @@ -167,29 +160,29 @@ namespace fx { case hash("gate_attack"): { auto value = opc.read(Default::gateAttack); - for (size_t c = 0; c < 2; ++c) - impl.set_Attack(c, value); + for (faustGate& gate : impl._gate) + gate.setAttack(value); } break; case hash("gate_hold"): { auto value = opc.read(Default::gateHold); - for (size_t c = 0; c < 2; ++c) - impl.set_Hold(c, value); + for (faustGate& gate : impl._gate) + gate.setHold(value); } break; case hash("gate_release"): { auto value = opc.read(Default::gateRelease); - for (size_t c = 0; c < 2; ++c) - impl.set_Release(c, value); + for (faustGate& gate : impl._gate) + gate.setRelease(value); } break; case hash("gate_threshold"): { auto value = opc.read(Default::gateThreshold); - for (size_t c = 0; c < 2; ++c) - impl.set_Threshold(c, value); + for (faustGate& gate : impl._gate) + gate.setThreshold(value); } break; case hash("gate_stlink"): diff --git a/src/sfizz/effects/Limiter.cpp b/src/sfizz/effects/Limiter.cpp index eb5f1c3c..8c13ca62 100644 --- a/src/sfizz/effects/Limiter.cpp +++ b/src/sfizz/effects/Limiter.cpp @@ -11,12 +11,12 @@ */ #include "Limiter.h" +#include "gen/limiter.hxx" #include "Opcode.h" #include "AudioSpan.h" #include "absl/memory/memory.h" static constexpr int _oversampling = 2; -#include "gen/limiter.hxx" namespace sfz { namespace fx { @@ -33,8 +33,8 @@ namespace fx { void Limiter::setSampleRate(double sampleRate) { - _limiter->classInit(sampleRate); - _limiter->instanceConstants(sampleRate); + _limiter->classInit(_oversampling * sampleRate); + _limiter->instanceConstants(_oversampling * sampleRate); for (unsigned c = 0; c < EffectChannels; ++c) { _downsampler2x[c].set_coefs(OSCoeffs2x); diff --git a/src/sfizz/effects/dsp/compressor.dsp b/src/sfizz/effects/dsp/compressor.dsp index 6675e7c1..acec90dd 100644 --- a/src/sfizz/effects/dsp/compressor.dsp +++ b/src/sfizz/effects/dsp/compressor.dsp @@ -3,9 +3,8 @@ import("stdfaust.lib"); cgain = co.compression_gain_mono(ratio, thresh, att, rel) with { ratio = hslider("[1] Ratio", 1.0, 1.0, 20.0, 0.01); thresh = hslider("[2] Threshold [unit:dB]", 0.0, -60.0, 0.0, 0.01); - over = fconstant(int _oversampling, ); - att = hslider("[3] Attack [unit:s]", 0.0, 0.0, 0.5, 1e-3) : *(over); - rel = hslider("[4] Release [unit:s]", 0.0, 0.0, 5.0, 1e-3) : *(over); + att = hslider("[3] Attack [unit:s]", 0.0, 0.0, 0.5, 1e-3); + rel = hslider("[4] Release [unit:s]", 0.0, 0.0, 5.0, 1e-3); }; process = cgain; diff --git a/src/sfizz/effects/dsp/disto_stage.dsp b/src/sfizz/effects/dsp/disto_stage.dsp index f05a54fa..f2494745 100644 --- a/src/sfizz/effects/dsp/disto_stage.dsp +++ b/src/sfizz/effects/dsp/disto_stage.dsp @@ -1,14 +1,12 @@ import("stdfaust.lib"); disto_stage(depth, x) = shs*hh(x)+(1.0-shs)*lh(x) : fi.dcblockerat(5.0) with { - over = fconstant(int _oversampling, ); - // sigmoid parameters a = depth*0.2+2.0; b = 2.0; // smooth hysteresis transition - shs = hs : si.smooth(ba.tau2pole(10e-3*over)); + shs = hs : si.smooth(ba.tau2pole(10e-3)); // the low and high hysteresis lh(x) = sig(a*x)*b; diff --git a/src/sfizz/effects/dsp/gate.dsp b/src/sfizz/effects/dsp/gate.dsp index 7bac7f27..bbb303f3 100644 --- a/src/sfizz/effects/dsp/gate.dsp +++ b/src/sfizz/effects/dsp/gate.dsp @@ -2,10 +2,9 @@ import("stdfaust.lib"); ggain = ef.gate_gain_mono(thresh, att, hold, rel) with { thresh = hslider("[1] Threshold [unit:dB]", 0.0, -60.0, 0.0, 0.01); - over = fconstant(int _oversampling, ); - att = hslider("[2] Attack [unit:s]", 0.0, 0.0, 10.0, 1e-3) : *(over); - hold = hslider("[3] Hold [unit:s]", 0.0, 0.0, 10.0, 1e-3) : *(over); - rel = hslider("[4] Release [unit:s]", 0.0, 0.0, 5.0, 1e-3) : *(over); + att = hslider("[2] Attack [unit:s]", 0.0, 0.0, 10.0, 1e-3); + hold = hslider("[3] Hold [unit:s]", 0.0, 0.0, 10.0, 1e-3); + rel = hslider("[4] Release [unit:s]", 0.0, 0.0, 5.0, 1e-3); }; process = ggain; diff --git a/src/sfizz/effects/dsp/limiter.dsp b/src/sfizz/effects/dsp/limiter.dsp index cbb14b26..e8ed03d9 100644 --- a/src/sfizz/effects/dsp/limiter.dsp +++ b/src/sfizz/effects/dsp/limiter.dsp @@ -1,9 +1,8 @@ import("stdfaust.lib"); limiter(x) = gain*x with { - att = 0.0008 * over; - rel = 0.5 * over; - over = fconstant(int _oversampling, ); + att = 0.0008; + rel = 0.5; peak = x : an.amp_follower_ud(att, rel); gain = ba.if(peak>1.0, 1.0/peak, 1.0) : si.smooth(ba.tau2pole(0.5*att)); }; From acf8b9f15a5846fe6d9c71e9b0d6490f66438a63 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 00:24:07 +0100 Subject: [PATCH 05/10] Delete old faust scripts --- scripts/generate_compressor.sh | 54 -------------------------- scripts/generate_disto.sh | 54 -------------------------- scripts/generate_filters.sh | 70 ---------------------------------- scripts/generate_fverb.sh | 54 -------------------------- scripts/generate_gate.sh | 54 -------------------------- 5 files changed, 286 deletions(-) delete mode 100755 scripts/generate_compressor.sh delete mode 100755 scripts/generate_disto.sh delete mode 100755 scripts/generate_filters.sh delete mode 100755 scripts/generate_fverb.sh delete mode 100755 scripts/generate_gate.sh diff --git a/scripts/generate_compressor.sh b/scripts/generate_compressor.sh deleted file mode 100755 index 7d799a5e..00000000 --- a/scripts/generate_compressor.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -# Note: needs faust >= 2.27.1 for UI macros -FAUSTARGS="-uim -inpl" - -# support GNU sed only, use gsed on a Mac -test -z "$SED" && SED=sed - -faustgen() { - mkdir -p src/sfizz/effects/gen - local outfile=src/sfizz/effects/gen/compressor.cxx - - local code=`faust $FAUSTARGS -cn faustCompressor src/sfizz/effects/dsp/compressor.dsp` - - # suppress some faust-specific stuff we don't care - echo "$code" \ - | fgrep -v -- '->declare(' \ - | fgrep -v -- '->openHorizontalBox(' \ - | fgrep -v -- '->openVerticalBox(' \ - | fgrep -v -- '->closeBox(' \ - | fgrep -v -- '->addHorizontalSlider(' \ - | fgrep -v -- '->addVerticalSlider(' \ - > "$outfile" - - # remove metadata - $SED -r -i 's/void[ \t]+metadata[ \t]*\(Meta[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void metadata()/' "$outfile" - - # remove UI - $SED -r -i 's/void[ \t]+buildUserInterface[ \t]*\(UI[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void buildUserInterface()/' "$outfile" - - # remove inheritance - $SED -r -i 's/:[ \t]*public[ \t]+dsp\b\s*//' "$outfile" - - # remove virtual - $SED -r -i 's/\bvirtual\b\s*//' "$outfile" - - # remove undesired UIM - $SED -r -i '/^[ \t]*#define[ \t]+FAUST_(FILE_NAME|CLASS_NAME|INPUTS|OUTPUTS|ACTIVES|PASSIVES)/d' "$outfile" - $SED -r -i '/^[ \t]*FAUST_ADD.*/d' "$outfile" - - # direct access to parameter variables - $SED -r -i 's/\bprivate:/public:/' "$outfile" - - # remove trailing whitespace - $SED -r -i 's/[ \t]+$//' "$outfile" -} - -faustgen diff --git a/scripts/generate_disto.sh b/scripts/generate_disto.sh deleted file mode 100755 index 095cb147..00000000 --- a/scripts/generate_disto.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -# Note: needs faust >= 2.27.1 for UI macros -FAUSTARGS="-uim -inpl" - -# support GNU sed only, use gsed on a Mac -test -z "$SED" && SED=sed - -faustgen() { - mkdir -p src/sfizz/effects/gen - local outfile=src/sfizz/effects/gen/disto_stage.cxx - - local code=`faust $FAUSTARGS -cn faustDisto src/sfizz/effects/dsp/disto_stage.dsp` - - # suppress some faust-specific stuff we don't care - echo "$code" \ - | fgrep -v -- '->declare(' \ - | fgrep -v -- '->openHorizontalBox(' \ - | fgrep -v -- '->openVerticalBox(' \ - | fgrep -v -- '->closeBox(' \ - | fgrep -v -- '->addHorizontalSlider(' \ - | fgrep -v -- '->addVerticalSlider(' \ - > "$outfile" - - # remove metadata - $SED -r -i 's/void[ \t]+metadata[ \t]*\(Meta[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void metadata()/' "$outfile" - - # remove UI - $SED -r -i 's/void[ \t]+buildUserInterface[ \t]*\(UI[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void buildUserInterface()/' "$outfile" - - # remove inheritance - $SED -r -i 's/:[ \t]*public[ \t]+dsp\b\s*//' "$outfile" - - # remove virtual - $SED -r -i 's/\bvirtual\b\s*//' "$outfile" - - # remove undesired UIM - $SED -r -i '/^[ \t]*#define[ \t]+FAUST_(FILE_NAME|CLASS_NAME|INPUTS|OUTPUTS|ACTIVES|PASSIVES)/d' "$outfile" - $SED -r -i '/^[ \t]*FAUST_ADD.*/d' "$outfile" - - # direct access to parameter variables - $SED -r -i 's/\bprivate:/public:/' "$outfile" - - # remove trailing whitespace - $SED -r -i 's/[ \t]+$//' "$outfile" -} - -faustgen diff --git a/scripts/generate_filters.sh b/scripts/generate_filters.sh deleted file mode 100755 index dd1ef713..00000000 --- a/scripts/generate_filters.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -FAUSTARGS="-double -inpl" - -# support GNU sed only, use gsed on a Mac -test -z "$SED" && SED=sed - -faustgen() { - mkdir -p src/sfizz/gen/filters - local outfile=src/sfizz/gen/filters/sfz"$1".cxx - - local code=`faust $FAUSTARGS -pn sfz"$1" -cn faust"$1" -scn sfzFilterDsp src/sfizz/dsp/filters/sfz_filters.dsp` - - # find variable names of our controls - local cutoffVar=`echo "$code" | $SED -r 's%.*\("Cutoff", &[ \t]*([a-zA-Z0-9_]+).*%\1%;t;d'` - local resoVar=`echo "$code" | $SED -r 's%.*\("Resonance", &[ \t]*([a-zA-Z0-9_]+).*%\1%;t;d'` - local pkshVar=`echo "$code" | $SED -r 's%.*\("Peak/shelf gain", &[ \t]*([a-zA-Z0-9_]+).*%\1%;t;d'` - local bwVar=`echo "$code" | $SED -r 's%.*\("Bandwidth", &[ \t]*([a-zA-Z0-9_]+).*%\1%;t;d'` - - # suppress some faust-specific stuff we don't care - echo "$code" \ - | fgrep -v -- '->declare(' \ - | fgrep -v -- '->openHorizontalBox(' \ - | fgrep -v -- '->openVerticalBox(' \ - | fgrep -v -- '->closeBox(' \ - | fgrep -v -- '->addHorizontalSlider(' \ - | fgrep -v -- '->addVerticalSlider(' \ - > "$outfile" - - # direct access to parameter variables - $SED -r -i 's/\bprivate:/public:/' "$outfile" - - # rename the variables for us to access more easily - if test ! -z "$cutoffVar"; then - $SED -r -i 's/\b'"$cutoffVar"'\b/fCutoff/' "$outfile" - fi - if test ! -z "$resoVar"; then - $SED -r -i 's/\b'"$resoVar"'\b/fQ/' "$outfile" - fi - if test ! -z "$pkshVar"; then - $SED -r -i 's/\b'"$pkshVar"'\b/fPkShGain/' "$outfile" - fi - if test ! -z "$bwVar"; then - $SED -r -i 's/\b'"$bwVar"'\b/fBandwidth/' "$outfile" - fi - - # remove trailing whitespace - $SED -r -i 's/[ \t]+$//' "$outfile" -} - -for f in \ - Lpf1p Lpf2p Lpf4p Lpf6p \ - Hpf1p Hpf2p Hpf4p Hpf6p \ - Bpf1p Bpf2p Bpf4p Bpf6p \ - Apf1p \ - Brf1p Brf2p \ - Lsh Hsh Peq \ - Pink \ - Lpf2pSv Hpf2pSv Bpf2pSv Brf2pSv \ - EqPeak EqLshelf EqHshelf -do - faustgen "$f" - faustgen "2ch$f" -done diff --git a/scripts/generate_fverb.sh b/scripts/generate_fverb.sh deleted file mode 100755 index 7c997e2b..00000000 --- a/scripts/generate_fverb.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -# Note: needs faust >= 2.27.1 for UI macros -FAUSTARGS="-uim -inpl" - -# support GNU sed only, use gsed on a Mac -test -z "$SED" && SED=sed - -faustgen() { - mkdir -p src/sfizz/effects/gen - local outfile=src/sfizz/effects/gen/fverb.cxx - - local code=`faust $FAUSTARGS -cn faustFverb src/sfizz/effects/dsp/fverb.dsp` - - # suppress some faust-specific stuff we don't care - echo "$code" \ - | fgrep -v -- '->declare(' \ - | fgrep -v -- '->openHorizontalBox(' \ - | fgrep -v -- '->openVerticalBox(' \ - | fgrep -v -- '->closeBox(' \ - | fgrep -v -- '->addHorizontalSlider(' \ - | fgrep -v -- '->addVerticalSlider(' \ - > "$outfile" - - # remove metadata - $SED -r -i 's/void[ \t]+metadata[ \t]*\(Meta[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void metadata()/' "$outfile" - - # remove UI - $SED -r -i 's/void[ \t]+buildUserInterface[ \t]*\(UI[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void buildUserInterface()/' "$outfile" - - # remove inheritance - $SED -r -i 's/:[ \t]*public[ \t]+dsp\b\s*//' "$outfile" - - # remove virtual - $SED -r -i 's/\bvirtual\b\s*//' "$outfile" - - # remove undesired UIM - $SED -r -i '/^[ \t]*#define[ \t]+FAUST_(FILE_NAME|CLASS_NAME|INPUTS|OUTPUTS|ACTIVES|PASSIVES)/d' "$outfile" - $SED -r -i '/^[ \t]*FAUST_ADD.*/d' "$outfile" - - # direct access to parameter variables - $SED -r -i 's/\bprivate:/public:/' "$outfile" - - # remove trailing whitespace - $SED -r -i 's/[ \t]+$//' "$outfile" -} - -faustgen diff --git a/scripts/generate_gate.sh b/scripts/generate_gate.sh deleted file mode 100755 index 6cb32422..00000000 --- a/scripts/generate_gate.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -# Note: needs faust >= 2.27.1 for UI macros -FAUSTARGS="-uim -inpl" - -# support GNU sed only, use gsed on a Mac -test -z "$SED" && SED=sed - -faustgen() { - mkdir -p src/sfizz/effects/gen - local outfile=src/sfizz/effects/gen/gate.cxx - - local code=`faust $FAUSTARGS -cn faustGate src/sfizz/effects/dsp/gate.dsp` - - # suppress some faust-specific stuff we don't care - echo "$code" \ - | fgrep -v -- '->declare(' \ - | fgrep -v -- '->openHorizontalBox(' \ - | fgrep -v -- '->openVerticalBox(' \ - | fgrep -v -- '->closeBox(' \ - | fgrep -v -- '->addHorizontalSlider(' \ - | fgrep -v -- '->addVerticalSlider(' \ - > "$outfile" - - # remove metadata - $SED -r -i 's/void[ \t]+metadata[ \t]*\(Meta[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void metadata()/' "$outfile" - - # remove UI - $SED -r -i 's/void[ \t]+buildUserInterface[ \t]*\(UI[ \t]*\*[ \t]*[a-zA-Z0-9_]+\)/void buildUserInterface()/' "$outfile" - - # remove inheritance - $SED -r -i 's/:[ \t]*public[ \t]+dsp\b\s*//' "$outfile" - - # remove virtual - $SED -r -i 's/\bvirtual\b\s*//' "$outfile" - - # remove undesired UIM - $SED -r -i '/^[ \t]*#define[ \t]+FAUST_(FILE_NAME|CLASS_NAME|INPUTS|OUTPUTS|ACTIVES|PASSIVES)/d' "$outfile" - $SED -r -i '/^[ \t]*FAUST_ADD.*/d' "$outfile" - - # direct access to parameter variables - $SED -r -i 's/\bprivate:/public:/' "$outfile" - - # remove trailing whitespace - $SED -r -i 's/[ \t]+$//' "$outfile" -} - -faustgen From 58c7c38f2e1a4c0c912115032c5e4a9275beee48 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 00:27:21 +0100 Subject: [PATCH 06/10] Add regenerated faust source --- src/sfizz/effects/gen/compressor.hxx | 166 +++-- src/sfizz/effects/gen/disto_stage.hxx | 149 ++--- src/sfizz/effects/gen/fverb.hxx | 797 ++++++++++++----------- src/sfizz/effects/gen/gate.hxx | 155 ++--- src/sfizz/effects/gen/limiter.hxx | 252 ++++--- src/sfizz/gen/filters/sfz2chApf1p.hxx | 151 ++--- src/sfizz/gen/filters/sfz2chBpf1p.hxx | 151 ++--- src/sfizz/gen/filters/sfz2chBpf2p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chBpf2pSv.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chBpf4p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chBpf6p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chBrf1p.hxx | 151 ++--- src/sfizz/gen/filters/sfz2chBrf2p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chBrf2pSv.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chEqHshelf.hxx | 165 +++-- src/sfizz/gen/filters/sfz2chEqLshelf.hxx | 165 +++-- src/sfizz/gen/filters/sfz2chEqPeak.hxx | 163 +++-- src/sfizz/gen/filters/sfz2chHpf1p.hxx | 151 ++--- src/sfizz/gen/filters/sfz2chHpf2p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chHpf2pSv.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chHpf4p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chHpf6p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chHsh.hxx | 173 +++-- src/sfizz/gen/filters/sfz2chLpf1p.hxx | 151 ++--- src/sfizz/gen/filters/sfz2chLpf2p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chLpf2pSv.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chLpf4p.hxx | 152 +++-- src/sfizz/gen/filters/sfz2chLpf6p.hxx | 176 +++-- src/sfizz/gen/filters/sfz2chLsh.hxx | 175 +++-- src/sfizz/gen/filters/sfz2chPeq.hxx | 163 +++-- src/sfizz/gen/filters/sfz2chPink.hxx | 132 ++-- src/sfizz/gen/filters/sfzApf1p.hxx | 141 ++-- src/sfizz/gen/filters/sfzBpf1p.hxx | 141 ++-- src/sfizz/gen/filters/sfzBpf2p.hxx | 142 ++-- src/sfizz/gen/filters/sfzBpf2pSv.hxx | 142 ++-- src/sfizz/gen/filters/sfzBpf4p.hxx | 142 ++-- src/sfizz/gen/filters/sfzBpf6p.hxx | 142 ++-- src/sfizz/gen/filters/sfzBrf1p.hxx | 141 ++-- src/sfizz/gen/filters/sfzBrf2p.hxx | 142 ++-- src/sfizz/gen/filters/sfzBrf2pSv.hxx | 142 ++-- src/sfizz/gen/filters/sfzEqHshelf.hxx | 155 ++--- src/sfizz/gen/filters/sfzEqLshelf.hxx | 155 ++--- src/sfizz/gen/filters/sfzEqPeak.hxx | 153 ++--- src/sfizz/gen/filters/sfzHpf1p.hxx | 141 ++-- src/sfizz/gen/filters/sfzHpf2p.hxx | 142 ++-- src/sfizz/gen/filters/sfzHpf2pSv.hxx | 142 ++-- src/sfizz/gen/filters/sfzHpf4p.hxx | 142 ++-- src/sfizz/gen/filters/sfzHpf6p.hxx | 142 ++-- src/sfizz/gen/filters/sfzHsh.hxx | 163 ++--- src/sfizz/gen/filters/sfzLpf1p.hxx | 141 ++-- src/sfizz/gen/filters/sfzLpf2p.hxx | 142 ++-- src/sfizz/gen/filters/sfzLpf2pSv.hxx | 142 ++-- src/sfizz/gen/filters/sfzLpf4p.hxx | 142 ++-- src/sfizz/gen/filters/sfzLpf6p.hxx | 142 ++-- src/sfizz/gen/filters/sfzLsh.hxx | 165 ++--- src/sfizz/gen/filters/sfzPeq.hxx | 153 ++--- src/sfizz/gen/filters/sfzPink.hxx | 122 ++-- 57 files changed, 4606 insertions(+), 4715 deletions(-) diff --git a/src/sfizz/effects/gen/compressor.hxx b/src/sfizz/effects/gen/compressor.hxx index ba19b870..39456bab 100644 --- a/src/sfizz/effects/gen/compressor.hxx +++ b/src/sfizz/effects/gen/compressor.hxx @@ -1,7 +1,11 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ name: "compressor" -Code generated with Faust 2.27.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -scal -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -scal -ftz 0 ------------------------------------------------------------ */ #ifndef __faustCompressor_H__ @@ -9,97 +13,73 @@ Compilation options: -lang cpp -inpl -scal -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustCompressor #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustCompressor { + //[Begin:class] - public: - - float fConst0; - float fConst1; + + private: + FAUSTFLOAT fHslider0; int fSampleRate; - float fConst2; + float fConst0; FAUSTFLOAT fHslider1; FAUSTFLOAT fHslider2; float fRec2[2]; float fRec1[2]; FAUSTFLOAT fHslider3; float fRec0[2]; - + public: + - void metadata() { - } - - int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { - (void)sample_rate; + //[Begin:classInit] + //[End:classInit] } - + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = float(_oversampling); - fConst1 = (0.5f * fConst0); - fConst2 = (1.0f / std::min(192000.0f, std::max(1.0f, float(fSampleRate)))); + fConst0 = (1.0f / float(fSampleRate)); + //[End:instanceConstants] } - + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] fHslider0 = FAUSTFLOAT(0.0f); fHslider1 = FAUSTFLOAT(1.0f); fHslider2 = FAUSTFLOAT(0.0f); fHslider3 = FAUSTFLOAT(0.0f); + //[End:instanceResetUserInterface] } - + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0f; } @@ -109,73 +89,81 @@ class faustCompressor { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec0[l2] = 0.0f; } + //[End:instanceClear] } - + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - faustCompressor* clone() { - return new faustCompressor(); - } - + + int getSampleRate() { return fSampleRate; } - - void buildUserInterface() { - } - - void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; float fSlow0 = float(fHslider0); - float fSlow1 = (fConst1 * fSlow0); + float fSlow1 = (0.5f * fSlow0); int iSlow2 = (std::fabs(fSlow1) < 1.1920929e-07f); - float fSlow3 = (iSlow2 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow2 ? 1.0f : fSlow1))))); - float fSlow4 = ((1.0f / std::max(1.00000001e-07f, float(fHslider1))) + -1.0f); - float fSlow5 = (fConst0 * fSlow0); - int iSlow6 = (std::fabs(fSlow5) < 1.1920929e-07f); - float fSlow7 = (iSlow6 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow6 ? 1.0f : fSlow5))))); - float fSlow8 = (fConst0 * float(fHslider2)); - int iSlow9 = (std::fabs(fSlow8) < 1.1920929e-07f); - float fSlow10 = (iSlow9 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow9 ? 1.0f : fSlow8))))); - float fSlow11 = float(fHslider3); - float fSlow12 = (1.0f - fSlow3); + float fSlow3 = (iSlow2 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow2 ? 1.0f : fSlow1))))); + float fSlow4 = ((1.0f / std::max(1.1920929e-07f, float(fHslider1))) + -1.0f); + int iSlow5 = (std::fabs(fSlow0) < 1.1920929e-07f); + float fSlow6 = (iSlow5 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow5 ? 1.0f : fSlow0))))); + float fSlow7 = float(fHslider2); + int iSlow8 = (std::fabs(fSlow7) < 1.1920929e-07f); + float fSlow9 = (iSlow8 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow8 ? 1.0f : fSlow7))))); + float fSlow10 = float(fHslider3); + float fSlow11 = (1.0f - fSlow3); for (int i = 0; (i < count); i = (i + 1)) { float fTemp0 = float(input0[i]); float fTemp1 = std::fabs(fTemp0); - float fTemp2 = ((fRec1[1] > fTemp1) ? fSlow10 : fSlow7); + float fTemp2 = ((fRec1[1] > fTemp1) ? fSlow9 : fSlow6); fRec2[0] = ((fRec2[1] * fTemp2) + (fTemp1 * (1.0f - fTemp2))); fRec1[0] = fRec2[0]; - fRec0[0] = ((fRec0[1] * fSlow3) + (fSlow4 * (std::max(((20.0f * std::log10(fRec1[0])) - fSlow11), 0.0f) * fSlow12))); + fRec0[0] = ((fSlow3 * fRec0[1]) + (fSlow4 * (std::max(((20.0f * std::log10(fRec1[0])) - fSlow10), 0.0f) * fSlow11))); output0[i] = FAUSTFLOAT(std::pow(10.0f, (0.0500000007f * fRec0[0]))); fRec2[1] = fRec2[0]; fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getRatio() const { return fHslider1; } + void setRatio(FAUSTFLOAT value) { fHslider1 = value; } + + FAUSTFLOAT getThreshold() const { return fHslider3; } + void setThreshold(FAUSTFLOAT value) { fHslider3 = value; } + + FAUSTFLOAT getAttack() const { return fHslider0; } + void setAttack(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getRelease() const { return fHslider2; } + void setRelease(FAUSTFLOAT value) { fHslider2 = value; } + + //[End:class] }; +//[After:class] -#ifdef FAUST_UIMACROS - - - - #define FAUST_LIST_ACTIVES(p) \ - p(HORIZONTALSLIDER, Ratio, "Ratio", fHslider1, 1.0f, 1.0f, 20.0f, 0.01f) \ - p(HORIZONTALSLIDER, Threshold, "Threshold", fHslider3, 0.0f, -60.0f, 0.0f, 0.01f) \ - p(HORIZONTALSLIDER, Attack, "Attack", fHslider0, 0.0f, 0.0f, 0.5f, 0.001f) \ - p(HORIZONTALSLIDER, Release, "Release", fHslider2, 0.0f, 0.0f, 5.0f, 0.001f) \ - - #define FAUST_LIST_PASSIVES(p) \ #endif - +#if defined(__GNUC__) +#pragma GCC diagnostic pop #endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/effects/gen/disto_stage.hxx b/src/sfizz/effects/gen/disto_stage.hxx index e630bd68..1c16e2fb 100644 --- a/src/sfizz/effects/gen/disto_stage.hxx +++ b/src/sfizz/effects/gen/disto_stage.hxx @@ -1,7 +1,11 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ name: "disto_stage" -Code generated with Faust 2.27.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -scal -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -scal -ftz 0 ------------------------------------------------------------ */ #ifndef __faustDisto_H__ @@ -9,20 +13,24 @@ Compilation options: -lang cpp -inpl -scal -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include + +//[Before:class] class faustDistoSIG0 { + //[Begin:class] - public: - + + private: + int iRec3[2]; - + public: - + int getNumInputsfaustDistoSIG0() { return 0; } @@ -53,14 +61,13 @@ class faustDistoSIG0 { } return rate; } - + void instanceInitfaustDistoSIG0(int sample_rate) { - (void)sample_rate; for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { iRec3[l3] = 0; } } - + void fillfaustDistoSIG0(int count, float* table) { for (int i = 0; (i < count); i = (i + 1)) { iRec3[0] = (iRec3[1] + 1); @@ -77,19 +84,19 @@ static void deletefaustDistoSIG0(faustDistoSIG0* dsp) { delete dsp; } static float ftbl0faustDistoSIG0[256]; -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustDisto #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif class faustDisto { - - public: - + + private: + float fVec0[2]; int fSampleRate; float fConst0; @@ -97,79 +104,52 @@ class faustDisto { float fConst2; float fConst3; float fConst4; - int iConst5; - float fConst6; + float fConst5; int iRec2[2]; - float fConst7; float fRec1[2]; FAUSTFLOAT fHslider0; float fVec1[2]; float fRec0[2]; - + public: + - void metadata() { - } - - int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] faustDistoSIG0* sig0 = newfaustDistoSIG0(); sig0->instanceInitfaustDistoSIG0(sample_rate); sig0->fillfaustDistoSIG0(256, ftbl0faustDistoSIG0); deletefaustDistoSIG0(sig0); + //[End:classInit] } - + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0f, std::max(1.0f, float(fSampleRate))); + fConst0 = float(fSampleRate); fConst1 = (15.707963f / fConst0); fConst2 = (1.0f / (fConst1 + 1.0f)); fConst3 = (1.0f - fConst1); - fConst4 = (0.00999999978f * float(_oversampling)); - iConst5 = (std::fabs(fConst4) < 1.1920929e-07f); - fConst6 = (iConst5 ? 0.0f : std::exp((0.0f - ((1.0f / fConst0) / (iConst5 ? 1.0f : fConst4))))); - fConst7 = (1.0f - fConst6); + fConst4 = std::exp((0.0f - (100.0f / fConst0))); + fConst5 = (1.0f - fConst4); + //[End:instanceConstants] } - + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] fHslider0 = FAUSTFLOAT(100.0f); + //[End:instanceResetUserInterface] } - + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fVec0[l0] = 0.0f; } @@ -185,38 +165,39 @@ class faustDisto { for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec0[l5] = 0.0f; } + //[End:instanceClear] } - + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - faustDisto* clone() { - return new faustDisto(); - } - + + int getSampleRate() { return fSampleRate; } - - void buildUserInterface() { - } - - void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; float fSlow0 = ((0.200000003f * float(fHslider0)) + 2.0f); for (int i = 0; (i < count); i = (i + 1)) { float fTemp0 = float(input0[i]); fVec0[0] = fTemp0; iRec2[0] = (((fTemp0 < fVec0[1]) & (fTemp0 < -0.25f)) ? 1 : (((fTemp0 > fVec0[1]) & (fTemp0 > 0.25f)) ? 0 : iRec2[1])); - fRec1[0] = ((fRec1[1] * fConst6) + (float(iRec2[0]) * fConst7)); + fRec1[0] = ((fConst4 * fRec1[1]) + (fConst5 * float(iRec2[0]))); float fTemp2 = std::max(0.0f, (12.75f * ((fSlow0 * fTemp0) + 10.0f))); int iTemp3 = int(fTemp2); float fTemp4 = ftbl0faustDistoSIG0[std::min(255, iTemp3)]; @@ -231,19 +212,21 @@ class faustDisto { fVec1[1] = fVec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getDepth() const { return fHslider0; } + void setDepth(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] -#ifdef FAUST_UIMACROS - - - - #define FAUST_LIST_ACTIVES(p) \ - p(HORIZONTALSLIDER, Depth, "Depth", fHslider0, 100.0f, 0.0f, 100.0f, 0.01f) \ - - #define FAUST_LIST_PASSIVES(p) \ #endif - +#if defined(__GNUC__) +#pragma GCC diagnostic pop #endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/effects/gen/fverb.hxx b/src/sfizz/effects/gen/fverb.hxx index 849c2485..cda9c189 100644 --- a/src/sfizz/effects/gen/fverb.hxx +++ b/src/sfizz/effects/gen/fverb.hxx @@ -1,10 +1,14 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "fverb" version: "0.5" -Code generated with Faust 2.27.1 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -scal -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -scal -ftz 0 ------------------------------------------------------------ */ #ifndef __faustFverb_H__ @@ -12,20 +16,24 @@ Compilation options: -lang cpp -inpl -scal -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include + +//[Before:class] class faustFverbSIG0 { + //[Begin:class] + + private: + + int iRec36[2]; + public: - - int iRec19[2]; - - public: - + int getNumInputsfaustFverbSIG0() { return 0; } @@ -56,19 +64,18 @@ class faustFverbSIG0 { } return rate; } - + void instanceInitfaustFverbSIG0(int sample_rate) { - (void)sample_rate; - for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { - iRec19[l4] = 0; + for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { + iRec36[l23] = 0; } } - + void fillfaustFverbSIG0(int count, float* table) { for (int i = 0; (i < count); i = (i + 1)) { - iRec19[0] = (iRec19[1] + 1); - table[i] = std::sin((9.58738019e-05f * float((iRec19[0] + -1)))); - iRec19[1] = iRec19[0]; + iRec36[0] = (iRec36[1] + 1); + table[i] = std::sin((9.58738019e-05f * float((iRec36[0] + -1)))); + iRec36[1] = iRec36[0]; } } @@ -79,114 +86,114 @@ static void deletefaustFverbSIG0(faustFverbSIG0* dsp) { delete dsp; } static float ftbl0faustFverbSIG0[65536]; -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustFverb #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif class faustFverb { - - public: - + + private: + FAUSTFLOAT fHslider0; float fRec0[2]; FAUSTFLOAT fHslider1; float fRec1[2]; FAUSTFLOAT fHslider2; float fRec10[2]; - int fSampleRate; - float fConst0; FAUSTFLOAT fHslider3; - float fRec18[2]; - float fConst1; - FAUSTFLOAT fHslider4; - float fRec21[2]; - float fRec20[2]; - float fConst2; - float fConst3; - float fRec14[2]; - float fRec15[2]; - int iRec16[2]; - int iRec17[2]; - FAUSTFLOAT fHslider5; - float fRec32[2]; + float fRec24[2]; int IOTA; float fVec0[131072]; - FAUSTFLOAT fHslider6; - float fRec33[2]; - FAUSTFLOAT fHslider7; - float fRec34[2]; - float fRec31[2]; - FAUSTFLOAT fHslider8; - float fRec35[2]; - float fRec30[2]; - FAUSTFLOAT fHslider9; - float fRec36[2]; - float fVec1[1024]; - int iConst4; - float fRec28[2]; - float fVec2[1024]; - int iConst5; + int fSampleRate; + float fConst0; + FAUSTFLOAT fHslider4; + float fRec25[2]; + float fConst1; + FAUSTFLOAT fHslider5; float fRec26[2]; - FAUSTFLOAT fHslider10; - float fRec37[2]; - float fVec3[4096]; - int iConst6; - float fRec24[2]; - float fVec4[2048]; - int iConst7; + float fRec23[2]; + FAUSTFLOAT fHslider6; + float fRec27[2]; float fRec22[2]; - int iConst8; + FAUSTFLOAT fHslider7; + float fRec28[2]; + float fVec1[131072]; + int iConst2; + float fRec20[2]; + float fVec2[131072]; + int iConst3; + float fRec18[2]; + FAUSTFLOAT fHslider8; + float fRec29[2]; + float fVec3[131072]; + int iConst4; + float fRec16[2]; + float fVec4[131072]; + int iConst5; + float fRec14[2]; + int iConst6; + FAUSTFLOAT fHslider9; + float fRec30[2]; + float fVec5[131072]; + FAUSTFLOAT fHslider10; + float fRec35[2]; FAUSTFLOAT fHslider11; float fRec38[2]; - float fVec5[131072]; + float fRec37[2]; + float fConst7; + float fConst8; + float fRec31[2]; + float fRec32[2]; + int iRec33[2]; + int iRec34[2]; float fRec12[2]; - float fVec6[32768]; + float fVec6[131072]; int iConst9; FAUSTFLOAT fHslider12; float fRec39[2]; float fRec11[2]; - float fVec7[32768]; + float fVec7[131072]; int iConst10; float fRec8[2]; - float fRec2[32768]; - float fRec3[16384]; - float fRec4[32768]; - float fRec45[2]; - float fRec46[2]; - int iRec47[2]; - int iRec48[2]; + float fRec2[131072]; + float fRec3[131072]; + float fRec4[131072]; float fVec8[131072]; - float fRec58[2]; - float fRec57[2]; - float fVec9[1024]; - int iConst11; - float fRec55[2]; - float fVec10[1024]; - int iConst12; + float fRec54[2]; float fRec53[2]; - float fVec11[4096]; - int iConst13; + float fVec9[131072]; + int iConst11; float fRec51[2]; - float fVec12[2048]; - int iConst14; + float fVec10[131072]; + int iConst12; float fRec49[2]; + float fVec11[131072]; + int iConst13; + float fRec47[2]; + float fVec12[131072]; + int iConst14; + float fRec45[2]; int iConst15; float fVec13[131072]; + float fRec55[2]; + float fRec56[2]; + int iRec57[2]; + int iRec58[2]; float fRec43[2]; - float fVec14[32768]; + float fVec14[131072]; int iConst16; float fRec42[2]; - float fVec15[16384]; + float fVec15[131072]; int iConst17; float fRec40[2]; - float fRec5[32768]; - float fRec6[8192]; - float fRec7[32768]; + float fRec5[131072]; + float fRec6[131072]; + float fRec7[131072]; int iConst18; int iConst19; int iConst20; @@ -201,73 +208,38 @@ class faustFverb { int iConst29; int iConst30; int iConst31; - + public: + - void metadata() { - } - - int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] faustFverbSIG0* sig0 = newfaustFverbSIG0(); sig0->instanceInitfaustFverbSIG0(sample_rate); sig0->fillfaustFverbSIG0(65536, ftbl0faustFverbSIG0); deletefaustFverbSIG0(sig0); + //[End:classInit] } - + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0f, std::max(1.0f, float(fSampleRate))); + fConst0 = float(fSampleRate); fConst1 = (1.0f / fConst0); - fConst2 = (1.0f / float(int((0.00999999978f * fConst0)))); - fConst3 = (0.0f - fConst2); - iConst4 = std::min(65536, std::max(0, (int((0.00462820474f * fConst0)) + -1))); - iConst5 = std::min(65536, std::max(0, (int((0.00370316859f * fConst0)) + -1))); - iConst6 = std::min(65536, std::max(0, (int((0.013116831f * fConst0)) + -1))); - iConst7 = std::min(65536, std::max(0, (int((0.00902825873f * fConst0)) + -1))); - iConst8 = (std::min(65536, std::max(0, int((0.106280029f * fConst0)))) + 1); + iConst2 = std::min(65536, std::max(0, (int((0.00462820474f * fConst0)) + -1))); + iConst3 = std::min(65536, std::max(0, (int((0.00370316859f * fConst0)) + -1))); + iConst4 = std::min(65536, std::max(0, (int((0.013116831f * fConst0)) + -1))); + iConst5 = std::min(65536, std::max(0, (int((0.00902825873f * fConst0)) + -1))); + iConst6 = (std::min(65536, std::max(0, int((0.106280029f * fConst0)))) + 1); + fConst7 = (1.0f / float(int((0.00999999978f * fConst0)))); + fConst8 = (0.0f - fConst7); iConst9 = std::min(65536, std::max(0, int((0.141695514f * fConst0)))); iConst10 = std::min(65536, std::max(0, (int((0.0892443135f * fConst0)) + -1))); iConst11 = std::min(65536, std::max(0, (int((0.00491448538f * fConst0)) + -1))); @@ -291,25 +263,29 @@ class faustFverb { iConst29 = std::min(65536, std::max(0, int((0.070931755f * fConst0)))); iConst30 = std::min(65536, std::max(0, int((0.0112563418f * fConst0)))); iConst31 = std::min(65536, std::max(0, int((0.00406572362f * fConst0)))); + //[End:instanceConstants] } - + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] fHslider0 = FAUSTFLOAT(100.0f); fHslider1 = FAUSTFLOAT(50.0f); fHslider2 = FAUSTFLOAT(50.0f); - fHslider3 = FAUSTFLOAT(0.5f); - fHslider4 = FAUSTFLOAT(1.0f); - fHslider5 = FAUSTFLOAT(100.0f); - fHslider6 = FAUSTFLOAT(0.0f); - fHslider7 = FAUSTFLOAT(10000.0f); - fHslider8 = FAUSTFLOAT(100.0f); - fHslider9 = FAUSTFLOAT(75.0f); - fHslider10 = FAUSTFLOAT(62.5f); - fHslider11 = FAUSTFLOAT(70.0f); + fHslider3 = FAUSTFLOAT(100.0f); + fHslider4 = FAUSTFLOAT(0.0f); + fHslider5 = FAUSTFLOAT(10000.0f); + fHslider6 = FAUSTFLOAT(100.0f); + fHslider7 = FAUSTFLOAT(75.0f); + fHslider8 = FAUSTFLOAT(62.5f); + fHslider9 = FAUSTFLOAT(70.0f); + fHslider10 = FAUSTFLOAT(0.5f); + fHslider11 = FAUSTFLOAT(1.0f); fHslider12 = FAUSTFLOAT(5500.0f); + //[End:instanceResetUserInterface] } - + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec0[l0] = 0.0f; } @@ -320,88 +296,88 @@ class faustFverb { fRec10[l2] = 0.0f; } for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { - fRec18[l3] = 0.0f; - } - for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { - fRec21[l5] = 0.0f; - } - for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { - fRec20[l6] = 0.0f; - } - for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) { - fRec14[l7] = 0.0f; - } - for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { - fRec15[l8] = 0.0f; - } - for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { - iRec16[l9] = 0; - } - for (int l10 = 0; (l10 < 2); l10 = (l10 + 1)) { - iRec17[l10] = 0; - } - for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) { - fRec32[l11] = 0.0f; + fRec24[l3] = 0.0f; } IOTA = 0; - for (int l12 = 0; (l12 < 131072); l12 = (l12 + 1)) { - fVec0[l12] = 0.0f; + for (int l4 = 0; (l4 < 131072); l4 = (l4 + 1)) { + fVec0[l4] = 0.0f; } - for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { - fRec33[l13] = 0.0f; + for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { + fRec25[l5] = 0.0f; + } + for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { + fRec26[l6] = 0.0f; + } + for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) { + fRec23[l7] = 0.0f; + } + for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { + fRec27[l8] = 0.0f; + } + for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { + fRec22[l9] = 0.0f; + } + for (int l10 = 0; (l10 < 2); l10 = (l10 + 1)) { + fRec28[l10] = 0.0f; + } + for (int l11 = 0; (l11 < 131072); l11 = (l11 + 1)) { + fVec1[l11] = 0.0f; + } + for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) { + fRec20[l12] = 0.0f; + } + for (int l13 = 0; (l13 < 131072); l13 = (l13 + 1)) { + fVec2[l13] = 0.0f; } for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { - fRec34[l14] = 0.0f; + fRec18[l14] = 0.0f; } for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) { - fRec31[l15] = 0.0f; + fRec29[l15] = 0.0f; } - for (int l16 = 0; (l16 < 2); l16 = (l16 + 1)) { - fRec35[l16] = 0.0f; + for (int l16 = 0; (l16 < 131072); l16 = (l16 + 1)) { + fVec3[l16] = 0.0f; } for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) { - fRec30[l17] = 0.0f; + fRec16[l17] = 0.0f; } - for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { - fRec36[l18] = 0.0f; + for (int l18 = 0; (l18 < 131072); l18 = (l18 + 1)) { + fVec4[l18] = 0.0f; } - for (int l19 = 0; (l19 < 1024); l19 = (l19 + 1)) { - fVec1[l19] = 0.0f; + for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) { + fRec14[l19] = 0.0f; } for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) { - fRec28[l20] = 0.0f; + fRec30[l20] = 0.0f; } - for (int l21 = 0; (l21 < 1024); l21 = (l21 + 1)) { - fVec2[l21] = 0.0f; + for (int l21 = 0; (l21 < 131072); l21 = (l21 + 1)) { + fVec5[l21] = 0.0f; } for (int l22 = 0; (l22 < 2); l22 = (l22 + 1)) { - fRec26[l22] = 0.0f; + fRec35[l22] = 0.0f; } - for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { - fRec37[l23] = 0.0f; - } - for (int l24 = 0; (l24 < 4096); l24 = (l24 + 1)) { - fVec3[l24] = 0.0f; + for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) { + fRec38[l24] = 0.0f; } for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) { - fRec24[l25] = 0.0f; + fRec37[l25] = 0.0f; } - for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) { - fVec4[l26] = 0.0f; + for (int l26 = 0; (l26 < 2); l26 = (l26 + 1)) { + fRec31[l26] = 0.0f; } for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) { - fRec22[l27] = 0.0f; + fRec32[l27] = 0.0f; } for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) { - fRec38[l28] = 0.0f; + iRec33[l28] = 0; } - for (int l29 = 0; (l29 < 131072); l29 = (l29 + 1)) { - fVec5[l29] = 0.0f; + for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) { + iRec34[l29] = 0; } for (int l30 = 0; (l30 < 2); l30 = (l30 + 1)) { fRec12[l30] = 0.0f; } - for (int l31 = 0; (l31 < 32768); l31 = (l31 + 1)) { + for (int l31 = 0; (l31 < 131072); l31 = (l31 + 1)) { fVec6[l31] = 0.0f; } for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) { @@ -410,133 +386,134 @@ class faustFverb { for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) { fRec11[l33] = 0.0f; } - for (int l34 = 0; (l34 < 32768); l34 = (l34 + 1)) { + for (int l34 = 0; (l34 < 131072); l34 = (l34 + 1)) { fVec7[l34] = 0.0f; } for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) { fRec8[l35] = 0.0f; } - for (int l36 = 0; (l36 < 32768); l36 = (l36 + 1)) { + for (int l36 = 0; (l36 < 131072); l36 = (l36 + 1)) { fRec2[l36] = 0.0f; } - for (int l37 = 0; (l37 < 16384); l37 = (l37 + 1)) { + for (int l37 = 0; (l37 < 131072); l37 = (l37 + 1)) { fRec3[l37] = 0.0f; } - for (int l38 = 0; (l38 < 32768); l38 = (l38 + 1)) { + for (int l38 = 0; (l38 < 131072); l38 = (l38 + 1)) { fRec4[l38] = 0.0f; } - for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) { - fRec45[l39] = 0.0f; + for (int l39 = 0; (l39 < 131072); l39 = (l39 + 1)) { + fVec8[l39] = 0.0f; } for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) { - fRec46[l40] = 0.0f; + fRec54[l40] = 0.0f; } for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) { - iRec47[l41] = 0; + fRec53[l41] = 0.0f; } - for (int l42 = 0; (l42 < 2); l42 = (l42 + 1)) { - iRec48[l42] = 0; + for (int l42 = 0; (l42 < 131072); l42 = (l42 + 1)) { + fVec9[l42] = 0.0f; } - for (int l43 = 0; (l43 < 131072); l43 = (l43 + 1)) { - fVec8[l43] = 0.0f; + for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) { + fRec51[l43] = 0.0f; } - for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) { - fRec58[l44] = 0.0f; + for (int l44 = 0; (l44 < 131072); l44 = (l44 + 1)) { + fVec10[l44] = 0.0f; } for (int l45 = 0; (l45 < 2); l45 = (l45 + 1)) { - fRec57[l45] = 0.0f; + fRec49[l45] = 0.0f; } - for (int l46 = 0; (l46 < 1024); l46 = (l46 + 1)) { - fVec9[l46] = 0.0f; + for (int l46 = 0; (l46 < 131072); l46 = (l46 + 1)) { + fVec11[l46] = 0.0f; } for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) { - fRec55[l47] = 0.0f; + fRec47[l47] = 0.0f; } - for (int l48 = 0; (l48 < 1024); l48 = (l48 + 1)) { - fVec10[l48] = 0.0f; + for (int l48 = 0; (l48 < 131072); l48 = (l48 + 1)) { + fVec12[l48] = 0.0f; } for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) { - fRec53[l49] = 0.0f; + fRec45[l49] = 0.0f; } - for (int l50 = 0; (l50 < 4096); l50 = (l50 + 1)) { - fVec11[l50] = 0.0f; + for (int l50 = 0; (l50 < 131072); l50 = (l50 + 1)) { + fVec13[l50] = 0.0f; } for (int l51 = 0; (l51 < 2); l51 = (l51 + 1)) { - fRec51[l51] = 0.0f; + fRec55[l51] = 0.0f; } - for (int l52 = 0; (l52 < 2048); l52 = (l52 + 1)) { - fVec12[l52] = 0.0f; + for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) { + fRec56[l52] = 0.0f; } for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) { - fRec49[l53] = 0.0f; + iRec57[l53] = 0; } - for (int l54 = 0; (l54 < 131072); l54 = (l54 + 1)) { - fVec13[l54] = 0.0f; + for (int l54 = 0; (l54 < 2); l54 = (l54 + 1)) { + iRec58[l54] = 0; } for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) { fRec43[l55] = 0.0f; } - for (int l56 = 0; (l56 < 32768); l56 = (l56 + 1)) { + for (int l56 = 0; (l56 < 131072); l56 = (l56 + 1)) { fVec14[l56] = 0.0f; } for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) { fRec42[l57] = 0.0f; } - for (int l58 = 0; (l58 < 16384); l58 = (l58 + 1)) { + for (int l58 = 0; (l58 < 131072); l58 = (l58 + 1)) { fVec15[l58] = 0.0f; } for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) { fRec40[l59] = 0.0f; } - for (int l60 = 0; (l60 < 32768); l60 = (l60 + 1)) { + for (int l60 = 0; (l60 < 131072); l60 = (l60 + 1)) { fRec5[l60] = 0.0f; } - for (int l61 = 0; (l61 < 8192); l61 = (l61 + 1)) { + for (int l61 = 0; (l61 < 131072); l61 = (l61 + 1)) { fRec6[l61] = 0.0f; } - for (int l62 = 0; (l62 < 32768); l62 = (l62 + 1)) { + for (int l62 = 0; (l62 < 131072); l62 = (l62 + 1)) { fRec7[l62] = 0.0f; } + //[End:instanceClear] } - + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - faustFverb* clone() { - return new faustFverb(); - } - + + int getSampleRate() { return fSampleRate; } - - void buildUserInterface() { - } - - void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; float fSlow0 = (9.99999975e-06f * float(fHslider0)); float fSlow1 = (9.99999975e-06f * float(fHslider1)); float fSlow2 = (9.99999975e-06f * float(fHslider2)); - float fSlow3 = (9.99999997e-07f * float(fHslider3)); - float fSlow4 = (0.00100000005f * float(fHslider4)); - float fSlow5 = (9.99999975e-06f * float(fHslider5)); - float fSlow6 = (9.99999997e-07f * float(fHslider6)); - float fSlow7 = (0.00100000005f * std::exp((fConst1 * (0.0f - (6.28318548f * float(fHslider7)))))); - float fSlow8 = (0.00100000005f * std::exp((fConst1 * (0.0f - (6.28318548f * float(fHslider8)))))); + float fSlow3 = (9.99999975e-06f * float(fHslider3)); + float fSlow4 = (9.99999997e-07f * float(fHslider4)); + float fSlow5 = (0.00100000005f * std::exp((fConst1 * (0.0f - (6.28318548f * float(fHslider5)))))); + float fSlow6 = (0.00100000005f * std::exp((fConst1 * (0.0f - (6.28318548f * float(fHslider6)))))); + float fSlow7 = (9.99999975e-06f * float(fHslider7)); + float fSlow8 = (9.99999975e-06f * float(fHslider8)); float fSlow9 = (9.99999975e-06f * float(fHslider9)); - float fSlow10 = (9.99999975e-06f * float(fHslider10)); - float fSlow11 = (9.99999975e-06f * float(fHslider11)); + float fSlow10 = (9.99999997e-07f * float(fHslider10)); + float fSlow11 = (0.00100000005f * float(fHslider11)); float fSlow12 = (0.00100000005f * std::exp((fConst1 * (0.0f - (6.28318548f * float(fHslider12)))))); for (int i = 0; (i < count); i = (i + 1)) { float fTemp0 = float(input0[i]); @@ -545,170 +522,198 @@ class faustFverb { fRec1[0] = (fSlow1 + (0.999000013f * fRec1[1])); fRec10[0] = (fSlow2 + (0.999000013f * fRec10[1])); float fTemp2 = std::min(0.5f, std::max(0.25f, (fRec10[0] + 0.150000006f))); - fRec18[0] = (fSlow3 + (0.999000013f * fRec18[1])); - fRec21[0] = (fSlow4 + (0.999000013f * fRec21[1])); - float fTemp3 = (fRec20[1] + (fConst1 * fRec21[0])); - fRec20[0] = (fTemp3 - float(int(fTemp3))); - int iTemp4 = (int((fConst0 * ((fRec18[0] * ftbl0faustFverbSIG0[int((65536.0f * (fRec20[0] + (0.25f - float(int((fRec20[0] + 0.25f)))))))]) + 0.0305097271f))) + -1); - float fTemp5 = ((fRec14[1] != 0.0f) ? (((fRec15[1] > 0.0f) & (fRec15[1] < 1.0f)) ? fRec14[1] : 0.0f) : (((fRec15[1] == 0.0f) & (iTemp4 != iRec16[1])) ? fConst2 : (((fRec15[1] == 1.0f) & (iTemp4 != iRec17[1])) ? fConst3 : 0.0f))); - fRec14[0] = fTemp5; - fRec15[0] = std::max(0.0f, std::min(1.0f, (fRec15[1] + fTemp5))); - iRec16[0] = (((fRec15[1] >= 1.0f) & (iRec17[1] != iTemp4)) ? iTemp4 : iRec16[1]); - iRec17[0] = (((fRec15[1] <= 0.0f) & (iRec16[1] != iTemp4)) ? iTemp4 : iRec17[1]); - fRec32[0] = (fSlow5 + (0.999000013f * fRec32[1])); - fVec0[(IOTA & 131071)] = (fTemp1 * fRec32[0]); - fRec33[0] = (fSlow6 + (0.999000013f * fRec33[1])); - int iTemp6 = std::min(65536, std::max(0, int((fConst0 * fRec33[0])))); - fRec34[0] = (fSlow7 + (0.999000013f * fRec34[1])); - fRec31[0] = (fVec0[((IOTA - iTemp6) & 131071)] + (fRec34[0] * fRec31[1])); - float fTemp7 = (1.0f - fRec34[0]); - fRec35[0] = (fSlow8 + (0.999000013f * fRec35[1])); - fRec30[0] = ((fRec31[0] * fTemp7) + (fRec35[0] * fRec30[1])); - float fTemp8 = (fRec35[0] + 1.0f); - float fTemp9 = (0.0f - (0.5f * fTemp8)); - fRec36[0] = (fSlow9 + (0.999000013f * fRec36[1])); - float fTemp10 = (((0.5f * (fRec30[0] * fTemp8)) + (fRec30[1] * fTemp9)) - (fRec36[0] * fRec28[1])); - fVec1[(IOTA & 1023)] = fTemp10; - fRec28[0] = fVec1[((IOTA - iConst4) & 1023)]; - float fRec29 = (fRec36[0] * fTemp10); - float fTemp11 = ((fRec29 + fRec28[1]) - (fRec36[0] * fRec26[1])); - fVec2[(IOTA & 1023)] = fTemp11; - fRec26[0] = fVec2[((IOTA - iConst5) & 1023)]; - float fRec27 = (fRec36[0] * fTemp11); - fRec37[0] = (fSlow10 + (0.999000013f * fRec37[1])); - float fTemp12 = ((fRec27 + fRec26[1]) - (fRec37[0] * fRec24[1])); - fVec3[(IOTA & 4095)] = fTemp12; - fRec24[0] = fVec3[((IOTA - iConst6) & 4095)]; - float fRec25 = (fRec37[0] * fTemp12); - float fTemp13 = ((fRec25 + fRec24[1]) - (fRec37[0] * fRec22[1])); - fVec4[(IOTA & 2047)] = fTemp13; - fRec22[0] = fVec4[((IOTA - iConst7) & 2047)]; - float fRec23 = (fRec37[0] * fTemp13); + fRec24[0] = (fSlow3 + (0.999000013f * fRec24[1])); + fVec0[(IOTA & 131071)] = (fTemp1 * fRec24[0]); + fRec25[0] = (fSlow4 + (0.999000013f * fRec25[1])); + int iTemp3 = std::min(65536, std::max(0, int((fConst0 * fRec25[0])))); + fRec26[0] = (fSlow5 + (0.999000013f * fRec26[1])); + fRec23[0] = (fVec0[((IOTA - iTemp3) & 131071)] + (fRec26[0] * fRec23[1])); + float fTemp4 = (1.0f - fRec26[0]); + fRec27[0] = (fSlow6 + (0.999000013f * fRec27[1])); + fRec22[0] = ((fRec23[0] * fTemp4) + (fRec27[0] * fRec22[1])); + float fTemp5 = (fRec27[0] + 1.0f); + float fTemp6 = (0.0f - (0.5f * fTemp5)); + fRec28[0] = (fSlow7 + (0.999000013f * fRec28[1])); + float fTemp7 = (((0.5f * (fRec22[0] * fTemp5)) + (fRec22[1] * fTemp6)) - (fRec28[0] * fRec20[1])); + fVec1[(IOTA & 131071)] = fTemp7; + fRec20[0] = fVec1[((IOTA - iConst2) & 131071)]; + float fRec21 = (fRec28[0] * fTemp7); + float fTemp8 = ((fRec21 + fRec20[1]) - (fRec28[0] * fRec18[1])); + fVec2[(IOTA & 131071)] = fTemp8; + fRec18[0] = fVec2[((IOTA - iConst3) & 131071)]; + float fRec19 = (fRec28[0] * fTemp8); + fRec29[0] = (fSlow8 + (0.999000013f * fRec29[1])); + float fTemp9 = ((fRec19 + fRec18[1]) - (fRec29[0] * fRec16[1])); + fVec3[(IOTA & 131071)] = fTemp9; + fRec16[0] = fVec3[((IOTA - iConst4) & 131071)]; + float fRec17 = (fRec29[0] * fTemp9); + float fTemp10 = ((fRec17 + fRec16[1]) - (fRec29[0] * fRec14[1])); + fVec4[(IOTA & 131071)] = fTemp10; + fRec14[0] = fVec4[((IOTA - iConst5) & 131071)]; + float fRec15 = (fRec29[0] * fTemp10); + fRec30[0] = (fSlow9 + (0.999000013f * fRec30[1])); + float fTemp11 = (fRec14[1] + ((fRec10[0] * fRec5[((IOTA - iConst6) & 131071)]) + (fRec15 + (fRec30[0] * fRec12[1])))); + fVec5[(IOTA & 131071)] = fTemp11; + fRec35[0] = (fSlow10 + (0.999000013f * fRec35[1])); fRec38[0] = (fSlow11 + (0.999000013f * fRec38[1])); - float fTemp14 = (fRec22[1] + ((fRec10[0] * fRec5[((IOTA - iConst8) & 32767)]) + (fRec23 + (fRec38[0] * fRec12[1])))); - fVec5[(IOTA & 131071)] = fTemp14; - fRec12[0] = (((1.0f - fRec15[0]) * fVec5[((IOTA - std::min(65536, std::max(0, iRec16[0]))) & 131071)]) + (fRec15[0] * fVec5[((IOTA - std::min(65536, std::max(0, iRec17[0]))) & 131071)])); - float fRec13 = (0.0f - (fRec38[0] * fTemp14)); - float fTemp15 = (fRec13 + fRec12[1]); - fVec6[(IOTA & 32767)] = fTemp15; + float fTemp12 = (fRec37[1] + (fConst1 * fRec38[0])); + fRec37[0] = (fTemp12 - float(int(fTemp12))); + int iTemp13 = (int((fConst0 * ((fRec35[0] * ftbl0faustFverbSIG0[int((65536.0f * (fRec37[0] + (0.25f - float(int((fRec37[0] + 0.25f)))))))]) + 0.0305097271f))) + -1); + float fTemp14 = ((fRec31[1] != 0.0f) ? (((fRec32[1] > 0.0f) & (fRec32[1] < 1.0f)) ? fRec31[1] : 0.0f) : (((fRec32[1] == 0.0f) & (iTemp13 != iRec33[1])) ? fConst7 : (((fRec32[1] == 1.0f) & (iTemp13 != iRec34[1])) ? fConst8 : 0.0f))); + fRec31[0] = fTemp14; + fRec32[0] = std::max(0.0f, std::min(1.0f, (fRec32[1] + fTemp14))); + iRec33[0] = (((fRec32[1] >= 1.0f) & (iRec34[1] != iTemp13)) ? iTemp13 : iRec33[1]); + iRec34[0] = (((fRec32[1] <= 0.0f) & (iRec33[1] != iTemp13)) ? iTemp13 : iRec34[1]); + float fTemp15 = fVec5[((IOTA - std::min(65536, std::max(0, iRec33[0]))) & 131071)]; + fRec12[0] = (fTemp15 + (fRec32[0] * (fVec5[((IOTA - std::min(65536, std::max(0, iRec34[0]))) & 131071)] - fTemp15))); + float fRec13 = (0.0f - (fRec30[0] * fTemp11)); + float fTemp16 = (fRec13 + fRec12[1]); + fVec6[(IOTA & 131071)] = fTemp16; fRec39[0] = (fSlow12 + (0.999000013f * fRec39[1])); - fRec11[0] = (fVec6[((IOTA - iConst9) & 32767)] + (fRec39[0] * fRec11[1])); - float fTemp16 = (1.0f - fRec39[0]); - float fTemp17 = ((fTemp2 * fRec8[1]) + ((fRec10[0] * fRec11[0]) * fTemp16)); - fVec7[(IOTA & 32767)] = fTemp17; - fRec8[0] = fVec7[((IOTA - iConst10) & 32767)]; - float fRec9 = (0.0f - (fTemp2 * fTemp17)); - fRec2[(IOTA & 32767)] = (fRec9 + fRec8[1]); - fRec3[(IOTA & 16383)] = (fRec11[0] * fTemp16); - fRec4[(IOTA & 32767)] = fTemp15; - int iTemp18 = (int((fConst0 * ((fRec18[0] * ftbl0faustFverbSIG0[int((65536.0f * fRec20[0]))]) + 0.025603978f))) + -1); - float fTemp19 = ((fRec45[1] != 0.0f) ? (((fRec46[1] > 0.0f) & (fRec46[1] < 1.0f)) ? fRec45[1] : 0.0f) : (((fRec46[1] == 0.0f) & (iTemp18 != iRec47[1])) ? fConst2 : (((fRec46[1] == 1.0f) & (iTemp18 != iRec48[1])) ? fConst3 : 0.0f))); - fRec45[0] = fTemp19; - fRec46[0] = std::max(0.0f, std::min(1.0f, (fRec46[1] + fTemp19))); - iRec47[0] = (((fRec46[1] >= 1.0f) & (iRec48[1] != iTemp18)) ? iTemp18 : iRec47[1]); - iRec48[0] = (((fRec46[1] <= 0.0f) & (iRec47[1] != iTemp18)) ? iTemp18 : iRec48[1]); - fVec8[(IOTA & 131071)] = (fTemp0 * fRec32[0]); - fRec58[0] = (fVec8[((IOTA - iTemp6) & 131071)] + (fRec34[0] * fRec58[1])); - fRec57[0] = ((fTemp7 * fRec58[0]) + (fRec35[0] * fRec57[1])); - float fTemp20 = (((0.5f * (fRec57[0] * fTemp8)) + (fTemp9 * fRec57[1])) - (fRec36[0] * fRec55[1])); - fVec9[(IOTA & 1023)] = fTemp20; - fRec55[0] = fVec9[((IOTA - iConst11) & 1023)]; - float fRec56 = (fRec36[0] * fTemp20); - float fTemp21 = ((fRec56 + fRec55[1]) - (fRec36[0] * fRec53[1])); - fVec10[(IOTA & 1023)] = fTemp21; - fRec53[0] = fVec10[((IOTA - iConst12) & 1023)]; - float fRec54 = (fRec36[0] * fTemp21); - float fTemp22 = ((fRec54 + fRec53[1]) - (fRec37[0] * fRec51[1])); - fVec11[(IOTA & 4095)] = fTemp22; - fRec51[0] = fVec11[((IOTA - iConst13) & 4095)]; - float fRec52 = (fRec37[0] * fTemp22); - float fTemp23 = ((fRec52 + fRec51[1]) - (fRec37[0] * fRec49[1])); - fVec12[(IOTA & 2047)] = fTemp23; - fRec49[0] = fVec12[((IOTA - iConst14) & 2047)]; - float fRec50 = (fRec37[0] * fTemp23); - float fTemp24 = (fRec49[1] + ((fRec10[0] * fRec2[((IOTA - iConst15) & 32767)]) + (fRec50 + (fRec38[0] * fRec43[1])))); - fVec13[(IOTA & 131071)] = fTemp24; - fRec43[0] = (((1.0f - fRec46[0]) * fVec13[((IOTA - std::min(65536, std::max(0, iRec47[0]))) & 131071)]) + (fRec46[0] * fVec13[((IOTA - std::min(65536, std::max(0, iRec48[0]))) & 131071)])); - float fRec44 = (0.0f - (fRec38[0] * fTemp24)); - float fTemp25 = (fRec44 + fRec43[1]); - fVec14[(IOTA & 32767)] = fTemp25; - fRec42[0] = (fVec14[((IOTA - iConst16) & 32767)] + (fRec39[0] * fRec42[1])); - float fTemp26 = ((fTemp2 * fRec40[1]) + ((fRec10[0] * fTemp16) * fRec42[0])); - fVec15[(IOTA & 16383)] = fTemp26; - fRec40[0] = fVec15[((IOTA - iConst17) & 16383)]; - float fRec41 = (0.0f - (fTemp2 * fTemp26)); - fRec5[(IOTA & 32767)] = (fRec41 + fRec40[1]); - fRec6[(IOTA & 8191)] = (fTemp16 * fRec42[0]); - fRec7[(IOTA & 32767)] = fTemp25; - output0[i] = FAUSTFLOAT(((fTemp0 * fRec0[0]) + (0.600000024f * (fRec1[0] * (((fRec4[((IOTA - iConst18) & 32767)] + fRec4[((IOTA - iConst19) & 32767)]) + fRec2[((IOTA - iConst20) & 32767)]) - (((fRec3[((IOTA - iConst21) & 16383)] + fRec7[((IOTA - iConst22) & 32767)]) + fRec6[((IOTA - iConst23) & 8191)]) + fRec5[((IOTA - iConst24) & 32767)])))))); - output1[i] = FAUSTFLOAT(((fTemp1 * fRec0[0]) + (0.600000024f * (fRec1[0] * (((fRec7[((IOTA - iConst25) & 32767)] + fRec7[((IOTA - iConst26) & 32767)]) + fRec5[((IOTA - iConst27) & 32767)]) - (((fRec6[((IOTA - iConst28) & 8191)] + fRec4[((IOTA - iConst29) & 32767)]) + fRec3[((IOTA - iConst30) & 16383)]) + fRec2[((IOTA - iConst31) & 32767)])))))); + fRec11[0] = (fVec6[((IOTA - iConst9) & 131071)] + (fRec39[0] * fRec11[1])); + float fTemp17 = (1.0f - fRec39[0]); + float fTemp18 = ((fTemp2 * fRec8[1]) + ((fRec10[0] * fRec11[0]) * fTemp17)); + fVec7[(IOTA & 131071)] = fTemp18; + fRec8[0] = fVec7[((IOTA - iConst10) & 131071)]; + float fRec9 = (0.0f - (fTemp2 * fTemp18)); + fRec2[(IOTA & 131071)] = (fRec9 + fRec8[1]); + fRec3[(IOTA & 131071)] = (fRec11[0] * fTemp17); + fRec4[(IOTA & 131071)] = fTemp16; + fVec8[(IOTA & 131071)] = (fTemp0 * fRec24[0]); + fRec54[0] = (fVec8[((IOTA - iTemp3) & 131071)] + (fRec26[0] * fRec54[1])); + fRec53[0] = ((fTemp4 * fRec54[0]) + (fRec27[0] * fRec53[1])); + float fTemp19 = (((0.5f * (fRec53[0] * fTemp5)) + (fTemp6 * fRec53[1])) - (fRec28[0] * fRec51[1])); + fVec9[(IOTA & 131071)] = fTemp19; + fRec51[0] = fVec9[((IOTA - iConst11) & 131071)]; + float fRec52 = (fRec28[0] * fTemp19); + float fTemp20 = ((fRec52 + fRec51[1]) - (fRec28[0] * fRec49[1])); + fVec10[(IOTA & 131071)] = fTemp20; + fRec49[0] = fVec10[((IOTA - iConst12) & 131071)]; + float fRec50 = (fRec28[0] * fTemp20); + float fTemp21 = ((fRec50 + fRec49[1]) - (fRec29[0] * fRec47[1])); + fVec11[(IOTA & 131071)] = fTemp21; + fRec47[0] = fVec11[((IOTA - iConst13) & 131071)]; + float fRec48 = (fRec29[0] * fTemp21); + float fTemp22 = ((fRec48 + fRec47[1]) - (fRec29[0] * fRec45[1])); + fVec12[(IOTA & 131071)] = fTemp22; + fRec45[0] = fVec12[((IOTA - iConst14) & 131071)]; + float fRec46 = (fRec29[0] * fTemp22); + float fTemp23 = (fRec45[1] + ((fRec10[0] * fRec2[((IOTA - iConst15) & 131071)]) + (fRec46 + (fRec30[0] * fRec43[1])))); + fVec13[(IOTA & 131071)] = fTemp23; + int iTemp24 = (int((fConst0 * ((fRec35[0] * ftbl0faustFverbSIG0[int((65536.0f * fRec37[0]))]) + 0.025603978f))) + -1); + float fTemp25 = ((fRec55[1] != 0.0f) ? (((fRec56[1] > 0.0f) & (fRec56[1] < 1.0f)) ? fRec55[1] : 0.0f) : (((fRec56[1] == 0.0f) & (iTemp24 != iRec57[1])) ? fConst7 : (((fRec56[1] == 1.0f) & (iTemp24 != iRec58[1])) ? fConst8 : 0.0f))); + fRec55[0] = fTemp25; + fRec56[0] = std::max(0.0f, std::min(1.0f, (fRec56[1] + fTemp25))); + iRec57[0] = (((fRec56[1] >= 1.0f) & (iRec58[1] != iTemp24)) ? iTemp24 : iRec57[1]); + iRec58[0] = (((fRec56[1] <= 0.0f) & (iRec57[1] != iTemp24)) ? iTemp24 : iRec58[1]); + float fTemp26 = fVec13[((IOTA - std::min(65536, std::max(0, iRec57[0]))) & 131071)]; + fRec43[0] = (fTemp26 + (fRec56[0] * (fVec13[((IOTA - std::min(65536, std::max(0, iRec58[0]))) & 131071)] - fTemp26))); + float fRec44 = (0.0f - (fRec30[0] * fTemp23)); + float fTemp27 = (fRec44 + fRec43[1]); + fVec14[(IOTA & 131071)] = fTemp27; + fRec42[0] = (fVec14[((IOTA - iConst16) & 131071)] + (fRec39[0] * fRec42[1])); + float fTemp28 = ((fTemp2 * fRec40[1]) + ((fRec10[0] * fTemp17) * fRec42[0])); + fVec15[(IOTA & 131071)] = fTemp28; + fRec40[0] = fVec15[((IOTA - iConst17) & 131071)]; + float fRec41 = (0.0f - (fTemp2 * fTemp28)); + fRec5[(IOTA & 131071)] = (fRec41 + fRec40[1]); + fRec6[(IOTA & 131071)] = (fTemp17 * fRec42[0]); + fRec7[(IOTA & 131071)] = fTemp27; + output0[i] = FAUSTFLOAT(((fTemp0 * fRec0[0]) + (0.600000024f * (fRec1[0] * (((fRec4[((IOTA - iConst18) & 131071)] + fRec4[((IOTA - iConst19) & 131071)]) + fRec2[((IOTA - iConst20) & 131071)]) - (((fRec3[((IOTA - iConst21) & 131071)] + fRec7[((IOTA - iConst22) & 131071)]) + fRec6[((IOTA - iConst23) & 131071)]) + fRec5[((IOTA - iConst24) & 131071)])))))); + output1[i] = FAUSTFLOAT(((fTemp1 * fRec0[0]) + (0.600000024f * (fRec1[0] * (((fRec7[((IOTA - iConst25) & 131071)] + fRec7[((IOTA - iConst26) & 131071)]) + fRec5[((IOTA - iConst27) & 131071)]) - (((fRec6[((IOTA - iConst28) & 131071)] + fRec4[((IOTA - iConst29) & 131071)]) + fRec3[((IOTA - iConst30) & 131071)]) + fRec2[((IOTA - iConst31) & 131071)])))))); fRec0[1] = fRec0[0]; fRec1[1] = fRec1[0]; fRec10[1] = fRec10[0]; - fRec18[1] = fRec18[0]; - fRec21[1] = fRec21[0]; - fRec20[1] = fRec20[0]; - fRec14[1] = fRec14[0]; - fRec15[1] = fRec15[0]; - iRec16[1] = iRec16[0]; - iRec17[1] = iRec17[0]; - fRec32[1] = fRec32[0]; - IOTA = (IOTA + 1); - fRec33[1] = fRec33[0]; - fRec34[1] = fRec34[0]; - fRec31[1] = fRec31[0]; - fRec35[1] = fRec35[0]; - fRec30[1] = fRec30[0]; - fRec36[1] = fRec36[0]; - fRec28[1] = fRec28[0]; - fRec26[1] = fRec26[0]; - fRec37[1] = fRec37[0]; fRec24[1] = fRec24[0]; + IOTA = (IOTA + 1); + fRec25[1] = fRec25[0]; + fRec26[1] = fRec26[0]; + fRec23[1] = fRec23[0]; + fRec27[1] = fRec27[0]; fRec22[1] = fRec22[0]; + fRec28[1] = fRec28[0]; + fRec20[1] = fRec20[0]; + fRec18[1] = fRec18[0]; + fRec29[1] = fRec29[0]; + fRec16[1] = fRec16[0]; + fRec14[1] = fRec14[0]; + fRec30[1] = fRec30[0]; + fRec35[1] = fRec35[0]; fRec38[1] = fRec38[0]; + fRec37[1] = fRec37[0]; + fRec31[1] = fRec31[0]; + fRec32[1] = fRec32[0]; + iRec33[1] = iRec33[0]; + iRec34[1] = iRec34[0]; fRec12[1] = fRec12[0]; fRec39[1] = fRec39[0]; fRec11[1] = fRec11[0]; fRec8[1] = fRec8[0]; - fRec45[1] = fRec45[0]; - fRec46[1] = fRec46[0]; - iRec47[1] = iRec47[0]; - iRec48[1] = iRec48[0]; - fRec58[1] = fRec58[0]; - fRec57[1] = fRec57[0]; - fRec55[1] = fRec55[0]; + fRec54[1] = fRec54[0]; fRec53[1] = fRec53[0]; fRec51[1] = fRec51[0]; fRec49[1] = fRec49[0]; + fRec47[1] = fRec47[0]; + fRec45[1] = fRec45[0]; + fRec55[1] = fRec55[0]; + fRec56[1] = fRec56[0]; + iRec57[1] = iRec57[0]; + iRec58[1] = iRec58[0]; fRec43[1] = fRec43[0]; fRec42[1] = fRec42[0]; fRec40[1] = fRec40[0]; } + //[End:compute] } + + FAUSTFLOAT getPredelay() const { return fHslider4; } + void setPredelay(FAUSTFLOAT value) { fHslider4 = value; } + + FAUSTFLOAT getInputAmount() const { return fHslider3; } + void setInputAmount(FAUSTFLOAT value) { fHslider3 = value; } + + FAUSTFLOAT getInputLowPassCutoff() const { return fHslider5; } + void setInputLowPassCutoff(FAUSTFLOAT value) { fHslider5 = value; } + + FAUSTFLOAT getInputHighPassCutoff() const { return fHslider6; } + void setInputHighPassCutoff(FAUSTFLOAT value) { fHslider6 = value; } + + FAUSTFLOAT getInputDiffusion1() const { return fHslider7; } + void setInputDiffusion1(FAUSTFLOAT value) { fHslider7 = value; } + + FAUSTFLOAT getInputDiffusion2() const { return fHslider8; } + void setInputDiffusion2(FAUSTFLOAT value) { fHslider8 = value; } + + FAUSTFLOAT getTailDensity() const { return fHslider9; } + void setTailDensity(FAUSTFLOAT value) { fHslider9 = value; } + + FAUSTFLOAT getDecay() const { return fHslider2; } + void setDecay(FAUSTFLOAT value) { fHslider2 = value; } + + FAUSTFLOAT getDamping() const { return fHslider12; } + void setDamping(FAUSTFLOAT value) { fHslider12 = value; } + + FAUSTFLOAT getModulatorFrequency() const { return fHslider11; } + void setModulatorFrequency(FAUSTFLOAT value) { fHslider11 = value; } + + FAUSTFLOAT getModulatorDepth() const { return fHslider10; } + void setModulatorDepth(FAUSTFLOAT value) { fHslider10 = value; } + + FAUSTFLOAT getDry() const { return fHslider0; } + void setDry(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getWet() const { return fHslider1; } + void setWet(FAUSTFLOAT value) { fHslider1 = value; } + + //[End:class] }; +//[After:class] -#ifdef FAUST_UIMACROS - - - - #define FAUST_LIST_ACTIVES(p) \ - p(HORIZONTALSLIDER, Predelay, "Predelay", fHslider6, 0.0f, 0.0f, 300.0f, 1.0f) \ - p(HORIZONTALSLIDER, Input_amount, "Input amount", fHslider5, 100.0f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Input_low_pass_cutoff, "Input low pass cutoff", fHslider7, 10000.0f, 1.0f, 20000.0f, 1.0f) \ - p(HORIZONTALSLIDER, Input_high_pass_cutoff, "Input high pass cutoff", fHslider8, 100.0f, 1.0f, 1000.0f, 1.0f) \ - p(HORIZONTALSLIDER, Input_diffusion_1, "Input diffusion 1", fHslider9, 75.0f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Input_diffusion_2, "Input diffusion 2", fHslider10, 62.5f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Tail_density, "Tail density", fHslider11, 70.0f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Decay, "Decay", fHslider2, 50.0f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Damping, "Damping", fHslider12, 5500.0f, 10.0f, 20000.0f, 1.0f) \ - p(HORIZONTALSLIDER, Modulator_frequency, "Modulator frequency", fHslider4, 1.0f, 0.01f, 4.0f, 0.01f) \ - p(HORIZONTALSLIDER, Modulator_depth, "Modulator depth", fHslider3, 0.5f, 0.0f, 10.0f, 0.10000000000000001f) \ - p(HORIZONTALSLIDER, Dry, "Dry", fHslider0, 100.0f, 0.0f, 100.0f, 0.01f) \ - p(HORIZONTALSLIDER, Wet, "Wet", fHslider1, 50.0f, 0.0f, 100.0f, 0.01f) \ - - #define FAUST_LIST_PASSIVES(p) \ #endif - +#if defined(__GNUC__) +#pragma GCC diagnostic pop #endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/effects/gen/gate.hxx b/src/sfizz/effects/gen/gate.hxx index 93da987b..f1da8235 100644 --- a/src/sfizz/effects/gen/gate.hxx +++ b/src/sfizz/effects/gen/gate.hxx @@ -1,7 +1,11 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ name: "gate" -Code generated with Faust 2.27.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -scal -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -scal -ftz 0 ------------------------------------------------------------ */ #ifndef __faustGate_H__ @@ -9,101 +13,77 @@ Compilation options: -lang cpp -inpl -scal -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustGate #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustGate { + //[Begin:class] - public: - - float fConst0; + + private: + FAUSTFLOAT fHslider0; FAUSTFLOAT fHslider1; int fSampleRate; + float fConst0; float fConst1; - float fConst2; float fRec3[2]; FAUSTFLOAT fHslider2; int iVec0[2]; - float fConst3; FAUSTFLOAT fHslider3; int iRec4[2]; float fRec1[2]; float fRec0[2]; - + public: + - void metadata() { - } - - int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { - (void)sample_rate; + //[Begin:classInit] + //[End:classInit] } - + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = float(_oversampling); - fConst1 = std::min(192000.0f, std::max(1.0f, float(fSampleRate))); - fConst2 = (1.0f / fConst1); - fConst3 = (fConst1 * fConst0); + fConst0 = float(fSampleRate); + fConst1 = (1.0f / fConst0); + //[End:instanceConstants] } - + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] fHslider0 = FAUSTFLOAT(0.0f); fHslider1 = FAUSTFLOAT(0.0f); fHslider2 = FAUSTFLOAT(0.0f); fHslider3 = FAUSTFLOAT(0.0f); + //[End:instanceResetUserInterface] } - + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec3[l0] = 0.0f; } @@ -119,44 +99,45 @@ class faustGate { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec0[l4] = 0.0f; } + //[End:instanceClear] } - + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - faustGate* clone() { - return new faustGate(); - } - + + int getSampleRate() { return fSampleRate; } - - void buildUserInterface() { - } - - void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - float fSlow0 = (fConst0 * float(fHslider0)); - float fSlow1 = (fConst0 * float(fHslider1)); + float fSlow0 = float(fHslider0); + float fSlow1 = float(fHslider1); float fSlow2 = std::min(fSlow0, fSlow1); int iSlow3 = (std::fabs(fSlow2) < 1.1920929e-07f); - float fSlow4 = (iSlow3 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow3 ? 1.0f : fSlow2))))); + float fSlow4 = (iSlow3 ? 0.0f : std::exp((0.0f - (fConst1 / (iSlow3 ? 1.0f : fSlow2))))); float fSlow5 = (1.0f - fSlow4); float fSlow6 = std::pow(10.0f, (0.0500000007f * float(fHslider2))); - int iSlow7 = int((fConst3 * float(fHslider3))); + int iSlow7 = int((fConst0 * float(fHslider3))); int iSlow8 = (std::fabs(fSlow0) < 1.1920929e-07f); - float fSlow9 = (iSlow8 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow8 ? 1.0f : fSlow0))))); + float fSlow9 = (iSlow8 ? 0.0f : std::exp((0.0f - (fConst1 / (iSlow8 ? 1.0f : fSlow0))))); int iSlow10 = (std::fabs(fSlow1) < 1.1920929e-07f); - float fSlow11 = (iSlow10 ? 0.0f : std::exp((0.0f - (fConst2 / (iSlow10 ? 1.0f : fSlow1))))); + float fSlow11 = (iSlow10 ? 0.0f : std::exp((0.0f - (fConst1 / (iSlow10 ? 1.0f : fSlow1))))); for (int i = 0; (i < count); i = (i + 1)) { float fTemp0 = float(input0[i]); fRec3[0] = ((fRec3[1] * fSlow4) + (std::fabs(fTemp0) * fSlow5)); @@ -175,22 +156,30 @@ class faustGate { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getThreshold() const { return fHslider2; } + void setThreshold(FAUSTFLOAT value) { fHslider2 = value; } + + FAUSTFLOAT getAttack() const { return fHslider0; } + void setAttack(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getHold() const { return fHslider3; } + void setHold(FAUSTFLOAT value) { fHslider3 = value; } + + FAUSTFLOAT getRelease() const { return fHslider1; } + void setRelease(FAUSTFLOAT value) { fHslider1 = value; } + + //[End:class] }; +//[After:class] -#ifdef FAUST_UIMACROS - - - - #define FAUST_LIST_ACTIVES(p) \ - p(HORIZONTALSLIDER, Threshold, "Threshold", fHslider2, 0.0f, -60.0f, 0.0f, 0.01f) \ - p(HORIZONTALSLIDER, Attack, "Attack", fHslider0, 0.0f, 0.0f, 10.0f, 0.001f) \ - p(HORIZONTALSLIDER, Hold, "Hold", fHslider3, 0.0f, 0.0f, 10.0f, 0.001f) \ - p(HORIZONTALSLIDER, Release, "Release", fHslider1, 0.0f, 0.0f, 5.0f, 0.001f) \ - - #define FAUST_LIST_PASSIVES(p) \ #endif - +#if defined(__GNUC__) +#pragma GCC diagnostic pop #endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/effects/gen/limiter.hxx b/src/sfizz/effects/gen/limiter.hxx index 420f6728..0963f670 100644 --- a/src/sfizz/effects/gen/limiter.hxx +++ b/src/sfizz/effects/gen/limiter.hxx @@ -1,135 +1,171 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ name: "limiter" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -scal -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -scal -ftz 0 ------------------------------------------------------------ */ -#ifndef __faustLimiter_H__ -#define __faustLimiter_H__ +#ifndef __faustLimiter_H__ +#define __faustLimiter_H__ #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS + +#ifndef FAUSTCLASS #define FAUSTCLASS faustLimiter #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLimiter { + //[Begin:class] -private: - int fSampleRate; - float fConst0; - float fConst1; - float fConst2; - float fConst3; - float fConst4; - float fConst5; - float fConst6; - float fRec2[2]; - float fRec1[2]; - float fRec0[2]; - float fRec5[2]; - float fRec4[2]; - float fRec3[2]; + + private: + + int fSampleRate; + float fConst0; + float fConst1; + float fConst2; + float fConst3; + float fConst4; + float fConst5; + float fConst6; + float fRec2[2]; + float fRec1[2]; + float fRec0[2]; + float fRec5[2]; + float fRec4[2]; + float fRec3[2]; + + public: + -public: - static void classInit(int sample_rate) - { - (void)sample_rate; - } + static constexpr int getNumInputs() { + return 2; + } + static constexpr int getNumOutputs() { + return 2; + } + + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] + } + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] + fSampleRate = sample_rate; + fConst0 = float(fSampleRate); + fConst1 = std::exp((0.0f - (2500.0f / fConst0))); + fConst2 = (1.0f - fConst1); + fConst3 = std::exp((0.0f - (1250.0f / fConst0))); + fConst4 = (1.0f - fConst3); + fConst5 = std::exp((0.0f - (2.0f / fConst0))); + fConst6 = (1.0f - fConst5); + //[End:instanceConstants] + } + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + //[End:instanceResetUserInterface] + } + + void instanceClear() { + //[Begin:instanceClear] + for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { + fRec2[l0] = 0.0f; + } + for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { + fRec1[l1] = 0.0f; + } + for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { + fRec0[l2] = 0.0f; + } + for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { + fRec5[l3] = 0.0f; + } + for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { + fRec4[l4] = 0.0f; + } + for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { + fRec3[l5] = 0.0f; + } + //[End:instanceClear] + } + + void init(int sample_rate) { + //[Begin:init] + classInit(sample_rate); + instanceInit(sample_rate); + //[End:init] + } + void instanceInit(int sample_rate) { + //[Begin:instanceInit] + instanceConstants(sample_rate); + instanceResetUserInterface(); + instanceClear(); + //[End:instanceInit] + } + + + int getSampleRate() { + return fSampleRate; + } + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; + FAUSTFLOAT* output0 = outputs[0]; + FAUSTFLOAT* output1 = outputs[1]; + for (int i = 0; (i < count); i = (i + 1)) { + float fTemp0 = float(input0[i]); + float fTemp1 = float(input1[i]); + float fTemp2 = std::fabs(fTemp0); + fRec2[0] = std::max(fTemp2, ((fConst5 * fRec2[1]) + (fConst6 * fTemp2))); + fRec1[0] = ((fConst3 * fRec1[1]) + (fConst4 * fRec2[0])); + fRec0[0] = ((fConst1 * fRec0[1]) + (fConst2 * ((fRec1[0] > 1.0f) ? (1.0f / fRec1[0]) : 1.0f))); + output0[i] = FAUSTFLOAT((fTemp0 * fRec0[0])); + float fTemp3 = std::fabs(fTemp1); + fRec5[0] = std::max(fTemp3, ((fConst5 * fRec5[1]) + (fConst6 * fTemp3))); + fRec4[0] = ((fConst3 * fRec4[1]) + (fConst4 * fRec5[0])); + fRec3[0] = ((fConst1 * fRec3[1]) + (fConst2 * ((fRec4[0] > 1.0f) ? (1.0f / fRec4[0]) : 1.0f))); + output1[i] = FAUSTFLOAT((fTemp1 * fRec3[0])); + fRec2[1] = fRec2[0]; + fRec1[1] = fRec1[0]; + fRec0[1] = fRec0[0]; + fRec5[1] = fRec5[0]; + fRec4[1] = fRec4[0]; + fRec3[1] = fRec3[0]; + } + //[End:compute] + } - void instanceConstants(int sample_rate) - { - fSampleRate = sample_rate; - fConst0 = (std::min(192000.0f, std::max(1.0f, float(fSampleRate))) * float(_oversampling)); - fConst1 = std::exp((0.0f - (2500.0f / fConst0))); - fConst2 = (1.0f - fConst1); - fConst3 = std::exp((0.0f - (1250.0f / fConst0))); - fConst4 = (1.0f - fConst3); - fConst5 = std::exp((0.0f - (2.0f / fConst0))); - fConst6 = (1.0f - fConst5); - } - void instanceResetUserInterface() - { - } - - void instanceClear() - { - for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { - fRec2[l0] = 0.0f; - } - for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { - fRec1[l1] = 0.0f; - } - for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { - fRec0[l2] = 0.0f; - } - for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { - fRec5[l3] = 0.0f; - } - for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { - fRec4[l4] = 0.0f; - } - for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { - fRec3[l5] = 0.0f; - } - } - - void init(int sample_rate) - { - classInit(sample_rate); - instanceInit(sample_rate); - } - void instanceInit(int sample_rate) - { - instanceConstants(sample_rate); - instanceResetUserInterface(); - instanceClear(); - } - - int getSampleRate() - { - return fSampleRate; - } - - void compute(int count, const FAUSTFLOAT* const* inputs, FAUSTFLOAT* const* outputs) - { - const FAUSTFLOAT* input0 = inputs[0]; - const FAUSTFLOAT* input1 = inputs[1]; - FAUSTFLOAT* output0 = outputs[0]; - FAUSTFLOAT* output1 = outputs[1]; - for (int i = 0; (i < count); i = (i + 1)) { - float fTemp0 = float(input0[i]); - float fTemp1 = float(input1[i]); - float fTemp2 = std::fabs(fTemp0); - fRec2[0] = std::max(fTemp2, ((fConst5 * fRec2[1]) + (fConst6 * fTemp2))); - fRec1[0] = ((fConst3 * fRec1[1]) + (fConst4 * fRec2[0])); - fRec0[0] = ((fConst1 * fRec0[1]) + (fConst2 * ((fRec1[0] > 1.0f) ? (1.0f / fRec1[0]) : 1.0f))); - output0[i] = FAUSTFLOAT((fTemp0 * fRec0[0])); - float fTemp3 = std::fabs(fTemp1); - fRec5[0] = std::max(fTemp3, ((fConst5 * fRec5[1]) + (fConst6 * fTemp3))); - fRec4[0] = ((fConst3 * fRec4[1]) + (fConst4 * fRec5[0])); - fRec3[0] = ((fConst1 * fRec3[1]) + (fConst2 * ((fRec4[0] > 1.0f) ? (1.0f / fRec4[0]) : 1.0f))); - output1[i] = FAUSTFLOAT((fTemp1 * fRec3[0])); - fRec2[1] = fRec2[0]; - fRec1[1] = fRec1[0]; - fRec0[1] = fRec0[0]; - fRec5[1] = fRec5[0]; - fRec4[1] = fRec4[0]; - fRec3[1] = fRec3[0]; - } - } + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chApf1p.hxx b/src/sfizz/gen/filters/sfz2chApf1p.hxx index 08c62853..33ccbcfe 100644 --- a/src/sfizz/gen/filters/sfz2chApf1p.hxx +++ b/src/sfizz/gen/filters/sfz2chApf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chApf1p_H__ @@ -11,98 +15,71 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chApf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chApf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (6.2831853071795862 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } @@ -112,40 +89,41 @@ class faust2chApf1p : public sfzFilterDsp { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec2[l2] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chApf1p* clone() { - return new faust2chApf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (((fConst1 * double(fCutoff)) + -1.0) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (((fConst2 * double(fHslider0)) + -1.0) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 - (fRec1[0] * fRec0[1])); output0[i] = FAUSTFLOAT((fRec0[1] + (fRec1[0] * fRec0[0]))); fRec2[0] = (fTemp1 - (fRec1[0] * fRec2[1])); @@ -154,8 +132,21 @@ class faust2chApf1p : public sfzFilterDsp { fRec0[1] = fRec0[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBpf1p.hxx b/src/sfizz/gen/filters/sfz2chBpf1p.hxx index 9aa4ab02..6145ed42 100644 --- a/src/sfizz/gen/filters/sfz2chBpf1p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBpf1p_H__ @@ -11,100 +15,73 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec2[2]; double fRec1[2]; double fRec0[2]; double fRec4[2]; double fRec3[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -120,40 +97,41 @@ class faust2chBpf1p : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec3[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBpf1p* clone() { - return new faust2chBpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); - fRec2[0] = (fSlow1 + (fSlow0 * fRec2[1])); + fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow1); fRec1[0] = (fTemp0 + (fRec2[0] * fRec1[1])); double fTemp2 = (1.0 - fRec2[0]); fRec0[0] = ((fRec1[0] * fTemp2) + (fRec2[0] * fRec0[1])); @@ -169,8 +147,21 @@ class faust2chBpf1p : public sfzFilterDsp { fRec4[1] = fRec4[0]; fRec3[1] = fRec3[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBpf2p.hxx b/src/sfizz/gen/filters/sfz2chBpf2p.hxx index 011f0d3d..4ebc2083 100644 --- a/src/sfizz/gen/filters/sfz2chBpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBpf2p_H__ @@ -11,34 +15,38 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fRec2[2]; double fVec0[2]; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec3[2]; double fRec4[2]; double fVec1[2]; @@ -52,71 +60,40 @@ class faust2chBpf2p : public sfzFilterDsp { double fVec5[2]; double fRec8[2]; double fRec7[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -162,38 +139,39 @@ class faust2chBpf2p : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec7[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBpf2p* clone() { - return new faust2chBpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -238,8 +216,24 @@ class faust2chBpf2p : public sfzFilterDsp { fRec8[1] = fRec8[0]; fRec7[1] = fRec7[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx index f85094dd..2719a4d8 100644 --- a/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBpf2pSv_H__ @@ -11,104 +15,77 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec3[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; double fRec7[2]; double fRec8[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec3[l0] = 0.0; } @@ -130,38 +107,39 @@ class faust2chBpf2pSv : public sfzFilterDsp { for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec8[l6] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBpf2pSv* clone() { - return new faust2chBpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); @@ -194,8 +172,24 @@ class faust2chBpf2pSv : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec8[1] = fRec8[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBpf4p.hxx b/src/sfizz/gen/filters/sfz2chBpf4p.hxx index cf9d5cb5..84fe9ac1 100644 --- a/src/sfizz/gen/filters/sfz2chBpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBpf4p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fRec5[2]; double fVec0[2]; @@ -62,71 +70,40 @@ class faust2chBpf4p : public sfzFilterDsp { double fVec11[2]; double fRec10[2]; double fRec9[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -202,38 +179,39 @@ class faust2chBpf4p : public sfzFilterDsp { for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) { fRec9[l24] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBpf4p* clone() { - return new faust2chBpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -298,8 +276,24 @@ class faust2chBpf4p : public sfzFilterDsp { fRec10[1] = fRec10[0]; fRec9[1] = fRec9[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBpf6p.hxx b/src/sfizz/gen/filters/sfz2chBpf6p.hxx index 2e8808c6..473690f6 100644 --- a/src/sfizz/gen/filters/sfz2chBpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBpf6p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fRec7[2]; double fVec0[2]; @@ -72,71 +80,40 @@ class faust2chBpf6p : public sfzFilterDsp { double fVec17[2]; double fRec12[2]; double fRec11[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -242,38 +219,39 @@ class faust2chBpf6p : public sfzFilterDsp { for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) { fRec11[l34] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBpf6p* clone() { - return new faust2chBpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -358,8 +336,24 @@ class faust2chBpf6p : public sfzFilterDsp { fRec12[1] = fRec12[0]; fRec11[1] = fRec11[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBrf1p.hxx b/src/sfizz/gen/filters/sfz2chBrf1p.hxx index 99b3bd51..4817a6fc 100644 --- a/src/sfizz/gen/filters/sfz2chBrf1p.hxx +++ b/src/sfizz/gen/filters/sfz2chBrf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBrf1p_H__ @@ -11,100 +15,73 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBrf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBrf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec2[2]; double fRec1[2]; double fRec0[2]; double fRec4[2]; double fRec3[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (6.2831853071795862 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -120,40 +97,41 @@ class faust2chBrf1p : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec3[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBrf1p* clone() { - return new faust2chBrf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (((fConst1 * double(fCutoff)) + -1.0) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (((fConst2 * double(fHslider0)) + -1.0) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); - fRec2[0] = (fSlow1 + (fSlow0 * fRec2[1])); + fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow1); fRec1[0] = (fTemp0 - (fRec2[0] * fRec1[1])); fRec0[0] = (fRec1[1] + (fRec2[0] * (fRec1[0] - fRec0[1]))); output0[i] = FAUSTFLOAT((fTemp0 + (fRec0[1] + (fRec2[0] * fRec0[0])))); @@ -166,8 +144,21 @@ class faust2chBrf1p : public sfzFilterDsp { fRec4[1] = fRec4[0]; fRec3[1] = fRec3[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBrf2p.hxx b/src/sfizz/gen/filters/sfz2chBrf2p.hxx index 91e28d07..2c4a25af 100644 --- a/src/sfizz/gen/filters/sfz2chBrf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chBrf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBrf2p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBrf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBrf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -50,71 +58,40 @@ class faust2chBrf2p : public sfzFilterDsp { double fVec5[2]; double fRec6[2]; double fRec5[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -154,37 +131,38 @@ class faust2chBrf2p : public sfzFilterDsp { for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) { fRec5[l12] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBrf2p* clone() { - return new faust2chBrf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); - double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); + double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = (1.0 - fSlow0); double fSlow5 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow3) * fSlow4); @@ -224,8 +202,24 @@ class faust2chBrf2p : public sfzFilterDsp { fRec6[1] = fRec6[0]; fRec5[1] = fRec5[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx b/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx index 773f7fd7..020f13b0 100644 --- a/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chBrf2pSv_H__ @@ -11,104 +15,77 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chBrf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chBrf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec5[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec6[2]; double fRec2[2]; double fRec3[2]; double fRec9[2]; double fRec10[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec5[l0] = 0.0; } @@ -130,38 +107,39 @@ class faust2chBrf2pSv : public sfzFilterDsp { for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec10[l6] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chBrf2pSv* clone() { - return new faust2chBrf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); @@ -196,8 +174,24 @@ class faust2chBrf2pSv : public sfzFilterDsp { fRec9[1] = fRec9[0]; fRec10[1] = fRec10[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chEqHshelf.hxx b/src/sfizz/gen/filters/sfz2chEqHshelf.hxx index 85c9ea93..62447f2b 100644 --- a/src/sfizz/gen/filters/sfz2chEqHshelf.hxx +++ b/src/sfizz/gen/filters/sfz2chEqHshelf.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chEqHshelf_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include @@ -21,26 +25,30 @@ static double faust2chEqHshelf_faustpower2_f(double value) { return (value * value); } -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chEqHshelf #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chEqHshelf : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fBandwidth; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -56,72 +64,41 @@ class faust2chEqHshelf : public sfzFilterDsp { double fVec5[2]; double fRec8[2]; double fRec7[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -167,44 +144,45 @@ class faust2chEqHshelf : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec7[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chEqHshelf* clone() { - return new faust2chEqHshelf(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = (faust2chEqHshelf_faustpower2_f(fSlow1) + 1.0); double fSlow6 = (fSlow1 + -1.0); double fSlow7 = faust2chEqHshelf_faustpower2_f(fSlow6); - double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow5 / fSlow7) + -0.01), std::max(0.01, ((double(fBandwidth) * fSlow5) / fSlow7)))) + -1.0)) + 2.0))))); - double fSlow9 = (fSlow3 * fSlow6); + double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow5 / fSlow7) + -0.01), std::max(0.01, ((double(fVslider1) * fSlow5) / fSlow7)))) + -1.0)) + 2.0))))); + double fSlow9 = (fSlow6 * fSlow3); double fSlow10 = ((fSlow1 + fSlow8) + (1.0 - fSlow9)); double fSlow11 = (1.0 - fSlow0); double fSlow12 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow10) * fSlow11); @@ -249,8 +227,27 @@ class faust2chEqHshelf : public sfzFilterDsp { fRec8[1] = fRec8[0]; fRec7[1] = fRec7[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chEqLshelf.hxx b/src/sfizz/gen/filters/sfz2chEqLshelf.hxx index 42569770..5859b454 100644 --- a/src/sfizz/gen/filters/sfz2chEqLshelf.hxx +++ b/src/sfizz/gen/filters/sfz2chEqLshelf.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chEqLshelf_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include @@ -21,26 +25,30 @@ static double faust2chEqLshelf_faustpower2_f(double value) { return (value * value); } -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chEqLshelf #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chEqLshelf : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fBandwidth; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -56,72 +64,41 @@ class faust2chEqLshelf : public sfzFilterDsp { double fVec5[2]; double fRec8[2]; double fRec7[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -167,44 +144,45 @@ class faust2chEqLshelf : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec7[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chEqLshelf* clone() { - return new faust2chEqLshelf(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = (fSlow1 + -1.0); - double fSlow6 = (fSlow3 * fSlow5); + double fSlow6 = (fSlow5 * fSlow3); double fSlow7 = (faust2chEqLshelf_faustpower2_f(fSlow1) + 1.0); double fSlow8 = faust2chEqLshelf_faustpower2_f(fSlow5); - double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow7 / fSlow8) + -0.01), std::max(0.01, ((double(fBandwidth) * fSlow7) / fSlow8)))) + -1.0)) + 2.0))))); + double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow7 / fSlow8) + -0.01), std::max(0.01, ((double(fVslider1) * fSlow7) / fSlow8)))) + -1.0)) + 2.0))))); double fSlow10 = (fSlow6 + fSlow9); double fSlow11 = ((fSlow1 + fSlow10) + 1.0); double fSlow12 = (1.0 - fSlow0); @@ -249,8 +227,27 @@ class faust2chEqLshelf : public sfzFilterDsp { fRec8[1] = fRec8[0]; fRec7[1] = fRec7[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chEqPeak.hxx b/src/sfizz/gen/filters/sfz2chEqPeak.hxx index 9a3e28a3..1849c94f 100644 --- a/src/sfizz/gen/filters/sfz2chEqPeak.hxx +++ b/src/sfizz/gen/filters/sfz2chEqPeak.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chEqPeak_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif /* link with : "" */ #include @@ -19,27 +23,31 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chEqPeak #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chEqPeak : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst3; - FAUSTFLOAT fBandwidth; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -54,73 +62,42 @@ class faust2chEqPeak : public sfzFilterDsp { double fVec5[2]; double fRec7[2]; double fRec6[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); fConst3 = (2.1775860903036022 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); - fPkShGain = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -163,45 +140,46 @@ class faust2chEqPeak : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec6[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chEqPeak* clone() { - return new faust2chEqPeak(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::max(0.0, double(fCutoff)); + double fSlow1 = std::max(0.0, double(fHslider0)); double fSlow2 = (fConst2 * fSlow1); double fSlow3 = std::sin(fSlow2); - double fSlow4 = std::max(0.001, (0.5 / double(sinh(double((fConst3 * ((fSlow1 * double(fBandwidth)) / fSlow3))))))); - double fSlow5 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); + double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow5 = std::max(0.001, (0.5 / double(sinh(double((fConst3 * ((fSlow1 * double(fVslider1)) / fSlow3))))))); double fSlow6 = (0.5 * (fSlow3 / (fSlow4 * fSlow5))); double fSlow7 = (fSlow6 + 1.0); double fSlow8 = (1.0 - fSlow0); double fSlow9 = (((0.0 - (2.0 * std::cos(fSlow2))) / fSlow7) * fSlow8); - double fSlow10 = (0.5 * ((fSlow3 * fSlow5) / fSlow4)); + double fSlow10 = (0.5 * ((fSlow4 * fSlow3) / fSlow5)); double fSlow11 = (((fSlow10 + 1.0) / fSlow7) * fSlow8); double fSlow12 = (((1.0 - fSlow10) / fSlow7) * fSlow8); double fSlow13 = (((1.0 - fSlow6) / fSlow7) * fSlow8); @@ -239,8 +217,27 @@ class faust2chEqPeak : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec6[1] = fRec6[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHpf1p.hxx b/src/sfizz/gen/filters/sfz2chHpf1p.hxx index 9040783f..57ca9c51 100644 --- a/src/sfizz/gen/filters/sfz2chHpf1p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHpf1p_H__ @@ -11,98 +15,71 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } @@ -112,40 +89,41 @@ class faust2chHpf1p : public sfzFilterDsp { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec2[l2] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHpf1p* clone() { - return new faust2chHpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 + (fRec1[0] * fRec0[1])); double fTemp2 = (fRec1[0] + 1.0); double fTemp3 = (0.0 - (0.5 * fTemp2)); @@ -156,8 +134,21 @@ class faust2chHpf1p : public sfzFilterDsp { fRec0[1] = fRec0[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHpf2p.hxx b/src/sfizz/gen/filters/sfz2chHpf2p.hxx index 0906a3b1..99967081 100644 --- a/src/sfizz/gen/filters/sfz2chHpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHpf2p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -51,71 +59,40 @@ class faust2chHpf2p : public sfzFilterDsp { double fVec5[2]; double fRec7[2]; double fRec6[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -158,38 +135,39 @@ class faust2chHpf2p : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec6[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHpf2p* clone() { - return new faust2chHpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -232,8 +210,24 @@ class faust2chHpf2p : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec6[1] = fRec6[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx index 4089b324..6ff0bb53 100644 --- a/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHpf2pSv_H__ @@ -11,104 +15,77 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec4[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec3[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; double fRec7[2]; double fRec8[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec4[l0] = 0.0; } @@ -130,38 +107,39 @@ class faust2chHpf2pSv : public sfzFilterDsp { for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec8[l6] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHpf2pSv* clone() { - return new faust2chHpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); @@ -194,8 +172,24 @@ class faust2chHpf2pSv : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec8[1] = fRec8[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHpf4p.hxx b/src/sfizz/gen/filters/sfz2chHpf4p.hxx index 87cf14ee..d6e829be 100644 --- a/src/sfizz/gen/filters/sfz2chHpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHpf4p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec5[2]; @@ -61,71 +69,40 @@ class faust2chHpf4p : public sfzFilterDsp { double fVec11[2]; double fRec9[2]; double fRec8[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -198,38 +175,39 @@ class faust2chHpf4p : public sfzFilterDsp { for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec8[l23] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHpf4p* clone() { - return new faust2chHpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -294,8 +272,24 @@ class faust2chHpf4p : public sfzFilterDsp { fRec9[1] = fRec9[0]; fRec8[1] = fRec8[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHpf6p.hxx b/src/sfizz/gen/filters/sfz2chHpf6p.hxx index dcdd4ffb..b2fdbd97 100644 --- a/src/sfizz/gen/filters/sfz2chHpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHpf6p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec7[2]; @@ -71,71 +79,40 @@ class faust2chHpf6p : public sfzFilterDsp { double fVec17[2]; double fRec11[2]; double fRec10[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -238,38 +215,39 @@ class faust2chHpf6p : public sfzFilterDsp { for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) { fRec10[l33] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHpf6p* clone() { - return new faust2chHpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -356,8 +334,24 @@ class faust2chHpf6p : public sfzFilterDsp { fRec11[1] = fRec11[0]; fRec10[1] = fRec10[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chHsh.hxx b/src/sfizz/gen/filters/sfz2chHsh.hxx index f58b9574..7f7240d1 100644 --- a/src/sfizz/gen/filters/sfz2chHsh.hxx +++ b/src/sfizz/gen/filters/sfz2chHsh.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chHsh_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chHsh #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chHsh : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -53,72 +61,41 @@ class faust2chHsh : public sfzFilterDsp { double fVec5[2]; double fRec8[2]; double fRec7[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -164,48 +141,49 @@ class faust2chHsh : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec7[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chHsh* clone() { - return new faust2chHsh(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ))))); - double fSlow6 = (fSlow3 * (fSlow1 + -1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); + double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider1))))); + double fSlow6 = ((fSlow1 + -1.0) * fSlow3); double fSlow7 = ((fSlow1 + fSlow5) + (1.0 - fSlow6)); double fSlow8 = (1.0 - fSlow0); double fSlow9 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow7) * fSlow8); - double fSlow10 = (fSlow1 + fSlow6); - double fSlow11 = (((fSlow1 * ((fSlow5 + fSlow10) + 1.0)) / fSlow7) * fSlow8); - double fSlow12 = (((fSlow1 * (fSlow10 + (1.0 - fSlow5))) / fSlow7) * fSlow8); - double fSlow13 = (((fSlow1 + (1.0 - (fSlow5 + fSlow6))) / fSlow7) * fSlow8); + double fSlow10 = (fSlow6 + fSlow5); + double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow10) + 1.0)) / fSlow7) * fSlow8); + double fSlow12 = (((fSlow1 * ((fSlow1 + fSlow6) + (1.0 - fSlow5))) / fSlow7) * fSlow8); + double fSlow13 = (((fSlow1 + (1.0 - fSlow10)) / fSlow7) * fSlow8); double fSlow14 = ((2.0 * ((fSlow1 + (-1.0 - fSlow4)) / fSlow7)) * fSlow8); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); @@ -243,8 +221,27 @@ class faust2chHsh : public sfzFilterDsp { fRec8[1] = fRec8[0]; fRec7[1] = fRec7[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider1; } + void setResonance(FAUSTFLOAT value) { fVslider1 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLpf1p.hxx b/src/sfizz/gen/filters/sfz2chLpf1p.hxx index a11d4fa6..83819344 100644 --- a/src/sfizz/gen/filters/sfz2chLpf1p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLpf1p_H__ @@ -11,98 +15,71 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } @@ -112,40 +89,41 @@ class faust2chLpf1p : public sfzFilterDsp { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec2[l2] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLpf1p* clone() { - return new faust2chLpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 + (fRec1[0] * fRec0[1])); double fTemp2 = (1.0 - fRec1[0]); output0[i] = FAUSTFLOAT((fRec0[0] * fTemp2)); @@ -155,8 +133,21 @@ class faust2chLpf1p : public sfzFilterDsp { fRec0[1] = fRec0[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLpf2p.hxx b/src/sfizz/gen/filters/sfz2chLpf2p.hxx index 9b6d4dc1..b120b92a 100644 --- a/src/sfizz/gen/filters/sfz2chLpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLpf2p_H__ @@ -11,31 +15,35 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; double fVec0[2]; @@ -51,71 +59,40 @@ class faust2chLpf2p : public sfzFilterDsp { double fVec5[2]; double fRec7[2]; double fRec6[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -158,37 +135,38 @@ class faust2chLpf2p : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec6[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLpf2p* clone() { - return new faust2chLpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -233,8 +211,24 @@ class faust2chLpf2p : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec6[1] = fRec6[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx index 2bc4fe1a..75c2243b 100644 --- a/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLpf2pSv_H__ @@ -11,104 +15,77 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec3[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; double fRec7[2]; double fRec8[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec3[l0] = 0.0; } @@ -130,38 +107,39 @@ class faust2chLpf2pSv : public sfzFilterDsp { for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec8[l6] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLpf2pSv* clone() { - return new faust2chLpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); @@ -194,8 +172,24 @@ class faust2chLpf2pSv : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec8[1] = fRec8[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLpf4p.hxx b/src/sfizz/gen/filters/sfz2chLpf4p.hxx index f0a22427..448704b2 100644 --- a/src/sfizz/gen/filters/sfz2chLpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLpf4p_H__ @@ -11,31 +15,35 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; double fVec0[2]; @@ -61,71 +69,40 @@ class faust2chLpf4p : public sfzFilterDsp { double fVec11[2]; double fRec9[2]; double fRec8[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -198,37 +175,38 @@ class faust2chLpf4p : public sfzFilterDsp { for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec8[l23] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLpf4p* clone() { - return new faust2chLpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -295,8 +273,24 @@ class faust2chLpf4p : public sfzFilterDsp { fRec9[1] = fRec9[0]; fRec8[1] = fRec8[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLpf6p.hxx b/src/sfizz/gen/filters/sfz2chLpf6p.hxx index c09feb80..0d3ce7f2 100644 --- a/src/sfizz/gen/filters/sfz2chLpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLpf6p_H__ @@ -11,37 +15,41 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; - double fVec0[2]; double fRec7[2]; - double fVec1[2]; + double fVec0[2]; double fRec8[2]; + double fVec1[2]; double fVec2[2]; double fRec9[2]; double fRec6[2]; @@ -71,85 +79,54 @@ class faust2chLpf6p : public sfzFilterDsp { double fVec17[2]; double fRec11[2]; double fRec10[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { - fVec0[l1] = 0.0; + fRec7[l1] = 0.0; } for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { - fRec7[l2] = 0.0; + fVec0[l2] = 0.0; } for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { - fVec1[l3] = 0.0; + fRec8[l3] = 0.0; } for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { - fRec8[l4] = 0.0; + fVec1[l4] = 0.0; } for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fVec2[l5] = 0.0; @@ -238,37 +215,38 @@ class faust2chLpf6p : public sfzFilterDsp { for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) { fRec10[l33] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLpf6p* clone() { - return new faust2chLpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -281,14 +259,14 @@ class faust2chLpf6p : public sfzFilterDsp { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); fRec2[0] = (fSlow7 + (fSlow5 * fRec2[1])); - fVec0[0] = (fTemp0 * fRec2[0]); fRec7[0] = ((fSlow5 * fRec7[1]) + fSlow8); double fTemp2 = (fTemp0 * fRec7[0]); - fVec1[0] = fTemp2; + fVec0[0] = fTemp2; fRec8[0] = ((fSlow5 * fRec8[1]) + fSlow9); - fVec2[0] = (fVec1[1] - (fRec8[0] * fRec5[1])); + fVec1[0] = (fVec0[1] - (fRec8[0] * fRec5[1])); + fVec2[0] = (fTemp0 * fRec2[0]); fRec9[0] = ((fSlow5 * fRec9[1]) + fSlow10); - fRec6[0] = ((fVec0[1] + (fTemp2 + fVec2[1])) - (fRec9[0] * fRec6[1])); + fRec6[0] = ((fVec1[1] + (fTemp2 + fVec2[1])) - (fRec9[0] * fRec6[1])); fRec5[0] = fRec6[0]; fVec3[0] = (fRec2[0] * fRec5[0]); double fTemp3 = (fRec7[0] * fRec5[0]); @@ -323,10 +301,10 @@ class faust2chLpf6p : public sfzFilterDsp { fRec10[0] = fRec11[0]; output1[i] = FAUSTFLOAT(fRec10[0]); fRec2[1] = fRec2[0]; - fVec0[1] = fVec0[0]; fRec7[1] = fRec7[0]; - fVec1[1] = fVec1[0]; + fVec0[1] = fVec0[0]; fRec8[1] = fRec8[0]; + fVec1[1] = fVec1[0]; fVec2[1] = fVec2[0]; fRec9[1] = fRec9[0]; fRec6[1] = fRec6[0]; @@ -357,8 +335,24 @@ class faust2chLpf6p : public sfzFilterDsp { fRec11[1] = fRec11[0]; fRec10[1] = fRec10[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chLsh.hxx b/src/sfizz/gen/filters/sfz2chLsh.hxx index ba8105de..41d5f8a3 100644 --- a/src/sfizz/gen/filters/sfz2chLsh.hxx +++ b/src/sfizz/gen/filters/sfz2chLsh.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chLsh_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chLsh #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chLsh : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -53,72 +61,41 @@ class faust2chLsh : public sfzFilterDsp { double fVec5[2]; double fRec8[2]; double fRec7[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -164,48 +141,49 @@ class faust2chLsh : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec7[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chLsh* clone() { - return new faust2chLsh(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ))))); - double fSlow6 = (fSlow3 * (fSlow1 + -1.0)); - double fSlow7 = (fSlow1 + fSlow6); - double fSlow8 = ((fSlow5 + fSlow7) + 1.0); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); + double fSlow5 = ((fSlow1 + -1.0) * fSlow3); + double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider1))))); + double fSlow7 = (fSlow5 + fSlow6); + double fSlow8 = ((fSlow1 + fSlow7) + 1.0); double fSlow9 = (1.0 - fSlow0); double fSlow10 = ((2.0 * ((fSlow1 * (fSlow1 + (-1.0 - fSlow4))) / fSlow8)) * fSlow9); - double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow5) + (1.0 - fSlow6))) / fSlow8) * fSlow9); - double fSlow12 = (((fSlow1 * (fSlow1 + (1.0 - (fSlow5 + fSlow6)))) / fSlow8) * fSlow9); - double fSlow13 = (((fSlow7 + (1.0 - fSlow5)) / fSlow8) * fSlow9); + double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow6) + (1.0 - fSlow5))) / fSlow8) * fSlow9); + double fSlow12 = (((fSlow1 * (fSlow1 + (1.0 - fSlow7))) / fSlow8) * fSlow9); + double fSlow13 = ((((fSlow1 + fSlow5) + (1.0 - fSlow6)) / fSlow8) * fSlow9); double fSlow14 = (((0.0 - (2.0 * ((fSlow1 + fSlow4) + -1.0))) / fSlow8) * fSlow9); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); @@ -243,8 +221,27 @@ class faust2chLsh : public sfzFilterDsp { fRec8[1] = fRec8[0]; fRec7[1] = fRec7[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider1; } + void setResonance(FAUSTFLOAT value) { fVslider1 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chPeq.hxx b/src/sfizz/gen/filters/sfz2chPeq.hxx index 482b2933..c23009d1 100644 --- a/src/sfizz/gen/filters/sfz2chPeq.hxx +++ b/src/sfizz/gen/filters/sfz2chPeq.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chPeq_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chPeq #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chPeq : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -52,72 +60,41 @@ class faust2chPeq : public sfzFilterDsp { double fVec5[2]; double fRec7[2]; double fRec6[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); - fPkShGain = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -160,44 +137,45 @@ class faust2chPeq : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec6[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chPeq* clone() { - return new faust2chPeq(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); - double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); + double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fVslider1))); double fSlow5 = (0.5 * (fSlow2 / (fSlow3 * fSlow4))); double fSlow6 = (fSlow5 + 1.0); double fSlow7 = (1.0 - fSlow0); double fSlow8 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow6) * fSlow7); - double fSlow9 = (0.5 * ((fSlow2 * fSlow4) / fSlow3)); + double fSlow9 = (0.5 * ((fSlow4 * fSlow2) / fSlow3)); double fSlow10 = (((fSlow9 + 1.0) / fSlow6) * fSlow7); double fSlow11 = (((1.0 - fSlow9) / fSlow6) * fSlow7); double fSlow12 = (((1.0 - fSlow5) / fSlow6) * fSlow7); @@ -235,8 +213,27 @@ class faust2chPeq : public sfzFilterDsp { fRec7[1] = fRec7[0]; fRec6[1] = fRec6[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider1; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfz2chPink.hxx b/src/sfizz/gen/filters/sfz2chPink.hxx index c04cbcec..f1aca819 100644 --- a/src/sfizz/gen/filters/sfz2chPink.hxx +++ b/src/sfizz/gen/filters/sfz2chPink.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faust2chPink_H__ @@ -11,120 +15,94 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faust2chPink #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faust2chPink : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + double fRec0[4]; double fRec1[4]; int fSampleRate; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 2; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 2; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - case 1: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 4); l0 = (l0 + 1)) { fRec0[l0] = 0.0; } for (int l1 = 0; (l1 < 4); l1 = (l1 + 1)) { fRec1[l1] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faust2chPink* clone() { - return new faust2chPink(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; - FAUSTFLOAT* input1 = inputs[1]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; + FAUSTFLOAT const* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; for (int i = 0; (i < count); i = (i + 1)) { @@ -141,8 +119,18 @@ class faust2chPink : public sfzFilterDsp { fRec1[j1] = fRec1[(j1 - 1)]; } } + //[End:compute] } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzApf1p.hxx b/src/sfizz/gen/filters/sfzApf1p.hxx index 950129a6..2e674295 100644 --- a/src/sfizz/gen/filters/sfzApf1p.hxx +++ b/src/sfizz/gen/filters/sfzApf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustApf1p_H__ @@ -11,133 +15,128 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustApf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustApf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (6.2831853071795862 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { fRec0[l1] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustApf1p* clone() { - return new faustApf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (((fConst1 * double(fCutoff)) + -1.0) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (((fConst2 * double(fHslider0)) + -1.0) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 - (fRec1[0] * fRec0[1])); output0[i] = FAUSTFLOAT((fRec0[1] + (fRec1[0] * fRec0[0]))); fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBpf1p.hxx b/src/sfizz/gen/filters/sfzBpf1p.hxx index 0273c976..e714e436 100644 --- a/src/sfizz/gen/filters/sfzBpf1p.hxx +++ b/src/sfizz/gen/filters/sfzBpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBpf1p_H__ @@ -11,90 +15,71 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec2[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -104,37 +89,38 @@ class faustBpf1p : public sfzFilterDsp { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec0[l2] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBpf1p* clone() { - return new faustBpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); - fRec2[0] = (fSlow1 + (fSlow0 * fRec2[1])); + fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow1); fRec1[0] = (fTemp0 + (fRec2[0] * fRec1[1])); fRec0[0] = ((fRec1[0] * (1.0 - fRec2[0])) + (fRec2[0] * fRec0[1])); double fTemp1 = (fRec2[0] + 1.0); @@ -143,8 +129,21 @@ class faustBpf1p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBpf2p.hxx b/src/sfizz/gen/filters/sfzBpf2p.hxx index 5068871c..fea43873 100644 --- a/src/sfizz/gen/filters/sfzBpf2p.hxx +++ b/src/sfizz/gen/filters/sfzBpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBpf2p_H__ @@ -11,34 +15,38 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fRec2[2]; double fVec0[2]; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec3[2]; double fRec4[2]; double fVec1[2]; @@ -47,63 +55,40 @@ class faustBpf2p : public sfzFilterDsp { double fRec6[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -134,36 +119,37 @@ class faustBpf2p : public sfzFilterDsp { for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec0[l9] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBpf2p* clone() { - return new faustBpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -196,8 +182,24 @@ class faustBpf2p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBpf2pSv.hxx b/src/sfizz/gen/filters/sfzBpf2pSv.hxx index 8a81bb74..19389f89 100644 --- a/src/sfizz/gen/filters/sfzBpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzBpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBpf2pSv_H__ @@ -11,94 +15,75 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec3[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec3[l0] = 0.0; } @@ -114,36 +99,37 @@ class faustBpf2pSv : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec2[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBpf2pSv* clone() { - return new faustBpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow2); @@ -164,8 +150,24 @@ class faustBpf2pSv : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBpf4p.hxx b/src/sfizz/gen/filters/sfzBpf4p.hxx index 33af5534..1342d920 100644 --- a/src/sfizz/gen/filters/sfzBpf4p.hxx +++ b/src/sfizz/gen/filters/sfzBpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBpf4p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fRec5[2]; double fVec0[2]; @@ -52,63 +60,40 @@ class faustBpf4p : public sfzFilterDsp { double fVec5[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -154,36 +139,37 @@ class faustBpf4p : public sfzFilterDsp { for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec0[l14] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBpf4p* clone() { - return new faustBpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -226,8 +212,24 @@ class faustBpf4p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBpf6p.hxx b/src/sfizz/gen/filters/sfzBpf6p.hxx index 0888d48b..f595a458 100644 --- a/src/sfizz/gen/filters/sfzBpf6p.hxx +++ b/src/sfizz/gen/filters/sfzBpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBpf6p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fRec7[2]; double fVec0[2]; @@ -57,63 +65,40 @@ class faustBpf6p : public sfzFilterDsp { double fVec8[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -174,36 +159,37 @@ class faustBpf6p : public sfzFilterDsp { for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) { fRec0[l19] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBpf6p* clone() { - return new faustBpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); @@ -256,8 +242,24 @@ class faustBpf6p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBrf1p.hxx b/src/sfizz/gen/filters/sfzBrf1p.hxx index 88eaa643..4630be05 100644 --- a/src/sfizz/gen/filters/sfzBrf1p.hxx +++ b/src/sfizz/gen/filters/sfzBrf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBrf1p_H__ @@ -11,90 +15,71 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBrf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBrf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec2[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (6.2831853071795862 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -104,37 +89,38 @@ class faustBrf1p : public sfzFilterDsp { for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec0[l2] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBrf1p* clone() { - return new faustBrf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (((fConst1 * double(fCutoff)) + -1.0) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (((fConst2 * double(fHslider0)) + -1.0) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); - fRec2[0] = (fSlow1 + (fSlow0 * fRec2[1])); + fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow1); fRec1[0] = (fTemp0 - (fRec2[0] * fRec1[1])); fRec0[0] = (fRec1[1] + (fRec2[0] * (fRec1[0] - fRec0[1]))); output0[i] = FAUSTFLOAT((fTemp0 + (fRec0[1] + (fRec2[0] * fRec0[0])))); @@ -142,8 +128,21 @@ class faustBrf1p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBrf2p.hxx b/src/sfizz/gen/filters/sfzBrf2p.hxx index 70838f48..8e0635d1 100644 --- a/src/sfizz/gen/filters/sfzBrf2p.hxx +++ b/src/sfizz/gen/filters/sfzBrf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBrf2p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBrf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBrf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -45,63 +53,40 @@ class faustBrf2p : public sfzFilterDsp { double fVec2[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -126,35 +111,36 @@ class faustBrf2p : public sfzFilterDsp { for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) { fRec0[l7] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBrf2p* clone() { - return new faustBrf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); - double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); + double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = (1.0 - fSlow0); double fSlow5 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow3) * fSlow4); @@ -181,8 +167,24 @@ class faustBrf2p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzBrf2pSv.hxx b/src/sfizz/gen/filters/sfzBrf2pSv.hxx index dc10acf0..70ccbdc6 100644 --- a/src/sfizz/gen/filters/sfzBrf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzBrf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustBrf2pSv_H__ @@ -11,94 +15,75 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustBrf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustBrf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec5[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec6[2]; double fRec2[2]; double fRec3[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec5[l0] = 0.0; } @@ -114,36 +99,37 @@ class faustBrf2pSv : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec3[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustBrf2pSv* clone() { - return new faustBrf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow2); @@ -165,8 +151,24 @@ class faustBrf2pSv : public sfzFilterDsp { fRec2[1] = fRec2[0]; fRec3[1] = fRec3[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzEqHshelf.hxx b/src/sfizz/gen/filters/sfzEqHshelf.hxx index 43d9ac0a..e09cd941 100644 --- a/src/sfizz/gen/filters/sfzEqHshelf.hxx +++ b/src/sfizz/gen/filters/sfzEqHshelf.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustEqHshelf_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include @@ -21,26 +25,30 @@ static double faustEqHshelf_faustpower2_f(double value) { return (value * value); } -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustEqHshelf #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustEqHshelf : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fBandwidth; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -51,64 +59,41 @@ class faustEqHshelf : public sfzFilterDsp { double fRec6[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -139,42 +124,43 @@ class faustEqHshelf : public sfzFilterDsp { for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec0[l9] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustEqHshelf* clone() { - return new faustEqHshelf(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = (faustEqHshelf_faustpower2_f(fSlow1) + 1.0); double fSlow6 = (fSlow1 + -1.0); double fSlow7 = faustEqHshelf_faustpower2_f(fSlow6); - double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow5 / fSlow7) + -0.01), std::max(0.01, ((double(fBandwidth) * fSlow5) / fSlow7)))) + -1.0)) + 2.0))))); - double fSlow9 = (fSlow3 * fSlow6); + double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow5 / fSlow7) + -0.01), std::max(0.01, ((double(fVslider1) * fSlow5) / fSlow7)))) + -1.0)) + 2.0))))); + double fSlow9 = (fSlow6 * fSlow3); double fSlow10 = ((fSlow1 + fSlow8) + (1.0 - fSlow9)); double fSlow11 = (1.0 - fSlow0); double fSlow12 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow10) * fSlow11); @@ -207,8 +193,27 @@ class faustEqHshelf : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzEqLshelf.hxx b/src/sfizz/gen/filters/sfzEqLshelf.hxx index 89b93bb9..ac938e6b 100644 --- a/src/sfizz/gen/filters/sfzEqLshelf.hxx +++ b/src/sfizz/gen/filters/sfzEqLshelf.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustEqLshelf_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include @@ -21,26 +25,30 @@ static double faustEqLshelf_faustpower2_f(double value) { return (value * value); } -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustEqLshelf #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustEqLshelf : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fBandwidth; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -51,64 +59,41 @@ class faustEqLshelf : public sfzFilterDsp { double fRec6[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -139,42 +124,43 @@ class faustEqLshelf : public sfzFilterDsp { for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec0[l9] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustEqLshelf* clone() { - return new faustEqLshelf(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = (fSlow1 + -1.0); - double fSlow6 = (fSlow3 * fSlow5); + double fSlow6 = (fSlow5 * fSlow3); double fSlow7 = (faustEqLshelf_faustpower2_f(fSlow1) + 1.0); double fSlow8 = faustEqLshelf_faustpower2_f(fSlow5); - double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow7 / fSlow8) + -0.01), std::max(0.01, ((double(fBandwidth) * fSlow7) / fSlow8)))) + -1.0)) + 2.0))))); + double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min(((fSlow7 / fSlow8) + -0.01), std::max(0.01, ((double(fVslider1) * fSlow7) / fSlow8)))) + -1.0)) + 2.0))))); double fSlow10 = (fSlow6 + fSlow9); double fSlow11 = ((fSlow1 + fSlow10) + 1.0); double fSlow12 = (1.0 - fSlow0); @@ -207,8 +193,27 @@ class faustEqLshelf : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzEqPeak.hxx b/src/sfizz/gen/filters/sfzEqPeak.hxx index fb16a2d4..2d6f26e5 100644 --- a/src/sfizz/gen/filters/sfzEqPeak.hxx +++ b/src/sfizz/gen/filters/sfzEqPeak.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustEqPeak_H__ @@ -11,7 +15,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif /* link with : "" */ #include @@ -19,27 +23,31 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustEqPeak #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustEqPeak : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst3; - FAUSTFLOAT fBandwidth; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -49,65 +57,42 @@ class faustEqPeak : public sfzFilterDsp { double fVec2[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); fConst3 = (2.1775860903036022 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fBandwidth = FAUSTFLOAT(1.0); - fPkShGain = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + fVslider1 = FAUSTFLOAT(1.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -135,43 +120,44 @@ class faustEqPeak : public sfzFilterDsp { for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec0[l8] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustEqPeak* clone() { - return new faustEqPeak(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::max(0.0, double(fCutoff)); + double fSlow1 = std::max(0.0, double(fHslider0)); double fSlow2 = (fConst2 * fSlow1); double fSlow3 = std::sin(fSlow2); - double fSlow4 = std::max(0.001, (0.5 / double(sinh(double((fConst3 * ((fSlow1 * double(fBandwidth)) / fSlow3))))))); - double fSlow5 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); + double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow5 = std::max(0.001, (0.5 / double(sinh(double((fConst3 * ((fSlow1 * double(fVslider1)) / fSlow3))))))); double fSlow6 = (0.5 * (fSlow3 / (fSlow4 * fSlow5))); double fSlow7 = (fSlow6 + 1.0); double fSlow8 = (1.0 - fSlow0); double fSlow9 = (((0.0 - (2.0 * std::cos(fSlow2))) / fSlow7) * fSlow8); - double fSlow10 = (0.5 * ((fSlow3 * fSlow5) / fSlow4)); + double fSlow10 = (0.5 * ((fSlow4 * fSlow3) / fSlow5)); double fSlow11 = (((fSlow10 + 1.0) / fSlow7) * fSlow8); double fSlow12 = (((1.0 - fSlow10) / fSlow7) * fSlow8); double fSlow13 = (((1.0 - fSlow6) / fSlow7) * fSlow8); @@ -197,8 +183,27 @@ class faustEqPeak : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getBandwidth() const { return fVslider1; } + void setBandwidth(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHpf1p.hxx b/src/sfizz/gen/filters/sfzHpf1p.hxx index 4e0cf748..dce88d8d 100644 --- a/src/sfizz/gen/filters/sfzHpf1p.hxx +++ b/src/sfizz/gen/filters/sfzHpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHpf1p_H__ @@ -11,134 +15,129 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { fRec0[l1] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHpf1p* clone() { - return new faustHpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 + (fRec1[0] * fRec0[1])); double fTemp1 = (fRec1[0] + 1.0); output0[i] = FAUSTFLOAT(((0.5 * (fRec0[0] * fTemp1)) + (fRec0[1] * (0.0 - (0.5 * fTemp1))))); fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHpf2p.hxx b/src/sfizz/gen/filters/sfzHpf2p.hxx index bfca60e8..3b065b2e 100644 --- a/src/sfizz/gen/filters/sfzHpf2p.hxx +++ b/src/sfizz/gen/filters/sfzHpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHpf2p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -46,63 +54,40 @@ class faustHpf2p : public sfzFilterDsp { double fRec5[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -130,36 +115,37 @@ class faustHpf2p : public sfzFilterDsp { for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec0[l8] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHpf2p* clone() { - return new faustHpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -189,8 +175,24 @@ class faustHpf2p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHpf2pSv.hxx b/src/sfizz/gen/filters/sfzHpf2pSv.hxx index 12fa8259..65e1008f 100644 --- a/src/sfizz/gen/filters/sfzHpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzHpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHpf2pSv_H__ @@ -11,94 +15,75 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec4[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec3[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec4[l0] = 0.0; } @@ -114,36 +99,37 @@ class faustHpf2pSv : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec2[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHpf2pSv* clone() { - return new faustHpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow2); @@ -164,8 +150,24 @@ class faustHpf2pSv : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHpf4p.hxx b/src/sfizz/gen/filters/sfzHpf4p.hxx index 6ae2cf55..0a4e8660 100644 --- a/src/sfizz/gen/filters/sfzHpf4p.hxx +++ b/src/sfizz/gen/filters/sfzHpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHpf4p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec5[2]; @@ -51,63 +59,40 @@ class faustHpf4p : public sfzFilterDsp { double fVec5[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -150,36 +135,37 @@ class faustHpf4p : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec0[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHpf4p* clone() { - return new faustHpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -220,8 +206,24 @@ class faustHpf4p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHpf6p.hxx b/src/sfizz/gen/filters/sfzHpf6p.hxx index 32a72cd6..8c66173e 100644 --- a/src/sfizz/gen/filters/sfzHpf6p.hxx +++ b/src/sfizz/gen/filters/sfzHpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHpf6p_H__ @@ -11,32 +15,36 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fRec2[2]; double fVec0[2]; double fRec7[2]; @@ -56,63 +64,40 @@ class faustHpf6p : public sfzFilterDsp { double fVec8[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -170,36 +155,37 @@ class faustHpf6p : public sfzFilterDsp { for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec0[l18] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHpf6p* clone() { - return new faustHpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); @@ -251,8 +237,24 @@ class faustHpf6p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzHsh.hxx b/src/sfizz/gen/filters/sfzHsh.hxx index 6934d8f5..5570875b 100644 --- a/src/sfizz/gen/filters/sfzHsh.hxx +++ b/src/sfizz/gen/filters/sfzHsh.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustHsh_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustHsh #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustHsh : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -48,64 +56,41 @@ class faustHsh : public sfzFilterDsp { double fRec6[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -136,46 +121,47 @@ class faustHsh : public sfzFilterDsp { for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec0[l9] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustHsh* clone() { - return new faustHsh(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ))))); - double fSlow6 = (fSlow3 * (fSlow1 + -1.0)); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); + double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider1))))); + double fSlow6 = ((fSlow1 + -1.0) * fSlow3); double fSlow7 = ((fSlow1 + fSlow5) + (1.0 - fSlow6)); double fSlow8 = (1.0 - fSlow0); double fSlow9 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow7) * fSlow8); - double fSlow10 = (fSlow1 + fSlow6); - double fSlow11 = (((fSlow1 * ((fSlow5 + fSlow10) + 1.0)) / fSlow7) * fSlow8); - double fSlow12 = (((fSlow1 * (fSlow10 + (1.0 - fSlow5))) / fSlow7) * fSlow8); - double fSlow13 = (((fSlow1 + (1.0 - (fSlow5 + fSlow6))) / fSlow7) * fSlow8); + double fSlow10 = (fSlow6 + fSlow5); + double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow10) + 1.0)) / fSlow7) * fSlow8); + double fSlow12 = (((fSlow1 * ((fSlow1 + fSlow6) + (1.0 - fSlow5))) / fSlow7) * fSlow8); + double fSlow13 = (((fSlow1 + (1.0 - fSlow10)) / fSlow7) * fSlow8); double fSlow14 = ((2.0 * ((fSlow1 + (-1.0 - fSlow4)) / fSlow7)) * fSlow8); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); @@ -201,8 +187,27 @@ class faustHsh : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider1; } + void setResonance(FAUSTFLOAT value) { fVslider1 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLpf1p.hxx b/src/sfizz/gen/filters/sfzLpf1p.hxx index fb9093cc..bbec0a8a 100644 --- a/src/sfizz/gen/filters/sfzLpf1p.hxx +++ b/src/sfizz/gen/filters/sfzLpf1p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLpf1p_H__ @@ -11,133 +15,128 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLpf1p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLpf1p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; double fConst2; + FAUSTFLOAT fHslider0; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); - fConst1 = (1.0 / fConst0); - fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + fConst0 = double(fSampleRate); + fConst1 = std::exp((0.0 - (1000.0 / fConst0))); + fConst2 = (1.0 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec1[l0] = 0.0; } for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { fRec0[l1] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLpf1p* clone() { - return new faustLpf1p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fSmoothEnable ? fConst2 : 0.0); - double fSlow1 = (std::exp((fConst1 * (0.0 - (6.2831853071795862 * double(fCutoff))))) * (1.0 - fSlow0)); + double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); + double fSlow1 = (std::exp((fConst2 * (0.0 - (6.2831853071795862 * double(fHslider0))))) * (1.0 - fSlow0)); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); - fRec1[0] = (fSlow1 + (fSlow0 * fRec1[1])); + fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow1); fRec0[0] = (fTemp0 + (fRec1[0] * fRec0[1])); output0[i] = FAUSTFLOAT((fRec0[0] * (1.0 - fRec1[0]))); fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLpf2p.hxx b/src/sfizz/gen/filters/sfzLpf2p.hxx index 7f2044a2..105fd66f 100644 --- a/src/sfizz/gen/filters/sfzLpf2p.hxx +++ b/src/sfizz/gen/filters/sfzLpf2p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLpf2p_H__ @@ -11,31 +15,35 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLpf2p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLpf2p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; double fVec0[2]; @@ -46,63 +54,40 @@ class faustLpf2p : public sfzFilterDsp { double fRec5[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -130,35 +115,36 @@ class faustLpf2p : public sfzFilterDsp { for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec0[l8] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLpf2p* clone() { - return new faustLpf2p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -190,8 +176,24 @@ class faustLpf2p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLpf2pSv.hxx b/src/sfizz/gen/filters/sfzLpf2pSv.hxx index d70bcafc..a1af4a96 100644 --- a/src/sfizz/gen/filters/sfzLpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzLpf2pSv.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLpf2pSv_H__ @@ -11,94 +15,75 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLpf2pSv #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLpf2pSv : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; + FAUSTFLOAT fHslider0; double fRec3[2]; - FAUSTFLOAT fQ; + FAUSTFLOAT fVslider0; double fRec4[2]; double fRec5[2]; double fRec1[2]; double fRec2[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (3.1415926535897931 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec3[l0] = 0.0; } @@ -114,36 +99,37 @@ class faustLpf2pSv : public sfzFilterDsp { for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec2[l4] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLpf2pSv* clone() { - return new faustLpf2pSv(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); - double fSlow2 = (std::tan((fConst2 * double(fCutoff))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fQ)))); + double fSlow2 = (std::tan((fConst2 * double(fHslider0))) * fSlow1); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow2); @@ -164,8 +150,24 @@ class faustLpf2pSv : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec2[1] = fRec2[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLpf4p.hxx b/src/sfizz/gen/filters/sfzLpf4p.hxx index 087bac79..f7fe60f9 100644 --- a/src/sfizz/gen/filters/sfzLpf4p.hxx +++ b/src/sfizz/gen/filters/sfzLpf4p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLpf4p_H__ @@ -11,31 +15,35 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLpf4p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLpf4p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; double fVec0[2]; @@ -51,63 +59,40 @@ class faustLpf4p : public sfzFilterDsp { double fVec5[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -150,35 +135,36 @@ class faustLpf4p : public sfzFilterDsp { for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec0[l13] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLpf4p* clone() { - return new faustLpf4p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -221,8 +207,24 @@ class faustLpf4p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLpf6p.hxx b/src/sfizz/gen/filters/sfzLpf6p.hxx index a0c1dd24..263f1683 100644 --- a/src/sfizz/gen/filters/sfzLpf6p.hxx +++ b/src/sfizz/gen/filters/sfzLpf6p.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLpf6p_H__ @@ -11,31 +15,35 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLpf6p #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLpf6p : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; double fConst2; double fRec2[2]; double fVec0[2]; @@ -56,63 +64,40 @@ class faustLpf6p : public sfzFilterDsp { double fVec8[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = (6.2831853071795862 / fConst0); fConst2 = std::exp((0.0 - (1000.0 / fConst0))); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -170,35 +155,36 @@ class faustLpf6p : public sfzFilterDsp { for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec0[l18] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLpf6p* clone() { - return new faustLpf6p(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; - double fSlow0 = (fConst1 * std::max(0.0, double(fCutoff))); + double fSlow0 = (fConst1 * std::max(0.0, double(fHslider0))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); @@ -252,8 +238,24 @@ class faustLpf6p : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzLsh.hxx b/src/sfizz/gen/filters/sfzLsh.hxx index 8ff05ae5..55d27bbc 100644 --- a/src/sfizz/gen/filters/sfzLsh.hxx +++ b/src/sfizz/gen/filters/sfzLsh.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustLsh_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustLsh #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustLsh : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fVslider0; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -48,64 +56,41 @@ class faustLsh : public sfzFilterDsp { double fRec6[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fPkShGain = FAUSTFLOAT(0.0); - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fVslider0 = FAUSTFLOAT(0.0); + fHslider0 = FAUSTFLOAT(440.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -136,46 +121,47 @@ class faustLsh : public sfzFilterDsp { for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec0[l9] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustLsh* clone() { - return new faustLsh(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); - double fSlow2 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fVslider0))); + double fSlow2 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow3 = std::cos(fSlow2); - double fSlow4 = (fSlow3 * (fSlow1 + 1.0)); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ))))); - double fSlow6 = (fSlow3 * (fSlow1 + -1.0)); - double fSlow7 = (fSlow1 + fSlow6); - double fSlow8 = ((fSlow5 + fSlow7) + 1.0); + double fSlow4 = ((fSlow1 + 1.0) * fSlow3); + double fSlow5 = ((fSlow1 + -1.0) * fSlow3); + double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider1))))); + double fSlow7 = (fSlow5 + fSlow6); + double fSlow8 = ((fSlow1 + fSlow7) + 1.0); double fSlow9 = (1.0 - fSlow0); double fSlow10 = ((2.0 * ((fSlow1 * (fSlow1 + (-1.0 - fSlow4))) / fSlow8)) * fSlow9); - double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow5) + (1.0 - fSlow6))) / fSlow8) * fSlow9); - double fSlow12 = (((fSlow1 * (fSlow1 + (1.0 - (fSlow5 + fSlow6)))) / fSlow8) * fSlow9); - double fSlow13 = (((fSlow7 + (1.0 - fSlow5)) / fSlow8) * fSlow9); + double fSlow11 = (((fSlow1 * ((fSlow1 + fSlow6) + (1.0 - fSlow5))) / fSlow8) * fSlow9); + double fSlow12 = (((fSlow1 * (fSlow1 + (1.0 - fSlow7))) / fSlow8) * fSlow9); + double fSlow13 = ((((fSlow1 + fSlow5) + (1.0 - fSlow6)) / fSlow8) * fSlow9); double fSlow14 = (((0.0 - (2.0 * ((fSlow1 + fSlow4) + -1.0))) / fSlow8) * fSlow9); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); @@ -201,8 +187,27 @@ class faustLsh : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider1; } + void setResonance(FAUSTFLOAT value) { fVslider1 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider0; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider0 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzPeq.hxx b/src/sfizz/gen/filters/sfzPeq.hxx index 0603c45f..a0e6eee5 100644 --- a/src/sfizz/gen/filters/sfzPeq.hxx +++ b/src/sfizz/gen/filters/sfzPeq.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustPeq_H__ @@ -11,33 +15,37 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustPeq #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustPeq : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + int fSampleRate; double fConst0; double fConst1; double fConst2; - FAUSTFLOAT fCutoff; - FAUSTFLOAT fQ; - FAUSTFLOAT fPkShGain; + FAUSTFLOAT fHslider0; + FAUSTFLOAT fVslider0; + FAUSTFLOAT fVslider1; double fRec2[2]; double fVec0[2]; double fRec3[2]; @@ -47,64 +55,41 @@ class faustPeq : public sfzFilterDsp { double fVec2[2]; double fRec1[2]; double fRec0[2]; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; - fConst0 = std::min(192000.0, std::max(1.0, double(fSampleRate))); + fConst0 = double(fSampleRate); fConst1 = std::exp((0.0 - (1000.0 / fConst0))); fConst2 = (6.2831853071795862 / fConst0); + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { - fCutoff = FAUSTFLOAT(440.0); - fQ = FAUSTFLOAT(0.0); - fPkShGain = FAUSTFLOAT(0.0); + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + fHslider0 = FAUSTFLOAT(440.0); + fVslider0 = FAUSTFLOAT(0.0); + fVslider1 = FAUSTFLOAT(0.0); + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec2[l0] = 0.0; } @@ -132,42 +117,43 @@ class faustPeq : public sfzFilterDsp { for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec0[l8] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustPeq* clone() { - return new faustPeq(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); - double fSlow1 = (fConst2 * std::max(0.0, double(fCutoff))); + double fSlow1 = (fConst2 * std::max(0.0, double(fHslider0))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fQ)))); - double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * double(fVslider0)))); + double fSlow4 = std::pow(10.0, (0.025000000000000001 * double(fVslider1))); double fSlow5 = (0.5 * (fSlow2 / (fSlow3 * fSlow4))); double fSlow6 = (fSlow5 + 1.0); double fSlow7 = (1.0 - fSlow0); double fSlow8 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow6) * fSlow7); - double fSlow9 = (0.5 * ((fSlow2 * fSlow4) / fSlow3)); + double fSlow9 = (0.5 * ((fSlow4 * fSlow2) / fSlow3)); double fSlow10 = (((fSlow9 + 1.0) / fSlow6) * fSlow7); double fSlow11 = (((1.0 - fSlow9) / fSlow6) * fSlow7); double fSlow12 = (((1.0 - fSlow5) / fSlow6) * fSlow7); @@ -193,8 +179,27 @@ class faustPeq : public sfzFilterDsp { fRec1[1] = fRec1[0]; fRec0[1] = fRec0[0]; } + //[End:compute] } + + FAUSTFLOAT getCutoff() const { return fHslider0; } + void setCutoff(FAUSTFLOAT value) { fHslider0 = value; } + + FAUSTFLOAT getResonance() const { return fVslider0; } + void setResonance(FAUSTFLOAT value) { fVslider0 = value; } + + FAUSTFLOAT getPeakShelfGain() const { return fVslider1; } + void setPeakShelfGain(FAUSTFLOAT value) { fVslider1 = value; } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS diff --git a/src/sfizz/gen/filters/sfzPink.hxx b/src/sfizz/gen/filters/sfzPink.hxx index 31b1f1c5..58205df2 100644 --- a/src/sfizz/gen/filters/sfzPink.hxx +++ b/src/sfizz/gen/filters/sfzPink.hxx @@ -1,9 +1,13 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif /* ------------------------------------------------------------ author: "Jean Pierre Cimalando" license: "BSD-2-Clause" name: "sfz_filters" -Code generated with Faust 2.20.2 (https://faust.grame.fr) -Compilation options: -lang cpp -inpl -double -ftz 0 +Code generated with Faust 2.30.5 (https://faust.grame.fr) +Compilation options: -lang cpp -inpl -es 1 -double -ftz 0 ------------------------------------------------------------ */ #ifndef __faustPink_H__ @@ -11,107 +15,89 @@ Compilation options: -lang cpp -inpl -double -ftz 0 #ifndef FAUSTFLOAT #define FAUSTFLOAT float -#endif +#endif #include #include -#ifndef FAUSTCLASS +#ifndef FAUSTCLASS #define FAUSTCLASS faustPink #endif -#ifdef __APPLE__ +#ifdef __APPLE__ #define exp10f __exp10f #define exp10 __exp10 #endif + +//[Before:class] class faustPink : public sfzFilterDsp { + //[Begin:class] - public: - + + private: + double fRec0[4]; int fSampleRate; - + public: + - void metadata(Meta* m) { - } - - virtual int getNumInputs() { + static constexpr int getNumInputs() { return 1; } - virtual int getNumOutputs() { + static constexpr int getNumOutputs() { return 1; } - virtual int getInputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - virtual int getOutputRate(int channel) { - int rate; - switch ((channel)) { - case 0: { - rate = 1; - break; - } - default: { - rate = -1; - break; - } - } - return rate; - } - + static void classInit(int sample_rate) { + //[Begin:classInit] + //[End:classInit] } - - virtual void instanceConstants(int sample_rate) { + + void instanceConstants(int sample_rate) { + //[Begin:instanceConstants] fSampleRate = sample_rate; + //[End:instanceConstants] } - - virtual void instanceResetUserInterface() { + + void instanceResetUserInterface() { + //[Begin:instanceResetUserInterface] + //[End:instanceResetUserInterface] } - - virtual void instanceClear() { + + void instanceClear() { + //[Begin:instanceClear] for (int l0 = 0; (l0 < 4); l0 = (l0 + 1)) { fRec0[l0] = 0.0; } + //[End:instanceClear] } - - virtual void init(int sample_rate) { + + void init(int sample_rate) { + //[Begin:init] classInit(sample_rate); instanceInit(sample_rate); + //[End:init] } - virtual void instanceInit(int sample_rate) { + void instanceInit(int sample_rate) { + //[Begin:instanceInit] instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); + //[End:instanceInit] } - - virtual faustPink* clone() { - return new faustPink(); - } - - virtual int getSampleRate() { + + + int getSampleRate() { return fSampleRate; } - - virtual void buildUserInterface(UI* ui_interface) { - } - - virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { - FAUSTFLOAT* input0 = inputs[0]; + + + void compute(int count, FAUSTFLOAT const* const* inputs, FAUSTFLOAT* const* outputs) { + //[Begin:compute] + FAUSTFLOAT const* input0 = inputs[0]; FAUSTFLOAT* output0 = outputs[0]; for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); @@ -121,8 +107,18 @@ class faustPink : public sfzFilterDsp { fRec0[j0] = fRec0[(j0 - 1)]; } } + //[End:compute] } + + //[End:class] }; +//[After:class] + #endif +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#undef FAUSTFLOAT +#undef FAUSTCLASS From dc16470dda8d0738a6f57678e7f579fa3a3ee5c3 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 01:24:10 +0100 Subject: [PATCH 07/10] Fix fverb parameters corrupted in opcode spec work --- src/sfizz/Defaults.cpp | 1 + src/sfizz/Defaults.h | 1 + src/sfizz/effects/Fverb.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sfizz/Defaults.cpp b/src/sfizz/Defaults.cpp index 7a53d54d..792983ff 100644 --- a/src/sfizz/Defaults.cpp +++ b/src/sfizz/Defaults.cpp @@ -131,6 +131,7 @@ extern const OpcodeSpec sampleQuality { 1, Range(1, 10), 0 }; extern const OpcodeSpec octaveOffset { 0, Range(-10, 10), 0 }; extern const OpcodeSpec noteOffset { 0, Range(-127, 127), 0 }; extern const OpcodeSpec effect { 0.0f, Range(0.0f, 100.0f), kNormalizePercent }; +extern const OpcodeSpec effectPercent { 0.0f, Range(0.0f, 100.0f), 0 }; extern const OpcodeSpec apanWaveform { 0, Range(0, std::numeric_limits::max()), 0 }; extern const OpcodeSpec apanFrequency { 0.0f, Range(0.0f, std::numeric_limits::max()), 0 }; extern const OpcodeSpec apanPhase { 0.5f, Range(0.0f, 1.0f), kWrapPhase }; diff --git a/src/sfizz/Defaults.h b/src/sfizz/Defaults.h index 289b8d7d..f778e09e 100644 --- a/src/sfizz/Defaults.h +++ b/src/sfizz/Defaults.h @@ -250,6 +250,7 @@ namespace Default extern const OpcodeSpec octaveOffset; extern const OpcodeSpec noteOffset; extern const OpcodeSpec effect; + extern const OpcodeSpec effectPercent; extern const OpcodeSpec apanWaveform; extern const OpcodeSpec apanFrequency; extern const OpcodeSpec apanPhase; diff --git a/src/sfizz/effects/Fverb.cpp b/src/sfizz/effects/Fverb.cpp index 804e12a3..5d0bb14f 100644 --- a/src/sfizz/effects/Fverb.cpp +++ b/src/sfizz/effects/Fverb.cpp @@ -173,9 +173,9 @@ namespace fx { std::unique_ptr fx { reverb }; const Impl::Profile* profile = &Impl::largeHall; - float dry { Default::effect }; - float wet { Default::effect }; - float input { Default::effect }; + float dry { Default::effectPercent }; + float wet { Default::effectPercent }; + float input { Default::effectPercent }; float size { Default::fverbSize }; float predelay { Default::fverbPredelay }; float tone { Default::fverbTone }; @@ -205,13 +205,13 @@ namespace fx { break; case hash("reverb_dry"): - dry = opc.read(Default::effect); + dry = opc.read(Default::effectPercent); break; case hash("reverb_wet"): - wet = opc.read(Default::effect); + wet = opc.read(Default::effectPercent); break; case hash("reverb_input"): - input = opc.read(Default::effect); + input = opc.read(Default::effectPercent); break; case hash("reverb_size"): size = opc.read(Default::fverbSize); From 81f54f98f2555078b12deee46f6bd5eae3fa8bb5 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 01:26:12 +0100 Subject: [PATCH 08/10] Fix strings parameters corrupted in opcode spec work --- src/sfizz/effects/Strings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sfizz/effects/Strings.cpp b/src/sfizz/effects/Strings.cpp index 2ef50f7c..070496ec 100644 --- a/src/sfizz/effects/Strings.cpp +++ b/src/sfizz/effects/Strings.cpp @@ -116,7 +116,7 @@ namespace fx { auto outputR = absl::MakeSpan(outputs[1], nframes); absl::Span wet = _tempBuffer.getSpan(2).first(nframes); - sfz::fill(wet, 0.01f *_wet); // TOD strings_wet_oncc modulation... + sfz::fill(wet, _wet); // TOD strings_wet_oncc modulation... sfz::copy(inputL, outputL); sfz::copy(inputR, outputR); From 988d7926b533b8c839e14aecf8f2c4ff54d7cbd1 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 01:48:18 +0100 Subject: [PATCH 09/10] Clear the disto after Fs change --- src/sfizz/effects/Disto.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sfizz/effects/Disto.cpp b/src/sfizz/effects/Disto.cpp index 05ba158c..13eeaa52 100644 --- a/src/sfizz/effects/Disto.cpp +++ b/src/sfizz/effects/Disto.cpp @@ -83,6 +83,8 @@ void Disto::setSampleRate(double sampleRate) stage.instanceConstants(_oversampling * sampleRate); } } + + clear(); } void Disto::setSamplesPerBlock(int samplesPerBlock) From c6c53a41e57a495e126bb3de999f5ec006c6e121 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 25 Feb 2021 02:06:56 +0100 Subject: [PATCH 10/10] Adjust disto DC cutoff to account for oversampling --- src/sfizz/effects/dsp/disto_stage.dsp | 2 +- src/sfizz/effects/gen/disto_stage.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sfizz/effects/dsp/disto_stage.dsp b/src/sfizz/effects/dsp/disto_stage.dsp index f2494745..ec4a8383 100644 --- a/src/sfizz/effects/dsp/disto_stage.dsp +++ b/src/sfizz/effects/dsp/disto_stage.dsp @@ -1,6 +1,6 @@ import("stdfaust.lib"); -disto_stage(depth, x) = shs*hh(x)+(1.0-shs)*lh(x) : fi.dcblockerat(5.0) with { +disto_stage(depth, x) = shs*hh(x)+(1.0-shs)*lh(x) : fi.dcblockerat(40.0) with { // sigmoid parameters a = depth*0.2+2.0; b = 2.0; diff --git a/src/sfizz/effects/gen/disto_stage.hxx b/src/sfizz/effects/gen/disto_stage.hxx index 1c16e2fb..ee112e87 100644 --- a/src/sfizz/effects/gen/disto_stage.hxx +++ b/src/sfizz/effects/gen/disto_stage.hxx @@ -134,7 +134,7 @@ class faustDisto { //[Begin:instanceConstants] fSampleRate = sample_rate; fConst0 = float(fSampleRate); - fConst1 = (15.707963f / fConst0); + fConst1 = (125.663704f / fConst0); fConst2 = (1.0f / (fConst1 + 1.0f)); fConst3 = (1.0f - fConst1); fConst4 = std::exp((0.0f - (100.0f / fConst0)));