;; polynomial bandlimited step functions
(bind-func static poly_blep
(lambda (pos:float inc height rising_edge:i1)
(let ((out 0.0) (t 0.0))
(if (> pos (- 1.0 inc))
(begin ;; leftside of discontinuity
(set! t (/ (- pos 1.0) inc))
(set! out (* height (+ (* t t) (* 2.0 t) 1.0))))
(if (< pos inc)
(begin ;; rightside of discontinunity
(set! t (/ pos inc))
(set! out (* height (- (* 2.0 t) (* t t) 1.0))))))
(if (not rising_edge) ;; if falling
(set! out (* out -1.0)))
out)))