correct svf cutoff var names
parent
79b1d9239f
commit
987d22d332
2
notes
2
notes
|
@ -40,8 +40,6 @@ TODO {
|
|||
}
|
||||
}
|
||||
|
||||
- filter cutoff preset for knobgadget
|
||||
|
||||
revert-to-saved menu action
|
||||
|
||||
distortion effect
|
||||
|
|
|
@ -7,13 +7,13 @@ using Xybrid::NodeLib::SVFilter;
|
|||
using Xybrid::Data::AudioFrame;
|
||||
using namespace Xybrid::Audio;
|
||||
|
||||
void SVFilter::process(AudioFrame in, double freq, double res, int ovs) {
|
||||
void SVFilter::process(AudioFrame in, double cutoff, double resonance, int ovs) {
|
||||
if (ovs <= 0) return;
|
||||
freq = std::max(freq, 1.0);
|
||||
res = std::max(res, 0.01);
|
||||
cutoff = std::max(cutoff, 1.0);
|
||||
resonance = std::max(resonance, 0.01);
|
||||
|
||||
double f = 2.0 * std::sin(PI * freq / (audioEngine->curSampleRate() * ovs));
|
||||
double q = std::sqrt(1.0 - std::atan(std::sqrt(res)) * 2.0 / PI);
|
||||
double f = 2.0 * std::sin(PI * cutoff / (audioEngine->curSampleRate() * ovs));
|
||||
double q = std::sqrt(1.0 - std::atan(std::sqrt(resonance)) * 2.0 / PI);
|
||||
double damp = std::sqrt(q);
|
||||
|
||||
for (int i = 0; i < ovs; i++) {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Xybrid::NodeLib {
|
|||
inline SVFilter(const SVFilter& o) { std::memcpy(static_cast<void*>(this), static_cast<const void*>(&o), sizeof(SVFilter)); }
|
||||
inline SVFilter& operator=(const SVFilter& o) { std::memcpy(static_cast<void*>(this), static_cast<const void*>(&o), sizeof(SVFilter)); return *this; }
|
||||
|
||||
void process(Data::AudioFrame in, double freq, double res, int oversamp = DEFAULT_OVERSAMP);
|
||||
void process(Data::AudioFrame in, double cutoff, double resonance, int oversamp = DEFAULT_OVERSAMP);
|
||||
inline void reset() { low = 0.0; high = 0.0; band = 0.0; notch = 0.0; }
|
||||
inline void normalize(double m = 1.0) {
|
||||
low = low.clamp(m);
|
||||
|
|
|
@ -80,7 +80,7 @@ void SVF::process() {
|
|||
for (size_t f = 0; f < ts; f++) {
|
||||
AudioFrame inp = (*in)[f];
|
||||
|
||||
filter.process(inp, frequency, r);
|
||||
filter.process(inp, cutoff, r);
|
||||
|
||||
switch (mode) {
|
||||
case Low:
|
||||
|
@ -102,13 +102,13 @@ void SVF::process() {
|
|||
}
|
||||
|
||||
void SVF::saveData(QCborMap& m) const {
|
||||
m[qs("frequency")] = frequency;
|
||||
m[qs("cutoff")] = cutoff;
|
||||
m[qs("resonance")] = resonance;
|
||||
m[qs("mode")] = mode;
|
||||
}
|
||||
|
||||
void SVF::loadData(const QCborMap& m) {
|
||||
frequency = m.value("frequency").toDouble(frequency);
|
||||
cutoff = m.value("cutoff").toDouble(m.value("frequency").toDouble(cutoff));
|
||||
resonance = m.value("resonance").toDouble(resonance);
|
||||
mode = static_cast<FilterMode>(m.value("mode").toInteger(mode));
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void SVF::onGadgetCreated() {
|
|||
return qs("?");
|
||||
};
|
||||
|
||||
KnobGadget::autoCutoff(l, frequency);
|
||||
KnobGadget::autoCutoff(l, cutoff);
|
||||
(new KnobGadget(l))->bind(resonance)->setLabel(qs("Res"))->setTextFunc(KnobGadget::textPercent)->setRange(0.0, 1.0, 0.01)->setDefault(0.0);
|
||||
(new KnobGadget(l))->bind(mode)->setLabel(qs("Mode"))->setTextFunc(modetxt)->setRange(0, Notch, 1, KnobGadget::BigStep)->setDefault(0);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Xybrid::Effects {
|
|||
class SVF : public Data::Node {
|
||||
NodeLib::SVFilter filter;
|
||||
|
||||
double frequency = 6440.0;
|
||||
double cutoff = 6440.0;
|
||||
double resonance = 0.0;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue