(bind-func blsawXAnalogue_c
(lambda (mod inverted:i1 highcpu:i1)
(let ((inc 0.0) (absinc 0.0:f) (out 0.0) (blep 0.0) (t 0.0)
(rising (if inverted 1 0))
(inv (if inverted -1.0 1.0)))
(lambda (amp:float frq:float nothing:float)
(set! inc (/ frq SRs))
;; positive frequencies
(if (and (> inc 0.0) (>= mod 1.0))
(set! mod (- mod 1.0)))
;; negative frequencies
(if (and (< inc 0.0) (<= mod 0.0))
(set! mod (+ mod 1.0)))
(set! blep
(if highcpu
(blep_n (cast fBLEPTable_8_BLKHAR SAMPLE*) 4096.0 mod (fabs inc) 1.0 rising 4.0 #f)
(poly_blep mod (fabs inc) 1.0 rising)))
(set! out (* inv (- (* mod 2.0) 1.0))) ;; bipolar
(set! mod (+ mod inc)) ;; update mod
(* amp (+ out blep))))))