;convert 3 buffers buffer_size/2 in length to LR interleaved signal
(bind-func MS_to_LR_3_channels
(lambda (buffer:float* buffer_size:i64 mid:float* side_l:float* side_r:float*)
(let ((n:i64 0))
(dotimes (n (/ buffer_size 2))
(pset! buffer (* n 2) (/ (+ (pref mid n) (pref side_l n)) 2.0))
(pset! buffer (+ (* n 2) 1) (/ (+ (pref mid n) (pref side_r n)) 2.0)))
void)))