summaryrefslogtreecommitdiff
path: root/tran/delaycc.alg
diff options
context:
space:
mode:
Diffstat (limited to 'tran/delaycc.alg')
-rw-r--r--tran/delaycc.alg20
1 files changed, 20 insertions, 0 deletions
diff --git a/tran/delaycc.alg b/tran/delaycc.alg
new file mode 100644
index 0000000..8e2d502
--- /dev/null
+++ b/tran/delaycc.alg
@@ -0,0 +1,20 @@
+(DELAY-ALG
+(NAME "delay")
+(ARGUMENTS ("sound_type" "input") ("time_type" "delay") ("double" "feedback"))
+(START (MIN input))
+(STATE ("double" "feedback" "feedback")
+ ("long" "delaylen" "max(1, round(input->sr * delay))")
+ ("sample_type *" "delaybuf"
+ "(sample_type *) calloc (susp->delaylen, sizeof(sample_type))")
+ ("sample_type *" "delayptr" "susp->delaybuf")
+ ("sample_type *" "endptr" "susp->delaybuf + susp->delaylen"))
+(CONSTANT "feedback" "delaylen" "endptr")
+(NOT-REGISTER delaybuf)
+(LINEAR input)
+(TERMINATE (MIN input))
+(INNER-LOOP "output = *delayptr;
+ *delayptr = (sample_type) (*delayptr * feedback) + input;
+ if (++delayptr >= endptr) delayptr = susp->delaybuf;")
+(FINALIZATION "free(susp->delaybuf);")
+)
+