make-envelope   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/tests/core/xtlang.xtm

Implementation

(bind-func make-envelope
   (lambda (points:double* num-of-points)
      (let ((klines:[double,double]** (envelope-segments points num-of-points))
      (line-length num-of-points))
   (lambda (time)
      (let ((res -1.0)
      (k:i64 0))
         (dotimes (k num-of-points)
      (let ((line (pointer-ref klines k))
      (time-point (pointer-ref points (* k 2))))
         (if (or (= time time-point)
           (< time-point time))
       (set! res (line time)))))
         res)))))


Back to Index