;; iir comb without interpolation
;; more efficient than comb if you
;; don't need variable length
(bind-func static delay_c
(lambda (delay:i64)
(let ((line:SAMPLE* (zalloc delay))
(time 0)
(i 0)
(n 0)
(y 0.0))
(dotimes (i delay) (pset! line i 0.0))
(lambda (x:SAMPLE wet feedback)
(set! n (modulo time delay))
(set! y (pref line n))
(set! time (+ time 1))
(pset! line n (* feedback (+ x y)))
(+ x (* y wet))))))