Start update/refactor
This commit is contained in:
parent
b79063c97b
commit
db9d7e93e2
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "dsp"]
|
||||
path = dsp
|
||||
url = https://signalsmith-audio.co.uk/code/dsp.git
|
||||
[submodule "modules/dsp"]
|
||||
path = modules/dsp
|
||||
url = https://github.com/Signalsmith-Audio/dsp.git
|
||||
[submodule "modules/hilbert-iir"]
|
||||
path = modules/hilbert-iir
|
||||
url = https://github.com/Signalsmith-Audio/hilbert-iir.git
|
||||
|
||||
1
dsp
1
dsp
@ -1 +0,0 @@
|
||||
Subproject commit 618097bed9e7fb1b87a99592f78c9a8a964eda08
|
||||
1
modules/dsp
Submodule
1
modules/dsp
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 89d19acd59e9decfe2c86d2af2bd8586c33ff3d1
|
||||
1
modules/hilbert-iir
Submodule
1
modules/hilbert-iir
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 55384665f1c8e88d15be9719f9dfc67b43a49a4c
|
||||
@ -57,11 +57,11 @@ namespace stfx {
|
||||
template<class RangeParam>
|
||||
RangeParam & rangeHz(RangeParam ¶m) {
|
||||
return param
|
||||
.unit("Hz", 0, 10, 1000)
|
||||
.unit("Hz", 1, 1, 10)
|
||||
.unit("Hz", 2, 0, 1)
|
||||
.unit("kHz", 1, kHzToHz, hzToKHz, 10000, 1e100)
|
||||
.unit("kHz", 2, kHzToHz, hzToKHz, 1000, 10000);
|
||||
.unit("Hz", 2, -1, 1)
|
||||
.unit("Hz", 1, -10, 10)
|
||||
.unit("Hz", 0, -1000, 1000)
|
||||
.unit("kHz", 2, kHzToHz, hzToKHz, -1e4, 1e4)
|
||||
.unit("kHz", 1, kHzToHz, hzToKHz);
|
||||
}
|
||||
template<class RangeParam>
|
||||
RangeParam & rangePercent(RangeParam ¶m) {
|
||||
@ -72,22 +72,22 @@ namespace stfx {
|
||||
template<class RangeParam>
|
||||
RangeParam & rangeMs(RangeParam ¶m) {
|
||||
return param
|
||||
.unit("ms", 2, 0, 1)
|
||||
.unit("ms", 1, 1, 10)
|
||||
.unit("ms", 0, 10, 1000)
|
||||
.unit("seconds", 2, sToMs, msToS, 0, 1)
|
||||
.unit("seconds", 1, sToMs, msToS, 1, 10)
|
||||
.unit("seconds", 0, sToMs, msToS, 10, 1e100);
|
||||
.unit("ms", 2, -1, 1)
|
||||
.unit("ms", 1, -10, 10)
|
||||
.unit("ms", 0, -1000, 1000)
|
||||
.unit("seconds", 2, sToMs, msToS, -1e3, 1e3)
|
||||
.unit("seconds", 1, sToMs, msToS, -1e4, 1e4)
|
||||
.unit("seconds", 0, sToMs, msToS);
|
||||
}
|
||||
template<class RangeParam>
|
||||
RangeParam & rangeSec(RangeParam ¶m) {
|
||||
return param
|
||||
.unit("seconds", 2, 0, 1)
|
||||
.unit("seconds", 1, 1, 10)
|
||||
.unit("seconds", 0, 10, 1e100)
|
||||
.unit("ms", 2, msToS, sToMs, 0, 0.001)
|
||||
.unit("ms", 1, msToS, sToMs, 0.001, 0.01)
|
||||
.unit("ms", 0, msToS, sToMs, 0.01, 1);
|
||||
.unit("ms", 2, msToS, sToMs, -1e-3, 1e-3)
|
||||
.unit("ms", 1, msToS, sToMs, -1e-2, 1e-2)
|
||||
.unit("ms", 0, msToS, sToMs, -1e-1, 1e-1)
|
||||
.unit("seconds", 2, -1, 1)
|
||||
.unit("seconds", 1, -10, 10)
|
||||
.unit("seconds", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,6 +231,10 @@ namespace stfx {
|
||||
void forEach(Callback callback) const {
|
||||
callback(0, length);
|
||||
}
|
||||
|
||||
constexpr bool wantsMeters() const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Parameters can be assigned using `=`, and store their own history for transitions
|
||||
@ -240,6 +244,7 @@ namespace stfx {
|
||||
// Used for the 20ms parameter fade
|
||||
Value _from, _to;
|
||||
public:
|
||||
LibraryParam(const Value &initial, const Value &) : LibraryParam(initial) {}
|
||||
LibraryParam(const Value &initial) : current(initial), prevBlock(initial), _from(initial), _to(initial) {}
|
||||
operator Value () const {
|
||||
return current;
|
||||
@ -313,10 +318,9 @@ namespace stfx {
|
||||
/// Base class for our effect to inherit from. Provides parameter classes and some default config.
|
||||
template<typename SampleType>
|
||||
class LibraryEffectBase {
|
||||
protected:
|
||||
public:
|
||||
using ParamRange = LibraryParam<double>;
|
||||
using ParamStepped = LibraryParam<int>;
|
||||
public:
|
||||
using Sample = SampleType;
|
||||
|
||||
ParamRange bpm{120};
|
||||
@ -363,6 +367,7 @@ namespace stfx {
|
||||
static int version(int v) {return v;}
|
||||
// Ignore the UI/synchronisation stuff
|
||||
static bool extra() {return false;}
|
||||
static bool extra(const char *, const char *) {return false;}
|
||||
static void invalidate(const char *) {}
|
||||
|
||||
// We ignore any basic type
|
||||
36
units.h
36
units.h
@ -1,36 +0,0 @@
|
||||
/* Copyright 2022 Signalsmith Audio Ltd. / Geraint Luff
|
||||
Released under the Boost Software License (see LICENSE.txt) */
|
||||
#ifndef SIGNALSMITH_UNITS_H
|
||||
#define SIGNALSMITH_UNITS_H
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace signalsmith { namespace units {
|
||||
|
||||
static double dbToGain(double db) {
|
||||
return std::pow(10, db*0.05);
|
||||
}
|
||||
static double gainToDb(double gain) {
|
||||
return std::log10(std::max<double>(gain, 1e-10))*20;
|
||||
}
|
||||
static double dbToEnergy(double db) {
|
||||
return std::pow(10, db*0.1);
|
||||
}
|
||||
static double energyToDb(double gain) {
|
||||
return std::log10(std::max<double>(gain, 1e-10))*10;
|
||||
}
|
||||
static double pcToRatio(double percent) {
|
||||
return percent*0.01;
|
||||
}
|
||||
static double ratioToPc(double linear) {
|
||||
return linear*100;
|
||||
}
|
||||
static double kHzToHz(double kHz) {
|
||||
return kHz*1000;
|
||||
}
|
||||
static double hzToKHz(double hz) {
|
||||
return hz*0.001;
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
#endif // include guard
|
||||
Loading…
x
Reference in New Issue
Block a user