AudioFrame.clamp, SVFilter.normalize
parent
4822ef1bb6
commit
bf793d20fd
11
notes
11
notes
|
@ -32,13 +32,8 @@ parameters {
|
|||
|
||||
TODO {
|
||||
immediate frontburner {
|
||||
- fix warnings in mixboard
|
||||
- decide whether to standardize knob setup orderings
|
||||
- bump gain knob max to +12dB
|
||||
- preset function for gain and balance? autoGain (templated because bind)
|
||||
|
||||
SVFilter::normalize()
|
||||
^ AudioFrame::clamp()
|
||||
- SVFilter::normalize()
|
||||
- AudioFrame::clamp()
|
||||
|
||||
revert action
|
||||
|
||||
|
@ -102,6 +97,8 @@ TODO {
|
|||
}
|
||||
|
||||
misc features needed before proper release {
|
||||
ABOUT BOX WITH INCLIB LICENSE NOTICES
|
||||
|
||||
expand/compact pattern 2x/3x, keeping fold interval
|
||||
|
||||
at *least* js plugin support, with lua+lv2 highly preferable
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Xybrid::Data {
|
||||
struct AudioFrame {
|
||||
// stored as double here for operational precision
|
||||
double l = 0;
|
||||
double r = 0;
|
||||
double l = 0.0;
|
||||
double r = 0.0;
|
||||
|
||||
inline AudioFrame() = default;
|
||||
inline AudioFrame(double v) : l(v), r(v) { }
|
||||
|
@ -45,6 +47,8 @@ namespace Xybrid::Data {
|
|||
r *= m;
|
||||
}
|
||||
|
||||
inline AudioFrame clamp(double m = 1.0) { return { std::clamp(l, -m, m), std::clamp(r, -m, m) }; }
|
||||
|
||||
static AudioFrame gainBalanceMult(double gain, double balance = 0.0);
|
||||
inline AudioFrame gainBalance(double gain, double balance = 0.0) const { return *this*gainBalanceMult(gain, balance); }
|
||||
};
|
||||
|
|
|
@ -26,6 +26,12 @@ namespace Xybrid::NodeLib {
|
|||
|
||||
void process(Data::AudioFrame in, double freq, double res, 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);
|
||||
high = high.clamp(m);
|
||||
band = band.clamp(m);
|
||||
notch = notch.clamp(m);
|
||||
}
|
||||
|
||||
static inline double scaledResonance(double r) { return std::pow(10, r*5); }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue