diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-07-11 11:41:21 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-07-11 11:41:21 -0400 |
| commit | f88ca0bc946bae086e02eacdc6c129f00e2e07e3 (patch) | |
| tree | eb8975ec505315e7f53a15ded32fb0cfd6b57731 /src/math-helpers.cpp | |
| parent | 1fd2b900a5f97379e80adc411d3763f9ba811570 (diff) | |
pke: audio: fx boilerplate, low-pass spatial
Diffstat (limited to 'src/math-helpers.cpp')
| -rw-r--r-- | src/math-helpers.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/math-helpers.cpp b/src/math-helpers.cpp index 5150e55..d153ce5 100644 --- a/src/math-helpers.cpp +++ b/src/math-helpers.cpp @@ -48,3 +48,19 @@ void BulletToGlm(const btTransform &trans, glm::mat4 &glmMat4) { glmMat4[3][3] = 1.0f; } +template<typename T> +T log_interp_T(T min_value, T max_value, T t) { + T start = log10(min_value); + T end = log10(max_value); + T intrp = start + (t * (end - start)); + return pow(T(10), intrp); +} + +float log_interp(float min_value, float max_value, float t) { + return log_interp_T<float>(min_value, max_value, t); +} + +double log_interp(double min_value, double max_value, double t) { + return log_interp_T<double>(min_value, max_value, t); +} + |
