(bind-func cerberus_flanger_cc
(lambda ()
(let ((val 0.0:f)
(delay_fine 10.0)
(range_fine 0.0)
(delay_course 300.0)
(range_course 0.0))
(lambda (inst offset:i32 cc:i32 value:i32)
(set! val (/ (i32tof value) 127.0))
(cond ((= cc (+ offset 0)) ;; flanger mix
(set_flanger_mix inst val))
((= cc (+ offset 1)) ;; low mark in ms
(set! delay_fine (* 10.0 val))
(set_flanger_low inst (+ delay_course delay_fine)))
((= cc (+ offset 2)) ;; delay range
(set! delay_course (* val 100.0))
(set_flanger_low inst (+ delay_course delay_fine)))
((= cc (+ offset 3)) ;; high mark in ms
(set! range_fine (* 20.0 val))
(set_flanger_high inst (+ range_course range_fine)))
((= cc (+ offset 4)) ;; range range
(set! range_course (* val 200.0))
(set_flanger_high inst (+ range_course range_fine)))
((= cc (+ offset 5)) ;; flanger rate
(set_flanger_rate inst (* 0.25 val)))
((= cc (+ offset 6)) ;; flanger feedback
(set_flanger_fb inst (* 0.999 val))))))))