summaryrefslogtreecommitdiff
path: root/tran/aresonvc.alg
diff options
context:
space:
mode:
authorSteve M. Robbins <smr@debian.org>2011-10-22 04:54:51 +0200
committerSteve M. Robbins <smr@debian.org>2011-10-22 04:54:51 +0200
commitdd657ad3f1428b026486db3ec36691df17ddf515 (patch)
tree6ffb465595479fb5a76c1a6ea3ec992abaa8c1c1 /tran/aresonvc.alg
Import nyquist_3.05.orig.tar.gz
[dgit import orig nyquist_3.05.orig.tar.gz]
Diffstat (limited to 'tran/aresonvc.alg')
-rw-r--r--tran/aresonvc.alg34
1 files changed, 34 insertions, 0 deletions
diff --git a/tran/aresonvc.alg b/tran/aresonvc.alg
new file mode 100644
index 0000000..277ef8a
--- /dev/null
+++ b/tran/aresonvc.alg
@@ -0,0 +1,34 @@
+(ARESONVC-ALG
+(NAME "aresonvc")
+(ARGUMENTS ("sound_type" "s1") ("sound_type" "hz") ("double" "bw")
+ ("int" "normalization"))
+(LINEAR s1)
+(INLINE-INTERPOLATION T)
+(ALWAYS-SCALE hz)
+(START (MAX s1 hz))
+(TERMINATE (MIN s1 hz))
+(LOGICAL-STOP (MIN s1))
+(SAMPLE-RATE (MAX s1))
+(STEP-FUNCTION hz)
+(STATE ("double" "c3co" "exp(bw * -PI2 / s1->sr)")
+ ("double" "c3p1" "susp->c3co + 1.0")
+ ("double" "c3t4" "susp->c3co * 4.0")
+ ("double" "omc3" "1.0 - susp->c3co")
+ ("double" "c2" "0.0")
+ ("double" "c1" "0.0")
+ ("int" "normalization" "normalization")
+ ("double" "y1" "0.0")
+ ("double" "y2" "0.0;
+ hz->scale = (sample_type) (hz->scale * (PI2 / s1->sr))"))
+(DEPENDS ("c2" "hz" "c3t4 * cos(hz) / c3p1")
+ ("c1" "hz" "(normalization == 0 ? 0.0 :
+ (normalization == 1 ? 1.0 - omc3 * sqrt(1.0 - c2 * c2 / c3t4) :
+ 1.0 - sqrt(c3p1 * c3p1 - c2 * c2) * omc3 / c3p1))"))
+(CONSTANT "c1" "c2" "c3co" "c3p1" "c3t4" "omc3" "normalization")
+(FORCE-INTO-REGISTER c3t4 c3p1 normalization omc3)
+(INNER-LOOP-LOCALS " register double y0, current;")
+(INNER-LOOP "current = s1;
+ y0 = c1 * current + c2 * y1 - c3co * y2;
+ output = (sample_type) y0;
+ y2 = y1; y1 = y0 - current")
+)