(bind-func static envelope_c
(lambda (points:SAMPLE* num_of_points)
(let ((klines:[SAMPLE,SAMPLE]** (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 (pref klines k))
(time_point (pref points (* k 2))))
(if (or (= time time_point)
(< time_point time))
(set! res (line time)))))
res)))))